diff --git a/jode/jode/flow/CreateAssignExpression.java b/jode/jode/flow/CreateAssignExpression.java index 15bf379..a38975f 100644 --- a/jode/jode/flow/CreateAssignExpression.java +++ b/jode/jode/flow/CreateAssignExpression.java @@ -58,14 +58,15 @@ public class CreateAssignExpression { StoreInstruction store = (StoreInstruction) ic.getInstruction(); if (!store.isFreeOperator()) return false; - int lvalueCount = store.getLValue().getFreeOperandCount(); + Expression lvalue = store.getSubExpressions()[0]; + int lvalueCount = lvalue.getFreeOperandCount(); boolean isAssignOp = false; if (opBlock.subBlocks[0] instanceof SpecialBlock) { SpecialBlock dup = (SpecialBlock) opBlock.subBlocks[0]; if (dup.type != SpecialBlock.DUP || dup.depth != lvalueCount - || dup.count != store.getLValue().getType().stackSize() + || dup.count != lvalue.getType().stackSize() || !(opBlock.outer instanceof SequentialBlock)) return false; opBlock = (SequentialBlock) opBlock.outer; @@ -102,7 +103,7 @@ public class CreateAssignExpression { if (expr instanceof ConvertOperator && expr.getSubExpressions()[0] instanceof Operator - && expr.getType().isOfType(store.getLValue().getType())) { + && expr.getType().isOfType(lvalue.getType())) { /* This gets tricky. We need to allow something like * s = (short) (int) ((double) s / 0.1); @@ -129,9 +130,9 @@ public class CreateAssignExpression { || !(loadExpr.isFreeOperator(lvalueCount))) return false; - if (store.getLValue() instanceof LocalStoreOperator) + if (lvalue instanceof LocalStoreOperator) ((LocalLoadOperator)loadExpr).getLocalInfo().combineWith - (((LocalStoreOperator)store.getLValue()).getLocalInfo()); + (((LocalStoreOperator)lvalue).getLocalInfo()); rightHandSide = expr.getSubExpressions()[1]; } else { @@ -159,9 +160,9 @@ public class CreateAssignExpression { || !(((Operator) simple).isFreeOperator(lvalueCount))) return false; - if (store.getLValue() instanceof LocalStoreOperator) + if (lvalue instanceof LocalStoreOperator) ((LocalLoadOperator)simple).getLocalInfo().combineWith - (((LocalStoreOperator)store.getLValue()).getLocalInfo()); + (((LocalStoreOperator)lvalue).getLocalInfo()); /* ... and remove it. */ if (parent != null) { @@ -177,7 +178,7 @@ public class CreateAssignExpression { dup.removeBlock(); ib.setInstruction(rightHandSide); - store.getLValue().setType(rvalueType); + lvalue.setType(rvalueType); store.makeOpAssign(store.OPASSIGN_OP + opIndex); if (isAssignOp) @@ -199,10 +200,11 @@ public class CreateAssignExpression { if (sequBlock.subBlocks[0] instanceof SpecialBlock && store.isFreeOperator()) { + Expression lvalue = store.getSubExpressions()[0]; SpecialBlock dup = (SpecialBlock) sequBlock.subBlocks[0]; if (dup.type != SpecialBlock.DUP - || dup.depth != store.getLValue().getFreeOperandCount() - || dup.count != store.getLValue().getType().stackSize()) + || dup.depth != lvalue.getFreeOperandCount() + || dup.count != lvalue.getType().stackSize()) return false; dup.removeBlock(); diff --git a/jode/jode/flow/CreatePrePostIncExpression.java b/jode/jode/flow/CreatePrePostIncExpression.java index 7faf8b6..c42d029 100644 --- a/jode/jode/flow/CreatePrePostIncExpression.java +++ b/jode/jode/flow/CreatePrePostIncExpression.java @@ -113,8 +113,9 @@ public class CreatePrePostIncExpression { * not yet resolved (and note that the rvalue part * should also have 1 remaining operand) */ - int lvalueCount = store.getLValue().getFreeOperandCount(); - if (!store.getLValue().isFreeOperator() + Expression lvalue = store.getSubExpressions()[0]; + int lvalueCount = lvalue.getFreeOperandCount(); + if (!((Operator)lvalue).isFreeOperator() || !store.isVoid() || !(store.getSubExpressions()[1] instanceof BinaryOperator)) return false; @@ -148,7 +149,7 @@ public class CreatePrePostIncExpression { SpecialBlock dup = (SpecialBlock) sb.subBlocks[0]; if (dup.type != SpecialBlock.DUP - || dup.count != store.getLValue().getType().stackSize() + || dup.count != lvalue.getType().stackSize() || dup.depth != lvalueCount) return false; @@ -176,7 +177,7 @@ public class CreatePrePostIncExpression { return false; } ic.setInstruction - (new PrePostFixOperator(store.getLValue().getType(), op, + (new PrePostFixOperator(lvalue.getType(), op, store.getLValue(), true)); ic.moveDefinitions(sb, last); last.replace(sb); diff --git a/jode/jode/flow/FlowBlock.java.in b/jode/jode/flow/FlowBlock.java.in index e473163..b60b777 100644 --- a/jode/jode/flow/FlowBlock.java.in +++ b/jode/jode/flow/FlowBlock.java.in @@ -1743,4 +1743,3 @@ public class FlowBlock { } } } - diff --git a/jode/jode/flow/TransformConstructors.java b/jode/jode/flow/TransformConstructors.java index 5ce594b..90c563b 100644 --- a/jode/jode/flow/TransformConstructors.java +++ b/jode/jode/flow/TransformConstructors.java @@ -26,6 +26,7 @@ import jode.decompiler.ClassAnalyzer; import jode.decompiler.MethodAnalyzer; import jode.decompiler.FieldAnalyzer; import jode.decompiler.MethodAnalyzer; +import jode.decompiler.OuterValues; import jode.decompiler.OuterValueListener; import jode.expr.*; import jode.type.MethodType; @@ -37,16 +38,32 @@ import java.util.Vector; import java.util.Enumeration; /** - * This class will transform the constructors. This involves several - * steps: + * This class will transform the constructors. We differ three types of + * constructors: + *
type0
+ *
are constructors, that call no constructors or whose default super + * call was already removed. java.lang.Object.<init> + * and static constructors are examples for the first kind.
+ *
type1
+ *
are constructors, that call the constructor of super class
+ *
type2
+ *
are constructors, that call another constructor of the same class
+ *
* - *