From 5b634ecb4d7066d054db956822585fb768bfe38a Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Mon, 24 Apr 2017 19:45:23 +0300 Subject: [PATCH] do not collect field names into a separate set --- .../java/decompiler/main/rels/ClassWrapper.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java index 5ae532a..acc2849 100644 --- a/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java +++ b/src/org/jetbrains/java/decompiler/main/rels/ClassWrapper.java @@ -27,7 +27,6 @@ import org.jetbrains.java.decompiler.modules.decompiler.stats.RootStatement; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarProcessor; import org.jetbrains.java.decompiler.modules.decompiler.vars.VarVersionPair; import org.jetbrains.java.decompiler.struct.StructClass; -import org.jetbrains.java.decompiler.struct.StructField; import org.jetbrains.java.decompiler.struct.StructMethod; import org.jetbrains.java.decompiler.struct.attr.StructLocalVariableTableAttribute; import org.jetbrains.java.decompiler.struct.gen.MethodDescriptor; @@ -56,12 +55,6 @@ public class ClassWrapper { DecompilerContext.setProperty(DecompilerContext.CURRENT_CLASS_WRAPPER, this); DecompilerContext.getLogger().startClass(classStruct.qualifiedName); - // collect field names - Set setFieldNames = new HashSet<>(); - for (StructField fd : classStruct.getFields()) { - setFieldNames.add(fd.getName()); - } - int maxSec = Integer.parseInt(DecompilerContext.getProperty(IFernflowerPreferences.MAX_PROCESSING_METHOD).toString()); boolean testMode = DecompilerContext.getOption(IFernflowerPreferences.UNIT_TEST_MODE); @@ -160,7 +153,9 @@ public class ClassWrapper { if (!isError) { // rename vars so that no one has the same name as a field - varProc.refreshVarNames(new VarNamesCollector(setFieldNames)); + VarNamesCollector namesCollector = new VarNamesCollector(); + classStruct.getFields().forEach(f -> namesCollector.addName(f.getName())); + varProc.refreshVarNames(namesCollector); // if debug information present and should be used if (DecompilerContext.getOption(IFernflowerPreferences.USE_DEBUG_VAR_NAMES)) {