Clearer diagnostic message for platform type inspection #KT-14630 Fixed

This commit is contained in:
Mikhail Glukhikh
2017-01-10 13:13:59 +03:00
parent 3bf38e62c8
commit 43a4035390
2 changed files with 5 additions and 4 deletions
@@ -47,7 +47,8 @@ class HasPlatformTypeInspection(
override val problemHighlightType = ProblemHighlightType.WEAK_WARNING
override val problemText = "Declaration has platform type. Make the type explicit to prevent subtle bugs."
override val problemText = "Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. " +
"Specify type explicitly as nullable or non-nullable."
override fun additionalFixes(element: KtCallableDeclaration): List<LocalQuickFix>? {
val type = SpecifyTypeExplicitlyIntention.dangerousFlexibleTypeOrNull(element, publicAPIOnly, reportPlatformArguments) ?: return null
@@ -5,7 +5,7 @@
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/function.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Function, property or variable has platform type.</problem_class>
<description>Declaration has platform type. Make the type explicit to prevent subtle bugs.</description>
<description>Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable.</description>
</problem>
<problem>
<file>function.kt</file>
@@ -13,7 +13,7 @@
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/function.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Function or property has platform type</problem_class>
<description>Declaration has platform type. Make the type explicit to prevent subtle bugs.</description>
<description>Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable.</description>
</problem>
<problem>
<file>property1.kt</file>
@@ -21,6 +21,6 @@
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/property1.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Function, property or variable has platform type.</problem_class>
<description>Declaration has platform type. Make the type explicit to prevent subtle bugs.</description>
<description>Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable.</description>
</problem>
</problems>