Fixed 'IDEA-128676: Initializer in a nested class disappears'

master
Stiver 11 years ago
parent 887c093afd
commit c672e5bc83
  1. 4
      src/de/fernflower/main/InitializerProcessor.java
  2. 4
      src/de/fernflower/struct/StructClass.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) {

@ -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));
}

Loading…
Cancel
Save