mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Merge pull request #3573 from aschackmull/java/private-interface-methods
Java: Fix for private interface methods.
This commit is contained in:
@@ -361,18 +361,23 @@ class Method extends Callable, @method {
|
||||
override MethodAccess getAReference() { result = Callable.super.getAReference() }
|
||||
|
||||
override predicate isPublic() {
|
||||
Callable.super.isPublic() or
|
||||
// JLS 9.4: Every method declaration in the body of an interface is implicitly public.
|
||||
getDeclaringType() instanceof Interface or
|
||||
Callable.super.isPublic()
|
||||
or
|
||||
// JLS 9.4: Every method declaration in the body of an interface without an
|
||||
// access modifier is implicitly public.
|
||||
getDeclaringType() instanceof Interface and
|
||||
not this.isPrivate()
|
||||
or
|
||||
exists(FunctionalExpr func | func.asMethod() = this)
|
||||
}
|
||||
|
||||
override predicate isAbstract() {
|
||||
Callable.super.isAbstract()
|
||||
or
|
||||
// JLS 9.4: An interface method lacking a `default` modifier or a `static` modifier
|
||||
// JLS 9.4: An interface method lacking a `private`, `default`, or `static` modifier
|
||||
// is implicitly abstract.
|
||||
this.getDeclaringType() instanceof Interface and
|
||||
not this.isPrivate() and
|
||||
not this.isDefault() and
|
||||
not this.isStatic()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user