*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@163 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent b5d609af5c
commit a6bc1392d1
  1. 30
      jode/jode/bytecode/ClassInfo.java
  2. 127
      jode/jode/bytecode/SearchPath.java
  3. 8
      jode/jode/decompiler/LocalInfo.java
  4. 2
      jode/jode/decompiler/LocalVariableRangeList.java
  5. 2
      jode/jode/decompiler/LocalVariableTable.java
  6. 8
      jode/jode/decompiler/MethodAnalyzer.java
  7. 4
      jode/jode/expr/ComplexExpression.java
  8. 9
      jode/jode/expr/LocalLoadOperator.java
  9. 5
      jode/jode/flow/CompleteSynchronized.java
  10. 5
      jode/jode/flow/CreateConstantArray.java
  11. 5
      jode/jode/flow/CreateExpression.java
  12. 5
      jode/jode/flow/CreateForInitializer.java
  13. 9
      jode/jode/flow/CreateIfThenElseOperator.java
  14. 30
      jode/jode/flow/FlowBlock.java
  15. 5
      jode/jode/flow/RemoveEmpty.java
  16. 18
      jode/jode/flow/TransformConstructors.java
  17. 17
      jode/jode/flow/TransformExceptionHandlers.java
  18. 2
      jode/jode/flow/VariableSet.java
  19. 2
      jode/jode/obfuscator/ClassBundle.java
  20. 58
      jode/jode/obfuscator/Main.java
  21. 6
      jode/jode/type/Type.java

@ -48,11 +48,20 @@ public class ClassInfo extends BinaryInfo {
private MethodInfo[] methods;
private AttributeInfo[] attributes;
public final static ClassInfo javaLangObject =
ClassInfo.forName("java.lang.Object");
public final static ClassInfo javaLangObject = forName("java.lang.Object");
public static void setClassPath(String path) {
classpath = new SearchPath(path);
Enumeration enum = classes.elements();
while (enum.hasMoreElements()) {
ClassInfo ci = (ClassInfo) enum.nextElement();
ci.status = 0;
ci.superclass = null;
ci.fields = null;
ci.interfaces = null;
ci.methods = null;
ci.attributes = null;
}
}
public static boolean exists(String name) {
@ -202,16 +211,15 @@ public class ClassInfo extends BinaryInfo {
} catch (IOException ex) {
String message = ex.getLocalizedMessage();
if ((howMuch & ~(METHODS|HIERARCHY)) == 0)
System.err.println("Can't read class " + name
+ ", types may be incorrect. ("
+ ex.getClass().getName()
+ (message != null ? ": " + message : "")
+ ")");
jode.Decompiler.err.println
("Can't read class " + name + ", types may be incorrect. ("
+ ex.getClass().getName()
+ (message != null ? ": " + message : "") + ")");
else
System.err.println("Can't read class " + name + "("
+ ex.getClass().getName()
+ (message != null ? ": " + message : "")
+ ")");
jode.Decompiler.err.println
("Can't read class " + name
+ "(" + ex.getClass().getName()
+ (message != null ? ": " + message : "") + ")");
if (name.equals("java.lang.Object"))
superclass = null;

@ -18,10 +18,12 @@
*/
package jode.bytecode;
import java.io.*;
import java.net.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.StringTokenizer;
import java.util.Enumeration;
import jode.Decompiler;
/**
* This class represents a path of multiple directories and/or zip files,
@ -31,6 +33,12 @@ import java.util.Enumeration;
*/
public class SearchPath {
/**
* Hack to allow URLs that use the same separator as the normal
* path separator. Use a very unusual character for this.
*/
public static final char protocolSeparator = 31;
URL[] bases;
File[] dirs;
ZipFile[] zips;
@ -45,23 +53,59 @@ public class SearchPath {
new StringTokenizer(path, File.pathSeparator);
int length = tokenizer.countTokens();
bases = new URL[length];
dirs = new File[length];
zips = new ZipFile[length];
for (int i=0; i< length; i++) {
dirs[i] = new File(tokenizer.nextToken());
if (!dirs[i].isDirectory()) {
try {
zips[i] = new ZipFile(dirs[i]);
} catch (java.io.IOException ex) {
/* disable this entry */
dirs[i] = null;
}
}
}
String token = tokenizer.nextToken()
.replace(protocolSeparator, ':');
int index = token.indexOf(':');
if (index != -1 && index < token.length()-2
&& token.charAt(index+1) == '/'
&& token.charAt(index+2) == '/') {
// This looks like an URL.
try {
bases[i] = new URL(token);
} catch (MalformedURLException ex) {
/* disable entry */
bases[i] = null;
dirs[i] = null;
}
} else {
try {
dirs[i] = new File(token);
if (!dirs[i].isDirectory()) {
try {
zips[i] = new ZipFile(dirs[i]);
} catch (java.io.IOException ex) {
/* disable this entry */
dirs[i] = null;
}
}
} catch (SecurityException ex) {
/* disable this entry */
Decompiler.err.println("Warning: SecurityException while"
+ " accessing " + token);
dirs[i] = null;
}
}
}
}
public boolean exists(String filename) {
for (int i=0; i<dirs.length; i++) {
if (bases[i] != null) {
try {
URL url = new URL(bases[i], filename);
URLConnection conn = url.openConnection();
conn.connect();
conn.getInputStream().close();
return true;
} catch (IOException ex) {
/* ignore */
}
continue;
}
if (dirs[i] == null)
continue;
if (zips[i] != null) {
@ -72,9 +116,13 @@ public class SearchPath {
if (java.io.File.separatorChar != '/')
filename = filename
.replace('/', java.io.File.separatorChar);
File f = new File(dirs[i], filename);
if (f.exists())
return true;
try {
File f = new File(dirs[i], filename);
if (f.exists())
return true;
} catch (SecurityException ex) {
/* ignore and take next element */
}
}
}
return false;
@ -88,6 +136,21 @@ public class SearchPath {
*/
public InputStream getFile(String filename) throws IOException {
for (int i=0; i<dirs.length; i++) {
if (bases[i] != null) {
try {
URL url = new URL(bases[i], filename);
URLConnection conn = url.openConnection();
return conn.getInputStream();
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
+" while accessing "
+bases[i]+filename);
/* ignore and take next element */
} catch (FileNotFoundException ex) {
/* ignore and take next element */
}
continue;
}
if (dirs[i] == null)
continue;
if (zips[i] != null) {
@ -98,9 +161,16 @@ public class SearchPath {
if (java.io.File.separatorChar != '/')
filename = filename
.replace('/', java.io.File.separatorChar);
File f = new File(dirs[i], filename);
if (f.exists())
return new FileInputStream(f);
try {
File f = new File(dirs[i], filename);
if (f.exists())
return new FileInputStream(f);
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
+" while accessing "
+dirs[i]+filename);
/* ignore and take next element */
}
}
}
throw new FileNotFoundException(filename);
@ -133,9 +203,15 @@ public class SearchPath {
if (java.io.File.separatorChar != '/')
filename = filename
.replace('/', java.io.File.separatorChar);
File f = new File(dirs[i], filename);
if (f.exists())
return f.isDirectory();
try {
File f = new File(dirs[i], filename);
if (f.exists())
return f.isDirectory();
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
+" while accessing "
+dirs[i]+filename);
}
}
}
return false;
@ -190,9 +266,16 @@ public class SearchPath {
(java.io.File.separatorChar != '/')
? dirName.replace('/', java.io.File.separatorChar)
: dirName;
File f = new File(dirs[pathNr], localDirName);
if (f.exists() && f.isDirectory())
files = f.list();
try {
File f = new File(dirs[pathNr], localDirName);
if (f.exists() && f.isDirectory())
files = f.list();
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
+" while accessing "
+dirs[pathNr]+localDirName);
/* ignore and take next element */
}
}
pathNr++;
}

@ -75,7 +75,7 @@ public class LocalInfo {
} else {
if (this != li) {
shadow = li;
// System.err.println("combining "+name+"("+type+") and "
// Decompiler.err.println("combining "+name+"("+type+") and "
// +li.name+"("+li.type+")");
li.setType(type);
@ -88,7 +88,7 @@ public class LocalInfo {
(LocalVarOperator) enum.nextElement();
if (needTypeUpdate) {
if (Decompiler.isTypeDebugging)
System.err.println("updating " + lvo);
Decompiler.err.println("updating " + lvo);
lvo.updateType();
}
shadow.operators.addElement(lvo);
@ -183,7 +183,7 @@ public class LocalInfo {
LocalInfo li = getLocalInfo();
newType = li.type.intersection(newType);
if (Decompiler.isTypeDebugging)
System.err.println(getName()+" setType, new: "+newType
Decompiler.err.println(getName()+" setType, new: "+newType
+ " old: "+li.type);
if (!li.type.equals(newType)) {
li.type = newType;
@ -191,7 +191,7 @@ public class LocalInfo {
while (enum.hasMoreElements()) {
LocalVarOperator lvo = (LocalVarOperator) enum.nextElement();
if (Decompiler.isTypeDebugging)
System.err.println("updating "+lvo);
Decompiler.err.println("updating "+lvo);
lvo.updateType();
}
}

@ -51,7 +51,7 @@ public class LocalVariableRangeList {
after = after.next;
}
if (after != null && li.start + li.length > after.start)
System.err.println("warning: non disjoint locals");
Decompiler.err.println("warning: non disjoint locals");
li.next = after;
if (before == null)
list = li;

@ -46,7 +46,7 @@ public class LocalVariableTable {
int slot = stream.readUnsignedShort();
locals[slot].addLocal(start, end-start, name, type);
if (Decompiler.showLVT)
System.err.println(name + ": " + type
Decompiler.err.println(name + ": " + type
+" range "+start+" - "+end
+" slot "+slot);
}

@ -132,10 +132,10 @@ public class MethodAnalyzer implements Analyzer {
if (!Decompiler.immediateOutput) {
if (Decompiler.isVerbose)
System.err.print(methodName+": ");
Decompiler.err.print(methodName+": ");
code.analyze();
if (Decompiler.isVerbose)
System.err.println("");
Decompiler.err.println("");
}
}
@ -147,10 +147,10 @@ public class MethodAnalyzer implements Analyzer {
// immediate output.
if (Decompiler.isVerbose)
System.err.print(methodName+": ");
Decompiler.err.print(methodName+": ");
code.analyze();
if (Decompiler.isVerbose)
System.err.println("");
Decompiler.err.println("");
}
if (isConstructor() && isStatic()

@ -175,7 +175,7 @@ public class ComplexExpression extends Expression {
opType = opType.intersection(exprType);
if (!opType.equals(exprType) && opType != Type.tError) {
if (Decompiler.isTypeDebugging)
System.err.println("change in "+this+": "
Decompiler.err.println("change in "+this+": "
+exprType
+"->"+opType);
subExpressions[i].setType(opType);
@ -205,7 +205,7 @@ public class ComplexExpression extends Expression {
if (!types[i].equals(opType)
&& types[i] != Type.tError) {
if (Decompiler.isTypeDebugging)
System.err.println("change in "+this+": "
Decompiler.err.println("change in "+this+": "
+operator.getOperandType(i)
+"->"+types[i]);
changed = true;

@ -18,6 +18,7 @@
*/
package jode.decompiler;
import jode.Decompiler;
import jode.Type;
import jode.LocalInfo;
@ -49,8 +50,8 @@ implements LocalVarOperator {
}
public void updateType() {
if (jode.Decompiler.isTypeDebugging)
System.err.println("local "+local.getName()+" changed: "
if (Decompiler.isTypeDebugging)
Decompiler.err.println("local "+local.getName()+" changed: "
+type+" to "+local.getType()
+" in "+parent);
super.setType(local.getType());
@ -59,12 +60,12 @@ implements LocalVarOperator {
}
public Type getType() {
// System.err.println("LocalLoad.getType of "+local.getName()+": "+local.getType());
// Decompiler.err.println("LocalLoad.getType of "+local.getName()+": "+local.getType());
return local.getType();
}
public void setType(Type type) {
// System.err.println("LocalLoad.setType of "+local.getName()+": "+local.getType());
// Decompiler.err.println("LocalLoad.setType of "+local.getName()+": "+local.getType());
super.setType(local.setType(type));
}

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.Decompiler;
import jode.decompiler.*;
public class CompleteSynchronized {
@ -48,8 +49,8 @@ public class CompleteSynchronized {
return false;
}
if (jode.Decompiler.isVerbose)
System.err.print('s');
if (Decompiler.isVerbose)
Decompiler.err.print('s');
synBlock.isEntered = true;
synBlock.moveDefinitions(last.outer,last);

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.Decompiler;
import jode.decompiler.*;
import jode.Type;
@ -96,8 +97,8 @@ public class CreateConstantArray {
if (arraylength <= index)
return false;
if (jode.Decompiler.isVerbose)
System.err.print('a');
if (Decompiler.isVerbose)
Decompiler.err.print('a');
ConstantArrayOperator cao
= new ConstantArrayOperator(newArrayOp.getType(),

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.Decompiler;
import jode.decompiler.*;
/**
@ -110,8 +111,8 @@ public class CreateExpression {
sequBlock = (SequentialBlock)sequBlock.outer;
}
if(jode.Decompiler.isVerbose)
System.err.print('x');
if(Decompiler.isVerbose)
Decompiler.err.print('x');
Expression newExpr;
if (params == 1 && op instanceof NopOperator) {

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.Decompiler;
import jode.decompiler.*;
public class CreateForInitializer {
@ -43,8 +44,8 @@ public class CreateForInitializer {
|| !forBlock.conditionMatches(init))
return false;
if (jode.Decompiler.isVerbose)
System.err.print('f');
if (Decompiler.isVerbose)
Decompiler.err.print('f');
forBlock.setInit((InstructionBlock) sequBlock.subBlocks[0]);
return true;

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.Decompiler;
import jode.Type;
import jode.decompiler.*;
@ -62,8 +63,8 @@ public class CreateIfThenElseOperator {
| !createFunnyHelper(trueDest, falseDest, ifBlock.elseBlock))
return false;
if (jode.Decompiler.isVerbose)
System.err.print('?');
if (Decompiler.isVerbose)
Decompiler.err.print('?');
IfThenElseOperator iteo = new IfThenElseOperator(Type.tBoolean);
((InstructionBlock)ifBlock.thenBlock).setInstruction
@ -217,8 +218,8 @@ public class CreateIfThenElseOperator {
return false;
e[0] = ifBlock.cond;
if (jode.Decompiler.isVerbose)
System.err.print('?');
if (Decompiler.isVerbose)
Decompiler.err.print('?');
thenBlock.flowBlock.removeSuccessor(thenBlock.jump);
thenBlock.removeJump();

@ -519,10 +519,10 @@ public class FlowBlock {
this.gen.unionExact(successor.gen);
if (Decompiler.debugInOut) {
System.err.println("UpdateInOut: gens : "+gens);
System.err.println(" kills: "+kills);
System.err.println(" s.in : "+successor.in);
System.err.println(" in : "+in);
Decompiler.err.println("UpdateInOut: gens : "+gens);
Decompiler.err.println(" kills: "+kills);
Decompiler.err.println(" s.in : "+successor.in);
Decompiler.err.println(" in : "+in);
}
}
@ -643,16 +643,16 @@ public class FlowBlock {
/* Update the in/out-Vectors now */
updateInOut(succ, jumps);
if (Decompiler.isFlowDebugging)
System.err.println("before Optimize: "+this);
Decompiler.err.println("before Optimize: "+this);
/* Try to eliminate as many jumps as possible.
*/
jumps = optimizeJumps(jumps, succ);
if (Decompiler.isFlowDebugging)
System.err.println("before Remaining: "+this);
Decompiler.err.println("before Remaining: "+this);
resolveRemaining(jumps);
if (Decompiler.isFlowDebugging)
System.err.println("after Optimize: "+this);
Decompiler.err.println("after Optimize: "+this);
/* Now unify the blocks.
*/
@ -952,7 +952,7 @@ public class FlowBlock {
public void doTransformations() {
if (Decompiler.isFlowDebugging)
System.err.println("before Transformation: "+this);
Decompiler.err.println("before Transformation: "+this);
while (lastModified instanceof SequentialBlock) {
if (!lastModified.getSubBlocks()[0].doTransformations())
@ -962,7 +962,7 @@ public class FlowBlock {
/* empty */;
if (Decompiler.isFlowDebugging)
System.err.println("after Transformation: "+this);
Decompiler.err.println("after Transformation: "+this);
}
/**
@ -1007,7 +1007,7 @@ public class FlowBlock {
*/
public boolean analyze(int start, int end) {
if (Decompiler.debugAnalyze)
System.err.println("analyze("+start+", "+end+")");
Decompiler.err.println("analyze("+start+", "+end+")");
boolean changed = false;
@ -1023,10 +1023,10 @@ public class FlowBlock {
if (doT2(start, end)) {
if (Decompiler.isFlowDebugging)
System.err.println("after T2: "+this);
Decompiler.err.println("after T2: "+this);
if (Decompiler.debugAnalyze)
System.err.println("T2("+addr+","+(addr+length)
Decompiler.err.println("T2("+addr+","+(addr+length)
+") succeeded");
/* T2 transformation succeeded. This may
* make another T1 analysis in the previous
@ -1043,7 +1043,7 @@ public class FlowBlock {
* Finish this analyzation.
*/
if (Decompiler.debugAnalyze)
System.err.println
Decompiler.err.println
("No more successors applicable: "
+ start + " - " + end + "; "
+ addr + " - " + (addr+length));
@ -1058,7 +1058,7 @@ public class FlowBlock {
changed = true;
if (Decompiler.isFlowDebugging)
System.err.println("after T1: "+this);
Decompiler.err.println("after T1: "+this);
break;
}
@ -1072,7 +1072,7 @@ public class FlowBlock {
((FlowBlock)enum.nextElement()).addr;
if (predAddr < start || predAddr >= end) {
if (Decompiler.debugAnalyze)
System.err.println
Decompiler.err.println
("breaking analyze("
+ start + ", " + end + "); "
+ addr + " - " + (addr+length));

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.Decompiler;
import jode.decompiler.*;
public class RemoveEmpty {
@ -49,8 +50,8 @@ public class RemoveEmpty {
/* XXX check if blocks may be swapped
* (there mustn't be side effects in one of them).
*/
System.err.println("WARNING: this program contains a SWAP "
+"opcode and may not be translated correctly.");
Decompiler.err.println("WARNING: this program contains a SWAP "
+"opcode and may not be translated correctly.");
if (block1.getInstruction().isVoid()
|| block2.getInstruction().isVoid())

@ -36,7 +36,7 @@ public class TransformConstructors {
StructuredBlock[] sb = new StructuredBlock[constrCount];
for (int i=0; i< constrCount; ) {
sb[i] = cons[i].getMethodHeader().block;
// System.err.println("constr "+i+": "+sb[i]);
// Decompiler.err.println("constr "+i+": "+sb[i]);
if (!isStatic) {
InstructionBlock ib;
if (sb[i] instanceof InstructionBlock)
@ -64,7 +64,7 @@ public class TransformConstructors {
/* This constructor calls another constructor, so we
* can skip it.
*/
// System.err.println("skipping this()");
// Decompiler.err.println("skipping this()");
cons[i] = cons[--constrCount];
continue;
}
@ -78,7 +78,7 @@ public class TransformConstructors {
sb[i] = sb[i].getSubBlocks()[1];
else
sb[i] = null;
// System.err.println("normal constructor");
// Decompiler.err.println("normal constructor");
}
i++;
}
@ -107,16 +107,16 @@ public class TransformConstructors {
if (!expr.isConstant()) {
// System.err.println("not constant: "+expr);
// Decompiler.err.println("not constant: "+expr);
break big_loop;
}
// System.err.println("field "+pfo.getFieldName()+ " = "+expr);
// Decompiler.err.println("field "+pfo.getFieldName()+ " = "+expr);
if (!isStatic
&& !(((ComplexExpression)instr).getSubExpressions()[0]
.toString().equals("this"))) {
// System.err.println("not this: "+instr);
// Decompiler.err.println("not this: "+instr);
break big_loop;
}
@ -126,14 +126,14 @@ public class TransformConstructors {
: sb[i];
if (!(ib instanceof InstructionBlock)
|| !((InstructionBlock)ib).getInstruction().equals(instr)) {
// System.err.println("constr "+i+" differs: "+ib);
// Decompiler.err.println("constr "+i+" differs: "+ib);
break big_loop;
}
}
if (!clazzAnalyzer.setFieldInitializer(pfo.getFieldName(), expr)) {
// System.err.println("setField failed");
// Decompiler.err.println("setField failed");
break big_loop;
}
@ -146,7 +146,7 @@ public class TransformConstructors {
}
for (int i=0; i< constrCount; i++)
if (sb[i] == null) {
// System.err.println("constr "+i+" is over");
// Decompiler.err.println("constr "+i+" is over");
break big_loop;
}
}

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.AssertError;
import jode.Decompiler;
import jode.Type;
import jode.LocalInfo;
import jode.decompiler.*;
@ -139,10 +140,10 @@ public class TransformExceptionHandlers {
tryFlow.in.unionExact(catchFlow.in);
tryFlow.gen.unionExact(catchFlow.gen);
if (jode.Decompiler.debugInOut) {
System.err.println("UpdateInOutCatch: gens : "+gens);
System.err.println(" s.in : "+catchFlow.in);
System.err.println(" in : "+tryFlow.in);
if (Decompiler.debugInOut) {
Decompiler.err.println("UpdateInOutCatch: gens : "+gens);
Decompiler.err.println(" s.in : "+catchFlow.in);
Decompiler.err.println(" in : "+tryFlow.in);
}
}
@ -832,8 +833,8 @@ public class TransformExceptionHandlers {
int endHandler = (i< count-1 && endPCs[i+1] > handlerPCs[i])
? endPCs[i+1]
: Integer.MAX_VALUE;
if (jode.Decompiler.debugAnalyze)
System.err.println("analyzeCatch(" + startPCs[i] + ", "
if (Decompiler.debugAnalyze)
Decompiler.err.println("analyzeCatch(" + startPCs[i] + ", "
+ endPCs[i] + ", " +handlerPCs[i] + ")");
FlowBlock tryFlow = flows[startPCs[i]];
while (tryFlow.analyze(startPCs[i], handlerPCs[i]));
@ -873,8 +874,8 @@ public class TransformExceptionHandlers {
analyzeCatchBlock(jode.Type.tObject, tryFlow, catchFlow);
tryFlow.checkConsistent();
if (jode.Decompiler.debugAnalyze)
System.err.println("analyzeCatch(" + tryFlow.addr + ", "
if (Decompiler.debugAnalyze)
Decompiler.err.println("analyzeCatch(" + tryFlow.addr + ", "
+ (tryFlow.addr + tryFlow.length) +
") done.");
}

@ -54,7 +54,7 @@ public class VariableSet implements Cloneable {
size += count;
if (size > locals.length) {
int nextSize = locals.length * 2;
// System.err.println("wanted: "+size+" next: "+nextSize);
// Decompiler.err.println("wanted: "+size+" next: "+nextSize);
LocalInfo[] newLocals
= new LocalInfo[nextSize > size ? nextSize : size];
System.arraycopy(locals, 0, newLocals, 0, count);

@ -31,7 +31,7 @@ public class ClassBundle {
public void loadClass(ClassInfo clazz) {
if (loadedClasses.get(clazz.getName()) != null) {
System.err.println("warning: ignoring double class: "
Decompiler.err.println("warning: ignoring double class: "
+ clazz.getName());
return;
}

@ -20,16 +20,18 @@ package jode;
import jode.bytecode.ClassInfo;
import jode.obfuscator.*;
import java.util.Vector;
import java.lang.reflect.Modifier;
public class Obfuscator {
public static boolean isVerbose = false;
public static boolean isDebugging = false;
public static final int PRESERVE_PRIVATE = 0; // does this make sense?
public static final int PRESERVE_PACKAGE = 1;
public static final int PRESERVE_PROTECTED = 2;
public static final int PRESERVE_PUBLIC = 3;
public static final int PRESERVE_NONE = 4;
public static final int PRESERVE_NONE = 0;
public static final int PRESERVE_PUBLIC = Modifier.PUBLIC;
public static final int PRESERVE_PROTECTED =
PRESERVE_PUBLIC | Modifier.PROTECTED;
public static final int PRESERVE_PACKAGE =
PRESERVE_PROTECTED | Modifier.PRIVATE; //XXX
public static final int RENAME_STRONG = 0;
public static final int RENAME_WEAK = 1;
@ -38,42 +40,40 @@ public class Obfuscator {
public static final int RENAME_TABLE = 4;
public static void usage() {
System.err.println("usage: jode.Obfuscator flags* [class | package]*");
System.err.println("\t[-v] "+"Verbose output");
System.err.println("\t[-debug] "+"Debugging");
System.err.println("\t[-nostrip] "+
Decompiler.err.println("usage: jode.Obfuscator flags* [class | package]*");
Decompiler.err.println("\t[-v] "+"Verbose output");
Decompiler.err.println("\t[-debug] "+"Debugging");
Decompiler.err.println("\t[-nostrip] "+
"Don't strip not needed methods");
System.err.println("\t[-sourcepath] "+
Decompiler.err.println("\t[-sourcepath] "+
"Colon-separated list of source-file directory");
System.err.println("\t[-d <directory>] "+
Decompiler.err.println("\t[-d <directory>] "+
"Destination directory for output classes");
System.err.println("Preserve options: ");
System.err.println("\t[-private] "+
"Preserve all private members");
System.err.println("\t[-package] "+
Decompiler.err.println("Preserve options: ");
Decompiler.err.println("\t[-package] "+
"Preserve all package members");
System.err.println("\t[-protected] "+
Decompiler.err.println("\t[-protected] "+
"Preserve all protected members");
System.err.println("\t[-public] "+
Decompiler.err.println("\t[-public] "+
"Preserve all public members");
System.err.println("\t[-class <name>] "+
Decompiler.err.println("\t[-class <name>] "+
"Preserve only the given class (allowed multiple times");
System.err.println("\t[-method <name>] "+
Decompiler.err.println("\t[-method <name>] "+
"Preserve only the given metod (allowed multiple times");
System.err.println("Obfuscating options: ");
System.err.println("\t[-strong] "+
Decompiler.err.println("Obfuscating options: ");
Decompiler.err.println("\t[-strong] "+
"Rename identifiers to random number/letters");
System.err.println("\t[-weak] "+
Decompiler.err.println("\t[-weak] "+
"Rename to random, but legal java identifier");
System.err.println("\t[-unique] "+
Decompiler.err.println("\t[-unique] "+
"Rename to unique legal java identifier");
System.err.println("\t[-none] "+
Decompiler.err.println("\t[-none] "+
"Don't rename any method.");
System.err.println("\t[-table <file>] "+
Decompiler.err.println("\t[-table <file>] "+
"Read translation table from file");
System.err.println("\t[-revtable <file>] "+
Decompiler.err.println("\t[-revtable <file>] "+
"Write reversed translation table to file");
}
@ -107,8 +107,6 @@ public class Obfuscator {
destPath = params[++i];
/* Preserve options */
else if (params[i].equals("-private"))
preserve = PRESERVE_PRIVATE;
else if (params[i].equals("-package"))
preserve = PRESERVE_PACKAGE;
else if (params[i].equals("-protected"))
@ -145,13 +143,13 @@ public class Obfuscator {
break;
} else {
if (!params[i].startsWith("-h"))
System.err.println("Unknown option: "+params[i]);
Decompiler.err.println("Unknown option: "+params[i]);
usage();
return;
}
}
if (i == params.length) {
System.err.println("No package or classes specified.");
Decompiler.err.println("No package or classes specified.");
usage();
return;
}

@ -397,7 +397,7 @@ public class Type {
if (result == tError) {
boolean oldTypeDebugging = Decompiler.isTypeDebugging;
Decompiler.isTypeDebugging = true;
System.err.println("intersecting "+ this +" and "+ type
Decompiler.err.println("intersecting "+ this +" and "+ type
+ " to <" + bottom + "," + top + ">"
+ " to <error>");
Decompiler.isTypeDebugging = oldTypeDebugging;
@ -405,10 +405,10 @@ public class Type {
throw new AssertError("type error");
} else if (Decompiler.isTypeDebugging) {
if (this.equals(type)) {
// System.err.println("intersecting identical: "+this);
// Decompiler.err.println("intersecting identical: "+this);
// Thread.dumpStack();
} else
System.err.println("intersecting "+ this +" and "+ type +
Decompiler.err.println("intersecting "+ this +" and "+ type +
" to " + result);
}

Loading…
Cancel
Save