minor cleanup and formatting

master
Egor.Ushakov 8 years ago
parent 2a213aa4a0
commit d149b53799
  1. 22
      src/org/jetbrains/java/decompiler/main/collectors/ImportCollector.java

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

Loading…
Cancel
Save