diff --git a/idea/testData/quickfix/platformTypesInspection/.inspection b/idea/testData/quickfix/platformTypesInspection/.inspection new file mode 100644 index 00000000000..bab00f46c30 --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/.inspection @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.inspections.HasPlatformTypeInspection \ No newline at end of file diff --git a/idea/testData/quickfix/platformTypesInspection/nestedNoAssertRuntime.kt b/idea/testData/quickfix/platformTypesInspection/nestedNoAssertRuntime.kt new file mode 100644 index 00000000000..ba9e42ef37b --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/nestedNoAssertRuntime.kt @@ -0,0 +1,8 @@ +// "Add non-null asserted (!!) call" "false" +// ACTION: Convert function to property +// ACTION: Convert to block body +// ACTION: Create test +// ACTION: Specify return type explicitly +// ACTION: Specify return type explicitly + +fun foo() = arrayOf(java.lang.String.valueOf(1)) \ No newline at end of file diff --git a/idea/testData/quickfix/platformTypesInspection/nestedRuntime.kt b/idea/testData/quickfix/platformTypesInspection/nestedRuntime.kt new file mode 100644 index 00000000000..cb4d32a698d --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/nestedRuntime.kt @@ -0,0 +1,3 @@ +// "Specify return type explicitly" "true" + +fun foo() = arrayOf(java.lang.String.valueOf(1)) \ No newline at end of file diff --git a/idea/testData/quickfix/platformTypesInspection/nestedRuntime.kt.after b/idea/testData/quickfix/platformTypesInspection/nestedRuntime.kt.after new file mode 100644 index 00000000000..d5b46c94d26 --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/nestedRuntime.kt.after @@ -0,0 +1,3 @@ +// "Specify return type explicitly" "true" + +fun foo(): Array = arrayOf(java.lang.String.valueOf(1)) \ No newline at end of file diff --git a/idea/testData/quickfix/platformTypesInspection/nullableAssertRuntime.kt b/idea/testData/quickfix/platformTypesInspection/nullableAssertRuntime.kt new file mode 100644 index 00000000000..66856287f14 --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/nullableAssertRuntime.kt @@ -0,0 +1,3 @@ +// "Add non-null asserted (!!) call" "true" + +fun bar() = java.lang.String.valueOf(1) \ No newline at end of file diff --git a/idea/testData/quickfix/platformTypesInspection/nullableAssertRuntime.kt.after b/idea/testData/quickfix/platformTypesInspection/nullableAssertRuntime.kt.after new file mode 100644 index 00000000000..6af7edad196 --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/nullableAssertRuntime.kt.after @@ -0,0 +1,3 @@ +// "Add non-null asserted (!!) call" "true" + +fun bar() = java.lang.String.valueOf(1)!! \ No newline at end of file diff --git a/idea/testData/quickfix/platformTypesInspection/nullableRuntime.kt b/idea/testData/quickfix/platformTypesInspection/nullableRuntime.kt new file mode 100644 index 00000000000..5d2542dd0b2 --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/nullableRuntime.kt @@ -0,0 +1,3 @@ +// "Specify return type explicitly" "true" + +fun foo() = java.lang.String.valueOf(1) \ No newline at end of file diff --git a/idea/testData/quickfix/platformTypesInspection/nullableRuntime.kt.after b/idea/testData/quickfix/platformTypesInspection/nullableRuntime.kt.after new file mode 100644 index 00000000000..3180fc80cee --- /dev/null +++ b/idea/testData/quickfix/platformTypesInspection/nullableRuntime.kt.after @@ -0,0 +1,3 @@ +// "Specify return type explicitly" "true" + +fun foo(): String? = java.lang.String.valueOf(1) \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java index 6155a9b6e11..4b14a63d64c 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java @@ -6371,6 +6371,39 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest { } } + @TestMetadata("idea/testData/quickfix/platformTypesInspection") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class PlatformTypesInspection extends AbstractQuickFixTest { + public void testAllFilesPresentInPlatformTypesInspection() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/quickfix/platformTypesInspection"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), true); + } + + @TestMetadata("nestedNoAssertRuntime.kt") + public void testNestedNoAssertRuntime() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/platformTypesInspection/nestedNoAssertRuntime.kt"); + doTest(fileName); + } + + @TestMetadata("nestedRuntime.kt") + public void testNestedRuntime() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/platformTypesInspection/nestedRuntime.kt"); + doTest(fileName); + } + + @TestMetadata("nullableAssertRuntime.kt") + public void testNullableAssertRuntime() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/platformTypesInspection/nullableAssertRuntime.kt"); + doTest(fileName); + } + + @TestMetadata("nullableRuntime.kt") + public void testNullableRuntime() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/platformTypesInspection/nullableRuntime.kt"); + doTest(fileName); + } + } + @TestMetadata("idea/testData/quickfix/properties") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)