@@ -4,6 +4,7 @@ private import DataFlowUtil
4
4
private import semmle.code.java.dataflow.InstanceAccess
5
5
private import semmle.code.java.dataflow.FlowSummary
6
6
private import semmle.code.java.dispatch.VirtualDispatch as VirtualDispatch
7
+ private import semmle.code.java.dataflow.TypeFlow
7
8
private import semmle.code.java.dispatch.internal.Unification
8
9
9
10
private module DispatchImpl {
@@ -63,15 +64,21 @@ private module DispatchImpl {
63
64
private predicate contextArgHasType ( Call ctx , int i , RefType t , boolean exact ) {
64
65
relevantContext ( ctx , i ) and
65
66
exists ( RefType srctype |
66
- exists ( Expr arg , Expr src |
67
+ exists ( Expr arg |
67
68
i = - 1 and
68
69
ctx .getQualifier ( ) = arg
69
70
or
70
71
ctx .getArgument ( i ) = arg
71
72
|
72
- src = VirtualDispatch:: variableTrack ( arg ) and
73
- srctype = getPreciseType ( src ) and
74
- if src instanceof ClassInstanceExpr then exact = true else exact = false
73
+ exprTypeFlow ( arg , srctype , exact )
74
+ or
75
+ not exprTypeFlow ( arg , _, _) and
76
+ exprUnionTypeFlow ( arg , srctype , exact )
77
+ or
78
+ not exprTypeFlow ( arg , _, _) and
79
+ not exprUnionTypeFlow ( arg , _, _) and
80
+ srctype = getPreciseType ( arg ) and
81
+ if arg instanceof ClassInstanceExpr then exact = true else exact = false
75
82
)
76
83
or
77
84
exists ( Node arg |
0 commit comments