diff --git a/jode/jode/expr/GetFieldOperator.java b/jode/jode/expr/GetFieldOperator.java index 4deee95..433bd54 100644 --- a/jode/jode/expr/GetFieldOperator.java +++ b/jode/jode/expr/GetFieldOperator.java @@ -26,6 +26,7 @@ public class GetFieldOperator extends Operator { CodeAnalyzer codeAnalyzer; String fieldName; Type classType; + boolean needCast = false; public GetFieldOperator(CodeAnalyzer codeAnalyzer, boolean staticFlag, Type classType, Type type, String fieldName) { @@ -55,6 +56,8 @@ public class GetFieldOperator extends Operator { } public void setOperandType(Type types[]) { + if (!staticFlag) + needCast = types[0].getTop().equals(Type.tUnknown); } public String toString(String[] operands) { @@ -63,10 +66,12 @@ public class GetFieldOperator extends Operator { && codeAnalyzer.findLocal(fieldName) == null ? fieldName : classType.toString() + "." + fieldName) - : (operands[0].equals("this") - && codeAnalyzer.findLocal(fieldName) == null - ? fieldName - : operands[0] + "." + fieldName); + : (operands[0].equals("null") + ? "((" + classType + ") null)." + fieldName + : (operands[0].equals("this") + && codeAnalyzer.findLocal(fieldName) == null + ? fieldName + : operands[0] + "." + fieldName)); } public boolean equals(Object o) { diff --git a/jode/jode/expr/PutFieldOperator.java b/jode/jode/expr/PutFieldOperator.java index a1709c8..4c7fa72 100644 --- a/jode/jode/expr/PutFieldOperator.java +++ b/jode/jode/expr/PutFieldOperator.java @@ -44,6 +44,13 @@ public class PutFieldOperator extends StoreInstruction { return staticFlag; } + public boolean isSynthetic() { + if (!classType.equals(Type.tClass(codeAnalyzer.getClazz().getName()))) + return false; + return codeAnalyzer.getClassAnalyzer() + .getField(fieldName, fieldType).isSynthetic(); + } + public String getFieldName() { return fieldName; } @@ -79,10 +86,12 @@ public class PutFieldOperator extends StoreInstruction { && codeAnalyzer.findLocal(fieldName) == null ? fieldName : classType.toString() + "." + fieldName) - : (operands[0].equals("this") - && codeAnalyzer.findLocal(fieldName) == null - ? fieldName - : operands[0] + "." + fieldName); + : ((operands[0].equals("this") + && codeAnalyzer.findLocal(fieldName) == null + ? fieldName + : operands[0].equals("null") + ? "((" + classType + ") null)." + fieldName + : operands[0] + "." + fieldName)); } public boolean equals(Object o) {