diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.fir.txt b/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.fir.txt new file mode 100644 index 00000000000..2ff56cdfb3d --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.fir.txt @@ -0,0 +1,22 @@ +import com.example.Unresolved1; +import org.example.*; +import org.another.*; + +/** + * public final class C : kotlin/Any { + * + * // signature: ()V + * public constructor() + * + * // module name: main + * } + */ +@kotlin.Metadata() +@Unresolved1() +@Unresolved2() +public final class C { + + public C() { + super(); + } +} diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.kt b/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.kt new file mode 100644 index 00000000000..2c613816fdf --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.kt @@ -0,0 +1,12 @@ +// CORRECT_ERROR_TYPES +// EXPECTED_ERROR: (kotlin:10:1) cannot find symbol + + +@file:Suppress("UNRESOLVED_REFERENCE") +import com.example.Unresolved1 +import org.example.* +import org.another.* + +@Unresolved1 +@Unresolved2 +class C \ No newline at end of file diff --git a/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.txt b/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.txt new file mode 100644 index 00000000000..7a7fcb77adf --- /dev/null +++ b/plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.txt @@ -0,0 +1,22 @@ +import com.example.Unresolved1; +import org.example.*; +import org.another.*; + +@Unresolved1() +@Unresolved2() +/** + * public final class C : kotlin/Any { + * + * // signature: ()V + * public constructor() + * + * // module name: main + * } + */ +@kotlin.Metadata() +public final class C { + + public C() { + super(); + } +} diff --git a/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/ClassFileToSourceStubConverterTestGenerated.java b/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/ClassFileToSourceStubConverterTestGenerated.java index 1598b77d7d0..c47405b6f7a 100644 --- a/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/ClassFileToSourceStubConverterTestGenerated.java +++ b/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/ClassFileToSourceStubConverterTestGenerated.java @@ -307,6 +307,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi runTest("plugins/kapt3/kapt3-compiler/testData/converter/importsKt22083.kt"); } + @Test + @TestMetadata("importsWithUnresolvedAnnotations.kt") + public void testImportsWithUnresolvedAnnotations() throws Exception { + runTest("plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.kt"); + } + @Test @TestMetadata("incorrectDelegate.kt") public void testIncorrectDelegate() throws Exception { diff --git a/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/IrClassFileToSourceStubConverterTestGenerated.java b/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/IrClassFileToSourceStubConverterTestGenerated.java index ca9add8bf37..b3ffb2e0b22 100644 --- a/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/IrClassFileToSourceStubConverterTestGenerated.java +++ b/plugins/kapt3/kapt3-compiler/tests-gen/org/jetbrains/kotlin/kapt3/test/runners/IrClassFileToSourceStubConverterTestGenerated.java @@ -307,6 +307,12 @@ public class IrClassFileToSourceStubConverterTestGenerated extends AbstractIrCla runTest("plugins/kapt3/kapt3-compiler/testData/converter/importsKt22083.kt"); } + @Test + @TestMetadata("importsWithUnresolvedAnnotations.kt") + public void testImportsWithUnresolvedAnnotations() throws Exception { + runTest("plugins/kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.kt"); + } + @Test @TestMetadata("incorrectDelegate.kt") public void testIncorrectDelegate() throws Exception { diff --git a/plugins/kapt4/src/org/jetbrains/kotlin/kapt4/Kapt4StubGenerator.kt b/plugins/kapt4/src/org/jetbrains/kotlin/kapt4/Kapt4StubGenerator.kt index fd229510860..713bb92b108 100644 --- a/plugins/kapt4/src/org/jetbrains/kotlin/kapt4/Kapt4StubGenerator.kt +++ b/plugins/kapt4/src/org/jetbrains/kotlin/kapt4/Kapt4StubGenerator.kt @@ -326,6 +326,7 @@ internal class Kapt4StubGenerator { val rawQualifiedName = when (annotation.qualifiedName) { // A temporary fix for KT-60482 "" -> (annotation as? KtLightElement<*, *>)?.kotlinOrigin?.node?.let { qualifiedName(it) } + ?.also { recordUnresolvedQualifier(it) } else -> annotation.qualifiedName } ?: return null diff --git a/plugins/kapt4/tests-gen/org/jetbrains/kotlin/kapt4/KotlinKapt4ContextTestGenerated.java b/plugins/kapt4/tests-gen/org/jetbrains/kotlin/kapt4/KotlinKapt4ContextTestGenerated.java index 2ad19ad4371..145b5f83740 100644 --- a/plugins/kapt4/tests-gen/org/jetbrains/kotlin/kapt4/KotlinKapt4ContextTestGenerated.java +++ b/plugins/kapt4/tests-gen/org/jetbrains/kotlin/kapt4/KotlinKapt4ContextTestGenerated.java @@ -307,6 +307,12 @@ public class KotlinKapt4ContextTestGenerated extends AbstractKotlinKapt4ContextT runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/importsKt22083.kt"); } + @Test + @TestMetadata("importsWithUnresolvedAnnotations.kt") + public void testImportsWithUnresolvedAnnotations() throws Exception { + runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/importsWithUnresolvedAnnotations.kt"); + } + @Test @TestMetadata("incorrectDelegate.kt") public void testIncorrectDelegate() throws Exception {