@@ -326,18 +326,24 @@ class LambdaCallKind = Method; // the "apply" method in the functional interface
326326
327327/** Holds if `creation` is an expression that creates a lambda of kind `kind` for `c`. */
328328predicate lambdaCreation ( Node creation , LambdaCallKind kind , DataFlowCallable c ) {
329- exists ( FunctionalExpr func , FunctionalInterface interface |
329+ exists ( ClassInstanceExpr func , Interface t , FunctionalInterface interface |
330330 creation .asExpr ( ) = func and
331- func .asMethod ( ) = c and
332- func .getType ( ) .( RefType ) .getSourceDeclaration ( ) = interface and
333- kind = interface .getRunMethod ( )
331+ func .getAnonymousClass ( ) .getAMethod ( ) = c and
332+ func .getConstructedType ( ) .extendsOrImplements + ( t ) and
333+ t .getSourceDeclaration ( ) = interface and
334+ c .( Method ) .overridesOrInstantiates + ( pragma [ only_bind_into ] ( kind ) ) and
335+ pragma [ only_bind_into ] ( kind ) = interface .getRunMethod ( ) .getSourceDeclaration ( )
334336 )
335337}
336338
337339/** Holds if `call` is a lambda call of kind `kind` where `receiver` is the lambda expression. */
338340predicate lambdaCall ( DataFlowCall call , LambdaCallKind kind , Node receiver ) {
339341 receiver = call .( SummaryCall ) .getReceiver ( ) and
340- getNodeDataFlowType ( receiver ) .getSourceDeclaration ( ) .( FunctionalInterface ) .getRunMethod ( ) = kind
342+ getNodeDataFlowType ( receiver )
343+ .getSourceDeclaration ( )
344+ .( FunctionalInterface )
345+ .getRunMethod ( )
346+ .getSourceDeclaration ( ) = kind
341347}
342348
343349/** Extra data-flow steps needed for lambda flow analysis. */
0 commit comments