@@ -746,46 +746,26 @@ private void discoverPossibleSideEffects(EclipseProjectAnalysisEngine<InstanceKe
746
746
continue ;
747
747
748
748
CallStringWithReceivers callString = Util .getCallString (instance );
749
- CallSiteReference [] callSiteRefs = callString .getCallSiteRefs ();
750
- assert callSiteRefs .length == 2 : "Expecting call sites two-deep." ;
749
+ assert callString .getMethods ().length >= 1 : "Expecting call sites at least one-deep." ;
751
750
752
- // get the target of the caller.
753
- MethodReference callerDeclaredTarget = callSiteRefs [1 ].getDeclaredTarget ();
754
-
755
- // get it's IR.
756
- IMethod callerTargetMethod = engine .getClassHierarchy ().resolveMethod (callerDeclaredTarget );
757
- boolean fallback = false ;
758
-
759
- if (callerTargetMethod == null ) {
760
- LOGGER .warning ("Cannot resolve caller declared target method: " + callerDeclaredTarget );
761
-
762
- // fall back.
763
- callerTargetMethod = callString .getMethods ()[1 ];
764
- LOGGER .warning ("Falling back to method: " + callerTargetMethod );
765
- fallback = true ;
766
- }
767
-
768
- IR ir = engine .getCache ().getIR (callerTargetMethod );
751
+ IR ir = engine .getCache ().getIR (callString .getMethods ()[0 ]);
769
752
770
753
if (ir == null ) {
771
- LOGGER .warning ("Can't find IR for target: " + callerTargetMethod );
754
+ LOGGER .warning ("Can't find IR for target: " + callString . getMethods ()[ 0 ] );
772
755
continue ; // next instance.
773
756
}
774
757
775
758
// get calls to the caller target.
776
- // if we are falling back, use index 1, otherwise stick with index
777
- // 0.
778
- int callSiteRefsInx = fallback ? 1 : 0 ;
779
- SSAAbstractInvokeInstruction [] calls = ir .getCalls (callSiteRefs [callSiteRefsInx ]);
759
+ SSAAbstractInvokeInstruction [] calls = ir .getCalls (callString .getCallSiteRefs ()[0 ]);
780
760
assert calls .length == 1 : "Are we only expecting one call here?" ;
781
761
782
762
// I guess we're only interested in ones with a single behavioral
783
763
// parameter (the first parameter is implicit).
784
764
if (calls [0 ].getNumberOfUses () == 2 ) {
785
765
// get the use of the first parameter.
786
766
int use = calls [0 ].getUse (1 );
787
- this .discoverLambdaSideEffects (engine , mod , Collections .singleton (instance ), callerDeclaredTarget , ir ,
788
- use );
767
+ this .discoverLambdaSideEffects (engine , mod , Collections .singleton (instance ),
768
+ callString . getMethods ()[ 0 ]. getReference (), ir , use );
789
769
}
790
770
}
791
771
}
0 commit comments