Add inspection to detect non-const vals used as Java annotation args
So #KT-20615 Fixed
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
public class JavaUser {
|
||||
// Dangerous
|
||||
@Ann(s = KotlinPropertiesKt.importantString)
|
||||
public void foo() {}
|
||||
|
||||
// Also dangerous
|
||||
@AnnValue(OtherPropertiesKt.notSoImportantString)
|
||||
public void bar() {}
|
||||
|
||||
// Safe
|
||||
@Ann(s = KotlinPropertiesKt.constantString)
|
||||
public void baz() {}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
annotation class Ann(val s: String)
|
||||
|
||||
annotation class AnnValue(val value: String)
|
||||
|
||||
@JvmField val importantString = "important"
|
||||
|
||||
const val constantString = "constant"
|
||||
Reference in New Issue
Block a user