diff options
Diffstat (limited to 'src/main/java/cuchaz/enigma/convert/MappingsConverter.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/convert/MappingsConverter.java | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java index 394b8c8..d1daadb 100644 --- a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java +++ b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java | |||
| @@ -151,7 +151,9 @@ public class MappingsConverter { | |||
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | } | 153 | } |
| 154 | destMapping.addInnerClassMapping(migrateClassMapping(obfDestClassEntry, sourceMapping, matches, true)); | 154 | if (destMapping != null) { |
| 155 | destMapping.addInnerClassMapping(migrateClassMapping(obfDestClassEntry, sourceMapping, matches, true)); | ||
| 156 | } | ||
| 155 | } | 157 | } |
| 156 | } | 158 | } |
| 157 | } | 159 | } |
| @@ -160,15 +162,12 @@ public class MappingsConverter { | |||
| 160 | 162 | ||
| 161 | private static ClassMapping migrateClassMapping(ClassEntry newObfClass, ClassMapping oldClassMapping, final ClassMatches matches, boolean useSimpleName) { | 163 | private static ClassMapping migrateClassMapping(ClassEntry newObfClass, ClassMapping oldClassMapping, final ClassMatches matches, boolean useSimpleName) { |
| 162 | 164 | ||
| 163 | ClassNameReplacer replacer = new ClassNameReplacer() { | 165 | ClassNameReplacer replacer = className -> { |
| 164 | @Override | 166 | ClassEntry newClassEntry = matches.getUniqueMatches().get(new ClassEntry(className)); |
| 165 | public String replace(String className) { | 167 | if (newClassEntry != null) { |
| 166 | ClassEntry newClassEntry = matches.getUniqueMatches().get(new ClassEntry(className)); | 168 | return newClassEntry.getName(); |
| 167 | if (newClassEntry != null) { | ||
| 168 | return newClassEntry.getName(); | ||
| 169 | } | ||
| 170 | return null; | ||
| 171 | } | 169 | } |
| 170 | return null; | ||
| 172 | }; | 171 | }; |
| 173 | 172 | ||
| 174 | ClassMapping newClassMapping; | 173 | ClassMapping newClassMapping; |
| @@ -229,7 +228,7 @@ public class MappingsConverter { | |||
| 229 | 228 | ||
| 230 | // non obfuscated classes can be migrated | 229 | // non obfuscated classes can be migrated |
| 231 | ClassEntry classEntry = oldObfType.getClassEntry(); | 230 | ClassEntry classEntry = oldObfType.getClassEntry(); |
| 232 | if (!classEntry.getPackageName().equals(Constants.NonePackage)) { | 231 | if (!classEntry.getPackageName().equals(Constants.NONE_PACKAGE)) { |
| 233 | return true; | 232 | return true; |
| 234 | } | 233 | } |
| 235 | 234 | ||
| @@ -390,7 +389,7 @@ public class MappingsConverter { | |||
| 390 | 389 | ||
| 391 | public static <T extends Entry> MemberMatches<T> computeMemberMatches(Deobfuscator destDeobfuscator, Mappings destMappings, ClassMatches classMatches, Doer<T> doer) { | 390 | public static <T extends Entry> MemberMatches<T> computeMemberMatches(Deobfuscator destDeobfuscator, Mappings destMappings, ClassMatches classMatches, Doer<T> doer) { |
| 392 | 391 | ||
| 393 | MemberMatches<T> memberMatches = new MemberMatches<T>(); | 392 | MemberMatches<T> memberMatches = new MemberMatches<>(); |
| 394 | 393 | ||
| 395 | // unmatched source fields are easy | 394 | // unmatched source fields are easy |
| 396 | MappingsChecker checker = new MappingsChecker(destDeobfuscator.getJarIndex()); | 395 | MappingsChecker checker = new MappingsChecker(destDeobfuscator.getJarIndex()); |
| @@ -481,15 +480,12 @@ public class MappingsConverter { | |||
| 481 | } | 480 | } |
| 482 | 481 | ||
| 483 | private static Type translate(Type type, final BiMap<ClassEntry, ClassEntry> map) { | 482 | private static Type translate(Type type, final BiMap<ClassEntry, ClassEntry> map) { |
| 484 | return new Type(type, new ClassNameReplacer() { | 483 | return new Type(type, inClassName -> { |
| 485 | @Override | 484 | ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); |
| 486 | public String replace(String inClassName) { | 485 | if (outClassEntry == null) { |
| 487 | ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); | 486 | return null; |
| 488 | if (outClassEntry == null) { | ||
| 489 | return null; | ||
| 490 | } | ||
| 491 | return outClassEntry.getName(); | ||
| 492 | } | 487 | } |
| 488 | return outClassEntry.getName(); | ||
| 493 | }); | 489 | }); |
| 494 | } | 490 | } |
| 495 | 491 | ||
| @@ -497,15 +493,12 @@ public class MappingsConverter { | |||
| 497 | if (signature == null) { | 493 | if (signature == null) { |
| 498 | return null; | 494 | return null; |
| 499 | } | 495 | } |
| 500 | return new Signature(signature, new ClassNameReplacer() { | 496 | return new Signature(signature, inClassName -> { |
| 501 | @Override | 497 | ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); |
| 502 | public String replace(String inClassName) { | 498 | if (outClassEntry == null) { |
| 503 | ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); | 499 | return null; |
| 504 | if (outClassEntry == null) { | ||
| 505 | return null; | ||
| 506 | } | ||
| 507 | return outClassEntry.getName(); | ||
| 508 | } | 500 | } |
| 501 | return outClassEntry.getName(); | ||
| 509 | }); | 502 | }); |
| 510 | } | 503 | } |
| 511 | 504 | ||