Skip to content

Commit dc163b5

Browse files
committed
Fix java/unreachable-catch-clause regression
1 parent 097bc19 commit dc163b5

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

java/ql/lib/semmle/code/java/Type.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,15 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
424424
*/
425425
RefType getAStrictAncestor() { result = this.getASupertype().getAnAncestor() }
426426

427+
/**
428+
* Gets a direct or indirect supertype of this type.
429+
* This does not include itself, unless this type is part of a cycle
430+
* in the type hierarchy.
431+
*/
432+
overlay[caller?]
433+
pragma[inline]
434+
RefType getAStrictAncestorI() { result = this.getASupertype().getAnAncestor() }
435+
427436
/**
428437
* Gets the source declaration of a direct supertype of this type, excluding itself.
429438
*

java/ql/src/Likely Bugs/Statements/PartiallyMaskedCatch.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ from TryStmt try, int first, int second, RefType masking, RefType masked, string
8989
where
9090
try.getFile().isJavaSourceFile() and
9191
masking = caughtType(try, first) and
92-
masking.getAStrictAncestor() = masked and
92+
masking.getAStrictAncestorI() = masked and
9393
masked = caughtType(try, second) and
9494
forall(RefType thrownType |
9595
thrownType = getAThrownExceptionType(try) and

0 commit comments

Comments
 (0)