Merge pull request #9146 from tamasvajk/kotlin-inner-class-static

Kotlin: exclude Kotlin source from 'inner class could be static' check
This commit is contained in:
Tamás Vajk
2022-05-17 08:43:39 +02:00
committed by GitHub
4 changed files with 10 additions and 1 deletions

View File

@@ -130,7 +130,9 @@ predicate potentiallyStatic(InnerClass c) {
)
) and
// JUnit Nested test classes are required to be non-static.
not c.hasAnnotation("org.junit.jupiter.api", "Nested")
not c.hasAnnotation("org.junit.jupiter.api", "Nested") and
// There's no `static` in kotlin:
not c.getLocation().getFile().isKotlinSourceFile()
}
/**

View File

@@ -0,0 +1 @@
Performance/InnerClassCouldBeStatic.ql

View File

@@ -0,0 +1,6 @@
class A {
fun fn1() {}
companion object {
fun fn2() {}
}
}