Skip to content

Commit 631ba8a

Browse files
committed
Kotlin: exclude Kotlin source from 'inner class could be static' check
1 parent cd17e2e commit 631ba8a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

java/ql/src/Performance/InnerClassCouldBeStatic.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ predicate potentiallyStatic(InnerClass c) {
130130
)
131131
) and
132132
// JUnit Nested test classes are required to be non-static.
133-
not c.hasAnnotation("org.junit.jupiter.api", "Nested")
133+
not c.hasAnnotation("org.junit.jupiter.api", "Nested") and
134+
// There's no `static` in kotlin:
135+
not c.getLocation().getFile().isKotlinSourceFile()
134136
}
135137

136138
/**
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
| Test.kt:3:5:5:5 | Companion | Companion should be made static, since the enclosing instance is not used. |

0 commit comments

Comments
 (0)