diff --git a/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java b/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java index f5cd16d..ee3933c 100644 --- a/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java +++ b/src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java @@ -15,7 +15,6 @@ */ package org.jetbrains.java.decompiler.main.collectors; -import org.jetbrains.java.decompiler.main.ClassesProcessor; import org.jetbrains.java.decompiler.main.ClassesProcessor.ClassNode; import org.jetbrains.java.decompiler.main.DecompilerContext; import org.jetbrains.java.decompiler.main.TextBuffer; @@ -49,20 +48,16 @@ public class ImportCollector { currentPackagePoint = ""; } - Map mapRootCases = DecompilerContext.getClassProcessor().getMapRootClasses(); - for(StructClass sClass = root.classStruct; - sClass!=null; - ){ - // all field names for current class .. - for(StructField f: sClass.getFields()) { + Map classes = DecompilerContext.getStructContext().getClasses(); + StructClass currentClass = root.classStruct; + while (currentClass != null) { + // all field names for the current class .. + for (StructField f : currentClass.getFields()) { setFieldNames.add(f.getName()); } // .. and traverse through parent. - ClassNode classNode; - if(sClass.superClass==null || (classNode = (mapRootCases.get(sClass.superClass.getString())))==null) - break; - sClass = classNode.classStruct; + currentClass = currentClass.superClass != null ? classes.get(currentClass.superClass.getString()) : null; } } @@ -74,9 +69,10 @@ public class ImportCollector { */ public String getShortNameInClassContext(String classToName) { String shortName = getShortName(classToName); - if(setFieldNames.contains(shortName)) { + if (setFieldNames.contains(shortName)) { return classToName; - } else { + } + else { return shortName; } }