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) {
440440 )
441441}
442442
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+
443455/**
444456 * Holds if `n` has type `t` and this information is discarded, such that `t`
445457 * 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) {
452464 downcastSuccessor ( n .asExpr ( ) , srctype ) or
453465 instanceOfGuarded ( n .asExpr ( ) , srctype ) or
454466 arrayInstanceOfGuarded ( n .asExpr ( ) , srctype ) or
455- n .asExpr ( ) .( FunctionalExpr ) .getConstructedType ( ) = srctype
467+ n .asExpr ( ) .( FunctionalExpr ) .getConstructedType ( ) = srctype or
468+ superAccess ( n .asExpr ( ) , srctype )
456469 |
457470 t = srctype .( BoundedType ) .getAnUltimateUpperBoundType ( )
458471 or
You can’t perform that action at this time.
0 commit comments