From 43a40353909eee80a6e0cae1d2e26b21066bae89 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 10 Jan 2017 13:13:59 +0300 Subject: [PATCH] Clearer diagnostic message for platform type inspection #KT-14630 Fixed --- .../kotlin/idea/inspections/HasPlatformTypeInspection.kt | 3 ++- .../inspections/hasPlatformType/inspectionData/expected.xml | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt index 9022720e084..d511f3cc0dc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt @@ -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? { val type = SpecifyTypeExplicitlyIntention.dangerousFlexibleTypeOrNull(element, publicAPIOnly, reportPlatformArguments) ?: return null diff --git a/idea/testData/inspections/hasPlatformType/inspectionData/expected.xml b/idea/testData/inspections/hasPlatformType/inspectionData/expected.xml index c3788ec0ee8..6c704244fbd 100644 --- a/idea/testData/inspections/hasPlatformType/inspectionData/expected.xml +++ b/idea/testData/inspections/hasPlatformType/inspectionData/expected.xml @@ -5,7 +5,7 @@ light_idea_test_case Function, property or variable has platform type. - Declaration has platform type. Make the type explicit to prevent subtle bugs. + Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable. function.kt @@ -13,7 +13,7 @@ light_idea_test_case Function or property has platform type - Declaration has platform type. Make the type explicit to prevent subtle bugs. + Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable. property1.kt @@ -21,6 +21,6 @@ light_idea_test_case Function, property or variable has platform type. - Declaration has platform type. Make the type explicit to prevent subtle bugs. + Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable. \ No newline at end of file