diff --git a/plugins/kotlin/fir/test/org/jetbrains/kotlin/idea/fir/externalAnnotations/AbstractK2ExternalAnnotationTest.kt b/plugins/kotlin/fir/test/org/jetbrains/kotlin/idea/fir/externalAnnotations/AbstractK2ExternalAnnotationTest.kt
new file mode 100644
index 000000000000..47ff725fb6dd
--- /dev/null
+++ b/plugins/kotlin/fir/test/org/jetbrains/kotlin/idea/fir/externalAnnotations/AbstractK2ExternalAnnotationTest.kt
@@ -0,0 +1,16 @@
+// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+package org.jetbrains.kotlin.idea.fir.externalAnnotations
+
+import org.jetbrains.kotlin.idea.externalAnnotations.AbstractExternalAnnotationTest
+import org.jetbrains.kotlin.test.utils.IgnoreTests
+import java.io.File
+
+abstract class AbstractK2ExternalAnnotationTest : AbstractExternalAnnotationTest() {
+ override fun isFirPlugin(): Boolean = true
+
+ override fun doTest(kotlinFilePath: String) {
+ val original = File(kotlinFilePath)
+ super.doTest(IgnoreTests.getFirTestFile(original).path)
+ IgnoreTests.cleanUpIdenticalFirTestFile(original)
+ }
+}
diff --git a/plugins/kotlin/fir/test/org/jetbrains/kotlin/idea/fir/externalAnnotations/K2ExternalAnnotationTestGenerated.java b/plugins/kotlin/fir/test/org/jetbrains/kotlin/idea/fir/externalAnnotations/K2ExternalAnnotationTestGenerated.java
new file mode 100644
index 000000000000..297e9aca8a87
--- /dev/null
+++ b/plugins/kotlin/fir/test/org/jetbrains/kotlin/idea/fir/externalAnnotations/K2ExternalAnnotationTestGenerated.java
@@ -0,0 +1,45 @@
+// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+
+package org.jetbrains.kotlin.idea.fir.externalAnnotations;
+
+import com.intellij.testFramework.TestDataPath;
+import org.jetbrains.kotlin.idea.test.JUnit3RunnerWithInners;
+import org.jetbrains.kotlin.idea.test.KotlinTestUtils;
+import org.jetbrains.kotlin.test.TestMetadata;
+import org.jetbrains.kotlin.idea.base.test.TestRoot;
+import org.junit.runner.RunWith;
+
+/**
+ * This class is generated by {@link org.jetbrains.kotlin.testGenerator.generator.TestGenerator}.
+ * DO NOT MODIFY MANUALLY.
+ */
+@SuppressWarnings("all")
+@TestRoot("fir")
+@TestDataPath("$CONTENT_ROOT")
+@RunWith(JUnit3RunnerWithInners.class)
+@TestMetadata("../idea/tests/testData/externalAnnotations")
+public class K2ExternalAnnotationTestGenerated extends AbstractK2ExternalAnnotationTest {
+ private void runTest(String testDataFilePath) throws Exception {
+ KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
+ }
+
+ @TestMetadata("notNullMethod.kt")
+ public void testNotNullMethod() throws Exception {
+ runTest("../idea/tests/testData/externalAnnotations/notNullMethod.kt");
+ }
+
+ @TestMetadata("nullableField.kt")
+ public void testNullableField() throws Exception {
+ runTest("../idea/tests/testData/externalAnnotations/nullableField.kt");
+ }
+
+ @TestMetadata("nullableMethod.kt")
+ public void testNullableMethod() throws Exception {
+ runTest("../idea/tests/testData/externalAnnotations/nullableMethod.kt");
+ }
+
+ @TestMetadata("nullableMethodParameter.kt")
+ public void testNullableMethodParameter() throws Exception {
+ runTest("../idea/tests/testData/externalAnnotations/nullableMethodParameter.kt");
+ }
+}
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/AbstractExternalAnnotationTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/AbstractExternalAnnotationTest.kt
index b470ffe0834e..ae84006acad8 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/AbstractExternalAnnotationTest.kt
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/AbstractExternalAnnotationTest.kt
@@ -1,4 +1,4 @@
-// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
+// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.externalAnnotations
import com.intellij.openapi.application.runWriteAction
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescrip
import org.jetbrains.kotlin.idea.test.runAll
import java.io.File
-abstract class AbstractExternalAnnotationTest: KotlinLightCodeInsightFixtureTestCase() {
+abstract class AbstractExternalAnnotationTest : KotlinLightCodeInsightFixtureTestCase() {
override fun setUp() {
super.setUp()
@@ -39,7 +39,7 @@ abstract class AbstractExternalAnnotationTest: KotlinLightCodeInsightFixtureTest
}
}
- protected fun doTest(kotlinFilePath: String) {
+ protected open fun doTest(kotlinFilePath: String) {
myFixture.configureByFiles(kotlinFilePath, dataFilePath(externalAnnotationsFile), dataFilePath(classWithExternalAnnotatedMembers))
myFixture.checkHighlighting()
}
@@ -57,4 +57,6 @@ abstract class AbstractExternalAnnotationTest: KotlinLightCodeInsightFixtureTest
private const val classWithExternalAnnotatedMembers = "ClassWithExternalAnnotatedMembers.java"
private const val externalAnnotationsFile = "$externalAnnotationsPath/annotations.xml"
}
-}
\ No newline at end of file
+}
+
+abstract class AbstractK1ExternalAnnotationTest : AbstractExternalAnnotationTest()
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/ExternalAnnotationTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/K1ExternalAnnotationTestGenerated.java
similarity index 94%
rename from plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/ExternalAnnotationTestGenerated.java
rename to plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/K1ExternalAnnotationTestGenerated.java
index f2fa42f6a114..b38b68ea2019 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/ExternalAnnotationTestGenerated.java
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/externalAnnotations/K1ExternalAnnotationTestGenerated.java
@@ -18,7 +18,7 @@ import org.junit.runner.RunWith;
@TestDataPath("$CONTENT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("testData/externalAnnotations")
-public class ExternalAnnotationTestGenerated extends AbstractExternalAnnotationTest {
+public class K1ExternalAnnotationTestGenerated extends AbstractK1ExternalAnnotationTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
diff --git a/plugins/kotlin/idea/tests/testData/externalAnnotations/notNullMethod.fir.kt b/plugins/kotlin/idea/tests/testData/externalAnnotations/notNullMethod.fir.kt
new file mode 100644
index 000000000000..23090d23c65b
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/externalAnnotations/notNullMethod.fir.kt
@@ -0,0 +1,8 @@
+fun test() {
+ val x = ClassWithExternalAnnotatedMembers()
+ x.notNullMethod()?.foo()
+}
+
+fun String.foo() {
+
+}
diff --git a/plugins/kotlin/idea/tests/testData/externalAnnotations/notNullMethod.kt b/plugins/kotlin/idea/tests/testData/externalAnnotations/notNullMethod.kt
index 87ace024cbd5..201d2ca22161 100644
--- a/plugins/kotlin/idea/tests/testData/externalAnnotations/notNullMethod.kt
+++ b/plugins/kotlin/idea/tests/testData/externalAnnotations/notNullMethod.kt
@@ -1,4 +1,8 @@
fun test() {
val x = ClassWithExternalAnnotatedMembers()
- x.notNullMethod()?.toLowerCase()
-}
\ No newline at end of file
+ x.notNullMethod()?.foo()
+}
+
+fun String.foo() {
+
+}
diff --git a/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableField.fir.kt b/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableField.fir.kt
new file mode 100644
index 000000000000..42c0a0df5069
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableField.fir.kt
@@ -0,0 +1,5 @@
+@Suppress("UNUSED_VARIABLE")
+fun test() {
+ val x = ClassWithExternalAnnotatedMembers()
+ val y: String = x.nullableField
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableMethod.fir.kt b/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableMethod.fir.kt
new file mode 100644
index 000000000000..4a071eb60ab0
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableMethod.fir.kt
@@ -0,0 +1,5 @@
+@Suppress("UNUSED_VARIABLE")
+fun test() {
+ val x = ClassWithExternalAnnotatedMembers()
+ val y: String = x.nullableMethod()
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableMethodParameter.fir.kt b/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableMethodParameter.fir.kt
new file mode 100644
index 000000000000..e37267cb44ee
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/externalAnnotations/nullableMethodParameter.fir.kt
@@ -0,0 +1,4 @@
+fun test() {
+ val x = ClassWithExternalAnnotatedMembers()
+ x.methodWithNotNullParameter(null)
+}
\ No newline at end of file
diff --git a/plugins/kotlin/util/test-generator-fe10/test/org/jetbrains/kotlin/fe10/testGenerator/Fe10GenerateTests.kt b/plugins/kotlin/util/test-generator-fe10/test/org/jetbrains/kotlin/fe10/testGenerator/Fe10GenerateTests.kt
index 1841fd6d3fc8..8e0aee91508a 100644
--- a/plugins/kotlin/util/test-generator-fe10/test/org/jetbrains/kotlin/fe10/testGenerator/Fe10GenerateTests.kt
+++ b/plugins/kotlin/util/test-generator-fe10/test/org/jetbrains/kotlin/fe10/testGenerator/Fe10GenerateTests.kt
@@ -65,6 +65,7 @@ import org.jetbrains.kotlin.idea.editor.backspaceHandler.AbstractBackspaceHandle
import org.jetbrains.kotlin.idea.editor.commenter.AbstractKotlinCommenterTest
import org.jetbrains.kotlin.idea.editor.quickDoc.AbstractQuickDocProviderTest
import org.jetbrains.kotlin.idea.externalAnnotations.AbstractExternalAnnotationTest
+import org.jetbrains.kotlin.idea.externalAnnotations.AbstractK1ExternalAnnotationTest
import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest
import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest
import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyWithLibTest
@@ -461,8 +462,8 @@ private fun assembleWorkspace(): TWorkspace = workspace {
model("search/annotations")
}
- testClass {
- model("externalAnnotations")
+ testClass {
+ model("externalAnnotations", pattern = KT_WITHOUT_DOTS)
}
testClass {
diff --git a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt
index 791dbd97d6c0..1db15b10ecde 100644
--- a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt
+++ b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.idea.fir.completion.test.handlers.AbstractHighLevelJ
import org.jetbrains.kotlin.idea.fir.completion.test.handlers.AbstractK2CompletionCharFilterTest
import org.jetbrains.kotlin.idea.fir.completion.wheigher.AbstractHighLevelWeigherTest
import org.jetbrains.kotlin.idea.fir.documentation.AbstractFirQuickDocTest
+import org.jetbrains.kotlin.idea.fir.externalAnnotations.AbstractK2ExternalAnnotationTest
import org.jetbrains.kotlin.idea.fir.findUsages.AbstractFindUsagesFirTest
import org.jetbrains.kotlin.idea.fir.findUsages.AbstractFindUsagesWithDisableComponentSearchFirTest
import org.jetbrains.kotlin.idea.fir.findUsages.AbstractKotlinFindUsagesWithLibraryFirTest
@@ -223,6 +224,10 @@ private fun assembleWorkspace(): TWorkspace = workspace {
testClass {
model("internal/toolWindow", isRecursive = false, pattern = DIRECTORY, testMethodName = "doTestWithIr")
}
+
+ testClass {
+ model("externalAnnotations", pattern = KT_WITHOUT_DOTS)
+ }
}
testGroup("fir", testDataPath = "../completion/testData") {