|
11 | 11 | import com.ibm.wala.ipa.callgraph.propagation.cfa.CallString;
|
12 | 12 | import com.ibm.wala.ipa.callgraph.propagation.cfa.CallStringContextSelector;
|
13 | 13 | import com.ibm.wala.ssa.SSAInvokeInstruction;
|
| 14 | +import com.ibm.wala.types.MethodReference; |
| 15 | +import com.ibm.wala.types.TypeName; |
14 | 16 | import com.ibm.wala.util.collections.Pair;
|
| 17 | +import com.ibm.wala.util.strings.Atom; |
15 | 18 |
|
16 | 19 | public class Util {
|
17 | 20 |
|
@@ -52,11 +55,28 @@ public static boolean instanceKeyCorrespondsWithInstantiationInstruction(Instanc
|
52 | 55 | CallSiteReference[] callSiteRefs = callString.getCallSiteRefs();
|
53 | 56 |
|
54 | 57 | // for each call site reference.
|
55 |
| - for (CallSiteReference callSiteReference : callSiteRefs) |
| 58 | + for (CallSiteReference callSiteReference : callSiteRefs) { |
| 59 | + CallSiteReference instructionCallSite = instruction.getCallSite(); |
| 60 | + |
56 | 61 | // if the call site reference equals the call site corresponding
|
57 | 62 | // to the creation instruction.
|
58 |
| - if (callSiteReference.equals(instruction.getCallSite())) |
| 63 | + if (callSiteReference.equals(instructionCallSite)) |
59 | 64 | return true;
|
| 65 | + // workaround #80. |
| 66 | + else if (callSiteReference.getProgramCounter() == instructionCallSite.getProgramCounter()) { |
| 67 | + // compare declared targets. |
| 68 | + MethodReference callSiteDeclaredTarget = callSiteReference.getDeclaredTarget(); |
| 69 | + MethodReference instructionCallDeclaredTarget = instructionCallSite.getDeclaredTarget(); |
| 70 | + |
| 71 | + if (callSiteDeclaredTarget.getDeclaringClass().getName() |
| 72 | + .equals(instructionCallDeclaredTarget.getDeclaringClass().getName()) |
| 73 | + && callSiteDeclaredTarget.getDeclaringClass().getName() |
| 74 | + .equals(TypeName.string2TypeName("Ljava/util/Arrays")) |
| 75 | + && callSiteDeclaredTarget.getName().equals(instructionCallDeclaredTarget.getName()) |
| 76 | + && callSiteDeclaredTarget.getName().equals(Atom.findOrCreateAsciiAtom("stream"))) |
| 77 | + return true; |
| 78 | + } |
| 79 | + } |
60 | 80 | }
|
61 | 81 | return false;
|
62 | 82 | }
|
|
0 commit comments