File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
java/ql/lib/semmle/code/java/dataflow Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,18 @@ predicate arrayInstanceOfGuarded(ArrayAccess aa, RefType t) {
440
440
)
441
441
}
442
442
443
+ /**
444
+ * Holds if `t` is the type of the `this` value corresponding to the the
445
+ * `SuperAccess`. As the `SuperAccess` expression has the type of the supertype,
446
+ * the type `t` is a stronger type bound.
447
+ */
448
+ private predicate superAccess ( SuperAccess sup , RefType t ) {
449
+ sup .isEnclosingInstanceAccess ( t )
450
+ or
451
+ sup .isOwnInstanceAccess ( ) and
452
+ t = sup .getEnclosingCallable ( ) .getDeclaringType ( )
453
+ }
454
+
443
455
/**
444
456
* Holds if `n` has type `t` and this information is discarded, such that `t`
445
457
* might be a better type bound for nodes where `n` flows to. This might include
@@ -452,7 +464,8 @@ private predicate typeFlowBaseCand(TypeFlowNode n, RefType t) {
452
464
downcastSuccessor ( n .asExpr ( ) , srctype ) or
453
465
instanceOfGuarded ( n .asExpr ( ) , srctype ) or
454
466
arrayInstanceOfGuarded ( n .asExpr ( ) , srctype ) or
455
- n .asExpr ( ) .( FunctionalExpr ) .getConstructedType ( ) = srctype
467
+ n .asExpr ( ) .( FunctionalExpr ) .getConstructedType ( ) = srctype or
468
+ superAccess ( n .asExpr ( ) , srctype )
456
469
|
457
470
t = srctype .( BoundedType ) .getAnUltimateUpperBoundType ( )
458
471
or
You can’t perform that action at this time.
0 commit comments