diff options
| author | 2016-08-14 18:00:20 +0200 | |
|---|---|---|
| committer | 2016-08-14 18:00:20 +0200 | |
| commit | 9c1e37241a5fac55cc51de1daab14371a8a81cf7 (patch) | |
| tree | a6f70610402de422a5ffc2d6734c0e941318dc39 | |
| parent | Make sure to rewrite all the mapping files (diff) | |
| download | enigma-9c1e37241a5fac55cc51de1daab14371a8a81cf7.tar.gz enigma-9c1e37241a5fac55cc51de1daab14371a8a81cf7.tar.xz enigma-9c1e37241a5fac55cc51de1daab14371a8a81cf7.zip | |
Fix remapping of methods in children class with interfaces
| -rw-r--r-- | src/main/java/cuchaz/enigma/analysis/TranslationIndex.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java index 9f751083..921fff44 100644 --- a/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/TranslationIndex.java | |||
| @@ -94,6 +94,7 @@ public class TranslationIndex { | |||
| 94 | for (String interfaceClassName : c.getClassFile().getInterfaces()) { | 94 | for (String interfaceClassName : c.getClassFile().getInterfaces()) { |
| 95 | ClassEntry interfaceClassEntry = new ClassEntry(Descriptor.toJvmName(interfaceClassName)); | 95 | ClassEntry interfaceClassEntry = new ClassEntry(Descriptor.toJvmName(interfaceClassName)); |
| 96 | if (!isJre(interfaceClassEntry)) { | 96 | if (!isJre(interfaceClassEntry)) { |
| 97 | |||
| 97 | this.interfaces.put(classEntry, interfaceClassEntry); | 98 | this.interfaces.put(classEntry, interfaceClassEntry); |
| 98 | } | 99 | } |
| 99 | } | 100 | } |
| @@ -218,12 +219,18 @@ public class TranslationIndex { | |||
| 218 | 219 | ||
| 219 | // Get all possible superclasses and reverse the list | 220 | // Get all possible superclasses and reverse the list |
| 220 | List<ClassEntry> superclasses = Lists.reverse(getAncestry(originalEntry.getClassEntry())); | 221 | List<ClassEntry> superclasses = Lists.reverse(getAncestry(originalEntry.getClassEntry())); |
| 222 | |||
| 221 | boolean existInEntry = false; | 223 | boolean existInEntry = false; |
| 222 | 224 | ||
| 223 | for (ClassEntry classEntry : superclasses) | 225 | for (ClassEntry classEntry : superclasses) |
| 224 | { | 226 | { |
| 225 | entry = entry.cloneToNewClass(classEntry); | 227 | entry = entry.cloneToNewClass(classEntry); |
| 226 | existInEntry = entryExists(entry); | 228 | existInEntry = entryExists(entry); |
| 229 | |||
| 230 | // Check for possible entry in interfaces of superclasses | ||
| 231 | ClassEntry interfaceEntry = resolveInterface(entry); | ||
| 232 | if (interfaceEntry != null) | ||
| 233 | return interfaceEntry; | ||
| 227 | if (existInEntry) | 234 | if (existInEntry) |
| 228 | break; | 235 | break; |
| 229 | } | 236 | } |
| @@ -258,6 +265,7 @@ public class TranslationIndex { | |||
| 258 | public ClassEntry resolveInterface(Entry entry) { | 265 | public ClassEntry resolveInterface(Entry entry) { |
| 259 | // the interfaces for any class is a forest | 266 | // the interfaces for any class is a forest |
| 260 | // so let's look at all the trees | 267 | // so let's look at all the trees |
| 268 | |||
| 261 | for (ClassEntry interfaceEntry : this.interfaces.get(entry.getClassEntry())) { | 269 | for (ClassEntry interfaceEntry : this.interfaces.get(entry.getClassEntry())) { |
| 262 | ClassEntry resolvedClassEntry = resolveSuperclass(entry.cloneToNewClass(interfaceEntry)); | 270 | ClassEntry resolvedClassEntry = resolveSuperclass(entry.cloneToNewClass(interfaceEntry)); |
| 263 | if (resolvedClassEntry != null) { | 271 | if (resolvedClassEntry != null) { |