[SLC] [KAPT] KT-61916 Fix generation of annotations in annotation arguments

This commit is contained in:
strangepleasures
2023-09-14 13:21:07 +00:00
committed by Space Team
parent 878452bd2b
commit cf01d2970f
16 changed files with 225 additions and 2 deletions
@@ -199,7 +199,7 @@ internal fun KtAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiA
is KtAnnotationApplicationValue ->
SymbolLightSimpleAnnotation(
fqName = annotationValue.classId?.relativeClassName?.asString(),
fqName = annotationValue.classId?.asFqNameString(),
parent = parent,
arguments = annotationValue.arguments,
kotlinOrigin = annotationValue.psi,
@@ -1,4 +1,4 @@
@kotlin.Deprecated(message = "", replaceWith = @ReplaceWith(expression = ""), level = kotlin.DeprecationLevel.ERROR)
@kotlin.Deprecated(message = "", replaceWith = @kotlin.ReplaceWith(expression = ""), level = kotlin.DeprecationLevel.ERROR)
public final class MyClass /* MyClass*/ {
public MyClass();// .ctor()
}
@@ -30,6 +30,12 @@ public class SymbolLightClassesByPsiForLibraryTestGenerated extends AbstractSymb
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/allowedTargets.kt");
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
@@ -30,6 +30,12 @@ public class SymbolLightClassesEqualityByPsiForLibraryTestGenerated extends Abst
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/allowedTargets.kt");
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
@@ -30,6 +30,12 @@ public class SymbolLightClassesParentingByPsiForLibraryTestGenerated extends Abs
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/allowedTargets.kt");
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
@@ -30,6 +30,12 @@ public class SymbolLightClassesByPsiForSourceTestGenerated extends AbstractSymbo
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/allowedTargets.kt");
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
@@ -30,6 +30,12 @@ public class SymbolLightClassesEqualityByPsiForSourceTestGenerated extends Abstr
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/allowedTargets.kt");
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
@@ -30,6 +30,12 @@ public class SymbolLightClassesParentingByPsiForSourceTestGenerated extends Abst
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/allowedTargets.kt");
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithSetParamPropertyModifier.kt")
public void testAnnotationWithSetParamPropertyModifier() throws Exception {
@@ -0,0 +1,13 @@
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
public abstract @interface A /* a.A*/ {
}
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
public abstract @interface B /* b.B*/ {
public abstract a.A param();// param()
}
@b.B(param = @a.A())
public final class C /* b.C*/ {
public C();// .ctor()
}
@@ -0,0 +1,17 @@
// FILE: a/A.kt
package a
annotation class A
// FILE: b/B.kt
package b
import a.A
annotation class B(val param: A)
@B(param = A())
class C
@@ -0,0 +1,61 @@
package a;
/**
* public final annotation class a/A : kotlin/Annotation {
*
* // signature: <init>()V
* public constructor()
*
* // module name: main
* }
*/
@kotlin.Metadata()
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
public abstract @interface A {
}
////////////////////
package b;
/**
* public final annotation class b/B : kotlin/Annotation {
*
* // signature: <init>(La/A;)V
* public constructor(value: a/A)
*
* // getter: value()La/A;
* public final val value: a/A
* public final get
*
* // module name: main
* }
*/
@kotlin.Metadata()
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
public abstract @interface B {
public abstract a.A value();
}
////////////////////
package b;
/**
* public final class b/C : kotlin/Any {
*
* // signature: <init>()V
* public constructor()
*
* // module name: main
* }
*/
@kotlin.Metadata()
@B(value = @a.A())
public final class C {
public C() {
super();
}
}
@@ -0,0 +1,17 @@
// FILE: a/A.kt
package a
annotation class A
// FILE: b/B.kt
package b
import a.A
annotation class B(val value: A)
@B(A())
class C
@@ -0,0 +1,61 @@
package a;
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
/**
* public final annotation class a/A : kotlin/Annotation {
*
* // signature: <init>()V
* public constructor()
*
* // module name: main
* }
*/
@kotlin.Metadata()
public abstract @interface A {
}
////////////////////
package b;
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
/**
* public final annotation class b/B : kotlin/Annotation {
*
* // signature: <init>(La/A;)V
* public constructor(value: a/A)
*
* // getter: value()La/A;
* public final val value: a/A
* public final get
*
* // module name: main
* }
*/
@kotlin.Metadata()
public abstract @interface B {
public abstract a.A value();
}
////////////////////
package b;
@B(value = @a.A())
/**
* public final class b/C : kotlin/Any {
*
* // signature: <init>()V
* public constructor()
*
* // module name: main
* }
*/
@kotlin.Metadata()
public final class C {
public C() {
super();
}
}
@@ -43,6 +43,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kapt3/kapt3-compiler/testData/converter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("plugins/kapt3/kapt3-compiler/testData/converter/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithFqNames.kt")
public void testAnnotationWithFqNames() throws Exception {
@@ -43,6 +43,12 @@ public class IrClassFileToSourceStubConverterTestGenerated extends AbstractIrCla
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kapt3/kapt3-compiler/testData/converter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("plugins/kapt3/kapt3-compiler/testData/converter/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithFqNames.kt")
public void testAnnotationWithFqNames() throws Exception {
@@ -43,6 +43,12 @@ public class KotlinKapt4ContextTestGenerated extends AbstractKotlinKapt4ContextT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("annotationInAnnotationParameters.kt")
public void testAnnotationInAnnotationParameters() throws Exception {
runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/annotationInAnnotationParameters.kt");
}
@Test
@TestMetadata("annotationWithFqNames.kt")
public void testAnnotationWithFqNames() throws Exception {