diff options
| author | 2016-07-02 20:13:13 +1000 | |
|---|---|---|
| committer | 2016-07-02 20:13:13 +1000 | |
| commit | 74edc74c2c7b3236f00bf92499bb884837673b7d (patch) | |
| tree | 155556b4d6e390574f16082583f2853e35e3c716 /src/main/java/cuchaz/enigma/analysis | |
| parent | Renamed Fields (diff) | |
| download | enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.gz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.tar.xz enigma-fork-74edc74c2c7b3236f00bf92499bb884837673b7d.zip | |
Reformatting code
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis')
7 files changed, 19 insertions, 139 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/EntryRenamer.java b/src/main/java/cuchaz/enigma/analysis/EntryRenamer.java index 9c3d051..a885c6a 100644 --- a/src/main/java/cuchaz/enigma/analysis/EntryRenamer.java +++ b/src/main/java/cuchaz/enigma/analysis/EntryRenamer.java | |||
| @@ -36,10 +36,7 @@ public class EntryRenamer { | |||
| 36 | // for each key/value pair... | 36 | // for each key/value pair... |
| 37 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); | 37 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); |
| 38 | for (Map.Entry<Key, Val> entry : map.entrySet()) { | 38 | for (Map.Entry<Key, Val> entry : map.entrySet()) { |
| 39 | entriesToAdd.add(new AbstractMap.SimpleEntry<>( | 39 | entriesToAdd.add(new AbstractMap.SimpleEntry<>(renameClassesInThing(renames, entry.getKey()), renameClassesInThing(renames, entry.getValue()))); |
| 40 | renameClassesInThing(renames, entry.getKey()), | ||
| 41 | renameClassesInThing(renames, entry.getValue()) | ||
| 42 | )); | ||
| 43 | } | 40 | } |
| 44 | map.clear(); | 41 | map.clear(); |
| 45 | for (Map.Entry<Key, Val> entry : entriesToAdd) { | 42 | for (Map.Entry<Key, Val> entry : entriesToAdd) { |
| @@ -51,10 +48,7 @@ public class EntryRenamer { | |||
| 51 | // for each key/value pair... | 48 | // for each key/value pair... |
| 52 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); | 49 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); |
| 53 | for (Map.Entry<Key, Val> entry : map.entries()) { | 50 | for (Map.Entry<Key, Val> entry : map.entries()) { |
| 54 | entriesToAdd.add(new AbstractMap.SimpleEntry<>( | 51 | entriesToAdd.add(new AbstractMap.SimpleEntry<>(renameClassesInThing(renames, entry.getKey()), renameClassesInThing(renames, entry.getValue()))); |
| 55 | renameClassesInThing(renames, entry.getKey()), | ||
| 56 | renameClassesInThing(renames, entry.getValue()) | ||
| 57 | )); | ||
| 58 | } | 52 | } |
| 59 | map.clear(); | 53 | map.clear(); |
| 60 | for (Map.Entry<Key, Val> entry : entriesToAdd) { | 54 | for (Map.Entry<Key, Val> entry : entriesToAdd) { |
| @@ -66,10 +60,7 @@ public class EntryRenamer { | |||
| 66 | // for each key/value pair... | 60 | // for each key/value pair... |
| 67 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); | 61 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); |
| 68 | for (Map.Entry<Key, Val> entry : map.entries()) { | 62 | for (Map.Entry<Key, Val> entry : map.entries()) { |
| 69 | entriesToAdd.add(new AbstractMap.SimpleEntry<>( | 63 | entriesToAdd.add(new AbstractMap.SimpleEntry<>(renameMethodsInThing(renames, entry.getKey()), renameMethodsInThing(renames, entry.getValue()))); |
| 70 | renameMethodsInThing(renames, entry.getKey()), | ||
| 71 | renameMethodsInThing(renames, entry.getValue()) | ||
| 72 | )); | ||
| 73 | } | 64 | } |
| 74 | map.clear(); | 65 | map.clear(); |
| 75 | for (Map.Entry<Key, Val> entry : entriesToAdd) { | 66 | for (Map.Entry<Key, Val> entry : entriesToAdd) { |
| @@ -81,10 +72,7 @@ public class EntryRenamer { | |||
| 81 | // for each key/value pair... | 72 | // for each key/value pair... |
| 82 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); | 73 | Set<Map.Entry<Key, Val>> entriesToAdd = Sets.newHashSet(); |
| 83 | for (Map.Entry<Key, Val> entry : map.entrySet()) { | 74 | for (Map.Entry<Key, Val> entry : map.entrySet()) { |
| 84 | entriesToAdd.add(new AbstractMap.SimpleEntry<>( | 75 | entriesToAdd.add(new AbstractMap.SimpleEntry<>(renameMethodsInThing(renames, entry.getKey()), renameMethodsInThing(renames, entry.getValue()))); |
| 85 | renameMethodsInThing(renames, entry.getKey()), | ||
| 86 | renameMethodsInThing(renames, entry.getValue()) | ||
| 87 | )); | ||
| 88 | } | 76 | } |
| 89 | map.clear(); | 77 | map.clear(); |
| 90 | for (Map.Entry<Key, Val> entry : entriesToAdd) { | 78 | for (Map.Entry<Key, Val> entry : entriesToAdd) { |
diff --git a/src/main/java/cuchaz/enigma/analysis/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/JarIndex.java index 8b30f9e..377a8cb 100644 --- a/src/main/java/cuchaz/enigma/analysis/JarIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/JarIndex.java | |||
| @@ -60,14 +60,14 @@ public class JarIndex { | |||
| 60 | for (ClassEntry classEntry : JarClassIterator.getClassEntries(jar)) { | 60 | for (ClassEntry classEntry : JarClassIterator.getClassEntries(jar)) { |
| 61 | if (classEntry.isInDefaultPackage()) { | 61 | if (classEntry.isInDefaultPackage()) { |
| 62 | // move out of default package | 62 | // move out of default package |
| 63 | classEntry = new ClassEntry(Constants.NonePackage + "/" + classEntry.getName()); | 63 | classEntry = new ClassEntry(Constants.NONE_PACKAGE + "/" + classEntry.getName()); |
| 64 | } | 64 | } |
| 65 | this.obfClassEntries.add(classEntry); | 65 | this.obfClassEntries.add(classEntry); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | // step 2: index field/method/constructor access | 68 | // step 2: index field/method/constructor access |
| 69 | for (CtClass c : JarClassIterator.classes(jar)) { | 69 | for (CtClass c : JarClassIterator.classes(jar)) { |
| 70 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NonePackage); | 70 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NONE_PACKAGE); |
| 71 | for (CtField field : c.getDeclaredFields()) { | 71 | for (CtField field : c.getDeclaredFields()) { |
| 72 | FieldEntry fieldEntry = EntryFactory.getFieldEntry(field); | 72 | FieldEntry fieldEntry = EntryFactory.getFieldEntry(field); |
| 73 | this.access.put(fieldEntry, Access.get(field)); | 73 | this.access.put(fieldEntry, Access.get(field)); |
| @@ -82,7 +82,7 @@ public class JarIndex { | |||
| 82 | 82 | ||
| 83 | // step 3: index extends, implements, fields, and methods | 83 | // step 3: index extends, implements, fields, and methods |
| 84 | for (CtClass c : JarClassIterator.classes(jar)) { | 84 | for (CtClass c : JarClassIterator.classes(jar)) { |
| 85 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NonePackage); | 85 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NONE_PACKAGE); |
| 86 | this.translationIndex.indexClass(c); | 86 | this.translationIndex.indexClass(c); |
| 87 | String className = Descriptor.toJvmName(c.getName()); | 87 | String className = Descriptor.toJvmName(c.getName()); |
| 88 | for (String interfaceName : c.getClassFile().getInterfaces()) { | 88 | for (String interfaceName : c.getClassFile().getInterfaces()) { |
| @@ -99,7 +99,7 @@ public class JarIndex { | |||
| 99 | 99 | ||
| 100 | // step 4: index field, method, constructor references | 100 | // step 4: index field, method, constructor references |
| 101 | for (CtClass c : JarClassIterator.classes(jar)) { | 101 | for (CtClass c : JarClassIterator.classes(jar)) { |
| 102 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NonePackage); | 102 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NONE_PACKAGE); |
| 103 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { | 103 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { |
| 104 | indexBehaviorReferences(behavior); | 104 | indexBehaviorReferences(behavior); |
| 105 | } | 105 | } |
| @@ -109,7 +109,7 @@ public class JarIndex { | |||
| 109 | 109 | ||
| 110 | // step 5: index inner classes and anonymous classes | 110 | // step 5: index inner classes and anonymous classes |
| 111 | for (CtClass c : JarClassIterator.classes(jar)) { | 111 | for (CtClass c : JarClassIterator.classes(jar)) { |
| 112 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NonePackage); | 112 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NONE_PACKAGE); |
| 113 | ClassEntry innerClassEntry = EntryFactory.getClassEntry(c); | 113 | ClassEntry innerClassEntry = EntryFactory.getClassEntry(c); |
| 114 | ClassEntry outerClassEntry = findOuterClass(c); | 114 | ClassEntry outerClassEntry = findOuterClass(c); |
| 115 | if (outerClassEntry != null) { | 115 | if (outerClassEntry != null) { |
| @@ -183,7 +183,7 @@ public class JarIndex { | |||
| 183 | calledMethodEntry.getSignature() | 183 | calledMethodEntry.getSignature() |
| 184 | ); | 184 | ); |
| 185 | } | 185 | } |
| 186 | EntryReference<BehaviorEntry, BehaviorEntry> reference = new EntryReference<BehaviorEntry, BehaviorEntry>( | 186 | EntryReference<BehaviorEntry, BehaviorEntry> reference = new EntryReference<>( |
| 187 | calledMethodEntry, | 187 | calledMethodEntry, |
| 188 | call.getMethodName(), | 188 | call.getMethodName(), |
| 189 | behaviorEntry | 189 | behaviorEntry |
| @@ -198,7 +198,7 @@ public class JarIndex { | |||
| 198 | if (resolvedClassEntry != null && !resolvedClassEntry.equals(calledFieldEntry.getClassEntry())) { | 198 | if (resolvedClassEntry != null && !resolvedClassEntry.equals(calledFieldEntry.getClassEntry())) { |
| 199 | calledFieldEntry = new FieldEntry(calledFieldEntry, resolvedClassEntry); | 199 | calledFieldEntry = new FieldEntry(calledFieldEntry, resolvedClassEntry); |
| 200 | } | 200 | } |
| 201 | EntryReference<FieldEntry, BehaviorEntry> reference = new EntryReference<FieldEntry, BehaviorEntry>( | 201 | EntryReference<FieldEntry, BehaviorEntry> reference = new EntryReference<>( |
| 202 | calledFieldEntry, | 202 | calledFieldEntry, |
| 203 | call.getFieldName(), | 203 | call.getFieldName(), |
| 204 | behaviorEntry | 204 | behaviorEntry |
| @@ -209,7 +209,7 @@ public class JarIndex { | |||
| 209 | @Override | 209 | @Override |
| 210 | public void edit(ConstructorCall call) { | 210 | public void edit(ConstructorCall call) { |
| 211 | ConstructorEntry calledConstructorEntry = EntryFactory.getConstructorEntry(call); | 211 | ConstructorEntry calledConstructorEntry = EntryFactory.getConstructorEntry(call); |
| 212 | EntryReference<BehaviorEntry, BehaviorEntry> reference = new EntryReference<BehaviorEntry, BehaviorEntry>( | 212 | EntryReference<BehaviorEntry, BehaviorEntry> reference = new EntryReference<>( |
| 213 | calledConstructorEntry, | 213 | calledConstructorEntry, |
| 214 | call.getMethodName(), | 214 | call.getMethodName(), |
| 215 | behaviorEntry | 215 | behaviorEntry |
| @@ -220,7 +220,7 @@ public class JarIndex { | |||
| 220 | @Override | 220 | @Override |
| 221 | public void edit(NewExpr call) { | 221 | public void edit(NewExpr call) { |
| 222 | ConstructorEntry calledConstructorEntry = EntryFactory.getConstructorEntry(call); | 222 | ConstructorEntry calledConstructorEntry = EntryFactory.getConstructorEntry(call); |
| 223 | EntryReference<BehaviorEntry, BehaviorEntry> reference = new EntryReference<BehaviorEntry, BehaviorEntry>( | 223 | EntryReference<BehaviorEntry, BehaviorEntry> reference = new EntryReference<>( |
| 224 | calledConstructorEntry, | 224 | calledConstructorEntry, |
| 225 | call.getClassName(), | 225 | call.getClassName(), |
| 226 | behaviorEntry | 226 | behaviorEntry |
| @@ -711,7 +711,7 @@ public class JarIndex { | |||
| 711 | 711 | ||
| 712 | public Set<ClassEntry> getInterfaces(String className) { | 712 | public Set<ClassEntry> getInterfaces(String className) { |
| 713 | ClassEntry classEntry = new ClassEntry(className); | 713 | ClassEntry classEntry = new ClassEntry(className); |
| 714 | Set<ClassEntry> interfaces = new HashSet<ClassEntry>(); | 714 | Set<ClassEntry> interfaces = new HashSet<>(); |
| 715 | interfaces.addAll(this.translationIndex.getInterfaces(classEntry)); | 715 | interfaces.addAll(this.translationIndex.getInterfaces(classEntry)); |
| 716 | for (ClassEntry ancestor : this.translationIndex.getAncestry(classEntry)) { | 716 | for (ClassEntry ancestor : this.translationIndex.getAncestry(classEntry)) { |
| 717 | interfaces.addAll(this.translationIndex.getInterfaces(ancestor)); | 717 | interfaces.addAll(this.translationIndex.getInterfaces(ancestor)); |
diff --git a/src/main/java/cuchaz/enigma/analysis/MethodImplementationsTreeNode.java b/src/main/java/cuchaz/enigma/analysis/MethodImplementationsTreeNode.java index 1cf80d9..7919b5d 100644 --- a/src/main/java/cuchaz/enigma/analysis/MethodImplementationsTreeNode.java +++ b/src/main/java/cuchaz/enigma/analysis/MethodImplementationsTreeNode.java | |||
| @@ -75,9 +75,7 @@ public class MethodImplementationsTreeNode extends DefaultMutableTreeNode { | |||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | // add them to this node | 77 | // add them to this node |
| 78 | for (MethodImplementationsTreeNode node : nodes) { | 78 | nodes.forEach(this::add); |
| 79 | this.add(node); | ||
| 80 | } | ||
| 81 | } | 79 | } |
| 82 | 80 | ||
| 83 | public static MethodImplementationsTreeNode findNode(MethodImplementationsTreeNode node, MethodEntry entry) { | 81 | public static MethodImplementationsTreeNode findNode(MethodImplementationsTreeNode node, MethodEntry entry) { |
diff --git a/src/main/java/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java b/src/main/java/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java index a3bed6e..6383783 100644 --- a/src/main/java/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java +++ b/src/main/java/cuchaz/enigma/analysis/MethodInheritanceTreeNode.java | |||
| @@ -79,9 +79,7 @@ public class MethodInheritanceTreeNode extends DefaultMutableTreeNode { | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | // add them to this node | 81 | // add them to this node |
| 82 | for (MethodInheritanceTreeNode node : nodes) { | 82 | nodes.forEach(this::add); |
| 83 | this.add(node); | ||
| 84 | } | ||
| 85 | 83 | ||
| 86 | if (recurse) { | 84 | if (recurse) { |
| 87 | for (MethodInheritanceTreeNode node : nodes) { | 85 | for (MethodInheritanceTreeNode node : nodes) { |
diff --git a/src/main/java/cuchaz/enigma/analysis/RelatedMethodChecker.java b/src/main/java/cuchaz/enigma/analysis/RelatedMethodChecker.java deleted file mode 100644 index 08e2dbf..0000000 --- a/src/main/java/cuchaz/enigma/analysis/RelatedMethodChecker.java +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.analysis; | ||
| 12 | |||
| 13 | import com.google.common.collect.Maps; | ||
| 14 | import com.google.common.collect.Sets; | ||
| 15 | |||
| 16 | import java.util.Map; | ||
| 17 | import java.util.Set; | ||
| 18 | |||
| 19 | import cuchaz.enigma.mapping.*; | ||
| 20 | |||
| 21 | public class RelatedMethodChecker { | ||
| 22 | |||
| 23 | private JarIndex m_jarIndex; | ||
| 24 | private Map<Set<MethodEntry>, String> m_deobfNamesByGroup; | ||
| 25 | private Map<MethodEntry, String> m_deobfNamesByObfMethod; | ||
| 26 | private Map<MethodEntry, Set<MethodEntry>> m_groupsByObfMethod; | ||
| 27 | private Set<Set<MethodEntry>> m_inconsistentGroups; | ||
| 28 | |||
| 29 | public RelatedMethodChecker(JarIndex jarIndex) { | ||
| 30 | m_jarIndex = jarIndex; | ||
| 31 | m_deobfNamesByGroup = Maps.newHashMap(); | ||
| 32 | m_deobfNamesByObfMethod = Maps.newHashMap(); | ||
| 33 | m_groupsByObfMethod = Maps.newHashMap(); | ||
| 34 | m_inconsistentGroups = Sets.newHashSet(); | ||
| 35 | } | ||
| 36 | |||
| 37 | public void checkMethod(ClassEntry classEntry, MethodMapping methodMapping) { | ||
| 38 | |||
| 39 | // TEMP: disable the expensive check for now, maybe we can optimize it later, or just use it for debugging | ||
| 40 | if (true) { | ||
| 41 | return; | ||
| 42 | } | ||
| 43 | |||
| 44 | BehaviorEntry obfBehaviorEntry = EntryFactory.getObfBehaviorEntry(classEntry, methodMapping); | ||
| 45 | if (!(obfBehaviorEntry instanceof MethodEntry)) { | ||
| 46 | // only methods have related implementations | ||
| 47 | return; | ||
| 48 | } | ||
| 49 | MethodEntry obfMethodEntry = (MethodEntry) obfBehaviorEntry; | ||
| 50 | String deobfName = methodMapping.getDeobfName(); | ||
| 51 | m_deobfNamesByObfMethod.put(obfMethodEntry, deobfName); | ||
| 52 | |||
| 53 | // have we seen this method's group before? | ||
| 54 | Set<MethodEntry> group = m_groupsByObfMethod.get(obfMethodEntry); | ||
| 55 | if (group == null) { | ||
| 56 | |||
| 57 | // no, compute the group and save the name | ||
| 58 | group = m_jarIndex.getRelatedMethodImplementations(obfMethodEntry); | ||
| 59 | m_deobfNamesByGroup.put(group, deobfName); | ||
| 60 | |||
| 61 | assert (group.contains(obfMethodEntry)); | ||
| 62 | for (MethodEntry relatedMethodEntry : group) { | ||
| 63 | m_groupsByObfMethod.put(relatedMethodEntry, group); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | // check the name | ||
| 68 | if (!sameName(m_deobfNamesByGroup.get(group), deobfName)) { | ||
| 69 | m_inconsistentGroups.add(group); | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | private boolean sameName(String a, String b) { | ||
| 74 | if (a == null && b == null) { | ||
| 75 | return true; | ||
| 76 | } else if (a != null && b != null) { | ||
| 77 | return a.equals(b); | ||
| 78 | } | ||
| 79 | return false; | ||
| 80 | } | ||
| 81 | |||
| 82 | public boolean hasProblems() { | ||
| 83 | return m_inconsistentGroups.size() > 0; | ||
| 84 | } | ||
| 85 | |||
| 86 | public String getReport() { | ||
| 87 | StringBuilder buf = new StringBuilder(); | ||
| 88 | buf.append(m_inconsistentGroups.size()); | ||
| 89 | buf.append(" groups of methods related by inheritance and/or interfaces have different deobf names!\n"); | ||
| 90 | for (Set<MethodEntry> group : m_inconsistentGroups) { | ||
| 91 | buf.append("\tGroup with "); | ||
| 92 | buf.append(group.size()); | ||
| 93 | buf.append(" methods:\n"); | ||
| 94 | for (MethodEntry methodEntry : group) { | ||
| 95 | buf.append("\t\t"); | ||
| 96 | buf.append(methodEntry.toString()); | ||
| 97 | buf.append(" => "); | ||
| 98 | buf.append(m_deobfNamesByObfMethod.get(methodEntry)); | ||
| 99 | buf.append("\n"); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | return buf.toString(); | ||
| 103 | } | ||
| 104 | } | ||
diff --git a/src/main/java/cuchaz/enigma/analysis/SourceIndex.java b/src/main/java/cuchaz/enigma/analysis/SourceIndex.java index cbc2945..719930e 100644 --- a/src/main/java/cuchaz/enigma/analysis/SourceIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/SourceIndex.java | |||
| @@ -98,7 +98,7 @@ public class SourceIndex { | |||
| 98 | public void addReference(AstNode node, Entry deobfEntry, Entry deobfContext) { | 98 | public void addReference(AstNode node, Entry deobfEntry, Entry deobfContext) { |
| 99 | Token token = getToken(node); | 99 | Token token = getToken(node); |
| 100 | if (token != null) { | 100 | if (token != null) { |
| 101 | EntryReference<Entry, Entry> deobfReference = new EntryReference<Entry, Entry>(deobfEntry, token.text, deobfContext); | 101 | EntryReference<Entry, Entry> deobfReference = new EntryReference<>(deobfEntry, token.text, deobfContext); |
| 102 | this.tokenToReference.put(token, deobfReference); | 102 | this.tokenToReference.put(token, deobfReference); |
| 103 | this.referenceToTokens.put(deobfReference, token); | 103 | this.referenceToTokens.put(deobfReference, token); |
| 104 | } | 104 | } |
| @@ -107,7 +107,7 @@ public class SourceIndex { | |||
| 107 | public void addDeclaration(AstNode node, Entry deobfEntry) { | 107 | public void addDeclaration(AstNode node, Entry deobfEntry) { |
| 108 | Token token = getToken(node); | 108 | Token token = getToken(node); |
| 109 | if (token != null) { | 109 | if (token != null) { |
| 110 | EntryReference<Entry, Entry> reference = new EntryReference<Entry, Entry>(deobfEntry, token.text); | 110 | EntryReference<Entry, Entry> reference = new EntryReference<>(deobfEntry, token.text); |
| 111 | this.tokenToReference.put(token, reference); | 111 | this.tokenToReference.put(token, reference); |
| 112 | this.referenceToTokens.put(reference, token); | 112 | this.referenceToTokens.put(reference, token); |
| 113 | this.declarationToToken.put(deobfEntry, token); | 113 | this.declarationToToken.put(deobfEntry, token); |
diff --git a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java index f020ae2..adb87b6 100644 --- a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java | |||
| @@ -119,7 +119,7 @@ public class TranslationIndex implements Serializable { | |||
| 119 | 119 | ||
| 120 | public void renameClasses(Map<String, String> renames) { | 120 | public void renameClasses(Map<String, String> renames) { |
| 121 | EntryRenamer.renameClassesInMap(renames, this.superclasses); | 121 | EntryRenamer.renameClassesInMap(renames, this.superclasses); |
| 122 | EntryRenamer.renameClassesInMultimap(renames,this.fieldEntries); | 122 | EntryRenamer.renameClassesInMultimap(renames, this.fieldEntries); |
| 123 | EntryRenamer.renameClassesInMultimap(renames, this.behaviorEntries); | 123 | EntryRenamer.renameClassesInMultimap(renames, this.behaviorEntries); |
| 124 | } | 124 | } |
| 125 | 125 | ||