Report "use of non-const Kotlin property" also on Java case labels

#KT-25536 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-11-23 14:59:20 +03:00
parent 23c43cd124
commit 651faa4ab2
4 changed files with 58 additions and 27 deletions
@@ -9,5 +9,16 @@ public class JavaUser {
// Safe
@Ann(s = KotlinPropertiesKt.constantString)
public void baz() {}
public void baz(String z) {
switch (z) {
case KotlinPropertiesKt.constantString: // Safe
break;
case KotlinPropertiesKt.importantString: // Dangerous
break;
default:
break;
}
}
}
@@ -5,8 +5,8 @@
<module>First</module>
<package>&lt;default&gt;</package>
<entry_point TYPE="file" FQNAME="JavaUser.java" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin non-const property used as annotation argument</problem_class>
<description>Use of @JvmField non-const Kotlin property as annotation argument is incorrect. Will be forbidden in 1.3</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin non-const property used as Java constant</problem_class>
<description>Use of non-const Kotlin property as Java constant is incorrect. Will be forbidden in 1.4</description>
</problem>
<problem>
<file>JavaUser.java</file>
@@ -14,7 +14,16 @@
<module>First</module>
<package>&lt;default&gt;</package>
<entry_point TYPE="file" FQNAME="JavaUser.java" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin non-const property used as annotation argument</problem_class>
<description>Use of @JvmField non-const Kotlin property as annotation argument is incorrect. Will be forbidden in 1.3</description>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin non-const property used as Java constant</problem_class>
<description>Use of non-const Kotlin property as Java constant is incorrect. Will be forbidden in 1.4</description>
</problem>
<problem>
<file>JavaUser.java</file>
<line>17</line>
<module>First</module>
<package>&lt;default&gt;</package>
<entry_point TYPE="method" FQNAME="JavaUser void baz(java.lang.String z)" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin non-const property used as Java constant</problem_class>
<description>Use of non-const Kotlin property as Java constant is incorrect. Will be forbidden in 1.4</description>
</problem>
</problems>