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.
This commit is contained in:
Chris Smowton
2022-09-14 16:18:34 +01:00
parent 25b4d485b4
commit 3bdccb38b6

View File

@@ -78,7 +78,7 @@ RefType enclosingInstanceAccess(Expr expr) {
result = ma.getMethod().getDeclaringType() and
not exists(ma.getQualifier()) and
not ma.getMethod().isStatic() and
not exists(Method m | m.getSourceDeclaration() = ma.getMethod() | enclosing.inherits(m))
not enclosing.inherits(ma.getMethod())
)
)
}