diff options
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 | ||