diff --git a/jode/JodeAppletOneZero.java b/jode/JodeAppletOneZero.java index 0058322..2454182 100644 --- a/jode/JodeAppletOneZero.java +++ b/jode/JodeAppletOneZero.java @@ -2,6 +2,7 @@ package jode; import java.applet.*; import java.awt.*; import java.io.*; +import jode.decompiler.TabbedPrintWriter; public class JodeAppletOneZero extends Applet implements Runnable { diff --git a/jode/jode/Decompiler.java b/jode/jode/Decompiler.java index 9c9505a..6ed4a85 100644 --- a/jode/jode/Decompiler.java +++ b/jode/jode/Decompiler.java @@ -19,6 +19,7 @@ package jode; import java.io.*; +import jode.decompiler.TabbedPrintWriter; public class Decompiler { public final static String version = "0.99"; diff --git a/jode/jode/JodeWindow.java b/jode/jode/JodeWindow.java index 910efd7..f39932b 100644 --- a/jode/jode/JodeWindow.java +++ b/jode/jode/JodeWindow.java @@ -3,6 +3,7 @@ import java.applet.*; import java.awt.*; import java.awt.event.*; import java.io.*; +import jode.decompiler.TabbedPrintWriter; public class JodeWindow implements ActionListener, Runnable diff --git a/jode/jode/bytecode/AttributeInfo.java b/jode/jode/bytecode/AttributeInfo.java index f4b24f8..c323489 100644 --- a/jode/jode/bytecode/AttributeInfo.java +++ b/jode/jode/bytecode/AttributeInfo.java @@ -17,7 +17,7 @@ * $Id$ */ package jode.bytecode; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import java.io.*; import java.lang.reflect.Modifier; diff --git a/jode/jode/decompiler/Analyzer.java b/jode/jode/decompiler/Analyzer.java index 8e50187..53386bd 100644 --- a/jode/jode/decompiler/Analyzer.java +++ b/jode/jode/decompiler/Analyzer.java @@ -17,7 +17,7 @@ * $Id$ */ -package jode; +package jode.decompiler; public interface Analyzer { public void analyze(); diff --git a/jode/jode/decompiler/ClassAnalyzer.java b/jode/jode/decompiler/ClassAnalyzer.java index 0215d21..760a012 100644 --- a/jode/jode/decompiler/ClassAnalyzer.java +++ b/jode/jode/decompiler/ClassAnalyzer.java @@ -17,20 +17,22 @@ * $Id$ */ -package jode; +package jode.decompiler; +import jode.*; import jode.bytecode.ClassInfo; import jode.bytecode.FieldInfo; import jode.bytecode.MethodInfo; import jode.bytecode.ConstantPool; import jode.bytecode.ClassFormatException; -import jode.decompiler.Expression; +import jode.expr.Expression; import jode.flow.TransformConstructors; import java.lang.reflect.Modifier; public class ClassAnalyzer implements Analyzer { JodeEnvironment env; - Analyzer[] analyzers; + FieldAnalyzer[] fields; + MethodAnalyzer[] methods; MethodAnalyzer staticConstructor; MethodAnalyzer[] constructors; @@ -46,14 +48,14 @@ public class ClassAnalyzer implements Analyzer { this.env = env; } - public boolean setFieldInitializer(String fieldName, Expression expr) { - for (int i=0; i< analyzers.length; i++) { - if (analyzers[i] instanceof FieldAnalyzer) { - FieldAnalyzer field = (FieldAnalyzer) analyzers[i]; - if (field.getName().equals(fieldName)) - return field.setInitializer(expr); - } + public boolean setFieldInitializer(String fieldName, Type fieldType, + Expression expr) { + for (int i=0; i< fields.length; i++) { + if (fields[i].getName().equals(fieldName) + && fields[i].getType().isOfType(fieldType)) + return fields[i].setInitializer(expr); } + System.err.println("Can't find field "+fieldType+" "+fieldName+"."); return false; } @@ -65,37 +67,42 @@ public class ClassAnalyzer implements Analyzer { int numFields = 0; int i = 0; - FieldInfo[] fields = clazz.getFields(); - MethodInfo[] methods = clazz.getMethods(); - if (fields == null) { + FieldInfo[] finfos = clazz.getFields(); + MethodInfo[] minfos = clazz.getMethods(); + if (finfos == null) { /* This means that the class could not be loaded. * give up. */ return; } - analyzers = new Analyzer[fields.length + - methods.length]; - for (int j=0; j < fields.length; j++) { - analyzers[i] = new FieldAnalyzer(this, fields[j], env); - analyzers[i++].analyze(); + fields = new FieldAnalyzer[finfos.length]; + methods = new MethodAnalyzer[minfos.length]; + for (int j=0; j < finfos.length; j++) { + fields[j] = new FieldAnalyzer(this, finfos[j], env); + fields[j].analyze(); } staticConstructor = null; java.util.Vector constrVector = new java.util.Vector(); for (int j=0; j < methods.length; j++) { - MethodAnalyzer analyzer = - new MethodAnalyzer(this, methods[j], env); - analyzers[i++] = analyzer; + methods[j] = new MethodAnalyzer(this, minfos[j], env); - if (analyzer.isConstructor()) { - if (analyzer.isStatic()) - staticConstructor = analyzer; + if (methods[j].isConstructor()) { + if (methods[j].isStatic()) + staticConstructor = methods[j]; else - constrVector.addElement(analyzer); + constrVector.addElement(methods[j]); } - analyzer.analyze(); + // First analyze only synthetic methods. + if (methods[j].isSynthetic()) + methods[j].analyze(); } + for (int j=0; j < methods.length; j++) { + // Now analyze the remaining methods + if (!methods[j].isSynthetic()) + methods[j].analyze(); + } constructors = new MethodAnalyzer[constrVector.size()]; if (constructors.length > 0) { constrVector.copyInto(constructors); @@ -115,7 +122,7 @@ public class ClassAnalyzer implements Analyzer { public void dumpSource(TabbedPrintWriter writer) throws java.io.IOException { - if (analyzers == null) { + if (fields == null) { /* This means that the class could not be loaded. * give up. */ @@ -148,8 +155,10 @@ public class ClassAnalyzer implements Analyzer { writer.openBrace(); writer.tab(); - for (int i=0; i< analyzers.length; i++) - analyzers[i].dumpSource(writer); + for (int i=0; i< fields.length; i++) + fields[i].dumpSource(writer); + for (int i=0; i< methods.length; i++) + methods[i].dumpSource(writer); writer.untab(); writer.closeBrace(); } diff --git a/jode/jode/decompiler/CodeAnalyzer.java b/jode/jode/decompiler/CodeAnalyzer.java index e701b23..eb948e7 100644 --- a/jode/jode/decompiler/CodeAnalyzer.java +++ b/jode/jode/decompiler/CodeAnalyzer.java @@ -17,12 +17,12 @@ * $Id$ */ -package jode; +package jode.decompiler; +import jode.*; import jode.bytecode.ClassInfo; import jode.bytecode.ConstantPool; import jode.bytecode.AttributeInfo; import jode.bytecode.CodeInfo; -import jode.expr.Opcodes; import jode.flow.FlowBlock; import jode.flow.TransformExceptionHandlers; diff --git a/jode/jode/decompiler/FieldAnalyzer.java b/jode/jode/decompiler/FieldAnalyzer.java index b8dbfdb..7d0338c 100644 --- a/jode/jode/decompiler/FieldAnalyzer.java +++ b/jode/jode/decompiler/FieldAnalyzer.java @@ -17,8 +17,9 @@ * $Id$ */ -package jode; +package jode.decompiler; import java.lang.reflect.Modifier; +import jode.*; import jode.bytecode.FieldInfo; import jode.bytecode.AttributeInfo; import jode.bytecode.ClassFormatException; @@ -69,6 +70,10 @@ public class FieldAnalyzer implements Analyzer { return fieldName; } + public Type getType() { + return type; + } + public boolean setInitializer(Expression expr) { expr.makeInitializer(); if (constant != null) diff --git a/jode/jode/decompiler/ImportHandler.java b/jode/jode/decompiler/ImportHandler.java index 9aa0bdc..ddfb27c 100644 --- a/jode/jode/decompiler/ImportHandler.java +++ b/jode/jode/decompiler/ImportHandler.java @@ -19,6 +19,8 @@ package jode; import java.util.*; +import jode.decompiler.TabbedPrintWriter; +import jode.decompiler.ClassAnalyzer; import jode.bytecode.ClassInfo; import java.io.IOException; diff --git a/jode/jode/decompiler/LocalInfo.java b/jode/jode/decompiler/LocalInfo.java index 530a47e..b64814e 100644 --- a/jode/jode/decompiler/LocalInfo.java +++ b/jode/jode/decompiler/LocalInfo.java @@ -17,9 +17,11 @@ * $Id$ */ -package jode; +package jode.decompiler; import java.util.Enumeration; import java.util.Vector; +import jode.Decompiler; +import jode.Type; import jode.expr.LocalVarOperator; /** diff --git a/jode/jode/decompiler/LocalVariableRangeList.java b/jode/jode/decompiler/LocalVariableRangeList.java index 9205a8e..c692b31 100644 --- a/jode/jode/decompiler/LocalVariableRangeList.java +++ b/jode/jode/decompiler/LocalVariableRangeList.java @@ -17,7 +17,9 @@ * $Id$ */ -package jode; +package jode.decompiler; +import jode.Decompiler; +import jode.Type; public class LocalVariableRangeList { diff --git a/jode/jode/decompiler/LocalVariableTable.java b/jode/jode/decompiler/LocalVariableTable.java index 43d4872..831d3e9 100644 --- a/jode/jode/decompiler/LocalVariableTable.java +++ b/jode/jode/decompiler/LocalVariableTable.java @@ -17,10 +17,12 @@ * $Id$ */ -package jode; +package jode.decompiler; +import java.io.*; +import jode.Decompiler; +import jode.Type; import jode.bytecode.AttributeInfo; import jode.bytecode.ConstantPool; -import java.io.*; public class LocalVariableTable { LocalVariableRangeList[] locals; diff --git a/jode/jode/decompiler/MethodAnalyzer.java b/jode/jode/decompiler/MethodAnalyzer.java index 7fdb204..32150b5 100644 --- a/jode/jode/decompiler/MethodAnalyzer.java +++ b/jode/jode/decompiler/MethodAnalyzer.java @@ -17,10 +17,11 @@ * $Id$ */ -package jode; +package jode.decompiler; import jode.bytecode.MethodInfo; import jode.bytecode.AttributeInfo; import jode.bytecode.CodeInfo; +import jode.*; import java.lang.reflect.Modifier; import java.io.*; @@ -30,6 +31,7 @@ public class MethodAnalyzer implements Analyzer { CodeAnalyzer code = null; ClassAnalyzer classAnalyzer; boolean isConstructor; + boolean isSynthetic; int modifiers; String methodName; MethodType methodType; @@ -44,6 +46,7 @@ public class MethodAnalyzer implements Analyzer { this.methodName = minfo.getName(); this.isConstructor = methodName.equals("") || methodName.equals(""); + this.isSynthetic = (minfo.findAttribute("Synthetic") != null); AttributeInfo codeattr = minfo.findAttribute("Code"); if (codeattr != null) { @@ -91,6 +94,10 @@ public class MethodAnalyzer implements Analyzer { return methodType.isStatic(); } + public boolean isSynthetic() { + return isSynthetic; + } + public int getParamCount() { int count = isStatic() ? 0 : 1; Type[] paramTypes = methodType.getParameterTypes(); @@ -130,7 +137,7 @@ public class MethodAnalyzer implements Analyzer { if (!isConstructor) methodType.getReturnType().useType(); - if (!Decompiler.immediateOutput) { + if (!Decompiler.immediateOutput || isSynthetic) { if (Decompiler.isVerbose) Decompiler.err.print(methodName+": "); code.analyze(); diff --git a/jode/jode/decompiler/Opcodes.java b/jode/jode/decompiler/Opcodes.java index a0cd057..d183f13 100644 --- a/jode/jode/decompiler/Opcodes.java +++ b/jode/jode/decompiler/Opcodes.java @@ -17,11 +17,10 @@ * $Id$ */ -package jode.expr; -import jode.CodeAnalyzer; -import jode.LocalInfo; +package jode.decompiler; import jode.Type; import jode.MethodType; +import jode.expr.*; import jode.flow.*; import jode.bytecode.*; import java.io.*; @@ -56,8 +55,8 @@ public abstract class Opcodes implements jode.bytecode.Opcodes { }; private static StructuredBlock createNormal(CodeAnalyzer ca, - int addr, int length, - Expression instr) + int addr, int length, + Expression instr) { return new InstructionBlock(instr, new Jump(addr+length)); } diff --git a/jode/jode/decompiler/TabbedPrintWriter.java b/jode/jode/decompiler/TabbedPrintWriter.java index 67181da..d71266a 100644 --- a/jode/jode/decompiler/TabbedPrintWriter.java +++ b/jode/jode/decompiler/TabbedPrintWriter.java @@ -17,8 +17,9 @@ * $Id$ */ -package jode; +package jode.decompiler; import java.io.*; +import jode.Decompiler; public class TabbedPrintWriter { boolean atbol; diff --git a/jode/jode/expr/CheckNullOperator.java b/jode/jode/expr/CheckNullOperator.java index 6ec5e6a..5147ab1 100644 --- a/jode/jode/expr/CheckNullOperator.java +++ b/jode/jode/expr/CheckNullOperator.java @@ -19,7 +19,7 @@ package jode.expr; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; /** * This is a pseudo operator, which represents the check against null diff --git a/jode/jode/expr/ClassFieldOperator.java b/jode/jode/expr/ClassFieldOperator.java index 2bf391d..dd7325f 100644 --- a/jode/jode/expr/ClassFieldOperator.java +++ b/jode/jode/expr/ClassFieldOperator.java @@ -19,7 +19,7 @@ package jode.expr; import jode.Type; -import jode.CodeAnalyzer; +import jode.decompiler.CodeAnalyzer; public class ClassFieldOperator extends NoArgOperator { Type classType; diff --git a/jode/jode/expr/ConstantArrayOperator.java b/jode/jode/expr/ConstantArrayOperator.java index b8b7c4b..b0a8f94 100644 --- a/jode/jode/expr/ConstantArrayOperator.java +++ b/jode/jode/expr/ConstantArrayOperator.java @@ -17,7 +17,7 @@ * $Id$ */ -package jode.decompiler; +package jode.expr; import jode.Type; import jode.ArrayType; diff --git a/jode/jode/expr/GetFieldOperator.java b/jode/jode/expr/GetFieldOperator.java index 3869103..4deee95 100644 --- a/jode/jode/expr/GetFieldOperator.java +++ b/jode/jode/expr/GetFieldOperator.java @@ -19,7 +19,7 @@ package jode.expr; import jode.Type; -import jode.CodeAnalyzer; +import jode.decompiler.CodeAnalyzer; public class GetFieldOperator extends Operator { boolean staticFlag; diff --git a/jode/jode/expr/IIncOperator.java b/jode/jode/expr/IIncOperator.java index 018a922..c1dbef9 100644 --- a/jode/jode/expr/IIncOperator.java +++ b/jode/jode/expr/IIncOperator.java @@ -19,7 +19,7 @@ package jode.expr; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; public class IIncOperator extends NoArgOperator implements LocalVarOperator, CombineableOperator { diff --git a/jode/jode/expr/InvokeOperator.java b/jode/jode/expr/InvokeOperator.java index b25687c..53ec70c 100644 --- a/jode/jode/expr/InvokeOperator.java +++ b/jode/jode/expr/InvokeOperator.java @@ -18,7 +18,7 @@ */ package jode.expr; -import jode.CodeAnalyzer; +import jode.decompiler.CodeAnalyzer; import jode.MethodType; import jode.Type; import jode.bytecode.ClassInfo; diff --git a/jode/jode/expr/LocalLoadOperator.java b/jode/jode/expr/LocalLoadOperator.java index c71cb8e..799ef2d 100644 --- a/jode/jode/expr/LocalLoadOperator.java +++ b/jode/jode/expr/LocalLoadOperator.java @@ -20,7 +20,7 @@ package jode.expr; import jode.Decompiler; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; public class LocalLoadOperator extends ConstOperator implements LocalVarOperator { diff --git a/jode/jode/expr/LocalStoreOperator.java b/jode/jode/expr/LocalStoreOperator.java index 2e8a5ba..bfb4221 100644 --- a/jode/jode/expr/LocalStoreOperator.java +++ b/jode/jode/expr/LocalStoreOperator.java @@ -19,7 +19,7 @@ package jode.expr; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; public class LocalStoreOperator extends StoreInstruction implements LocalVarOperator { diff --git a/jode/jode/expr/LocalVarOperator.java b/jode/jode/expr/LocalVarOperator.java index db9d7bd..6fd9e6d 100644 --- a/jode/jode/expr/LocalVarOperator.java +++ b/jode/jode/expr/LocalVarOperator.java @@ -19,7 +19,7 @@ package jode.expr; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; public interface LocalVarOperator { public boolean isRead(); diff --git a/jode/jode/expr/PutFieldOperator.java b/jode/jode/expr/PutFieldOperator.java index fa4870f..a1709c8 100644 --- a/jode/jode/expr/PutFieldOperator.java +++ b/jode/jode/expr/PutFieldOperator.java @@ -19,12 +19,13 @@ package jode.expr; import jode.Type; -import jode.CodeAnalyzer; +import jode.decompiler.CodeAnalyzer; public class PutFieldOperator extends StoreInstruction { CodeAnalyzer codeAnalyzer; boolean staticFlag; String fieldName; + Type fieldType; Type classType; public PutFieldOperator(CodeAnalyzer codeAnalyzer, boolean staticFlag, @@ -33,6 +34,7 @@ public class PutFieldOperator extends StoreInstruction { this.codeAnalyzer = codeAnalyzer; this.staticFlag = staticFlag; this.fieldName = fieldName; + this.fieldType = type; this.classType = classType; if (staticFlag) classType.useType(); @@ -46,6 +48,10 @@ public class PutFieldOperator extends StoreInstruction { return fieldName; } + public Type getFieldType() { + return fieldType; + } + public boolean matches(Operator loadop) { return loadop instanceof GetFieldOperator && ((GetFieldOperator)loadop).classType.equals(classType) diff --git a/jode/jode/flow/BreakBlock.java b/jode/jode/flow/BreakBlock.java index 5123562..f1ee38c 100644 --- a/jode/jode/flow/BreakBlock.java +++ b/jode/jode/flow/BreakBlock.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; /** * diff --git a/jode/jode/flow/BreakableBlock.java b/jode/jode/flow/BreakableBlock.java index 03d3602..4f88130 100644 --- a/jode/jode/flow/BreakableBlock.java +++ b/jode/jode/flow/BreakableBlock.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; /** * This is a structured block, that supports break. diff --git a/jode/jode/flow/CaseBlock.java b/jode/jode/flow/CaseBlock.java index 4713a6d..e4b62ec 100644 --- a/jode/jode/flow/CaseBlock.java +++ b/jode/jode/flow/CaseBlock.java @@ -105,7 +105,7 @@ public class CaseBlock extends StructuredBlock { public void makeDeclaration(VariableSet done) { java.util.Enumeration enum = allUsed.elements(); while (enum.hasMoreElements()) { - jode.LocalInfo li = (jode.LocalInfo) enum.nextElement(); + jode.decompiler.LocalInfo li = (jode.decompiler.LocalInfo) enum.nextElement(); if (!done.contains(li)) { wantBraces = true; break; @@ -123,7 +123,7 @@ public class CaseBlock extends StructuredBlock { : new StructuredBlock[0]; } - public void dumpInstruction(jode.TabbedPrintWriter writer) + public void dumpInstruction(jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { if (isDefault) { diff --git a/jode/jode/flow/CatchBlock.java b/jode/jode/flow/CatchBlock.java index f64b83f..7697953 100644 --- a/jode/jode/flow/CatchBlock.java +++ b/jode/jode/flow/CatchBlock.java @@ -18,7 +18,7 @@ */ package jode.flow; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; /** * @@ -91,7 +91,7 @@ public class CatchBlock extends StructuredBlock { * @param writer The tabbed print writer, where we print to. * @param local The local that should be declared. */ - public void dumpDeclaration(jode.TabbedPrintWriter writer, LocalInfo local) + public void dumpDeclaration(jode.decompiler.TabbedPrintWriter writer, LocalInfo local) throws java.io.IOException { if (local != exceptionLocal) { @@ -102,7 +102,7 @@ public class CatchBlock extends StructuredBlock { } } - public void dumpInstruction(jode.TabbedPrintWriter writer) + public void dumpInstruction(jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { writer.closeBraceContinue(); writer.print("catch ("+exceptionType.toString() + " " diff --git a/jode/jode/flow/ConditionalBlock.java b/jode/jode/flow/ConditionalBlock.java index efdae25..28da488 100644 --- a/jode/jode/flow/ConditionalBlock.java +++ b/jode/jode/flow/ConditionalBlock.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import jode.expr.Expression; import jode.expr.LocalVarOperator; diff --git a/jode/jode/flow/ContinueBlock.java b/jode/jode/flow/ContinueBlock.java index 035fd34..051e524 100644 --- a/jode/jode/flow/ContinueBlock.java +++ b/jode/jode/flow/ContinueBlock.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; /** * diff --git a/jode/jode/flow/CreateCheckNull.java b/jode/jode/flow/CreateCheckNull.java index a6c08e7..da1c2bf 100644 --- a/jode/jode/flow/CreateCheckNull.java +++ b/jode/jode/flow/CreateCheckNull.java @@ -20,7 +20,7 @@ package jode.flow; import jode.expr.*; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; public class CreateCheckNull { diff --git a/jode/jode/flow/DescriptionBlock.java b/jode/jode/flow/DescriptionBlock.java index ed8d293..4e0f6f8 100644 --- a/jode/jode/flow/DescriptionBlock.java +++ b/jode/jode/flow/DescriptionBlock.java @@ -18,7 +18,7 @@ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; /** * This is a block which contains a comment/description of what went diff --git a/jode/jode/flow/EmptyBlock.java b/jode/jode/flow/EmptyBlock.java index 841b66f..879d82b 100644 --- a/jode/jode/flow/EmptyBlock.java +++ b/jode/jode/flow/EmptyBlock.java @@ -18,7 +18,7 @@ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; /** * This is the structured block for an empty block. diff --git a/jode/jode/flow/FinallyBlock.java b/jode/jode/flow/FinallyBlock.java index 709ad4e..944be61 100644 --- a/jode/jode/flow/FinallyBlock.java +++ b/jode/jode/flow/FinallyBlock.java @@ -44,7 +44,7 @@ public class FinallyBlock extends CatchBlock { return null; } - public void dumpInstruction(jode.TabbedPrintWriter writer) + public void dumpInstruction(jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { writer.closeBraceContinue(); writer.print("finally"); diff --git a/jode/jode/flow/FlowBlock.java b/jode/jode/flow/FlowBlock.java index 89ddab5..bba6c63 100644 --- a/jode/jode/flow/FlowBlock.java +++ b/jode/jode/flow/FlowBlock.java @@ -19,7 +19,10 @@ package jode.flow; import java.util.*; -import jode.*; +import jode.Decompiler; +import jode.AssertError; +import jode.decompiler.TabbedPrintWriter; +import jode.decompiler.CodeAnalyzer; import jode.expr.Expression; import jode.expr.CombineableOperator; diff --git a/jode/jode/flow/IfThenElseBlock.java b/jode/jode/flow/IfThenElseBlock.java index 5074923..8f8d7a7 100644 --- a/jode/jode/flow/IfThenElseBlock.java +++ b/jode/jode/flow/IfThenElseBlock.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import jode.expr.Expression; /** diff --git a/jode/jode/flow/InstructionBlock.java b/jode/jode/flow/InstructionBlock.java index 41efca5..eb2ba02 100644 --- a/jode/jode/flow/InstructionBlock.java +++ b/jode/jode/flow/InstructionBlock.java @@ -16,8 +16,8 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; -import jode.LocalInfo; +import jode.decompiler.TabbedPrintWriter; +import jode.decompiler.LocalInfo; import jode.expr.ComplexExpression; import jode.expr.Expression; import jode.expr.LocalStoreOperator; diff --git a/jode/jode/flow/JsrBlock.java b/jode/jode/flow/JsrBlock.java index 3efc2ab..6bd53fe 100644 --- a/jode/jode/flow/JsrBlock.java +++ b/jode/jode/flow/JsrBlock.java @@ -63,7 +63,7 @@ public class JsrBlock extends StructuredBlock { return new StructuredBlock[] { innerBlock }; } - public void dumpInstruction(jode.TabbedPrintWriter writer) + public void dumpInstruction(jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { writer.println("JSR"); diff --git a/jode/jode/flow/Jump.java b/jode/jode/flow/Jump.java index 7dcf8a6..f9cf98d 100644 --- a/jode/jode/flow/Jump.java +++ b/jode/jode/flow/Jump.java @@ -85,7 +85,7 @@ public class Jump { * dumpInstruction afterwards. * @param writer The tabbed print writer, where we print to. */ - public void dumpSource(jode.TabbedPrintWriter writer) + public void dumpSource(jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { if (jode.Decompiler.debugInOut) { diff --git a/jode/jode/flow/LoopBlock.java b/jode/jode/flow/LoopBlock.java index 760a067..7e3e666 100644 --- a/jode/jode/flow/LoopBlock.java +++ b/jode/jode/flow/LoopBlock.java @@ -18,9 +18,9 @@ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; import jode.expr.Expression; import jode.expr.ConstOperator; import jode.expr.LocalStoreOperator; diff --git a/jode/jode/flow/RetBlock.java b/jode/jode/flow/RetBlock.java index 01184a2..451a494 100644 --- a/jode/jode/flow/RetBlock.java +++ b/jode/jode/flow/RetBlock.java @@ -17,7 +17,7 @@ * $Id$ */ package jode.flow; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; /** * This block represents a ret instruction. A ret instruction is @@ -46,7 +46,7 @@ public class RetBlock extends StructuredBlock { gen.addElement(local); } - public void dumpInstruction(jode.TabbedPrintWriter writer) + public void dumpInstruction(jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { writer.println("RET "+local); diff --git a/jode/jode/flow/ReturnBlock.java b/jode/jode/flow/ReturnBlock.java index 4aafb98..412ad8a 100644 --- a/jode/jode/flow/ReturnBlock.java +++ b/jode/jode/flow/ReturnBlock.java @@ -18,7 +18,7 @@ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import jode.expr.Expression; /** diff --git a/jode/jode/flow/SequentialBlock.java b/jode/jode/flow/SequentialBlock.java index 43907e0..7f86a36 100644 --- a/jode/jode/flow/SequentialBlock.java +++ b/jode/jode/flow/SequentialBlock.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; /** * A sequential block combines exactly two structured blocks to a new diff --git a/jode/jode/flow/SpecialBlock.java b/jode/jode/flow/SpecialBlock.java index ebe9f95..5353078 100644 --- a/jode/jode/flow/SpecialBlock.java +++ b/jode/jode/flow/SpecialBlock.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import jode.Decompiler; import jode.expr.*; diff --git a/jode/jode/flow/StructuredBlock.java b/jode/jode/flow/StructuredBlock.java index a90d32a..19b6dbc 100644 --- a/jode/jode/flow/StructuredBlock.java +++ b/jode/jode/flow/StructuredBlock.java @@ -18,9 +18,9 @@ */ package jode.flow; -import jode.TabbedPrintWriter; import jode.AssertError; -import jode.LocalInfo; +import jode.decompiler.TabbedPrintWriter; +import jode.decompiler.LocalInfo; /** * A structured block is the building block of the source programm. @@ -473,7 +473,7 @@ public abstract class StructuredBlock { * dumpInstruction afterwards. * @param writer The tabbed print writer, where we print to. */ - public void dumpSource(jode.TabbedPrintWriter writer) + public void dumpSource(jode.decompiler.TabbedPrintWriter writer) throws java.io.IOException { if (declare != null) { @@ -499,7 +499,7 @@ public abstract class StructuredBlock { * @param writer The tabbed print writer, where we print to. * @param local The local that should be declared. */ - public void dumpDeclaration(jode.TabbedPrintWriter writer, LocalInfo local) + public void dumpDeclaration(jode.decompiler.TabbedPrintWriter writer, LocalInfo local) throws java.io.IOException { writer.println(local.getType().toString() + " " @@ -516,8 +516,8 @@ public abstract class StructuredBlock { public String toString() { try { java.io.StringWriter strw = new java.io.StringWriter(); - jode.TabbedPrintWriter writer = - new jode.TabbedPrintWriter(strw); + jode.decompiler.TabbedPrintWriter writer = + new jode.decompiler.TabbedPrintWriter(strw); writer.println(super.toString()); writer.tab(); dumpSource(writer); diff --git a/jode/jode/flow/SwitchBlock.java b/jode/jode/flow/SwitchBlock.java index a5bea8a..439b2d7 100644 --- a/jode/jode/flow/SwitchBlock.java +++ b/jode/jode/flow/SwitchBlock.java @@ -18,7 +18,7 @@ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import jode.expr.Expression; /** diff --git a/jode/jode/flow/SynchronizedBlock.java b/jode/jode/flow/SynchronizedBlock.java index a1ef57c..db0671c 100644 --- a/jode/jode/flow/SynchronizedBlock.java +++ b/jode/jode/flow/SynchronizedBlock.java @@ -17,8 +17,8 @@ * $Id$ */ package jode.flow; -import jode.LocalInfo; -import jode.TabbedPrintWriter; +import jode.decompiler.LocalInfo; +import jode.decompiler.TabbedPrintWriter; import jode.expr.Expression; /** diff --git a/jode/jode/flow/ThrowBlock.java b/jode/jode/flow/ThrowBlock.java index 0844c1e..ea72069 100644 --- a/jode/jode/flow/ThrowBlock.java +++ b/jode/jode/flow/ThrowBlock.java @@ -18,7 +18,7 @@ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; import jode.expr.Expression; /** diff --git a/jode/jode/flow/TransformConstructors.java b/jode/jode/flow/TransformConstructors.java index b237110..8144265 100644 --- a/jode/jode/flow/TransformConstructors.java +++ b/jode/jode/flow/TransformConstructors.java @@ -17,7 +17,8 @@ * $Id$ */ package jode.flow; -import jode.ClassAnalyzer; +import jode.decompiler.ClassAnalyzer; +import jode.decompiler.MethodAnalyzer; import jode.expr.*; /** @@ -28,7 +29,7 @@ public class TransformConstructors { public static void transform(ClassAnalyzer clazzAnalyzer, boolean isStatic, - jode.MethodAnalyzer[] cons) { + MethodAnalyzer[] cons) { if (cons.length == 0) return; @@ -132,7 +133,8 @@ public class TransformConstructors { } - if (!clazzAnalyzer.setFieldInitializer(pfo.getFieldName(), expr)) { + if (!clazzAnalyzer.setFieldInitializer(pfo.getFieldName(), + pfo.getFieldType(), expr)) { // Decompiler.err.println("setField failed"); break big_loop; } diff --git a/jode/jode/flow/TransformExceptionHandlers.java b/jode/jode/flow/TransformExceptionHandlers.java index 526b84d..3ea15ce 100644 --- a/jode/jode/flow/TransformExceptionHandlers.java +++ b/jode/jode/flow/TransformExceptionHandlers.java @@ -20,7 +20,7 @@ package jode.flow; import jode.AssertError; import jode.Decompiler; import jode.Type; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; import jode.expr.*; import java.util.Enumeration; diff --git a/jode/jode/flow/TryBlock.java b/jode/jode/flow/TryBlock.java index 565ffd6..780a0e7 100644 --- a/jode/jode/flow/TryBlock.java +++ b/jode/jode/flow/TryBlock.java @@ -17,7 +17,7 @@ */ package jode.flow; -import jode.TabbedPrintWriter; +import jode.decompiler.TabbedPrintWriter; /** * A TryBlock is created for each exception in the diff --git a/jode/jode/flow/VariableSet.java b/jode/jode/flow/VariableSet.java index f27155e..f7f1b64 100644 --- a/jode/jode/flow/VariableSet.java +++ b/jode/jode/flow/VariableSet.java @@ -16,7 +16,7 @@ * $Id$ */ package jode.flow; -import jode.LocalInfo; +import jode.decompiler.LocalInfo; /** * This class represents a set of Variables, which are mainly used in diff --git a/jode/jode/obfuscator/ClassBundle.java b/jode/jode/obfuscator/ClassBundle.java index 5311dae..e2a2116 100644 --- a/jode/jode/obfuscator/ClassBundle.java +++ b/jode/jode/obfuscator/ClassBundle.java @@ -67,10 +67,6 @@ public class ClassBundle { } } - public void strip() { - basePackage.strip(); - } - public void buildTable(int renameRule) { basePackage.buildTable(renameRule); } diff --git a/jode/jode/obfuscator/ClassIdentifier.java b/jode/jode/obfuscator/ClassIdentifier.java index a44f850..2e45de2 100644 --- a/jode/jode/obfuscator/ClassIdentifier.java +++ b/jode/jode/obfuscator/ClassIdentifier.java @@ -216,21 +216,10 @@ public class ClassIdentifier extends Identifier { preserveIdentifier("", null); } - public void strip() { - willStrip = true; - if (Obfuscator.isDebugging) { - for (int i=0; i < identifiers.length; i++) { - if (!identifiers[i].isReachable()) - Obfuscator.err.println(identifiers[i].toString() - + " is stripped"); - } - } - } - public void buildTable(int renameRule) { super.buildTable(renameRule); for (int i=0; i < identifiers.length; i++) - if (!willStrip || identifiers[i].isReachable()) + if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) identifiers[i].buildTable(renameRule); } @@ -238,7 +227,7 @@ public class ClassIdentifier extends Identifier { if (getName() != getAlias()) out.println("" + getFullAlias() + " = " + getName()); for (int i=0; i < identifiers.length; i++) - if (!willStrip || identifiers[i].isReachable()) + if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) identifiers[i].writeTable(out); } @@ -295,7 +284,7 @@ public class ClassIdentifier extends Identifier { GrowableConstantPool gcp = new GrowableConstantPool(); for (int i=fieldCount; i < identifiers.length; i++) - if (!willStrip || identifiers[i].isReachable()) + if (!Obfuscator.shouldStrip || identifiers[i].isReachable()) ((MethodIdentifier)identifiers[i]).reserveSmallConstants(gcp); int[] hierarchyInts; @@ -316,13 +305,13 @@ public class ClassIdentifier extends Identifier { int methods = 0; for (int i=0; i