diff options
| author | 2018-10-25 00:01:49 +0200 | |
|---|---|---|
| committer | 2018-10-25 00:01:49 +0200 | |
| commit | 9274c5c862e6a38b37ff2d11f468a6a98cc47daf (patch) | |
| tree | 0d4cb774e77848112368a12bba42c7be0ed1f8fb /src/main/java/cuchaz/enigma/analysis/JarIndex.java | |
| parent | Merge pull request #62 from OpenModLoader/asm (diff) | |
| parent | recursively check ClassMapping dirty state (diff) | |
| download | enigma-fork-9274c5c862e6a38b37ff2d11f468a6a98cc47daf.tar.gz enigma-fork-9274c5c862e6a38b37ff2d11f468a6a98cc47daf.tar.xz enigma-fork-9274c5c862e6a38b37ff2d11f468a6a98cc47daf.zip | |
make rebuild method names discard child-only names. imperfect, but eh
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis/JarIndex.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/JarIndex.java | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/JarIndex.java index 5917a32..64ea795 100644 --- a/src/main/java/cuchaz/enigma/analysis/JarIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/JarIndex.java | |||
| @@ -268,13 +268,34 @@ public class JarIndex { | |||
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | public MethodInheritanceTreeNode getMethodInheritance(Translator deobfuscatingTranslator, MethodEntry obfMethodEntry) { | 270 | public MethodInheritanceTreeNode getMethodInheritance(Translator deobfuscatingTranslator, MethodEntry obfMethodEntry) { |
| 271 | |||
| 272 | // travel to the ancestor implementation | 271 | // travel to the ancestor implementation |
| 272 | LinkedList<ClassEntry> entries = new LinkedList<>(); | ||
| 273 | entries.add(obfMethodEntry.getOwnerClassEntry()); | ||
| 274 | |||
| 275 | // TODO: This could be optimized to not go through interfaces repeatedly... | ||
| 276 | |||
| 273 | ClassEntry baseImplementationClassEntry = obfMethodEntry.getOwnerClassEntry(); | 277 | ClassEntry baseImplementationClassEntry = obfMethodEntry.getOwnerClassEntry(); |
| 274 | for (ClassEntry ancestorClassEntry : this.translationIndex.getAncestry(obfMethodEntry.getOwnerClassEntry())) { | 278 | |
| 279 | for (ClassEntry itf : getInterfaces(obfMethodEntry.getOwnerClassEntry().getClassName())) { | ||
| 280 | MethodEntry itfMethodEntry = entryPool.getMethod(itf, obfMethodEntry.getName(), obfMethodEntry.getDesc().toString()); | ||
| 281 | if (itfMethodEntry != null && containsObfMethod(itfMethodEntry)) { | ||
| 282 | baseImplementationClassEntry = itf; | ||
| 283 | } | ||
| 284 | } | ||
| 285 | |||
| 286 | for (ClassEntry ancestorClassEntry : this.translationIndex.getAncestry(entries.remove())) { | ||
| 275 | MethodEntry ancestorMethodEntry = entryPool.getMethod(ancestorClassEntry, obfMethodEntry.getName(), obfMethodEntry.getDesc().toString()); | 287 | MethodEntry ancestorMethodEntry = entryPool.getMethod(ancestorClassEntry, obfMethodEntry.getName(), obfMethodEntry.getDesc().toString()); |
| 276 | if (ancestorMethodEntry != null && containsObfMethod(ancestorMethodEntry)) { | 288 | if (ancestorMethodEntry != null) { |
| 277 | baseImplementationClassEntry = ancestorClassEntry; | 289 | if (containsObfMethod(ancestorMethodEntry)) { |
| 290 | baseImplementationClassEntry = ancestorClassEntry; | ||
| 291 | } | ||
| 292 | |||
| 293 | for (ClassEntry itf : getInterfaces(ancestorClassEntry.getClassName())) { | ||
| 294 | MethodEntry itfMethodEntry = entryPool.getMethod(itf, obfMethodEntry.getName(), obfMethodEntry.getDesc().toString()); | ||
| 295 | if (itfMethodEntry != null && containsObfMethod(itfMethodEntry)) { | ||
| 296 | baseImplementationClassEntry = itf; | ||
| 297 | } | ||
| 298 | } | ||
| 278 | } | 299 | } |
| 279 | } | 300 | } |
| 280 | 301 | ||