Merge pull request #6520 from smowton/smowton/feature/allow-local-interfaces

Java: Allow local interfaces
This commit is contained in:
Chris Smowton
2021-09-03 12:01:36 +01:00
committed by GitHub
18 changed files with 2083 additions and 78 deletions

View File

@@ -37,8 +37,8 @@ where
// Remove local classes defined in the dead method - they are reported separately as a dead
// class. We keep anonymous class counts, because anonymous classes are not reported
// separately.
sum(LocalClass localClass |
localClass.getLocalClassDeclStmt().getEnclosingCallable() = deadMethod
sum(LocalClassOrInterface localClass |
localClass.getLocalTypeDeclStmt().getEnclosingCallable() = deadMethod
|
localClass.getNumberOfLinesOfCode()
)

View File

@@ -122,8 +122,8 @@ where
not abortsControlFlow(s) and
// Exclude the double semicolon case `if (cond) s;;`.
not t instanceof EmptyStmt and
// `LocalClassDeclStmt`s yield false positives since their `Location` doesn't include the `class` keyword.
not t instanceof LocalClassDeclStmt
// `LocalTypeDeclStmt`s yield false positives since their `Location` doesn't include the `class` keyword.
not t instanceof LocalTypeDeclStmt
select s,
"Indentation suggests that $@ belongs to $@, but this is not the case; consider adding braces or adjusting indentation.",
t, "the next statement", c, "the control structure"

View File

@@ -11,7 +11,7 @@ import java
abstract private class GeneratedType extends ClassOrInterface {
GeneratedType() {
not this instanceof AnonymousClass and
not this instanceof LocalClass and
not this.isLocal() and
not this.getPackage() instanceof ExcludedPackage
}