summaryrefslogtreecommitdiff
path: root/src/main/java/cuchaz/enigma/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cuchaz/enigma/analysis')
-rw-r--r--src/main/java/cuchaz/enigma/analysis/index/BridgeMethodIndex.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/index/BridgeMethodIndex.java b/src/main/java/cuchaz/enigma/analysis/index/BridgeMethodIndex.java
index 8a9b459..a4b1aac 100644
--- a/src/main/java/cuchaz/enigma/analysis/index/BridgeMethodIndex.java
+++ b/src/main/java/cuchaz/enigma/analysis/index/BridgeMethodIndex.java
@@ -1,7 +1,6 @@
1package cuchaz.enigma.analysis.index; 1package cuchaz.enigma.analysis.index;
2 2
3import com.google.common.collect.Maps; 3import com.google.common.collect.Maps;
4import com.google.common.collect.Sets;
5import cuchaz.enigma.translation.representation.AccessFlags; 4import cuchaz.enigma.translation.representation.AccessFlags;
6import cuchaz.enigma.translation.representation.MethodDescriptor; 5import cuchaz.enigma.translation.representation.MethodDescriptor;
7import cuchaz.enigma.translation.representation.TypeDescriptor; 6import cuchaz.enigma.translation.representation.TypeDescriptor;
@@ -17,7 +16,7 @@ public class BridgeMethodIndex implements JarIndexer {
17 private final InheritanceIndex inheritanceIndex; 16 private final InheritanceIndex inheritanceIndex;
18 private final ReferenceIndex referenceIndex; 17 private final ReferenceIndex referenceIndex;
19 18
20 private final Set<MethodEntry> bridgeToSpecialized = Sets.newHashSet(); 19 private final Map<MethodEntry, MethodEntry> bridgeToSpecialized = Maps.newHashMap();
21 private final Map<MethodEntry, MethodEntry> specializedToBridge = Maps.newHashMap(); 20 private final Map<MethodEntry, MethodEntry> specializedToBridge = Maps.newHashMap();
22 21
23 public BridgeMethodIndex(EntryIndex entryIndex, InheritanceIndex inheritanceIndex, ReferenceIndex referenceIndex) { 22 public BridgeMethodIndex(EntryIndex entryIndex, InheritanceIndex inheritanceIndex, ReferenceIndex referenceIndex) {
@@ -52,7 +51,6 @@ public class BridgeMethodIndex implements JarIndexer {
52 } 51 }
53 52
54 MethodEntry renamedSpecializedEntry = specializedEntry.withName(bridgeEntry.getName()); 53 MethodEntry renamedSpecializedEntry = specializedEntry.withName(bridgeEntry.getName());
55 bridgeToSpecialized.add(renamedSpecializedEntry);
56 specializedToBridge.put(renamedSpecializedEntry, specializedToBridge.get(specializedEntry)); 54 specializedToBridge.put(renamedSpecializedEntry, specializedToBridge.get(specializedEntry));
57 } 55 }
58 } 56 }
@@ -64,7 +62,7 @@ public class BridgeMethodIndex implements JarIndexer {
64 } 62 }
65 63
66 if (access.isBridge() || isPotentialBridge(syntheticMethod, specializedMethod)) { 64 if (access.isBridge() || isPotentialBridge(syntheticMethod, specializedMethod)) {
67 bridgeToSpecialized.add(syntheticMethod); 65 bridgeToSpecialized.put(syntheticMethod, specializedMethod);
68 specializedToBridge.put(specializedMethod, syntheticMethod); 66 specializedToBridge.put(specializedMethod, syntheticMethod);
69 } 67 }
70 } 68 }
@@ -130,7 +128,7 @@ public class BridgeMethodIndex implements JarIndexer {
130 } 128 }
131 129
132 public boolean isBridgeMethod(MethodEntry entry) { 130 public boolean isBridgeMethod(MethodEntry entry) {
133 return bridgeToSpecialized.contains(entry); 131 return bridgeToSpecialized.containsKey(entry);
134 } 132 }
135 133
136 public boolean isSpecializedMethod(MethodEntry entry) { 134 public boolean isSpecializedMethod(MethodEntry entry) {
@@ -142,7 +140,17 @@ public class BridgeMethodIndex implements JarIndexer {
142 return specializedToBridge.get(specialized); 140 return specializedToBridge.get(specialized);
143 } 141 }
144 142
143 public MethodEntry getSpecializedFromBridge(MethodEntry bridge) {
144 return bridgeToSpecialized.get(bridge);
145 }
146
147 /** Includes "renamed specialized -> bridge" entries. */
145 public Map<MethodEntry, MethodEntry> getSpecializedToBridge() { 148 public Map<MethodEntry, MethodEntry> getSpecializedToBridge() {
146 return Collections.unmodifiableMap(specializedToBridge); 149 return Collections.unmodifiableMap(specializedToBridge);
147 } 150 }
151
152 /** Only "bridge -> original name" entries. **/
153 public Map<MethodEntry, MethodEntry> getBridgeToSpecialized() {
154 return Collections.unmodifiableMap(bridgeToSpecialized);
155 }
148} 156}