mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +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 MethodAccess getAReference() { result = Callable.super.getAReference() }
|
||||||
|
|
||||||
override predicate isPublic() {
|
override predicate isPublic() {
|
||||||
Callable.super.isPublic() or
|
Callable.super.isPublic()
|
||||||
// JLS 9.4: Every method declaration in the body of an interface is implicitly public.
|
or
|
||||||
getDeclaringType() instanceof Interface 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)
|
exists(FunctionalExpr func | func.asMethod() = this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override predicate isAbstract() {
|
override predicate isAbstract() {
|
||||||
Callable.super.isAbstract()
|
Callable.super.isAbstract()
|
||||||
or
|
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.
|
// is implicitly abstract.
|
||||||
this.getDeclaringType() instanceof Interface and
|
this.getDeclaringType() instanceof Interface and
|
||||||
|
not this.isPrivate() and
|
||||||
not this.isDefault() and
|
not this.isDefault() and
|
||||||
not this.isStatic()
|
not this.isStatic()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user