From 6322b0ec355ab4aaeb8f3987aaf0e074b15d836c Mon Sep 17 00:00:00 2001 From: asiekierka Date: Thu, 18 Aug 2016 14:31:20 +0200 Subject: bridged method fix did not apply to all cases of method implementation finding - this fixes it --- src/main/java/cuchaz/enigma/analysis/JarIndex.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 { private void getRelatedMethodImplementations(Set methodEntries, MethodInheritanceTreeNode node) { MethodEntry methodEntry = node.getMethodEntry(); + if (containsObfBehavior(methodEntry)) { // collect the entry methodEntries.add(methodEntry); } // look at bridged methods! - // FIXME: looks like a hack to me MethodEntry bridgedEntry = getBridgedMethod(methodEntry); while (bridgedEntry != null) { methodEntries.addAll(getRelatedMethodImplementations(bridgedEntry)); @@ -665,6 +665,13 @@ public class JarIndex { methodEntries.add(methodEntry); } + // look at bridged methods! + MethodEntry bridgedEntry = getBridgedMethod(methodEntry); + while (bridgedEntry != null) { + methodEntries.addAll(getRelatedMethodImplementations(bridgedEntry)); + bridgedEntry = getBridgedMethod(bridgedEntry); + } + // recurse for (int i = 0; i < node.getChildCount(); i++) { getRelatedMethodImplementations(methodEntries, (MethodImplementationsTreeNode) node.getChildAt(i)); @@ -728,6 +735,7 @@ public class JarIndex { } public Set getImplementingClasses(String targetInterfaceName) { + // linear search is fast enough for now Set classNames = Sets.newHashSet(); for (Map.Entry entry : this.translationIndex.getClassInterfaces()) { -- cgit v1.2.3