summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/de/fernflower/main/InitializerProcessor.java4
-rw-r--r--src/de/fernflower/struct/StructClass.java4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/de/fernflower/main/InitializerProcessor.java b/src/de/fernflower/main/InitializerProcessor.java
index ecbb9bd..97a0e28 100644
--- a/src/de/fernflower/main/InitializerProcessor.java
+++ b/src/de/fernflower/main/InitializerProcessor.java
@@ -208,7 +208,9 @@ public class InitializerProcessor {
AssignmentExprent asexpr = (AssignmentExprent)exprent;
if(asexpr.getLeft().type == Exprent.EXPRENT_FIELD) {
FieldExprent fexpr = (FieldExprent)asexpr.getLeft();
- if(!fexpr.isStatic() && fexpr.getClassname().equals(cl.qualifiedName)) {
+ if(!fexpr.isStatic() && fexpr.getClassname().equals(cl.qualifiedName) &&
+ cl.hasField(fexpr.getName(), fexpr.getDescriptor().descriptorString)) { // check for the physical existence of the field. Could be defined in a superclass.
+
if(isExprentIndependent(asexpr.getRight(), lstMethWrappers.get(i))) {
String fieldKey = InterpreterUtil.makeUniqueKey(fexpr.getName(), fexpr.getDescriptor().descriptorString);
if(fieldWithDescr == null) {
diff --git a/src/de/fernflower/struct/StructClass.java b/src/de/fernflower/struct/StructClass.java
index 3f1d687..6824304 100644
--- a/src/de/fernflower/struct/StructClass.java
+++ b/src/de/fernflower/struct/StructClass.java
@@ -118,6 +118,10 @@ public class StructClass {
// public methods
// *****************************************************************************
+ public boolean hasField(String name, String descriptor) {
+ return getField(name, descriptor) != null;
+ }
+
public StructField getField(String name, String descriptor) {
return fields.getWithKey(InterpreterUtil.makeUniqueKey(name, descriptor));
}