diff --git a/java/ql/src/semmle/code/java/Type.qll b/java/ql/src/semmle/code/java/Type.qll index 7f48467ad9b..10d9b8b3a31 100755 --- a/java/ql/src/semmle/code/java/Type.qll +++ b/java/ql/src/semmle/code/java/Type.qll @@ -599,6 +599,13 @@ class Class extends RefType, @class { /** Holds if this class is a local class. */ predicate isLocal() { isLocalClass(this, _) } + /** Holds if this class is package protected, that is, neither public nor private nor protected. */ + predicate isPackageProtected() { + not isPrivate() and + not isProtected() and + not isPublic() + } + override RefType getSourceDeclaration() { classes(this, _, _, result) } /** @@ -816,6 +823,13 @@ class Interface extends RefType, @interface { any() } + /** Holds if this interface is package protected, that is, neither public nor private nor protected. */ + predicate isPackageProtected() { + not isPrivate() and + not isProtected() and + not isPublic() + } + override string getAPrimaryQlClass() { result = "Interface" } }