summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStiver <stiver.mail@gmail.com>2014-08-15 18:58:55 +0200
committerStiver <stiver.mail@gmail.com>2014-08-15 18:58:55 +0200
commitc672e5bc8316cf96090e47a0ed70d357ce6da68e (patch)
treec8ce801797ba0156a6584fe8e036798aa44caf94
parent887c093afdb49b9bd2a2a4930c0a6a331662399d (diff)
downloadfernflower-c672e5bc8316cf96090e47a0ed70d357ce6da68e.tar
fernflower-c672e5bc8316cf96090e47a0ed70d357ce6da68e.tar.gz
fernflower-c672e5bc8316cf96090e47a0ed70d357ce6da68e.tar.lz
fernflower-c672e5bc8316cf96090e47a0ed70d357ce6da68e.tar.xz
fernflower-c672e5bc8316cf96090e47a0ed70d357ce6da68e.zip
Fixed 'IDEA-128676: Initializer in a nested class disappears'
-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));
}