diff --git a/jode/jode/flow/CreateAssignExpression.java b/jode/jode/flow/CreateAssignExpression.java index fa95f63..15bf379 100644 --- a/jode/jode/flow/CreateAssignExpression.java +++ b/jode/jode/flow/CreateAssignExpression.java @@ -81,6 +81,7 @@ public class CreateAssignExpression { Operator expr = (Operator) ib.getInstruction(); if (expr.getFreeOperandCount() != lvalueCount) return false; + Type rvalueType = expr.getType(); SpecialBlock dup = null; @@ -176,6 +177,7 @@ public class CreateAssignExpression { dup.removeBlock(); ib.setInstruction(rightHandSide); + store.getLValue().setType(rvalueType); store.makeOpAssign(store.OPASSIGN_OP + opIndex); if (isAssignOp) diff --git a/jode/jode/flow/TransformConstructors.java b/jode/jode/flow/TransformConstructors.java index d183af6..5ce594b 100644 --- a/jode/jode/flow/TransformConstructors.java +++ b/jode/jode/flow/TransformConstructors.java @@ -75,6 +75,9 @@ public class TransformConstructors implements OuterValueListener { boolean isStatic; MethodAnalyzer[] cons; + /** + * @see jode.decompiler.ClassAnalyzer#outerValues + */ Expression[] outerValues; /** * The minimal first slot number after the outerValues. This is because @@ -159,7 +162,7 @@ public class TransformConstructors implements OuterValueListener { */ public int getOuterValueIndex(int slot) { int ovSlot = 1; // slot of first outerValue - for (int i=0; i< outerValues.length; i++) { + for (int i=0; i < outerValues.length; i++) { if (ovSlot == slot) return i; ovSlot += outerValues[i].getType().stackSize(); @@ -167,7 +170,10 @@ public class TransformConstructors implements OuterValueListener { return -1; } - public boolean checkAnonymousConstructor(MethodAnalyzer constr, + /** + * This will be + */ + private boolean checkAnonymousConstructor(MethodAnalyzer constr, InstructionBlock superBlock) { if (clazzAnalyzer.getName() != null) @@ -288,7 +294,7 @@ public class TransformConstructors implements OuterValueListener { * The outerValues[0] parameter is the normal this of the * surrounding method (but what is the surrounding method? * That can't be determined in some cases). If the - * surrounding method is static, the outerValues[0] parameter +s * surrounding method is static, the outerValues[0] parameter * disappears! * * Move optional super to method constructor$? @@ -531,6 +537,8 @@ public class TransformConstructors implements OuterValueListener { } public void initSyntheticFields() { + if ((Decompiler.options & Decompiler.OPTION_CONTRAFO) == 0) + return; if (isStatic) return; @@ -831,8 +839,16 @@ public class TransformConstructors implements OuterValueListener { } /** - * This does the transformations. It will set the field initializers - * and removing the initializers from all constructors. + * This does the normal constructor transformations. + * + * javac copies the field initializers to each constructor. This + * will undo the transformation: it will tell the fields about the + * initial value and removes the initialization from all constructors. + * + * There are of course many checks necessary: All field + * initializers must be equal in all constructors, and there + * mustn't be locals that used in field initialization (except + * outerValue - locals). */ public void transform() { if (cons.length == 0)