KotlinInvalidBundleOrPropertyInspection: fix false positive for a bundle with several properties files

#KT-31359 Fixed
This commit is contained in:
Dmitry Gridin
2019-06-19 18:47:25 +07:00
parent d9808b70b6
commit 59325900df
7 changed files with 33 additions and 10 deletions
@@ -3,4 +3,5 @@ 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
fun message3(@PropertyKey(resourceBundle = "lang") key: String) = key
}
@@ -0,0 +1 @@
test=de
@@ -0,0 +1,2 @@
test=en
tests=eee
@@ -3,4 +3,5 @@ fun test() {
K.message("foo.baz")
J.message("foo.baz", "arg")
J.message("foo.baz")
K.message3("www")
}
@@ -3,4 +3,6 @@ fun test() {
K.message("foo.bar", "arg1", "arg2")
J.message("foo.bar", "arg")
J.message("foo.bar", "arg1", "arg2")
K.message3("test")
K.message3("tests")
}
@@ -70,4 +70,20 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Invalid property key</problem_class>
<description>Invalid resource bundle reference 'TestBundle2'</description>
</problem>
<problem>
<file>unresolvedPropertyReference.kt</file>
<line>6</line>
<module>testInvalidBundleOrProperty_InvalidBundleOrProperty_0</module>
<entry_point TYPE="method" FQNAME="UnresolvedPropertyReferenceKt void test()"/>
<problem_class severity="ERROR" attribute_key="WRONG_REFERENCES_ATTRIBUTES">Invalid property key</problem_class>
<description>String literal 'www' doesn't appear to be valid property key</description>
</problem>
<problem>
<file>unresolvedBundleReference.kt</file>
<line>5</line>
<module>testInvalidBundleOrProperty_InvalidBundleOrProperty_0</module>
<entry_point TYPE="method" FQNAME="UnresolvedBundleReferenceKt java.lang.String message(java.lang.String key, java.lang.Object... args)" />
<problem_class severity="ERROR" attribute_key="WRONG_REFERENCES_ATTRIBUTES">Invalid property key</problem_class>
<description>Invalid resource bundle reference 'TestBundle2'</description>
</problem>
</problems>