Skip to content

Commit f91c71c

Browse files
authored
Merge pull request #5270 from Marcono1234/marcono1234/class-isPackageProtected
Java: Add Class and Interface.isPackageProtected()
2 parents 7ca57fd + fa189de commit f91c71c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

java/ql/src/semmle/code/java/Type.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,13 @@ class Class extends RefType, @class {
599599
/** Holds if this class is a local class. */
600600
predicate isLocal() { isLocalClass(this, _) }
601601

602+
/** Holds if this class is package protected, that is, neither public nor private nor protected. */
603+
predicate isPackageProtected() {
604+
not isPrivate() and
605+
not isProtected() and
606+
not isPublic()
607+
}
608+
602609
override RefType getSourceDeclaration() { classes(this, _, _, result) }
603610

604611
/**
@@ -816,6 +823,13 @@ class Interface extends RefType, @interface {
816823
any()
817824
}
818825

826+
/** Holds if this interface is package protected, that is, neither public nor private nor protected. */
827+
predicate isPackageProtected() {
828+
not isPrivate() and
829+
not isProtected() and
830+
not isPublic()
831+
}
832+
819833
override string getAPrimaryQlClass() { result = "Interface" }
820834
}
821835

0 commit comments

Comments
 (0)