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:
Anders Schack-Mulligen
2022-01-11 09:36:15 +01:00
committed by GitHub
4 changed files with 21 additions and 1 deletions

View File

@@ -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() {

View File

@@ -0,0 +1,11 @@
public class Test {
public static void method() {
class GenericLocal<T> { }
GenericLocal<Integer> instantiated = new GenericLocal<>();
}
}

View File

@@ -0,0 +1,2 @@
| Test$1GenericLocal.class:0:0:0:0 | GenericLocal<Integer> |
| Test.java:5:11:5:22 | GenericLocal |

View File

@@ -0,0 +1,7 @@
import java
from ClassOrInterface ci
where
ci.getSourceDeclaration().fromSource() and
ci.isLocal()
select ci