GlobalOptions

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@684 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 097068f315
commit 8e74989f48
  1. 114
      jode/jode/bytecode/BytecodeInfo.java
  2. 20
      jode/jode/bytecode/SearchPath.java
  3. 9
      jode/jode/decompiler/CodeAnalyzer.java
  4. 18
      jode/jode/decompiler/LocalInfo.java
  5. 4
      jode/jode/decompiler/LocalVariableRangeList.java
  6. 17
      jode/jode/decompiler/MethodAnalyzer.java
  7. 8
      jode/jode/expr/Expression.java
  8. 10
      jode/jode/expr/InvokeOperator.java
  9. 10
      jode/jode/expr/LocalLoadOperator.java
  10. 6
      jode/jode/flow/CompleteSynchronized.java
  11. 7
      jode/jode/flow/CreateExpression.java
  12. 6
      jode/jode/flow/CreateForInitializer.java
  13. 10
      jode/jode/flow/CreateIfThenElseOperator.java
  14. 74
      jode/jode/flow/FlowBlock.java
  15. 4
      jode/jode/flow/Jump.java
  16. 4
      jode/jode/flow/SequentialBlock.java
  17. 4
      jode/jode/flow/StructuredBlock.java
  18. 18
      jode/jode/flow/TransformConstructors.java
  19. 18
      jode/jode/flow/TransformExceptionHandlers.java
  20. 2
      jode/jode/flow/VariableSet.java
  21. 34
      jode/jode/jvm/CodeVerifier.java
  22. 6
      jode/jode/jvm/SyntheticAnalyzer.java
  23. 14
      jode/jode/obfuscator/ClassBundle.java
  24. 13
      jode/jode/obfuscator/ClassIdentifier.java
  25. 23
      jode/jode/obfuscator/ConstantAnalyzer.java
  26. 5
      jode/jode/obfuscator/Identifier.java
  27. 13
      jode/jode/obfuscator/MethodIdentifier.java
  28. 43
      jode/jode/obfuscator/PackageIdentifier.java
  29. 12
      jode/jode/swingui/Main.java
  30. 6
      jode/jode/type/IntegerType.java
  31. 6
      jode/jode/type/RangeType.java
  32. 6
      jode/jode/type/ReferenceType.java
  33. 6
      jode/jode/type/Type.java

@ -18,7 +18,7 @@
*/
package jode.bytecode;
import jode.Decompiler/*XXX*/;
import jode.GlobalOptions/*XXX*/;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ByteArrayInputStream;
@ -65,12 +65,12 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
DataInputStream input,
int howMuch) throws IOException {
if (name.equals("LocalVariableTable")) {
if (Decompiler.showLVT)
Decompiler.err.println("LocalVariableTable of "+methodInfo.clazzInfo.getName() + "." + methodInfo.getName());
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LVT) != 0)
GlobalOptions.err.println("LocalVariableTable of "+methodInfo.clazzInfo.getName() + "." + methodInfo.getName());
int count = input.readUnsignedShort();
if (length != 2 + count * 10) {
if (Decompiler.showLVT)
Decompiler.err.println("Illegal LVT length, ignoring it");
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LVT) != 0)
GlobalOptions.err.println("Illegal LVT length, ignoring it");
return;
}
lvt = new LocalVariableInfo[count];
@ -104,8 +104,8 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
// This is probably an evil lvt as created by HashJava
// simply ignore it.
if (Decompiler.showLVT)
Decompiler.err.println("Illegal entry, ignoring LVT");
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LVT) != 0)
GlobalOptions.err.println("Illegal entry, ignoring LVT");
lvt = null;
return;
}
@ -114,8 +114,8 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
lvt[i].name = cp.getUTF8(nameIndex);
lvt[i].type = cp.getUTF8(typeIndex);
lvt[i].slot = slot;
if (Decompiler.showLVT)
Decompiler.err.println("\t" + lvt[i].name + ": "
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_LVT) != 0)
GlobalOptions.err.println("\t" + lvt[i].name + ": "
+ lvt[i].type
+" range "+start+" - "+end
+" slot "+slot);
@ -123,7 +123,7 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
} else if (name.equals("LineNumberTable")) {
int count = input.readUnsignedShort();
if (length != 2 + count * 4) {
Decompiler.err.println
GlobalOptions.err.println
("Illegal LineNumberTable, ignoring it");
return;
}
@ -139,7 +139,7 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
}
if (startInstr == null
|| startInstr.addr != start) {
Decompiler.err.println
GlobalOptions.err.println
("Illegal entry, ignoring LineNumberTable table");
lnt = null;
return;
@ -174,8 +174,11 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
lastInstr = instr;
int opcode = input.readUnsignedByte();
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(addr+": "+opcodeString[opcode]);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(addr+": "+opcodeString[opcode]);
instr.opcode = opcode;
switch (opcode) {
@ -190,8 +193,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
throw new ClassFormatError
("Invalid local slot "+instr.localSlot);
instr.length = 4;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+opcodeString[wideopcode]
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+opcodeString[wideopcode]
+" "+instr.localSlot);
break;
case opc_lload: case opc_dload:
@ -201,8 +205,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
throw new ClassFormatError
("Invalid local slot "+instr.localSlot);
instr.length = 4;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+opcodeString[wideopcode]
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+opcodeString[wideopcode]
+" "+instr.localSlot);
break;
case opc_ret:
@ -212,8 +217,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
("Invalid local slot "+instr.localSlot);
instr.length = 4;
instr.alwaysJumps = true;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" ret "+instr.localSlot);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" ret "+instr.localSlot);
break;
case opc_iinc:
@ -223,8 +229,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
("Invalid local slot "+instr.localSlot);
instr.intData = input.readShort();
instr.length = 6;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" iinc "+instr.localSlot
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" iinc "+instr.localSlot
+" "+instr.intData);
break;
default:
@ -281,8 +288,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
throw new ClassFormatError
("Invalid local slot "+instr.localSlot);
instr.length = 2;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.localSlot);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.localSlot);
break;
case opc_lstore: case opc_dstore:
case opc_lload: case opc_dload:
@ -291,8 +299,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
throw new ClassFormatError
("Invalid local slot "+instr.localSlot);
instr.length = 2;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.localSlot);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.localSlot);
break;
case opc_ret:
@ -302,8 +311,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
("Invalid local slot "+instr.localSlot);
instr.alwaysJumps = true;
instr.length = 2;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.localSlot);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.localSlot);
break;
case opc_aconst_null:
@ -371,8 +381,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
("Invalid local slot "+instr.localSlot);
instr.intData = input.readByte();
instr.length = 3;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.localSlot
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.localSlot
+" "+instr.intData);
break;
@ -392,8 +403,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
succAddrs[addr][0] = addr+input.readShort();
predcounts[succAddrs[addr][0]]++;
instr.length = 3;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+succAddrs[addr][0]);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+succAddrs[addr][0]);
break;
case opc_goto_w:
@ -404,8 +416,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
succAddrs[addr][0] = addr+input.readInt();
predcounts[succAddrs[addr][0]]++;
instr.length = 5;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+succAddrs[addr][0]);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+succAddrs[addr][0]);
break;
case opc_tableswitch: {
@ -478,8 +491,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
|| opcode != opc_invokespecial))
throw new ClassFormatException
("Illegal call of special method/field "+ref);
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+ref);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+ref);
instr.objData = ref;
instr.length = 3;
break;
@ -494,8 +508,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
if (ref.getName().charAt(0) == '<')
throw new ClassFormatException
("Illegal call of special method "+ref);
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+ref);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+ref);
instr.objData = ref;
instr.intData = input.readUnsignedByte();
if (input.readUnsignedByte() != 0)
@ -514,8 +529,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
throw new ClassFormatException
("Can't create array with opc_new");
instr.objData = type;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.objData);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.objData);
instr.length = 3;
break;
}
@ -527,8 +543,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
throw new ClassFormatException
("multianewarray called for non array:"
+ instr.getDescription());
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.objData
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.objData
+" "+instr.intData);
instr.length = 4;
break;
@ -536,8 +553,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
String type = cp.getClassType(input.readUnsignedShort());
instr.opcode = opc_multianewarray;
instr.objData = "["+type;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.objData);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.objData);
instr.intData = 1;
instr.length = 3;
break;
@ -547,8 +565,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
(input.readUnsignedByte()-4);
instr.opcode = opc_multianewarray;
instr.objData = new String (new char[] { '[', sig });
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.print(" "+instr.objData);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.print(" "+instr.objData);
instr.intData = 1;
instr.length = 2;
break;
@ -562,8 +581,9 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes {
instr.length = 1;
}
addr += lastInstr.length;
if (Decompiler.isDebugging)/*XXX*/
Decompiler.err.println();
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_BYTECODE) != 0)
GlobalOptions.err.println();
}
}
firstInstr = instrs[0];

@ -22,7 +22,7 @@ import java.io.*;
import java.net.*;
import java.util.zip.*;
import java.util.*;
import jode.Decompiler;
import jode.GlobalOptions;
/**
* This class represents a path of multiple directories and/or zip files,
@ -112,7 +112,7 @@ public class SearchPath {
urlzips[nr] = newarr;
}
} catch (IOException ex) {
Decompiler.err.println("IOException while reading "
GlobalOptions.err.println("IOException while reading "
+"remote zip file "+bases[nr]);
// disable entry
bases[nr] = null;
@ -135,7 +135,7 @@ public class SearchPath {
}
zis.close();
} catch (IOException ex) {
Decompiler.err.println("Remote zip file "+bases[nr]
GlobalOptions.err.println("Remote zip file "+bases[nr]
+" is corrupted.");
// disable entry
bases[nr] = null;
@ -181,7 +181,7 @@ public class SearchPath {
} catch (IOException ex) {
// ignore
} catch (SecurityException ex) {
Decompiler.err.println("Warning: Security exception "
GlobalOptions.err.println("Warning: Security exception "
+"while accessing "
+bases[i]+".");
}
@ -203,7 +203,7 @@ public class SearchPath {
}
} catch (SecurityException ex) {
/* disable this entry */
Decompiler.err.println("Warning: SecurityException while"
GlobalOptions.err.println("Warning: SecurityException while"
+ " accessing " + token);
dirs[i] = null;
}
@ -311,10 +311,10 @@ public class SearchPath {
conn.setAllowUserInteraction(true);
return conn.getInputStream();
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
GlobalOptions.err.println("Warning: SecurityException"
+" while accessing "
+bases[i]+filename);
ex.printStackTrace(Decompiler.err);
ex.printStackTrace(GlobalOptions.err);
/* ignore and take next element */
} catch (FileNotFoundException ex) {
/* ignore and take next element */
@ -336,7 +336,7 @@ public class SearchPath {
if (f.exists())
return new FileInputStream(f);
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
GlobalOptions.err.println("Warning: SecurityException"
+" while accessing "
+dirs[i]+filename);
/* ignore and take next element */
@ -372,7 +372,7 @@ public class SearchPath {
if (f.exists())
return f.isDirectory();
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
GlobalOptions.err.println("Warning: SecurityException"
+" while accessing "
+dirs[i]+filename);
}
@ -439,7 +439,7 @@ public class SearchPath {
files = f.list();
}
} catch (SecurityException ex) {
Decompiler.err.println("Warning: SecurityException"
GlobalOptions.err.println("Warning: SecurityException"
+" while accessing "
+dirs[pathNr]+localDirName);
/* ignore and take next element */

@ -19,6 +19,7 @@
package jode.decompiler;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.type.Type;
import jode.bytecode.*;
import jode.flow.FlowBlock;
@ -135,8 +136,8 @@ public class CodeAnalyzer implements Analyzer {
jode.flow.StructuredBlock block
= Opcodes.readOpcode(instr, this);
if (jode.Decompiler.isVerbose && instr.addr > mark) {
Decompiler.err.print('.');
if (GlobalOptions.verboseLevel > 0 && instr.addr > mark) {
GlobalOptions.err.print('.');
mark += 1000;
}
@ -184,8 +185,8 @@ public class CodeAnalyzer implements Analyzer {
instr != null; instr = instr.nextByAddr)
instr.tmpInfo = null;
if (Decompiler.isVerbose)
Decompiler.err.print('-');
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.print('-');
// try {
// TabbedPrintWriter writer = new TabbedPrintWriter(System.err);

@ -20,7 +20,7 @@
package jode.decompiler;
import java.util.Enumeration;
import java.util.Vector;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.type.Type;
import jode.expr.LocalVarOperator;
@ -93,7 +93,7 @@ public class LocalInfo {
} else {
if (this != li) {
shadow = li;
// Decompiler.err.println("combining "+name+"("+type+") and "
// GlobalOptions.err.println("combining "+name+"("+type+") and "
// +li.name+"("+li.type+")");
li.setType(type);
@ -105,8 +105,8 @@ public class LocalInfo {
LocalVarOperator lvo =
(LocalVarOperator) enum.nextElement();
if (needTypeUpdate) {
if (Decompiler.isTypeDebugging)
Decompiler.err.println("updating " + lvo);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("updating " + lvo);
lvo.updateType();
}
shadow.operators.addElement(lvo);
@ -231,12 +231,12 @@ public class LocalInfo {
Type newType = li.type.intersection(otherType);
if (newType == Type.tError
&& otherType != Type.tError && li.type != Type.tError) {
Decompiler.err.println("Type error in local " + getName()+": "
GlobalOptions.err.println("Type error in local " + getName()+": "
+ li.type + " and " + otherType);
Thread.dumpStack();
}
else if (Decompiler.isTypeDebugging)
Decompiler.err.println(getName()+" setType, new: "+newType
else if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println(getName()+" setType, new: "+newType
+ " old: "+li.type);
if (!li.type.equals(newType)) {
@ -244,8 +244,8 @@ public class LocalInfo {
java.util.Enumeration enum = li.operators.elements();
while (enum.hasMoreElements()) {
LocalVarOperator lvo = (LocalVarOperator) enum.nextElement();
if (Decompiler.isTypeDebugging)
Decompiler.err.println("updating "+lvo);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("updating "+lvo);
lvo.updateType();
}
}

@ -18,7 +18,7 @@
*/
package jode.decompiler;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.type.Type;
public class LocalVariableRangeList {
@ -48,7 +48,7 @@ public class LocalVariableRangeList {
next.endAddr = Math.max(next.endAddr, li.endAddr);
return;
}
Decompiler.err.println("warning: non disjoint locals");
GlobalOptions.err.println("warning: non disjoint locals");
}
li.next = next;
if (prev == null)

@ -22,6 +22,7 @@ import jode.bytecode.MethodInfo;
import jode.type.*;
import jode.AssertError;
import jode.Decompiler;
import jode.GlobalOptions;
import java.lang.reflect.Modifier;
import java.io.*;
@ -135,11 +136,11 @@ public class MethodAnalyzer implements Analyzer {
imports.useType(methodType.getReturnType());
if (!Decompiler.immediateOutput) {
if (Decompiler.isVerbose)
Decompiler.err.print(methodName+": ");
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.print(methodName+": ");
code.analyze();
if (Decompiler.isVerbose)
Decompiler.err.println("");
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("");
}
}
@ -169,11 +170,11 @@ public class MethodAnalyzer implements Analyzer {
// We do the code.analyze() here, to get
// immediate output.
if (Decompiler.isVerbose)
Decompiler.err.print(methodName+": ");
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.print(methodName+": ");
code.analyze();
if (Decompiler.isVerbose)
Decompiler.err.println("");
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("");
}
if (isConstructor() && isStatic()

@ -19,7 +19,7 @@
package jode.expr;
import jode.type.Type;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.decompiler.TabbedPrintWriter;
public abstract class Expression {
@ -43,7 +43,7 @@ public abstract class Expression {
Type newType = type.intersection(otherType);
if (newType == Type.tError
&& type != Type.tError && otherType != Type.tError)
Decompiler.err.println("Type error in "+this+": "
GlobalOptions.err.println("Type error in "+this+": "
+"merging "+type+" and "+otherType);
type = newType;
}
@ -86,7 +86,7 @@ public abstract class Expression {
* conflict was found. You may wish to check for >0.
*/
public int canCombine(Expression e) {
// jode.Decompiler.err.println("Try to combine "+e+" into "+this);
// jode.GlobalOptions.err.println("Try to combine "+e+" into "+this);
return containsMatchingLoad(e)? 1 : 0;
}
@ -173,7 +173,7 @@ public abstract class Expression {
public void dumpExpression(TabbedPrintWriter writer, int minPriority)
throws java.io.IOException {
boolean needParen1 = false, needParen2 = false;
if (Decompiler.isTypeDebugging) {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0) {
if (minPriority > 700) {
needParen1 = true;
writer.print("(");

@ -21,7 +21,7 @@ package jode.expr;
import jode.decompiler.CodeAnalyzer;
import jode.decompiler.ClassAnalyzer;
import jode.decompiler.TabbedPrintWriter;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.bytecode.*;
import jode.jvm.*;
import jode.type.*;
@ -259,14 +259,14 @@ public final class InvokeOperator extends Operator
try {
result = (String) Interpreter.interpretMethod(env, info, locals);
} catch (InterpreterException ex) {
Decompiler.err.println("Warning: Can't interpret method "
GlobalOptions.err.println("Warning: Can't interpret method "
+methodName);
ex.printStackTrace(Decompiler.err);
ex.printStackTrace(GlobalOptions.err);
return null;
} catch (InvocationTargetException ex) {
Decompiler.err.println("Warning: Interpreted method throws"
GlobalOptions.err.println("Warning: Interpreted method throws"
+" an uncaught exception: ");
ex.getTargetException().printStackTrace(Decompiler.err);
ex.getTargetException().printStackTrace(GlobalOptions.err);
return null;
}
return new ConstOperator(result);

@ -18,7 +18,7 @@
*/
package jode.expr;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.type.Type;
import jode.decompiler.LocalInfo;
import jode.decompiler.TabbedPrintWriter;
@ -51,8 +51,8 @@ public class LocalLoadOperator extends NoArgOperator
}
public void updateType() {
if (Decompiler.isTypeDebugging)
Decompiler.err.println("local "+local.getName()+" changed: "
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("local "+local.getName()+" changed: "
+type+" to "+local.getType()
+" in "+parent);
super.setType(local.getType());
@ -65,12 +65,12 @@ public class LocalLoadOperator extends NoArgOperator
}
public Type getType() {
// Decompiler.err.println("LocalLoad.getType of "+local.getName()+": "+local.getType());
// GlobalOptions.err.println("LocalLoad.getType of "+local.getName()+": "+local.getType());
return local.getType();
}
public void setType(Type type) {
// Decompiler.err.println("LocalLoad.setType of "+local.getName()+": "+local.getType());
// GlobalOptions.err.println("LocalLoad.setType of "+local.getName()+": "+local.getType());
super.setType(local.setType(type));
}

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

@ -18,7 +18,7 @@
*/
package jode.flow;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.expr.*;
/**
@ -107,8 +107,9 @@ public class CreateExpression {
sequBlock = (SequentialBlock)sequBlock.outer;
}
if(Decompiler.isVerbose && lastExpression.getOperandCount() == 0)
Decompiler.err.print('x');
if (GlobalOptions.verboseLevel > 0
&& lastExpression.getOperandCount() == 0)
GlobalOptions.err.print('x');
ic.setInstruction(lastExpression);
ic.moveDefinitions(sequBlock, last);

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

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

@ -19,7 +19,7 @@
package jode.flow;
import java.util.*;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.AssertError;
import jode.decompiler.TabbedPrintWriter;
import jode.decompiler.CodeAnalyzer;
@ -654,11 +654,11 @@ public class FlowBlock {
this.in.unionExact(successor.in);
this.gen.unionExact(successor.gen);
if (Decompiler.debugInOut) {
Decompiler.err.println("UpdateInOut: gens : "+gens);
Decompiler.err.println(" kills: "+kills);
Decompiler.err.println(" s.in : "+successor.in);
Decompiler.err.println(" in : "+in);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_INOUT) != 0) {
GlobalOptions.err.println("UpdateInOut: gens : "+gens);
GlobalOptions.err.println(" kills: "+kills);
GlobalOptions.err.println(" s.in : "+successor.in);
GlobalOptions.err.println(" in : "+in);
}
}
@ -672,7 +672,7 @@ public class FlowBlock {
/* This checks are very time consuming, so don't do them
* normally.
*/
if (!Decompiler.doChecks)
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_CHECK) == 0)
return;
try {
@ -752,9 +752,9 @@ public class FlowBlock {
*/
public void doSequentialT1(StructuredBlock succ, int length) {
checkConsistent();
if (Decompiler.isFlowDebugging) {
Decompiler.err.println("merging sequentialBlock: "+this);
Decompiler.err.println("and: "+succ);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0) {
GlobalOptions.err.println("merging sequentialBlock: "+this);
GlobalOptions.err.println("and: "+succ);
}
VariableSet succIn = new VariableSet();
succ.fillInGenSet(succIn, this.gen);
@ -822,17 +822,17 @@ public class FlowBlock {
/* Update the in/out-Vectors now */
updateInOut(succ, jumps);
if (Decompiler.isFlowDebugging)
Decompiler.err.println("before Resolve: "+this);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("before Resolve: "+this);
/* Try to eliminate as many jumps as possible.
*/
jumps = resolveSomeJumps(jumps, succ);
if (Decompiler.isFlowDebugging)
Decompiler.err.println("before Remaining: "+this);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("before Remaining: "+this);
resolveRemaining(jumps);
if (Decompiler.isFlowDebugging)
Decompiler.err.println("after Resolve: "+this);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("after Resolve: "+this);
/* Now unify the blocks.
*/
@ -1130,8 +1130,8 @@ public class FlowBlock {
}
public void doTransformations() {
if (Decompiler.isFlowDebugging)
Decompiler.err.println("before Transformation: "+this);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("before Transformation: "+this);
while (lastModified instanceof SequentialBlock) {
if (!lastModified.getSubBlocks()[0].doTransformations())
@ -1140,8 +1140,8 @@ public class FlowBlock {
while (lastModified.doTransformations())
/* empty */;
if (Decompiler.isFlowDebugging)
Decompiler.err.println("after Transformation: "+this);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("after Transformation: "+this);
}
/**
@ -1185,8 +1185,8 @@ public class FlowBlock {
* @param end the end of the address range.
*/
public boolean analyze(int start, int end) {
if (Decompiler.debugAnalyze)
Decompiler.err.println("analyze("+start+", "+end+")");
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_ANALYZE) != 0)
GlobalOptions.err.println("analyze("+start+", "+end+")");
checkConsistent();
boolean changed = false;
@ -1202,11 +1202,11 @@ public class FlowBlock {
if (doT2(start, end)) {
if (Decompiler.isFlowDebugging)
Decompiler.err.println("after T2: "+this);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("after T2: "+this);
if (Decompiler.debugAnalyze)
Decompiler.err.println("T2("+addr+","+getNextAddr()
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_ANALYZE) != 0)
GlobalOptions.err.println("T2("+addr+","+getNextAddr()
+") succeeded");
/* T2 transformation succeeded. This may
* make another T1 analysis in the previous
@ -1222,8 +1222,8 @@ public class FlowBlock {
/* the Block has no successor where t1 is applicable.
* Finish this analyzation.
*/
if (Decompiler.debugAnalyze)
Decompiler.err.println
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_ANALYZE) != 0)
GlobalOptions.err.println
("No more successors applicable: "
+ start + " - " + end + "; "
+ addr + " - " + getNextAddr());
@ -1236,8 +1236,8 @@ public class FlowBlock {
/* T1 transformation succeeded. */
changed = true;
if (Decompiler.isFlowDebugging)
Decompiler.err.println("after T1: "+this);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
GlobalOptions.err.println("after T1: "+this);
break;
}
@ -1250,8 +1250,8 @@ public class FlowBlock {
int predAddr =
((FlowBlock)enum.nextElement()).addr;
if (predAddr < start || predAddr >= end) {
if (Decompiler.debugAnalyze)
Decompiler.err.println
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_ANALYZE) != 0)
GlobalOptions.err.println
("breaking analyze("
+ start + ", " + end + "); "
+ addr + " - " + getNextAddr());
@ -1373,7 +1373,7 @@ public class FlowBlock {
mergeSuccessors(lastFlow);
}
if (Decompiler.isFlowDebugging)
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_FLOW) != 0)
System.err.println("after analyzeSwitch: "+this);
checkConsistent();
return changed;
@ -1426,9 +1426,9 @@ public class FlowBlock {
mapStackToLocal(VariableStack.EMPTY);
return true;
// } catch (RuntimeException ex) {
// Decompiler.err.println("Can't resolve all PUSHes, "
// GlobalOptions.err.println("Can't resolve all PUSHes, "
// +"this is probably illegal bytecode:");
// ex.printStackTrace(Decompiler.err);
// ex.printStackTrace(GlobalOptions.err);
// return false;
// }
}
@ -1510,7 +1510,7 @@ public class FlowBlock {
writer.tab();
}
if (Decompiler.debugInOut) {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_INOUT) != 0) {
writer.println("in: "+in);
}
@ -1559,7 +1559,7 @@ public class FlowBlock {
java.io.StringWriter strw = new java.io.StringWriter();
TabbedPrintWriter writer = new TabbedPrintWriter(strw);
writer.println(super.toString() + ": "+addr+"-"+(addr+length));
if (Decompiler.debugInOut) {
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_INOUT) != 0) {
writer.println("in: "+in);
}
writer.tab();

@ -18,6 +18,7 @@
*/
package jode.flow;
import jode.GlobalOptions;
/**
* This class represents an unconditional jump.
@ -85,7 +86,8 @@ public class Jump {
public void dumpSource(jode.decompiler.TabbedPrintWriter writer)
throws java.io.IOException
{
if (jode.Decompiler.debugInOut) {
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_INOUT) != 0) {
writer.println("gen : "+ gen.toString());
writer.println("kill: "+ kill.toString());
}

@ -64,12 +64,12 @@ public class SequentialBlock extends StructuredBlock {
*/
public VariableStack mapStackToLocal(VariableStack stack) {
if (stack == null)
jode.Decompiler.err.println("map stack to local called with null: " + this+ " in "+this.flowBlock);
jode.GlobalOptions.err.println("map stack to local called with null: " + this+ " in "+this.flowBlock);
VariableStack middle = subBlocks[0].mapStackToLocal(stack);
if (middle != null)
// Otherwise the second block is at least "logical" dead code
return subBlocks[1].mapStackToLocal(middle);
jode.Decompiler.err.println("Dead code after Block " + subBlocks[0]);
jode.GlobalOptions.err.println("Dead code after Block " + subBlocks[0]);
return null;
}

@ -19,6 +19,7 @@
package jode.flow;
import jode.AssertError;
import jode.GlobalOptions;
import jode.decompiler.TabbedPrintWriter;
import jode.decompiler.LocalInfo;
@ -553,7 +554,8 @@ public abstract class StructuredBlock {
public void dumpSource(jode.decompiler.TabbedPrintWriter writer)
throws java.io.IOException
{
if (jode.Decompiler.isDebugging) {
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_LOCALS) != 0) {
if (declare != null)
writer.println("declaring: "+declare);
if (done != null)

@ -41,7 +41,7 @@ public class TransformConstructors {
if (header == null || !header.hasNoJumps())
return;
sb[i] = cons[i].getMethodHeader().block;
// Decompiler.err.println("constr "+i+": "+sb[i]);
// GlobalOptions.err.println("constr "+i+": "+sb[i]);
if (!isStatic) {
InstructionBlock ib;
if (sb[i] instanceof InstructionBlock)
@ -69,7 +69,7 @@ public class TransformConstructors {
/* This constructor calls another constructor, so we
* can skip it.
*/
// Decompiler.err.println("skipping this()");
// GlobalOptions.err.println("skipping this()");
cons[i] = cons[--constrCount];
continue;
}
@ -83,7 +83,7 @@ public class TransformConstructors {
sb[i] = sb[i].getSubBlocks()[1];
else
sb[i] = null;
// Decompiler.err.println("normal constructor");
// GlobalOptions.err.println("normal constructor");
}
i++;
}
@ -112,16 +112,16 @@ public class TransformConstructors {
if (!pfo.isThis() || !expr.isConstant()) {
// Decompiler.err.println("not constant: "+expr);
// GlobalOptions.err.println("not constant: "+expr);
break big_loop;
}
// Decompiler.err.println("field "+pfo.getFieldName()+ " = "+expr);
// GlobalOptions.err.println("field "+pfo.getFieldName()+ " = "+expr);
if (!isStatic
&& !(((ComplexExpression)instr).getSubExpressions()[0]
.toString().equals("this"))) {
// Decompiler.err.println("not this: "+instr);
// GlobalOptions.err.println("not this: "+instr);
break big_loop;
}
@ -131,7 +131,7 @@ public class TransformConstructors {
: sb[i];
if (!(ib instanceof InstructionBlock)
|| !((InstructionBlock)ib).getInstruction().equals(instr)) {
// Decompiler.err.println("constr "+i+" differs: "+ib);
// GlobalOptions.err.println("constr "+i+" differs: "+ib);
break big_loop;
}
}
@ -140,7 +140,7 @@ public class TransformConstructors {
if (!(clazzAnalyzer
.getField(pfo.getFieldName(), pfo.getFieldType())
.setInitializer(expr))) {
// Decompiler.err.println("setField failed");
// GlobalOptions.err.println("setField failed");
break big_loop;
}
@ -153,7 +153,7 @@ public class TransformConstructors {
}
for (int i=0; i< constrCount; i++)
if (sb[i] == null) {
// Decompiler.err.println("constr "+i+" is over");
// GlobalOptions.err.println("constr "+i+" is over");
break big_loop;
}
}

@ -19,7 +19,7 @@
package jode.flow;
import jode.AssertError;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.type.Type;
import jode.decompiler.LocalInfo;
import jode.expr.*;
@ -152,10 +152,10 @@ public class TransformExceptionHandlers {
tryFlow.in.unionExact(catchFlow.in);
tryFlow.gen.unionExact(catchFlow.gen);
if (Decompiler.debugInOut) {
Decompiler.err.println("UpdateInOutCatch: gens : "+gens);
Decompiler.err.println(" s.in : "+catchFlow.in);
Decompiler.err.println(" in : "+tryFlow.in);
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_INOUT) != 0) {
GlobalOptions.err.println("UpdateInOutCatch: gens : "+gens);
GlobalOptions.err.println(" s.in : "+catchFlow.in);
GlobalOptions.err.println(" in : "+tryFlow.in);
}
}
@ -854,8 +854,8 @@ public class TransformExceptionHandlers {
int endHandler = (i< count-1 && endPCs[i+1] > catches[i].addr)
? endPCs[i+1]
: Integer.MAX_VALUE;
if (Decompiler.debugAnalyze)
Decompiler.err.println("analyzeCatch(" + trys[i].addr + ", "
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_ANALYZE) != 0)
GlobalOptions.err.println("analyzeCatch(" + trys[i].addr + ", "
+ endPCs[i] + ", " +catches[i].addr + ")");
FlowBlock tryFlow = trys[i];
tryFlow.checkConsistent();
@ -885,8 +885,8 @@ public class TransformExceptionHandlers {
analyzeCatchBlock(Type.tObject, tryFlow, catchFlow);
tryFlow.checkConsistent();
if (Decompiler.debugAnalyze)
Decompiler.err.println("analyzeCatch(" + tryFlow.addr + ", "
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_ANALYZE) != 0)
GlobalOptions.err.println("analyzeCatch(" + tryFlow.addr + ", "
+ (tryFlow.addr + tryFlow.length) +
") done.");
}

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

@ -21,7 +21,7 @@ package jode.jvm;
import jode.bytecode.*;
import jode.type.*;
import jode.AssertError;
import jode.Decompiler;
import jode.GlobalOptions;
import java.util.BitSet;
import java.util.Stack;
@ -182,16 +182,19 @@ public class CodeVerifier implements Opcodes {
}
public boolean isOfType(Type t1, Type t2) {
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_VERIFIER) != 0)
GlobalOptions.err.println("isOfType("+t1+","+t2+")");
if (t1.equals(t2))
return true;
if (t1.getTypeCode() == Type.TC_INTEGER
&& t2.getTypeCode() == Type.TC_INTEGER)
return true;
if (t1 == Type.tUObject)
if (t1.equals(Type.tUObject))
return (t2.getTypeCode() == Type.TC_CLASS
|| t2.getTypeCode() == Type.TC_ARRAY
|| t2.getTypeCode() == -Type.TC_CLASS);
if (t2 == Type.tUObject)
if (t2.equals(Type.tUObject))
return (t1.getTypeCode() == Type.TC_CLASS
|| t1.getTypeCode() == Type.TC_ARRAY
|| t1.getTypeCode() == -Type.TC_CLASS);
@ -206,10 +209,10 @@ public class CodeVerifier implements Opcodes {
Type e2 = ((ArrayType)t2).getElementType();
if ((e1.getTypeCode() == Type.TC_CLASS
|| e1.getTypeCode() == Type.TC_ARRAY
|| e1 == Type.tUObject)
|| e1.equals(Type.tUObject))
&& (e2.getTypeCode() == Type.TC_CLASS
|| e2.getTypeCode() == Type.TC_ARRAY
|| e2 == Type.tUObject))
|| e2.equals(Type.tUObject)))
return isOfType(e1, e2);
return false;
} else {
@ -229,11 +232,11 @@ public class CodeVerifier implements Opcodes {
if (t1.getTypeCode() == Type.TC_INTEGER
&& t2.getTypeCode() == Type.TC_INTEGER)
return t1;
if (t1 == Type.tUObject)
if (t1.equals(Type.tUObject))
return (t2.getTypeCode() == Type.TC_CLASS
|| t2.getTypeCode() == Type.TC_ARRAY
|| t2.getTypeCode() == -Type.TC_CLASS) ? t2 : Type.tError;
if (t2 == Type.tUObject)
if (t2.equals(Type.tUObject))
return (t1.getTypeCode() == Type.TC_CLASS
|| t1.getTypeCode() == Type.TC_ARRAY
|| t1.getTypeCode() == -Type.TC_CLASS) ? t1 : Type.tError;
@ -248,10 +251,10 @@ public class CodeVerifier implements Opcodes {
Type e2 = ((ArrayType)t2).getElementType();
if ((e1.getTypeCode() == Type.TC_CLASS
|| e1.getTypeCode() == Type.TC_ARRAY
|| e1 == Type.tUObject)
|| e1.equals(Type.tUObject))
&& (e2.getTypeCode() == Type.TC_CLASS
|| e2.getTypeCode() == Type.TC_ARRAY
|| e2 == Type.tUObject))
|| e2.equals(Type.tUObject)))
return Type.tArray(mergeType(e1, e2));
return Type.tObject;
} else {
@ -415,7 +418,7 @@ public class CodeVerifier implements Opcodes {
|| !isOfType(arrType, Type.tArray(Type.tBoolean))))
throw new VerifyException(instr.getDescription());
Type elemType = (arrType == Type.tUObject ? Type.tUObject
Type elemType = (arrType.equals(Type.tUObject) ? Type.tUObject
:((ArrayType)arrType).getElementType());
result.push(elemType);
if (((1 << instr.opcode - opc_iaload) & 0xa) != 0)
@ -985,14 +988,15 @@ public class CodeVerifier implements Opcodes {
}
}
if (false /* debugVerify */) {
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_VERIFIER) != 0) {
for (Instruction instr = bi.getFirstInstr(); instr != null;
instr = instr.nextByAddr) {
VerifyInfo info = (VerifyInfo) instr.tmpInfo;
if (info != null)
System.err.println(info.toString());
System.err.println(instr.getDescription());
GlobalOptions.err.println(info.toString());
GlobalOptions.err.println(instr.getDescription());
}
}
@ -1011,8 +1015,8 @@ public class CodeVerifier implements Opcodes {
VerifyInfo info = (VerifyInfo) instr.tmpInfo;
if (info != null)
System.err.println(info.toString());
System.err.println(instr.getDescription());
GlobalOptions.err.println(info.toString());
GlobalOptions.err.println(instr.getDescription());
instr.tmpInfo = null;
}

@ -18,7 +18,7 @@
*/
package jode.decompiler;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.flow.*;
import jode.expr.*;
import jode.type.Type;
@ -36,8 +36,8 @@ public class SyntheticAnalyzer {
public SyntheticAnalyzer(MethodAnalyzer method) {
this.method = method;
if (method.getName().equals("class$"))
if (!checkGetClass() && Decompiler.isVerbose)
Decompiler.err.println("class$ seems to be wrong");
if (!checkGetClass() && GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("class$ seems to be wrong");
}
boolean checkGetClass() {

@ -18,7 +18,7 @@
*/
package jode.obfuscator;
import jode.Obfuscator;
import jode.GlobalOptions;
import jode.bytecode.ClassInfo;
import jode.bytecode.Reference;
import java.io.*;
@ -130,8 +130,8 @@ public class ClassBundle {
prop.load(input);
input.close();
} catch (java.io.IOException ex) {
Obfuscator.err.println("Can't read rename table "+filename);
ex.printStackTrace(Obfuscator.err);
GlobalOptions.err.println("Can't read rename table "+filename);
ex.printStackTrace(GlobalOptions.err);
}
basePackage.readTable(prop);
}
@ -144,8 +144,8 @@ public class ClassBundle {
prop.save(out, "Reverse renaming table");
out.close();
} catch (java.io.IOException ex) {
Obfuscator.err.println("Can't write rename table "+filename);
ex.printStackTrace(Obfuscator.err);
GlobalOptions.err.println("Can't write rename table "+filename);
ex.printStackTrace(GlobalOptions.err);
}
}
@ -163,12 +163,12 @@ public class ClassBundle {
zip.close();
} catch (IOException ex) {
System.err.println("Can't write zip file: "+destination);
ex.printStackTrace(Obfuscator.err);
ex.printStackTrace(GlobalOptions.err);
}
} else {
File directory = new File(destination);
if (!directory.exists()) {
Obfuscator.err.println("Destination directory "
GlobalOptions.err.println("Destination directory "
+directory.getPath()
+" doesn't exists.");
return;

@ -18,6 +18,7 @@
*/
package jode.obfuscator;
import jode.GlobalOptions;
import jode.Obfuscator;
import jode.bytecode.*;
import java.lang.reflect.Modifier;
@ -190,8 +191,8 @@ public class ClassIdentifier extends Identifier {
}
public void analyze() {
if (Obfuscator.verboseLevel > 0)
Obfuscator.err.println("Reachable: "+this);
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("Reachable: "+this);
}
public void initClass() {
@ -323,8 +324,8 @@ public class ClassIdentifier extends Identifier {
}
public void doTransformations() {
if (Obfuscator.verboseLevel > 0)
Obfuscator.err.println("Transforming "+this);
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("Transforming "+this);
info.setName(getFullAlias());
transformSuperIfaces();
@ -359,8 +360,8 @@ public class ClassIdentifier extends Identifier {
}
public void storeClass(DataOutputStream out) throws IOException {
if (Obfuscator.verboseLevel > 0)
Obfuscator.err.println("Writing "+this);
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("Writing "+this);
info.write(out);
}

@ -19,6 +19,7 @@
package jode.obfuscator;
import jode.type.MethodType;
import jode.GlobalOptions;
import jode.Obfuscator;
import jode.type.Type;
import jode.bytecode.*;
@ -1013,20 +1014,18 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
Object methodResult = null;
if (constant) {
try {
if (jode.Obfuscator.isDebugging)
jode.Decompiler.isDebugging = true; /*XXX*/
methodResult = runtime.invokeMethod
(ref, opcode != opc_invokespecial, cls, args);
} catch (InterpreterException ex) {
constant = false;
if (jode.Obfuscator.verboseLevel > 3)
Obfuscator.err.println("Can't interpret "+ref+": "
if (jode.GlobalOptions.verboseLevel > 3)
GlobalOptions.err.println("Can't interpret "+ref+": "
+ ex.getMessage());
/* result is not constant */
} catch (InvocationTargetException ex) {
constant = false;
if (jode.Obfuscator.verboseLevel > 3)
Obfuscator.err.println("Method "+ref
if (jode.GlobalOptions.verboseLevel > 3)
GlobalOptions.err.println("Method "+ref
+" throwed exception: "
+ ex.getTargetException()
.getMessage());
@ -1232,7 +1231,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
public BytecodeInfo stripCode() {
if (constInfos == null)
analyzeCode();
// bytecode.dumpCode(Obfuscator.err);
// bytecode.dumpCode(GlobalOptions.err);
for (Instruction instr = bytecode.getFirstInstr();
instr != null; instr = instr.nextByAddr) {
ConstantInfo info = (ConstantInfo) constInfos.get(instr);
@ -1248,8 +1247,8 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
instr.localSlot = -1;
instr.length = 2;
instr.objData = info.constant;
if (Obfuscator.verboseLevel > 2)
Obfuscator.err.println
if (GlobalOptions.verboseLevel > 2)
GlobalOptions.err.println
(m + ": Replacing " + instr
+ " with constant " + info.constant);
}
@ -1261,8 +1260,8 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
instr.opcode = opc_pop2;
else
instr.opcode = opc_pop;
if (Obfuscator.verboseLevel > 2)
Obfuscator.err.println
if (GlobalOptions.verboseLevel > 2)
GlobalOptions.err.println
(m + ": Replacing " + instr + " with goto " + pc.addr);
instr.alwaysJumps = false;
instr.succs[0].removePredecessor(instr);
@ -1330,7 +1329,7 @@ public class ConstantAnalyzer implements Opcodes, CodeAnalyzer {
FieldIdentifier fi = (FieldIdentifier)
m.clazz.bundle.getIdentifier(ref);
if (fi != null
&& jode.Obfuscator.shouldStrip && !fi.isReachable()) {
&& Obfuscator.shouldStrip && !fi.isReachable()) {
insertPop(instr);
instr.removeInstruction();
}

@ -18,6 +18,7 @@
*/
package jode.obfuscator;
import jode.GlobalOptions;
import jode.Obfuscator;
import java.io.*;
import java.util.Hashtable;
@ -158,8 +159,8 @@ public abstract class Identifier {
static int serialnr = 0;
public void buildTable(int renameRule) {
if (isPreserved()) {
if (Obfuscator.isDebugging)
Obfuscator.err.println(toString() + " is preserved");
if (GlobalOptions.verboseLevel > 4)
GlobalOptions.err.println(toString() + " is preserved");
} else if (renameRule != Obfuscator.RENAME_NONE) {
Identifier rep = getRepresentative();
if (rep.wasAliased)

@ -19,6 +19,7 @@
package jode.obfuscator;
import java.lang.reflect.Modifier;
import jode.GlobalOptions;
import jode.Obfuscator;
import jode.bytecode.*;
import jode.type.Type;
@ -85,8 +86,8 @@ public class MethodIdentifier extends Identifier implements Opcodes {
}
public void analyze() {
if (Obfuscator.verboseLevel > 1)
Obfuscator.err.println("Analyze: "+this);
if (GlobalOptions.verboseLevel > 1)
GlobalOptions.err.println("Analyze: "+this);
String type = getType();
int index = type.indexOf('L');
@ -169,7 +170,7 @@ public class MethodIdentifier extends Identifier implements Opcodes {
info.setType(clazz.bundle.getTypeAlias(info.getType()));
if (getCodeAnalyzer() != null) {
BytecodeInfo strippedBytecode = getCodeAnalyzer().stripCode();
// strippedBytecode.dumpCode(Obfuscator.err);
// strippedBytecode.dumpCode(GlobalOptions.err);
/* XXX This should be in a if (Obfuscator.distributeLocals) */
LocalOptimizer localOpt = new LocalOptimizer(strippedBytecode,
@ -179,14 +180,14 @@ public class MethodIdentifier extends Identifier implements Opcodes {
localOpt.distributeLocals();
// if (Obfuscator.isDebugging)
// if (GlobalOptions.verboseLevel > 4)
// localOpt.dumpLocals();
// strippedBytecode.dumpCode(Obfuscator.err);
// strippedBytecode.dumpCode(GlobalOptions.err);
RemovePopAnalyzer remPop =
new RemovePopAnalyzer(strippedBytecode, this);
remPop.stripCode();
// strippedBytecode.dumpCode(Obfuscator.err);
// strippedBytecode.dumpCode(GlobalOptions.err);
for (Instruction instr = strippedBytecode.getFirstInstr();
instr != null; instr = instr.nextByAddr) {

@ -18,6 +18,7 @@
*/
package jode.obfuscator;
import jode.GlobalOptions;
import jode.Obfuscator;
import jode.bytecode.ClassInfo;
import jode.bytecode.FieldInfo;
@ -128,7 +129,7 @@ public class PackageIdentifier extends Identifier {
ident = new PackageIdentifier(bundle, this, name, true);
loadedClasses.put(name, ident);
} else if (!ClassInfo.exists(fullname)) {
Obfuscator.err.println("Warning: Can't find class "+fullname);
GlobalOptions.err.println("Warning: Can't find class "+fullname);
} else {
ident = new ClassIdentifier(bundle, this, name,
ClassInfo.forName(fullname));
@ -170,10 +171,10 @@ public class PackageIdentifier extends Identifier {
component, loadOnDemand);
loadedClasses.put(component, ident);
} else if (!ClassInfo.exists(fullname)) {
Obfuscator.err.println("Warning: Can't find class "+fullname);
GlobalOptions.err.println("Warning: Can't find class "+fullname);
} else if (wildcard.matches(fullname)) {
if (Obfuscator.verboseLevel > 1)
Obfuscator.err.println("loading Class " +fullname);
if (GlobalOptions.verboseLevel > 1)
GlobalOptions.err.println("loading Class " +fullname);
ident = new ClassIdentifier(bundle, this, name,
ClassInfo.forName(fullname));
loadedClasses.put(name, ident);
@ -184,8 +185,8 @@ public class PackageIdentifier extends Identifier {
}
if (ident instanceof PackageIdentifier) {
if (wildcard.matches(ident.getFullName())) {
if (Obfuscator.verboseLevel > 0)
Obfuscator.err.println("loading Package " +ident.getFullName());
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("loading Package " +ident.getFullName());
((PackageIdentifier) ident).setLoadOnDemand();
}
@ -207,14 +208,14 @@ public class PackageIdentifier extends Identifier {
if (wildcard.matches(subFull)) {
if (ClassInfo.isPackage(subFull)) {
if (Obfuscator.verboseLevel > 0)
Obfuscator.err.println("loading Package " +subFull);
if (GlobalOptions.verboseLevel > 0)
GlobalOptions.err.println("loading Package " +subFull);
Identifier ident = new PackageIdentifier
(bundle, this, subclazz, true);
loadedClasses.put(subclazz, ident);
} else {
if (Obfuscator.verboseLevel > 1)
Obfuscator.err.println("loading Class " +subFull);
if (GlobalOptions.verboseLevel > 1)
GlobalOptions.err.println("loading Class " +subFull);
ClassIdentifier ident = new ClassIdentifier
(bundle, this,
subclazz, ClassInfo.forName(subFull));
@ -293,7 +294,7 @@ public class PackageIdentifier extends Identifier {
component, loadOnDemand);
loadedClasses.put(component, ident);
} else if (!ClassInfo.exists(fullname)) {
Obfuscator.err.println("Warning: Can't find class "+fullname);
GlobalOptions.err.println("Warning: Can't find class "+fullname);
} else {
ident = new ClassIdentifier(bundle, this, name,
ClassInfo.forName(fullname));
@ -457,8 +458,8 @@ public class PackageIdentifier extends Identifier {
while (enum.hasMoreElements()) {
Identifier ident = (Identifier) enum.nextElement();
if (Obfuscator.shouldStrip && !ident.isReachable()) {
if (Obfuscator.isDebugging)
Obfuscator.err.println("Class/Package "
if (GlobalOptions.verboseLevel > 4)
GlobalOptions.err.println("Class/Package "
+ ident.getFullName()
+ " is not reachable");
continue;
@ -475,9 +476,9 @@ public class PackageIdentifier extends Identifier {
out.flush();
zip.closeEntry();
} catch (java.io.IOException ex) {
Obfuscator.err.println("Can't write Class "
GlobalOptions.err.println("Can't write Class "
+ ident.getName());
ex.printStackTrace(Obfuscator.err);
ex.printStackTrace(GlobalOptions.err);
}
}
}
@ -487,15 +488,15 @@ public class PackageIdentifier extends Identifier {
File newDest = (parent == null) ? destination
: new File(destination, getAlias());
if (!newDest.exists() && !newDest.mkdir()) {
Obfuscator.err.println("Could not create directory "
GlobalOptions.err.println("Could not create directory "
+newDest.getPath()+", check permissions.");
}
Enumeration enum = loadedClasses.elements();
while (enum.hasMoreElements()) {
Identifier ident = (Identifier) enum.nextElement();
if (Obfuscator.shouldStrip && !ident.isReachable()) {
if (Obfuscator.isDebugging)
Obfuscator.err.println("Class/Package "
if (GlobalOptions.verboseLevel > 4)
GlobalOptions.err.println("Class/Package "
+ ident.getFullName()
+ " is not reachable");
continue;
@ -507,7 +508,7 @@ public class PackageIdentifier extends Identifier {
try {
File file = new File(newDest, ident.getAlias()+".class");
// if (file.exists()) {
// Obfuscator.err.println
// GlobalOptions.err.println
// ("Refuse to overwrite existing class file "
// +file.getPath()+". Remove it first.");
// return;
@ -517,9 +518,9 @@ public class PackageIdentifier extends Identifier {
((ClassIdentifier) ident).storeClass(out);
out.close();
} catch (java.io.IOException ex) {
Obfuscator.err.println("Can't write Class "
GlobalOptions.err.println("Can't write Class "
+ ident.getName());
ex.printStackTrace(Obfuscator.err);
ex.printStackTrace(GlobalOptions.err);
}
}
}

@ -18,7 +18,7 @@
*/
package jode.swingui;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.decompiler.*;
import jode.bytecode.ClassInfo;
///#ifndef OLDSWING
@ -44,7 +44,7 @@ public class MainWindow
public MainWindow() {
setClasspath(System.getProperty("java.class.path"));
JFrame frame = new JFrame(Decompiler.copyright);
JFrame frame = new JFrame(GlobalOptions.copyright);
fillContentPane(frame.getContentPane());
addMenu(frame);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
@ -83,7 +83,7 @@ public class MainWindow
rightPane.setDividerSize(4);
allPane.setDividerLocation(200);
allPane.setDividerSize(4);
Decompiler.err = new PrintStream(new AreaOutputStream(errorArea));
GlobalOptions.err = new PrintStream(new AreaOutputStream(errorArea));
}
public synchronized void valueChanged(TreeSelectionEvent e) {
@ -127,9 +127,9 @@ public class MainWindow
// out.close();
// } catch (IOException ex) {
// errorArea.setText("");
// Decompiler.err.println("Couldn't write to file "
// GlobalOptions.err.println("Couldn't write to file "
// + fileName + ": ");
// ex.printStackTrace(Decompiler.err);
// ex.printStackTrace(GlobalOptions.err);
// }
}
}
@ -176,7 +176,7 @@ public class MainWindow
} catch (Throwable t) {
sourcecodeArea.setText("Didn't succeed.\n"
+"Check the below area for more info.");
t.printStackTrace(Decompiler.err);
t.printStackTrace(GlobalOptions.err);
} finally {
synchronized(this) {
decompileThread = null;

@ -18,7 +18,7 @@
*/
package jode.type;
import jode.Decompiler;
import jode.GlobalOptions;
/**
* This is a type class for 16 bit integral types. There are seven
@ -229,8 +229,8 @@ public class IntegerType extends Type {
return other;
}
Type result = mergeTypes == 0 ? tError : new IntegerType(mergeTypes);
if (Decompiler.isTypeDebugging) {
Decompiler.err.println("intersecting "+ this +" and "+ type +
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0) {
GlobalOptions.err.println("intersecting "+ this +" and "+ type +
" to " + result);
}
return result;

@ -19,7 +19,7 @@
package jode.type;
import jode.AssertError;
import jode.Decompiler;
import jode.GlobalOptions;
import java.util.Hashtable;
/**
@ -168,8 +168,8 @@ public class RangeType extends Type {
else
result = tError;
if (Decompiler.isTypeDebugging) {
Decompiler.err.println("intersecting "+ this +" and "+ type +
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0) {
GlobalOptions.err.println("intersecting "+ this +" and "+ type +
" to " + result);
}
return result;

@ -18,7 +18,7 @@
*/
package jode.type;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.bytecode.ClassInfo;
import java.util.Vector;
import java.util.Stack;
@ -112,8 +112,8 @@ public abstract class ReferenceType extends Type {
else
result = tError;
if (Decompiler.isTypeDebugging) {
Decompiler.err.println("intersecting "+ this +" and "+ type +
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0) {
GlobalOptions.err.println("intersecting "+ this +" and "+ type +
" to " + result);
}
return result;

@ -19,7 +19,7 @@
package jode.type;
import jode.AssertError;
import jode.Decompiler;
import jode.GlobalOptions;
import jode.bytecode.ClassInfo;
///#ifdef JDK12
///import java.lang.ref.WeakReference;
@ -372,8 +372,8 @@ public class Type {
return type;
if (type == tUnknown || this == type)
return this;
if (Decompiler.isTypeDebugging)
Decompiler.err.println("intersecting "+ this +" and "+ type
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
GlobalOptions.err.println("intersecting "+ this +" and "+ type
+ " to <error>");
return tError;
}

Loading…
Cancel
Save