diff options
| author | 2016-07-02 18:04:57 +1000 | |
|---|---|---|
| committer | 2016-07-02 18:04:57 +1000 | |
| commit | 64c359d3c1d2347001e5c6becb1d7561457f52cc (patch) | |
| tree | bc2f37325b770475237437d204e95254dbfa0b3d /src/main/java/cuchaz/enigma/analysis/JarIndex.java | |
| parent | Fixed Null.json and #4 (diff) | |
| download | enigma-fork-64c359d3c1d2347001e5c6becb1d7561457f52cc.tar.gz enigma-fork-64c359d3c1d2347001e5c6becb1d7561457f52cc.tar.xz enigma-fork-64c359d3c1d2347001e5c6becb1d7561457f52cc.zip | |
Renamed Fields
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/JarIndex.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/JarIndex.java | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/JarIndex.java index 848d851..8b30f9e 100644 --- a/src/main/java/cuchaz/enigma/analysis/JarIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/JarIndex.java | |||
| @@ -26,32 +26,32 @@ import javassist.expr.*; | |||
| 26 | 26 | ||
| 27 | public class JarIndex { | 27 | public class JarIndex { |
| 28 | 28 | ||
| 29 | private Set<ClassEntry> m_obfClassEntries; | 29 | private Set<ClassEntry> obfClassEntries; |
| 30 | private TranslationIndex m_translationIndex; | 30 | private TranslationIndex translationIndex; |
| 31 | private Map<Entry, Access> m_access; | 31 | private Map<Entry, Access> access; |
| 32 | private Multimap<ClassEntry, FieldEntry> m_fields; | 32 | private Multimap<ClassEntry, FieldEntry> fields; |
| 33 | private Multimap<ClassEntry, BehaviorEntry> m_behaviors; | 33 | private Multimap<ClassEntry, BehaviorEntry> behaviors; |
| 34 | private Multimap<String, MethodEntry> m_methodImplementations; | 34 | private Multimap<String, MethodEntry> methodImplementations; |
| 35 | private Multimap<BehaviorEntry, EntryReference<BehaviorEntry, BehaviorEntry>> m_behaviorReferences; | 35 | private Multimap<BehaviorEntry, EntryReference<BehaviorEntry, BehaviorEntry>> behaviorReferences; |
| 36 | private Multimap<FieldEntry, EntryReference<FieldEntry, BehaviorEntry>> m_fieldReferences; | 36 | private Multimap<FieldEntry, EntryReference<FieldEntry, BehaviorEntry>> fieldReferences; |
| 37 | private Multimap<ClassEntry, ClassEntry> m_innerClassesByOuter; | 37 | private Multimap<ClassEntry, ClassEntry> innerClassesByOuter; |
| 38 | private Map<ClassEntry, ClassEntry> m_outerClassesByInner; | 38 | private Map<ClassEntry, ClassEntry> outerClassesByInner; |
| 39 | private Map<ClassEntry, BehaviorEntry> m_anonymousClasses; | 39 | private Map<ClassEntry, BehaviorEntry> anonymousClasses; |
| 40 | private Map<MethodEntry, MethodEntry> m_bridgedMethods; | 40 | private Map<MethodEntry, MethodEntry> bridgedMethods; |
| 41 | 41 | ||
| 42 | public JarIndex() { | 42 | public JarIndex() { |
| 43 | m_obfClassEntries = Sets.newHashSet(); | 43 | this.obfClassEntries = Sets.newHashSet(); |
| 44 | m_translationIndex = new TranslationIndex(); | 44 | this.translationIndex = new TranslationIndex(); |
| 45 | m_access = Maps.newHashMap(); | 45 | this.access = Maps.newHashMap(); |
| 46 | m_fields = HashMultimap.create(); | 46 | this.fields = HashMultimap.create(); |
| 47 | m_behaviors = HashMultimap.create(); | 47 | this.behaviors = HashMultimap.create(); |
| 48 | m_methodImplementations = HashMultimap.create(); | 48 | this.methodImplementations = HashMultimap.create(); |
| 49 | m_behaviorReferences = HashMultimap.create(); | 49 | this.behaviorReferences = HashMultimap.create(); |
| 50 | m_fieldReferences = HashMultimap.create(); | 50 | this.fieldReferences = HashMultimap.create(); |
| 51 | m_innerClassesByOuter = HashMultimap.create(); | 51 | this.innerClassesByOuter = HashMultimap.create(); |
| 52 | m_outerClassesByInner = Maps.newHashMap(); | 52 | this.outerClassesByInner = Maps.newHashMap(); |
| 53 | m_anonymousClasses = Maps.newHashMap(); | 53 | this.anonymousClasses = Maps.newHashMap(); |
| 54 | m_bridgedMethods = Maps.newHashMap(); | 54 | this.bridgedMethods = Maps.newHashMap(); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | public void indexJar(JarFile jar, boolean buildInnerClasses) { | 57 | public void indexJar(JarFile jar, boolean buildInnerClasses) { |
| @@ -62,7 +62,7 @@ public class JarIndex { | |||
| 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.NonePackage + "/" + classEntry.getName()); |
| 64 | } | 64 | } |
| 65 | m_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 |
| @@ -70,20 +70,20 @@ public class JarIndex { | |||
| 70 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NonePackage); | 70 | ClassRenamer.moveAllClassesOutOfDefaultPackage(c, Constants.NonePackage); |
| 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 | m_access.put(fieldEntry, Access.get(field)); | 73 | this.access.put(fieldEntry, Access.get(field)); |
| 74 | m_fields.put(fieldEntry.getClassEntry(), fieldEntry); | 74 | this.fields.put(fieldEntry.getClassEntry(), fieldEntry); |
| 75 | } | 75 | } |
| 76 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { | 76 | for (CtBehavior behavior : c.getDeclaredBehaviors()) { |
| 77 | BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior); | 77 | BehaviorEntry behaviorEntry = EntryFactory.getBehaviorEntry(behavior); |
| 78 | m_access.put(behaviorEntry, Access.get(behavior)); | 78 | this.access.put(behaviorEntry, Access.get(behavior)); |
| 79 | m_behaviors.put(behaviorEntry.getClassEntry(), behaviorEntry); | 79 | this.behaviors.put(behaviorEntry.getClassEntry(), behaviorEntry); |
| 80 | } | 80 | } |
| 81 | } | 81 | } |
| 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.NonePackage); |
| 86 | m_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()) { |
| 89 | className = Descriptor.toJvmName(className); | 89 | className = Descriptor.toJvmName(className); |
| @@ -113,13 +113,13 @@ public class JarIndex { | |||
| 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) { |
| 116 | m_innerClassesByOuter.put(outerClassEntry, innerClassEntry); | 116 | this.innerClassesByOuter.put(outerClassEntry, innerClassEntry); |
| 117 | boolean innerWasAdded = m_outerClassesByInner.put(innerClassEntry, outerClassEntry) == null; | 117 | boolean innerWasAdded = this.outerClassesByInner.put(innerClassEntry, outerClassEntry) == null; |
| 118 | assert (innerWasAdded); | 118 | assert (innerWasAdded); |
| 119 | 119 | ||
| 120 | BehaviorEntry enclosingBehavior = isAnonymousClass(c, outerClassEntry); | 120 | BehaviorEntry enclosingBehavior = isAnonymousClass(c, outerClassEntry); |
| 121 | if (enclosingBehavior != null) { | 121 | if (enclosingBehavior != null) { |
| 122 | m_anonymousClasses.put(innerClassEntry, enclosingBehavior); | 122 | this.anonymousClasses.put(innerClassEntry, enclosingBehavior); |
| 123 | 123 | ||
| 124 | // DEBUG | 124 | // DEBUG |
| 125 | //System.out.println("ANONYMOUS: " + outerClassEntry.getName() + "$" + innerClassEntry.getSimpleName()); | 125 | //System.out.println("ANONYMOUS: " + outerClassEntry.getName() + "$" + innerClassEntry.getSimpleName()); |
| @@ -132,7 +132,7 @@ public class JarIndex { | |||
| 132 | 132 | ||
| 133 | // step 6: update other indices with inner class info | 133 | // step 6: update other indices with inner class info |
| 134 | Map<String, String> renames = Maps.newHashMap(); | 134 | Map<String, String> renames = Maps.newHashMap(); |
| 135 | for (ClassEntry innerClassEntry : m_innerClassesByOuter.values()) { | 135 | for (ClassEntry innerClassEntry : this.innerClassesByOuter.values()) { |
| 136 | String newName = innerClassEntry.buildClassEntry(getObfClassChain(innerClassEntry)).getName(); | 136 | String newName = innerClassEntry.buildClassEntry(getObfClassChain(innerClassEntry)).getName(); |
| 137 | if (!innerClassEntry.getName().equals(newName)) { | 137 | if (!innerClassEntry.getName().equals(newName)) { |
| 138 | // DEBUG | 138 | // DEBUG |
| @@ -140,12 +140,12 @@ public class JarIndex { | |||
| 140 | renames.put(innerClassEntry.getName(), newName); | 140 | renames.put(innerClassEntry.getName(), newName); |
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | EntryRenamer.renameClassesInSet(renames, m_obfClassEntries); | 143 | EntryRenamer.renameClassesInSet(renames, this.obfClassEntries); |
| 144 | m_translationIndex.renameClasses(renames); | 144 | this.translationIndex.renameClasses(renames); |
| 145 | EntryRenamer.renameClassesInMultimap(renames, m_methodImplementations); | 145 | EntryRenamer.renameClassesInMultimap(renames, this.methodImplementations); |
| 146 | EntryRenamer.renameClassesInMultimap(renames, m_behaviorReferences); | 146 | EntryRenamer.renameClassesInMultimap(renames, this.behaviorReferences); |
| 147 | EntryRenamer.renameClassesInMultimap(renames, m_fieldReferences); | 147 | EntryRenamer.renameClassesInMultimap(renames, this.fieldReferences); |
| 148 | EntryRenamer.renameClassesInMap(renames, m_access); | 148 | EntryRenamer.renameClassesInMap(renames, this.access); |
| 149 | } | 149 | } |
| 150 | } | 150 | } |
| 151 | 151 | ||
| @@ -156,12 +156,12 @@ public class JarIndex { | |||
| 156 | MethodEntry methodEntry = (MethodEntry) behaviorEntry; | 156 | MethodEntry methodEntry = (MethodEntry) behaviorEntry; |
| 157 | 157 | ||
| 158 | // index implementation | 158 | // index implementation |
| 159 | m_methodImplementations.put(behaviorEntry.getClassName(), methodEntry); | 159 | this.methodImplementations.put(behaviorEntry.getClassName(), methodEntry); |
| 160 | 160 | ||
| 161 | // look for bridge and bridged methods | 161 | // look for bridge and bridged methods |
| 162 | CtMethod bridgedMethod = getBridgedMethod((CtMethod) behavior); | 162 | CtMethod bridgedMethod = getBridgedMethod((CtMethod) behavior); |
| 163 | if (bridgedMethod != null) { | 163 | if (bridgedMethod != null) { |
| 164 | m_bridgedMethods.put(methodEntry, EntryFactory.getMethodEntry(bridgedMethod)); | 164 | this.bridgedMethods.put(methodEntry, EntryFactory.getMethodEntry(bridgedMethod)); |
| 165 | } | 165 | } |
| 166 | } | 166 | } |
| 167 | // looks like we don't care about constructors here | 167 | // looks like we don't care about constructors here |
| @@ -175,7 +175,7 @@ public class JarIndex { | |||
| 175 | @Override | 175 | @Override |
| 176 | public void edit(MethodCall call) { | 176 | public void edit(MethodCall call) { |
| 177 | MethodEntry calledMethodEntry = EntryFactory.getMethodEntry(call); | 177 | MethodEntry calledMethodEntry = EntryFactory.getMethodEntry(call); |
| 178 | ClassEntry resolvedClassEntry = m_translationIndex.resolveEntryClass(calledMethodEntry); | 178 | ClassEntry resolvedClassEntry = translationIndex.resolveEntryClass(calledMethodEntry); |
| 179 | if (resolvedClassEntry != null && !resolvedClassEntry.equals(calledMethodEntry.getClassEntry())) { | 179 | if (resolvedClassEntry != null && !resolvedClassEntry.equals(calledMethodEntry.getClassEntry())) { |
| 180 | calledMethodEntry = new MethodEntry( | 180 | calledMethodEntry = new MethodEntry( |
| 181 | resolvedClassEntry, | 181 | resolvedClassEntry, |
| @@ -188,13 +188,13 @@ public class JarIndex { | |||
| 188 | call.getMethodName(), | 188 | call.getMethodName(), |
| 189 | behaviorEntry | 189 | behaviorEntry |
| 190 | ); | 190 | ); |
| 191 | m_behaviorReferences.put(calledMethodEntry, reference); | 191 | behaviorReferences.put(calledMethodEntry, reference); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | @Override | 194 | @Override |
| 195 | public void edit(FieldAccess call) { | 195 | public void edit(FieldAccess call) { |
| 196 | FieldEntry calledFieldEntry = EntryFactory.getFieldEntry(call); | 196 | FieldEntry calledFieldEntry = EntryFactory.getFieldEntry(call); |
| 197 | ClassEntry resolvedClassEntry = m_translationIndex.resolveEntryClass(calledFieldEntry); | 197 | ClassEntry resolvedClassEntry = translationIndex.resolveEntryClass(calledFieldEntry); |
| 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 | } |
| @@ -203,7 +203,7 @@ public class JarIndex { | |||
| 203 | call.getFieldName(), | 203 | call.getFieldName(), |
| 204 | behaviorEntry | 204 | behaviorEntry |
| 205 | ); | 205 | ); |
| 206 | m_fieldReferences.put(calledFieldEntry, reference); | 206 | fieldReferences.put(calledFieldEntry, reference); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | @Override | 209 | @Override |
| @@ -214,7 +214,7 @@ public class JarIndex { | |||
| 214 | call.getMethodName(), | 214 | call.getMethodName(), |
| 215 | behaviorEntry | 215 | behaviorEntry |
| 216 | ); | 216 | ); |
| 217 | m_behaviorReferences.put(calledConstructorEntry, reference); | 217 | behaviorReferences.put(calledConstructorEntry, reference); |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | @Override | 220 | @Override |
| @@ -225,7 +225,7 @@ public class JarIndex { | |||
| 225 | call.getClassName(), | 225 | call.getClassName(), |
| 226 | behaviorEntry | 226 | behaviorEntry |
| 227 | ); | 227 | ); |
| 228 | m_behaviorReferences.put(calledConstructorEntry, reference); | 228 | behaviorReferences.put(calledConstructorEntry, reference); |
| 229 | } | 229 | } |
| 230 | }); | 230 | }); |
| 231 | } catch (CannotCompileException ex) { | 231 | } catch (CannotCompileException ex) { |
| @@ -314,7 +314,7 @@ public class JarIndex { | |||
| 314 | 314 | ||
| 315 | // is the entry a superclass of the context? | 315 | // is the entry a superclass of the context? |
| 316 | ClassEntry calledClassEntry = reference.entry.getClassEntry(); | 316 | ClassEntry calledClassEntry = reference.entry.getClassEntry(); |
| 317 | ClassEntry superclassEntry = m_translationIndex.getSuperclass(reference.context.getClassEntry()); | 317 | ClassEntry superclassEntry = this.translationIndex.getSuperclass(reference.context.getClassEntry()); |
| 318 | if (superclassEntry != null && superclassEntry.equals(calledClassEntry)) { | 318 | if (superclassEntry != null && superclassEntry.equals(calledClassEntry)) { |
| 319 | // it's a super call, skip | 319 | // it's a super call, skip |
| 320 | continue; | 320 | continue; |
| @@ -360,7 +360,7 @@ public class JarIndex { | |||
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | // is the outer class in the jar? | 362 | // is the outer class in the jar? |
| 363 | return m_obfClassEntries.contains(outerClassEntry); | 363 | return this.obfClassEntries.contains(outerClassEntry); |
| 364 | 364 | ||
| 365 | } | 365 | } |
| 366 | 366 | ||
| @@ -500,31 +500,31 @@ public class JarIndex { | |||
| 500 | } | 500 | } |
| 501 | 501 | ||
| 502 | public Set<ClassEntry> getObfClassEntries() { | 502 | public Set<ClassEntry> getObfClassEntries() { |
| 503 | return m_obfClassEntries; | 503 | return this.obfClassEntries; |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | public Collection<FieldEntry> getObfFieldEntries() { | 506 | public Collection<FieldEntry> getObfFieldEntries() { |
| 507 | return m_fields.values(); | 507 | return this.fields.values(); |
| 508 | } | 508 | } |
| 509 | 509 | ||
| 510 | public Collection<FieldEntry> getObfFieldEntries(ClassEntry classEntry) { | 510 | public Collection<FieldEntry> getObfFieldEntries(ClassEntry classEntry) { |
| 511 | return m_fields.get(classEntry); | 511 | return this.fields.get(classEntry); |
| 512 | } | 512 | } |
| 513 | 513 | ||
| 514 | public Collection<BehaviorEntry> getObfBehaviorEntries() { | 514 | public Collection<BehaviorEntry> getObfBehaviorEntries() { |
| 515 | return m_behaviors.values(); | 515 | return this.behaviors.values(); |
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | public Collection<BehaviorEntry> getObfBehaviorEntries(ClassEntry classEntry) { | 518 | public Collection<BehaviorEntry> getObfBehaviorEntries(ClassEntry classEntry) { |
| 519 | return m_behaviors.get(classEntry); | 519 | return this.behaviors.get(classEntry); |
| 520 | } | 520 | } |
| 521 | 521 | ||
| 522 | public TranslationIndex getTranslationIndex() { | 522 | public TranslationIndex getTranslationIndex() { |
| 523 | return m_translationIndex; | 523 | return this.translationIndex; |
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | public Access getAccess(Entry entry) { | 526 | public Access getAccess(Entry entry) { |
| 527 | return m_access.get(entry); | 527 | return this.access.get(entry); |
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | public ClassInheritanceTreeNode getClassInheritance(Translator deobfuscatingTranslator, ClassEntry obfClassEntry) { | 530 | public ClassInheritanceTreeNode getClassInheritance(Translator deobfuscatingTranslator, ClassEntry obfClassEntry) { |
| @@ -532,7 +532,7 @@ public class JarIndex { | |||
| 532 | // get the root node | 532 | // get the root node |
| 533 | List<String> ancestry = Lists.newArrayList(); | 533 | List<String> ancestry = Lists.newArrayList(); |
| 534 | ancestry.add(obfClassEntry.getName()); | 534 | ancestry.add(obfClassEntry.getName()); |
| 535 | for (ClassEntry classEntry : m_translationIndex.getAncestry(obfClassEntry)) { | 535 | for (ClassEntry classEntry : this.translationIndex.getAncestry(obfClassEntry)) { |
| 536 | if (containsObfClass(classEntry)) { | 536 | if (containsObfClass(classEntry)) { |
| 537 | ancestry.add(classEntry.getName()); | 537 | ancestry.add(classEntry.getName()); |
| 538 | } | 538 | } |
| @@ -543,7 +543,7 @@ public class JarIndex { | |||
| 543 | ); | 543 | ); |
| 544 | 544 | ||
| 545 | // expand all children recursively | 545 | // expand all children recursively |
| 546 | rootNode.load(m_translationIndex, true); | 546 | rootNode.load(this.translationIndex, true); |
| 547 | 547 | ||
| 548 | return rootNode; | 548 | return rootNode; |
| 549 | } | 549 | } |
| @@ -563,7 +563,7 @@ public class JarIndex { | |||
| 563 | 563 | ||
| 564 | // travel to the ancestor implementation | 564 | // travel to the ancestor implementation |
| 565 | ClassEntry baseImplementationClassEntry = obfMethodEntry.getClassEntry(); | 565 | ClassEntry baseImplementationClassEntry = obfMethodEntry.getClassEntry(); |
| 566 | for (ClassEntry ancestorClassEntry : m_translationIndex.getAncestry(obfMethodEntry.getClassEntry())) { | 566 | for (ClassEntry ancestorClassEntry : this.translationIndex.getAncestry(obfMethodEntry.getClassEntry())) { |
| 567 | MethodEntry ancestorMethodEntry = new MethodEntry( | 567 | MethodEntry ancestorMethodEntry = new MethodEntry( |
| 568 | new ClassEntry(ancestorClassEntry), | 568 | new ClassEntry(ancestorClassEntry), |
| 569 | obfMethodEntry.getName(), | 569 | obfMethodEntry.getName(), |
| @@ -664,13 +664,13 @@ public class JarIndex { | |||
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | public Collection<EntryReference<FieldEntry, BehaviorEntry>> getFieldReferences(FieldEntry fieldEntry) { | 666 | public Collection<EntryReference<FieldEntry, BehaviorEntry>> getFieldReferences(FieldEntry fieldEntry) { |
| 667 | return m_fieldReferences.get(fieldEntry); | 667 | return this.fieldReferences.get(fieldEntry); |
| 668 | } | 668 | } |
| 669 | 669 | ||
| 670 | public Collection<FieldEntry> getReferencedFields(BehaviorEntry behaviorEntry) { | 670 | public Collection<FieldEntry> getReferencedFields(BehaviorEntry behaviorEntry) { |
| 671 | // linear search is fast enough for now | 671 | // linear search is fast enough for now |
| 672 | Set<FieldEntry> fieldEntries = Sets.newHashSet(); | 672 | Set<FieldEntry> fieldEntries = Sets.newHashSet(); |
| 673 | for (EntryReference<FieldEntry, BehaviorEntry> reference : m_fieldReferences.values()) { | 673 | for (EntryReference<FieldEntry, BehaviorEntry> reference : this.fieldReferences.values()) { |
| 674 | if (reference.context == behaviorEntry) { | 674 | if (reference.context == behaviorEntry) { |
| 675 | fieldEntries.add(reference.entry); | 675 | fieldEntries.add(reference.entry); |
| 676 | } | 676 | } |
| @@ -679,13 +679,13 @@ public class JarIndex { | |||
| 679 | } | 679 | } |
| 680 | 680 | ||
| 681 | public Collection<EntryReference<BehaviorEntry, BehaviorEntry>> getBehaviorReferences(BehaviorEntry behaviorEntry) { | 681 | public Collection<EntryReference<BehaviorEntry, BehaviorEntry>> getBehaviorReferences(BehaviorEntry behaviorEntry) { |
| 682 | return m_behaviorReferences.get(behaviorEntry); | 682 | return this.behaviorReferences.get(behaviorEntry); |
| 683 | } | 683 | } |
| 684 | 684 | ||
| 685 | public Collection<BehaviorEntry> getReferencedBehaviors(BehaviorEntry behaviorEntry) { | 685 | public Collection<BehaviorEntry> getReferencedBehaviors(BehaviorEntry behaviorEntry) { |
| 686 | // linear search is fast enough for now | 686 | // linear search is fast enough for now |
| 687 | Set<BehaviorEntry> behaviorEntries = Sets.newHashSet(); | 687 | Set<BehaviorEntry> behaviorEntries = Sets.newHashSet(); |
| 688 | for (EntryReference<BehaviorEntry, BehaviorEntry> reference : m_behaviorReferences.values()) { | 688 | for (EntryReference<BehaviorEntry, BehaviorEntry> reference : this.behaviorReferences.values()) { |
| 689 | if (reference.context == behaviorEntry) { | 689 | if (reference.context == behaviorEntry) { |
| 690 | behaviorEntries.add(reference.entry); | 690 | behaviorEntries.add(reference.entry); |
| 691 | } | 691 | } |
| @@ -694,27 +694,27 @@ public class JarIndex { | |||
| 694 | } | 694 | } |
| 695 | 695 | ||
| 696 | public Collection<ClassEntry> getInnerClasses(ClassEntry obfOuterClassEntry) { | 696 | public Collection<ClassEntry> getInnerClasses(ClassEntry obfOuterClassEntry) { |
| 697 | return m_innerClassesByOuter.get(obfOuterClassEntry); | 697 | return this.innerClassesByOuter.get(obfOuterClassEntry); |
| 698 | } | 698 | } |
| 699 | 699 | ||
| 700 | public ClassEntry getOuterClass(ClassEntry obfInnerClassEntry) { | 700 | public ClassEntry getOuterClass(ClassEntry obfInnerClassEntry) { |
| 701 | return m_outerClassesByInner.get(obfInnerClassEntry); | 701 | return this.outerClassesByInner.get(obfInnerClassEntry); |
| 702 | } | 702 | } |
| 703 | 703 | ||
| 704 | public boolean isAnonymousClass(ClassEntry obfInnerClassEntry) { | 704 | public boolean isAnonymousClass(ClassEntry obfInnerClassEntry) { |
| 705 | return m_anonymousClasses.containsKey(obfInnerClassEntry); | 705 | return this.anonymousClasses.containsKey(obfInnerClassEntry); |
| 706 | } | 706 | } |
| 707 | 707 | ||
| 708 | public BehaviorEntry getAnonymousClassCaller(ClassEntry obfInnerClassName) { | 708 | public BehaviorEntry getAnonymousClassCaller(ClassEntry obfInnerClassName) { |
| 709 | return m_anonymousClasses.get(obfInnerClassName); | 709 | return this.anonymousClasses.get(obfInnerClassName); |
| 710 | } | 710 | } |
| 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<ClassEntry>(); |
| 715 | interfaces.addAll(m_translationIndex.getInterfaces(classEntry)); | 715 | interfaces.addAll(this.translationIndex.getInterfaces(classEntry)); |
| 716 | for (ClassEntry ancestor : m_translationIndex.getAncestry(classEntry)) { | 716 | for (ClassEntry ancestor : this.translationIndex.getAncestry(classEntry)) { |
| 717 | interfaces.addAll(m_translationIndex.getInterfaces(ancestor)); | 717 | interfaces.addAll(this.translationIndex.getInterfaces(ancestor)); |
| 718 | } | 718 | } |
| 719 | return interfaces; | 719 | return interfaces; |
| 720 | } | 720 | } |
| @@ -723,31 +723,31 @@ public class JarIndex { | |||
| 723 | 723 | ||
| 724 | // linear search is fast enough for now | 724 | // linear search is fast enough for now |
| 725 | Set<String> classNames = Sets.newHashSet(); | 725 | Set<String> classNames = Sets.newHashSet(); |
| 726 | for (Map.Entry<ClassEntry, ClassEntry> entry : m_translationIndex.getClassInterfaces()) { | 726 | for (Map.Entry<ClassEntry, ClassEntry> entry : this.translationIndex.getClassInterfaces()) { |
| 727 | ClassEntry classEntry = entry.getKey(); | 727 | ClassEntry classEntry = entry.getKey(); |
| 728 | ClassEntry interfaceEntry = entry.getValue(); | 728 | ClassEntry interfaceEntry = entry.getValue(); |
| 729 | if (interfaceEntry.getName().equals(targetInterfaceName)) { | 729 | if (interfaceEntry.getName().equals(targetInterfaceName)) { |
| 730 | classNames.add(classEntry.getClassName()); | 730 | classNames.add(classEntry.getClassName()); |
| 731 | m_translationIndex.getSubclassNamesRecursively(classNames, classEntry); | 731 | this.translationIndex.getSubclassNamesRecursively(classNames, classEntry); |
| 732 | } | 732 | } |
| 733 | } | 733 | } |
| 734 | return classNames; | 734 | return classNames; |
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | public boolean isInterface(String className) { | 737 | public boolean isInterface(String className) { |
| 738 | return m_translationIndex.isInterface(new ClassEntry(className)); | 738 | return this.translationIndex.isInterface(new ClassEntry(className)); |
| 739 | } | 739 | } |
| 740 | 740 | ||
| 741 | public boolean containsObfClass(ClassEntry obfClassEntry) { | 741 | public boolean containsObfClass(ClassEntry obfClassEntry) { |
| 742 | return m_obfClassEntries.contains(obfClassEntry); | 742 | return this.obfClassEntries.contains(obfClassEntry); |
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | public boolean containsObfField(FieldEntry obfFieldEntry) { | 745 | public boolean containsObfField(FieldEntry obfFieldEntry) { |
| 746 | return m_access.containsKey(obfFieldEntry); | 746 | return this.access.containsKey(obfFieldEntry); |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | public boolean containsObfBehavior(BehaviorEntry obfBehaviorEntry) { | 749 | public boolean containsObfBehavior(BehaviorEntry obfBehaviorEntry) { |
| 750 | return m_access.containsKey(obfBehaviorEntry); | 750 | return this.access.containsKey(obfBehaviorEntry); |
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | public boolean containsObfArgument(ArgumentEntry obfArgumentEntry) { | 753 | public boolean containsObfArgument(ArgumentEntry obfArgumentEntry) { |
| @@ -776,7 +776,7 @@ public class JarIndex { | |||
| 776 | } | 776 | } |
| 777 | 777 | ||
| 778 | public MethodEntry getBridgedMethod(MethodEntry bridgeMethodEntry) { | 778 | public MethodEntry getBridgedMethod(MethodEntry bridgeMethodEntry) { |
| 779 | return m_bridgedMethods.get(bridgeMethodEntry); | 779 | return this.bridgedMethods.get(bridgeMethodEntry); |
| 780 | } | 780 | } |
| 781 | 781 | ||
| 782 | public List<ClassEntry> getObfClassChain(ClassEntry obfClassEntry) { | 782 | public List<ClassEntry> getObfClassChain(ClassEntry obfClassEntry) { |