diff options
| author | 2018-11-07 20:18:50 +0100 | |
|---|---|---|
| committer | 2018-11-07 20:18:50 +0100 | |
| commit | be22b07ae28cd8de11e3a32c3766aed6966ec6b5 (patch) | |
| tree | 97f8db1c2bcb129fe4af262bf3df959dd8f97711 /src/main/java/cuchaz/enigma/analysis/JarIndex.java | |
| parent | unify local variable/argument numbering (diff) | |
| download | enigma-fork-be22b07ae28cd8de11e3a32c3766aed6966ec6b5.tar.gz enigma-fork-be22b07ae28cd8de11e3a32c3766aed6966ec6b5.tar.xz enigma-fork-be22b07ae28cd8de11e3a32c3766aed6966ec6b5.zip | |
update Guava, show proper constructor tree node, fix AccessFlags.toString
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/JarIndex.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/JarIndex.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/JarIndex.java index f6338a2..158df4b 100644 --- a/src/main/java/cuchaz/enigma/analysis/JarIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/JarIndex.java | |||
| @@ -30,6 +30,7 @@ public class JarIndex { | |||
| 30 | private Multimap<ClassEntry, MethodDefEntry> methods; | 30 | private Multimap<ClassEntry, MethodDefEntry> methods; |
| 31 | private Multimap<String, MethodDefEntry> methodImplementations; | 31 | private Multimap<String, MethodDefEntry> methodImplementations; |
| 32 | private Multimap<MethodEntry, EntryReference<MethodEntry, MethodDefEntry>> methodsReferencing; | 32 | private Multimap<MethodEntry, EntryReference<MethodEntry, MethodDefEntry>> methodsReferencing; |
| 33 | private Multimap<ClassEntry, EntryReference<ClassEntry, MethodDefEntry>> methodsReferencingClasses; | ||
| 33 | private Multimap<MethodEntry, MethodEntry> methodReferences; | 34 | private Multimap<MethodEntry, MethodEntry> methodReferences; |
| 34 | private Multimap<FieldEntry, EntryReference<FieldEntry, MethodDefEntry>> fieldReferences; | 35 | private Multimap<FieldEntry, EntryReference<FieldEntry, MethodDefEntry>> fieldReferences; |
| 35 | private Multimap<ClassEntry, ClassEntry> innerClassesByOuter; | 36 | private Multimap<ClassEntry, ClassEntry> innerClassesByOuter; |
| @@ -45,6 +46,7 @@ public class JarIndex { | |||
| 45 | this.fields = HashMultimap.create(); | 46 | this.fields = HashMultimap.create(); |
| 46 | this.methods = HashMultimap.create(); | 47 | this.methods = HashMultimap.create(); |
| 47 | this.methodImplementations = HashMultimap.create(); | 48 | this.methodImplementations = HashMultimap.create(); |
| 49 | this.methodsReferencingClasses = HashMultimap.create(); | ||
| 48 | this.methodsReferencing = HashMultimap.create(); | 50 | this.methodsReferencing = HashMultimap.create(); |
| 49 | this.methodReferences = HashMultimap.create(); | 51 | this.methodReferences = HashMultimap.create(); |
| 50 | this.fieldReferences = HashMultimap.create(); | 52 | this.fieldReferences = HashMultimap.create(); |
| @@ -93,6 +95,7 @@ public class JarIndex { | |||
| 93 | EntryRenamer.renameClassesInSet(renames, this.obfClassEntries); | 95 | EntryRenamer.renameClassesInSet(renames, this.obfClassEntries); |
| 94 | this.translationIndex.renameClasses(renames); | 96 | this.translationIndex.renameClasses(renames); |
| 95 | EntryRenamer.renameClassesInMultimap(renames, this.methodImplementations); | 97 | EntryRenamer.renameClassesInMultimap(renames, this.methodImplementations); |
| 98 | EntryRenamer.renameClassesInMultimap(renames, this.methodsReferencingClasses); | ||
| 96 | EntryRenamer.renameClassesInMultimap(renames, this.methodsReferencing); | 99 | EntryRenamer.renameClassesInMultimap(renames, this.methodsReferencing); |
| 97 | EntryRenamer.renameClassesInMultimap(renames, this.methodReferences); | 100 | EntryRenamer.renameClassesInMultimap(renames, this.methodReferences); |
| 98 | EntryRenamer.renameClassesInMultimap(renames, this.fieldReferences); | 101 | EntryRenamer.renameClassesInMultimap(renames, this.fieldReferences); |
| @@ -136,12 +139,16 @@ public class JarIndex { | |||
| 136 | } | 139 | } |
| 137 | 140 | ||
| 138 | protected void indexMethodCall(MethodDefEntry callerEntry, String owner, String name, String desc) { | 141 | protected void indexMethodCall(MethodDefEntry callerEntry, String owner, String name, String desc) { |
| 139 | MethodEntry referencedMethod = new MethodEntry(entryPool.getClass(owner), name, new MethodDescriptor(desc)); | 142 | ClassEntry referencedClass = entryPool.getClass(owner); |
| 143 | MethodEntry referencedMethod = new MethodEntry(referencedClass, name, new MethodDescriptor(desc)); | ||
| 140 | ClassEntry resolvedClassEntry = translationIndex.resolveEntryOwner(referencedMethod); | 144 | ClassEntry resolvedClassEntry = translationIndex.resolveEntryOwner(referencedMethod); |
| 141 | if (resolvedClassEntry != null && !resolvedClassEntry.equals(referencedMethod.getOwnerClassEntry())) { | 145 | if (resolvedClassEntry != null && !resolvedClassEntry.equals(referencedMethod.getOwnerClassEntry())) { |
| 142 | referencedMethod = referencedMethod.updateOwnership(resolvedClassEntry); | 146 | referencedMethod = referencedMethod.updateOwnership(resolvedClassEntry); |
| 143 | } | 147 | } |
| 144 | methodsReferencing.put(referencedMethod, new EntryReference<>(referencedMethod, referencedMethod.getName(), callerEntry)); | 148 | methodsReferencing.put(referencedMethod, new EntryReference<>(referencedMethod, referencedMethod.getName(), callerEntry)); |
| 149 | if (referencedMethod.isConstructor()) { | ||
| 150 | methodsReferencingClasses.put(referencedClass, new EntryReference<>(referencedClass, referencedMethod.getName(), callerEntry)); | ||
| 151 | } | ||
| 145 | methodReferences.put(callerEntry, referencedMethod); | 152 | methodReferences.put(callerEntry, referencedMethod); |
| 146 | } | 153 | } |
| 147 | 154 | ||
| @@ -421,6 +428,10 @@ public class JarIndex { | |||
| 421 | return fieldEntries; | 428 | return fieldEntries; |
| 422 | } | 429 | } |
| 423 | 430 | ||
| 431 | public Collection<EntryReference<ClassEntry, MethodDefEntry>> getMethodsReferencing(ClassEntry classEntry) { | ||
| 432 | return this.methodsReferencingClasses.get(classEntry); | ||
| 433 | } | ||
| 434 | |||
| 424 | public Collection<EntryReference<MethodEntry, MethodDefEntry>> getMethodsReferencing(MethodEntry methodEntry) { | 435 | public Collection<EntryReference<MethodEntry, MethodDefEntry>> getMethodsReferencing(MethodEntry methodEntry) { |
| 425 | return this.methodsReferencing.get(methodEntry); | 436 | return this.methodsReferencing.get(methodEntry); |
| 426 | } | 437 | } |