diff options
| author | 2016-08-13 18:39:22 +0200 | |
|---|---|---|
| committer | 2016-08-13 18:39:22 +0200 | |
| commit | 030db77a1ca05181af9570b09cbd7923d51595f4 (patch) | |
| tree | 579f5bf9407f6f3eec349326a25558fe0d6b164c | |
| parent | Remoe JSON directory format support and clean up others things (diff) | |
| download | enigma-030db77a1ca05181af9570b09cbd7923d51595f4.tar.gz enigma-030db77a1ca05181af9570b09cbd7923d51595f4.tar.xz enigma-030db77a1ca05181af9570b09cbd7923d51595f4.zip | |
Fix override issues
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/TranslationIndex.java | 14 |
1 files changed, 10 insertions, 4 deletions
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 { | |||
| 206 | public ClassEntry resolveSuperclass(Entry entry) { | 206 | public ClassEntry resolveSuperclass(Entry entry) { |
| 207 | // this entry could refer to a method on a class where the method is not actually implemented | 207 | // this entry could refer to a method on a class where the method is not actually implemented |
| 208 | // travel up the inheritance tree to find the closest implementation | 208 | // travel up the inheritance tree to find the closest implementation |
| 209 | while (!entryExists(entry)) { | 209 | |
| 210 | // Save the original entry | ||
| 211 | Entry originalEntry = entry; | ||
| 212 | |||
| 213 | // Scan superclass before main class to avoid missing override issues | ||
| 214 | ClassEntry superclassEntry = null; | ||
| 215 | while (superclassEntry == null || !entryExists(entry)) { | ||
| 210 | 216 | ||
| 211 | // is there a parent class? | 217 | // is there a parent class? |
| 212 | ClassEntry superclassEntry = getSuperclass(entry.getClassEntry()); | 218 | superclassEntry = getSuperclass(entry.getClassEntry()); |
| 213 | if (superclassEntry == null) { | 219 | if (superclassEntry == null) { |
| 214 | // this is probably a method from a class in a library | 220 | // this is probably a method from a class in a library or it's in the default class |
| 215 | // we can't trace the implementation up any higher unless we index the library | 221 | // we can't trace the implementation up any higher unless we index the library |
| 216 | return null; | 222 | return entryExists(originalEntry) ? originalEntry.getClassEntry() : null; |
| 217 | } | 223 | } |
| 218 | 224 | ||
| 219 | // move up to the parent class | 225 | // move up to the parent class |