summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar asiekierka2016-08-18 14:31:20 +0200
committerGravatar asiekierka2016-08-18 14:31:20 +0200
commit6322b0ec355ab4aaeb8f3987aaf0e074b15d836c (patch)
tree07e3ac758a62dcaa5cd8b11afc525f2f98567db1
parentfix #4 by adding bridge checks to related method implementation scanning - pl... (diff)
downloadenigma-6322b0ec355ab4aaeb8f3987aaf0e074b15d836c.tar.gz
enigma-6322b0ec355ab4aaeb8f3987aaf0e074b15d836c.tar.xz
enigma-6322b0ec355ab4aaeb8f3987aaf0e074b15d836c.zip
bridged method fix did not apply to all cases of method implementation finding - this fixes it
-rw-r--r--src/main/java/cuchaz/enigma/analysis/JarIndex.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/cuchaz/enigma/analysis/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/JarIndex.java
index ddfdbd69..b274a7d3 100644
--- a/src/main/java/cuchaz/enigma/analysis/JarIndex.java
+++ b/src/main/java/cuchaz/enigma/analysis/JarIndex.java
@@ -634,13 +634,13 @@ public class JarIndex {
634 634
635 private void getRelatedMethodImplementations(Set<MethodEntry> methodEntries, MethodInheritanceTreeNode node) { 635 private void getRelatedMethodImplementations(Set<MethodEntry> methodEntries, MethodInheritanceTreeNode node) {
636 MethodEntry methodEntry = node.getMethodEntry(); 636 MethodEntry methodEntry = node.getMethodEntry();
637
637 if (containsObfBehavior(methodEntry)) { 638 if (containsObfBehavior(methodEntry)) {
638 // collect the entry 639 // collect the entry
639 methodEntries.add(methodEntry); 640 methodEntries.add(methodEntry);
640 } 641 }
641 642
642 // look at bridged methods! 643 // look at bridged methods!
643 // FIXME: looks like a hack to me
644 MethodEntry bridgedEntry = getBridgedMethod(methodEntry); 644 MethodEntry bridgedEntry = getBridgedMethod(methodEntry);
645 while (bridgedEntry != null) { 645 while (bridgedEntry != null) {
646 methodEntries.addAll(getRelatedMethodImplementations(bridgedEntry)); 646 methodEntries.addAll(getRelatedMethodImplementations(bridgedEntry));
@@ -665,6 +665,13 @@ public class JarIndex {
665 methodEntries.add(methodEntry); 665 methodEntries.add(methodEntry);
666 } 666 }
667 667
668 // look at bridged methods!
669 MethodEntry bridgedEntry = getBridgedMethod(methodEntry);
670 while (bridgedEntry != null) {
671 methodEntries.addAll(getRelatedMethodImplementations(bridgedEntry));
672 bridgedEntry = getBridgedMethod(bridgedEntry);
673 }
674
668 // recurse 675 // recurse
669 for (int i = 0; i < node.getChildCount(); i++) { 676 for (int i = 0; i < node.getChildCount(); i++) {
670 getRelatedMethodImplementations(methodEntries, (MethodImplementationsTreeNode) node.getChildAt(i)); 677 getRelatedMethodImplementations(methodEntries, (MethodImplementationsTreeNode) node.getChildAt(i));
@@ -728,6 +735,7 @@ public class JarIndex {
728 } 735 }
729 736
730 public Set<String> getImplementingClasses(String targetInterfaceName) { 737 public Set<String> getImplementingClasses(String targetInterfaceName) {
738
731 // linear search is fast enough for now 739 // linear search is fast enough for now
732 Set<String> classNames = Sets.newHashSet(); 740 Set<String> classNames = Sets.newHashSet();
733 for (Map.Entry<ClassEntry, ClassEntry> entry : this.translationIndex.getClassInterfaces()) { 741 for (Map.Entry<ClassEntry, ClassEntry> entry : this.translationIndex.getClassInterfaces()) {