From 030db77a1ca05181af9570b09cbd7923d51595f4 Mon Sep 17 00:00:00 2001 From: Thog Date: Sat, 13 Aug 2016 18:39:22 +0200 Subject: Fix override issues --- src/main/java/cuchaz/enigma/analysis/TranslationIndex.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java index 275f56c9..94af0311 100644 --- a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java @@ -206,14 +206,20 @@ public class TranslationIndex { public ClassEntry resolveSuperclass(Entry entry) { // this entry could refer to a method on a class where the method is not actually implemented // travel up the inheritance tree to find the closest implementation - while (!entryExists(entry)) { + + // Save the original entry + Entry originalEntry = entry; + + // Scan superclass before main class to avoid missing override issues + ClassEntry superclassEntry = null; + while (superclassEntry == null || !entryExists(entry)) { // is there a parent class? - ClassEntry superclassEntry = getSuperclass(entry.getClassEntry()); + superclassEntry = getSuperclass(entry.getClassEntry()); if (superclassEntry == null) { - // this is probably a method from a class in a library + // this is probably a method from a class in a library or it's in the default class // we can't trace the implementation up any higher unless we index the library - return null; + return entryExists(originalEntry) ? originalEntry.getClassEntry() : null; } // move up to the parent class -- cgit v1.2.3