Skip to content

Commit 5f1257b

Browse files
committed
WIP
1 parent fffaa56 commit 5f1257b

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,21 +417,14 @@ class RefType extends Type, Annotatable, Modifiable, @reftype {
417417
/** Gets a direct or indirect supertype of this type, including itself. */
418418
RefType getAnAncestor() { hasDescendant(result, this) }
419419

420-
/**
421-
* Gets a direct or indirect supertype of this type.
422-
* This does not include itself, unless this type is part of a cycle
423-
* in the type hierarchy.
424-
*/
425-
RefType getAStrictAncestor() { result = this.getASupertype().getAnAncestor() }
426-
427420
/**
428421
* Gets a direct or indirect supertype of this type.
429422
* This does not include itself, unless this type is part of a cycle
430423
* in the type hierarchy.
431424
*/
432425
overlay[caller?]
433426
pragma[inline]
434-
RefType getAStrictAncestorI() { result = this.getASupertype().getAnAncestor() }
427+
RefType getAStrictAncestor() { result = this.getASupertype().getAnAncestor() }
435428

436429
/**
437430
* Gets the source declaration of a direct supertype of this type, excluding itself.

java/ql/src/Likely Bugs/Inheritance/NoNonFinalInConstructor.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ where
4747
ma = unqualifiedCallToNonAbstractMethod(c, m) and
4848
// ... there exists an overriding method in a subtype,
4949
n.overrides+(m) and
50-
n.getDeclaringType().getAStrictAncestorI() = c.getDeclaringType() and
50+
n.getDeclaringType().getAStrictAncestor() = c.getDeclaringType() and
5151
// ... the method is in a supertype of c,
5252
m.getDeclaringType() = c.getDeclaringType().getAnAncestor() and
5353
// ... `n` reads a non-final field `f`,
5454
fa = nonFinalFieldRead(n, f) and
5555
// ... which is declared in a subtype of `c`,
56-
f.getDeclaringType().getAStrictAncestorI() = c.getDeclaringType() and
56+
f.getDeclaringType().getAStrictAncestor() = c.getDeclaringType() and
5757
// ... `f` is written only in the subtype constructor, and
5858
fw = fieldWriteOnlyIn(d, f) and
5959
// ... the subtype constructor calls (possibly indirectly) the offending super constructor.

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.getAStrictAncestorI() = masked and
92+
masking.getAStrictAncestor() = masked and
9393
masked = caughtType(try, second) and
9494
forall(RefType thrownType |
9595
thrownType = getAThrownExceptionType(try) and

0 commit comments

Comments
 (0)