Resource Bundles: Inspections on invalid property key/resource bundle references
#KT-6946 In Progress
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
package org.jetbrains.annotations
|
||||
|
||||
@Retention(AnnotationRetention.BINARY)
|
||||
@Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.FIELD)
|
||||
public annotation class PropertyKey(public val resourceBundle: String)
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
foo.bar = test: {0}
|
||||
foo.bar2 = test: {0}, {1}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import org.jetbrains.annotations.PropertyKey;
|
||||
|
||||
class J {
|
||||
static String message(@PropertyKey(resourceBundle = "TestBundle") String key, Object... args) {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
object K {
|
||||
fun message(@PropertyKey(resourceBundle = "TestBundle") key: String, vararg args: Any) = key
|
||||
fun message2(@PropertyKey(resourceBundle = "TestBundle") key: String, n: Int, vararg args: Any) = key
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun test() {
|
||||
K.message("foo.bar")
|
||||
J.message("foo.bar")
|
||||
K.message(key = "foo.bar", args = 1)
|
||||
K.message("foo.bar2", *arrayOf(1, 2))
|
||||
K.message2("foo.bar", 1)
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
import org.jetbrains.annotations.PropertyKey
|
||||
|
||||
private val TEST_BUNDLE2 = "TestBundle2"
|
||||
|
||||
fun message(@PropertyKey(resourceBundle = "TestBundle2") key: String, vararg args: Any) = key
|
||||
fun message2(@PropertyKey(resourceBundle = TEST_BUNDLE2) key: String, vararg args: Any) = key
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
K.message("foo.baz", "arg")
|
||||
K.message("foo.baz")
|
||||
J.message("foo.baz", "arg")
|
||||
J.message("foo.baz")
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
K.message("foo.bar", "arg")
|
||||
K.message("foo.bar", "arg1", "arg2")
|
||||
J.message("foo.bar", "arg")
|
||||
J.message("foo.bar", "arg1", "arg2")
|
||||
}
|
||||
Reference in New Issue
Block a user