mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
Merge pull request #7552 from smowton/smowton/fix/local-parameterized-classes
Note that parameterizations of local classes are themselves local
This commit is contained in:
@@ -905,7 +905,7 @@ class Interface extends ClassOrInterface, @interface {
|
||||
/** A class or interface. */
|
||||
class ClassOrInterface extends RefType, @classorinterface {
|
||||
/** Holds if this class or interface is local. */
|
||||
predicate isLocal() { isLocalClassOrInterface(this, _) }
|
||||
predicate isLocal() { isLocalClassOrInterface(this.getSourceDeclaration(), _) }
|
||||
|
||||
/** Holds if this class or interface is package protected, that is, neither public nor private nor protected. */
|
||||
predicate isPackageProtected() {
|
||||
|
||||
11
java/ql/test/library-tests/localclasses/Test.java
Normal file
11
java/ql/test/library-tests/localclasses/Test.java
Normal file
@@ -0,0 +1,11 @@
|
||||
public class Test {
|
||||
|
||||
public static void method() {
|
||||
|
||||
class GenericLocal<T> { }
|
||||
|
||||
GenericLocal<Integer> instantiated = new GenericLocal<>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
2
java/ql/test/library-tests/localclasses/test.expected
Normal file
2
java/ql/test/library-tests/localclasses/test.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
| Test$1GenericLocal.class:0:0:0:0 | GenericLocal<Integer> |
|
||||
| Test.java:5:11:5:22 | GenericLocal |
|
||||
7
java/ql/test/library-tests/localclasses/test.ql
Normal file
7
java/ql/test/library-tests/localclasses/test.ql
Normal file
@@ -0,0 +1,7 @@
|
||||
import java
|
||||
|
||||
from ClassOrInterface ci
|
||||
where
|
||||
ci.getSourceDeclaration().fromSource() and
|
||||
ci.isLocal()
|
||||
select ci
|
||||
Reference in New Issue
Block a user