Skip to content

Commit 3bdccb3

Browse files
committed
Adapt inner-class-could-be-static query now that specialised methods are callable via an implicit this qualifier.
Previously such a call always targeted the unbound method, so we checked for an inherited method that could be a specialisation thereof; now we expect it should be directly inherited.
1 parent 25b4d48 commit 3bdccb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

java/ql/src/Performance/InnerClassCouldBeStatic.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ RefType enclosingInstanceAccess(Expr expr) {
7878
result = ma.getMethod().getDeclaringType() and
7979
not exists(ma.getQualifier()) and
8080
not ma.getMethod().isStatic() and
81-
not exists(Method m | m.getSourceDeclaration() = ma.getMethod() | enclosing.inherits(m))
81+
not enclosing.inherits(ma.getMethod())
8282
)
8383
)
8484
}

0 commit comments

Comments
 (0)