Skip to content

Commit

Permalink
Ensure the root method is used when mapping specialized methods (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Sep 12, 2022
1 parent 84a9cbd commit bfc47f1
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cuchaz.enigma.command;

import cuchaz.enigma.ProgressListener;
import cuchaz.enigma.analysis.IndexTreeBuilder;
import cuchaz.enigma.analysis.index.BridgeMethodIndex;
import cuchaz.enigma.analysis.index.JarIndex;
import cuchaz.enigma.classprovider.CachingClassProvider;
Expand Down Expand Up @@ -53,6 +54,7 @@ public static void run(Path jar, String sourceFormat, Path sourcePath, String re

BridgeMethodIndex bridgeMethodIndex = jarIndex.getBridgeMethodIndex();
Translator translator = new MappingTranslator(source, jarIndex.getEntryResolver());
IndexTreeBuilder indexTreeBuilder = new IndexTreeBuilder(jarIndex);

// Copy all non-specialized methods
for (EntryTreeNode<EntryMapping> node : source) {
Expand All @@ -64,7 +66,7 @@ public static void run(Path jar, String sourceFormat, Path sourcePath, String re
// Add correct mappings for specialized methods
for (Map.Entry<MethodEntry, MethodEntry> entry : bridgeMethodIndex.getBridgeToSpecialized().entrySet()) {
MethodEntry bridge = entry.getKey();
MethodEntry specialized = entry.getValue();
MethodEntry specialized = indexTreeBuilder.buildMethodInheritance(translator, entry.getValue()).getMethodEntry();
String name = translator.translate(bridge).getName();
result.insert(specialized, new EntryMapping(name));
}
Expand Down

0 comments on commit bfc47f1

Please sign in to comment.