From d149b53799aa0cbf26a6e107d19a4539a7a3b94b Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Mon, 24 Apr 2017 15:11:07 +0300 Subject: [PATCH] minor cleanup and formatting --- .../main/collectors/ImportCollector.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) 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; } }