KT-62560 [SLC] Fix handling of empty varargs in annotations
This commit is contained in:
committed by
Space Team
parent
4f5926a88f
commit
03ed1d1d31
+4
-5
@@ -10,6 +10,7 @@ import com.intellij.psi.PsiModifierList
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationApplication
|
||||
import org.jetbrains.kotlin.analysis.api.annotations.KtAnnotationApplicationWithArgumentsInfo
|
||||
import org.jetbrains.kotlin.asJava.classes.lazyPub
|
||||
import org.jetbrains.kotlin.light.classes.symbol.*
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtCallElement
|
||||
@@ -39,10 +40,8 @@ internal class SymbolLightLazyAnnotation(
|
||||
override fun getQualifiedName(): String = fqName.asString()
|
||||
|
||||
private val _parameterList: PsiAnnotationParameterList by lazyPub {
|
||||
if (annotationApplication.isCallWithArguments) {
|
||||
symbolLightAnnotationParameterList { annotationApplicationWithArgumentsInfo.value.arguments }
|
||||
} else {
|
||||
symbolLightAnnotationParameterList()
|
||||
symbolLightAnnotationParameterList {
|
||||
annotationApplicationWithArgumentsInfo.value.normalizedArguments()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,4 +58,4 @@ internal class SymbolLightLazyAnnotation(
|
||||
other.parent == parent
|
||||
|
||||
override fun hashCode(): Int = fqName.hashCode()
|
||||
}
|
||||
}
|
||||
+19
-3
@@ -199,14 +199,14 @@ internal fun KtAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiA
|
||||
values.mapNotNull { element -> element.toAnnotationMemberValue(arrayLiteralParent) }
|
||||
}
|
||||
|
||||
is KtAnnotationApplicationValue ->
|
||||
is KtAnnotationApplicationValue -> {
|
||||
SymbolLightSimpleAnnotation(
|
||||
fqName = annotationValue.classId?.asFqNameString(),
|
||||
parent = parent,
|
||||
arguments = annotationValue.arguments,
|
||||
arguments = annotationValue.normalizedArguments(),
|
||||
kotlinOrigin = annotationValue.psi,
|
||||
)
|
||||
|
||||
}
|
||||
is KtConstantAnnotationValue -> {
|
||||
constantValue.createPsiExpression(parent)?.let {
|
||||
when (it) {
|
||||
@@ -221,6 +221,22 @@ internal fun KtAnnotationValue.toAnnotationMemberValue(parent: PsiElement): PsiA
|
||||
KtUnsupportedAnnotationValue -> null
|
||||
}
|
||||
|
||||
internal fun KtAnnotationApplicationWithArgumentsInfo.normalizedArguments(): List<KtNamedAnnotationValue> {
|
||||
val args = arguments
|
||||
val ctorSymbolPointer = constructorSymbolPointer ?: return args
|
||||
val element = psi ?: return args // May work incorrectly. See KT-63568
|
||||
|
||||
return analyzeForLightClasses(element) {
|
||||
val constructorSymbol = ctorSymbolPointer.restoreSymbolOrThrowIfDisposed()
|
||||
val params = constructorSymbol.valueParameters
|
||||
val missingVarargParameterName =
|
||||
params.singleOrNull { it.isVararg && !it.hasDefaultValue }?.name?.takeIf { name -> args.none { it.name == name } }
|
||||
if (missingVarargParameterName == null) args
|
||||
else args + KtNamedAnnotationValue(missingVarargParameterName, KtArrayAnnotationValue(emptyList(), null))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun KtEnumEntryAnnotationValue.asPsiReferenceExpression(parent: PsiElement): SymbolPsiReference? {
|
||||
val fqName = this.callableId?.asSingleFqName()?.asString() ?: return null
|
||||
val psiReference = parent.project.withElementFactorySafe {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@kotlin.Deprecated(message = "", replaceWith = @kotlin.ReplaceWith(expression = ""), level = kotlin.DeprecationLevel.ERROR)
|
||||
@kotlin.Deprecated(message = "", replaceWith = @kotlin.ReplaceWith(expression = "", imports = {}), level = kotlin.DeprecationLevel.ERROR)
|
||||
public final class MyClass /* MyClass*/ {
|
||||
public MyClass();// .ctor()
|
||||
}
|
||||
|
||||
+6
@@ -42,6 +42,12 @@ public class SymbolLightClassesByPsiForLibraryTestGenerated extends AbstractSymb
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithSetParamPropertyModifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
+6
@@ -42,6 +42,12 @@ public class SymbolLightClassesEqualityByPsiForLibraryTestGenerated extends Abst
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithSetParamPropertyModifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
+6
@@ -42,6 +42,12 @@ public class SymbolLightClassesParentingByPsiForLibraryTestGenerated extends Abs
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithSetParamPropertyModifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
+6
@@ -42,6 +42,12 @@ public class SymbolLightClassesByPsiForSourceTestGenerated extends AbstractSymbo
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithSetParamPropertyModifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
+6
@@ -42,6 +42,12 @@ public class SymbolLightClassesEqualityByPsiForSourceTestGenerated extends Abstr
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithSetParamPropertyModifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
+6
@@ -42,6 +42,12 @@ public class SymbolLightClassesParentingByPsiForSourceTestGenerated extends Abst
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithSetParamPropertyModifier.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface A /* A*/ {
|
||||
public abstract int[] x();// x()
|
||||
}
|
||||
|
||||
public final class AnnotationWithVaragArgumentsKt /* AnnotationWithVaragArgumentsKt*/ {
|
||||
@A()
|
||||
@B(x = "x", z = "z")
|
||||
@C(a = @A(), b = @B(x = "x", z = "z"))
|
||||
@D()
|
||||
@E(d = @D())
|
||||
public static final void foo();// foo()
|
||||
|
||||
@A(x = {1, 2})
|
||||
@B(x = "x", y = {1, 2}, z = "z")
|
||||
@C(a = @A(x = {1, 2}), b = @B(x = "x", y = {1, 2}, z = "z"))
|
||||
public static final void baz();// baz()
|
||||
|
||||
@A(x = {1})
|
||||
@B(x = "x", y = {1}, z = "z")
|
||||
@C(a = @A(x = {1}), b = @B(x = "x", y = {1}, z = "z"))
|
||||
public static final void bar();// bar()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface B /* B*/ {
|
||||
public abstract int[] y();// y()
|
||||
|
||||
public abstract java.lang.String x();// x()
|
||||
|
||||
public abstract java.lang.String z();// z()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface C /* C*/ {
|
||||
public abstract A a();// a()
|
||||
|
||||
public abstract B b();// b()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface D /* D*/ {
|
||||
public abstract java.lang.String[] x() default {"a", "b"};// x()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface E /* E*/ {
|
||||
public abstract D d();// d()
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface A /* A*/ {
|
||||
public abstract int[] x();// x()
|
||||
}
|
||||
|
||||
public final class AnnotationWithVaragArgumentsKt /* AnnotationWithVaragArgumentsKt*/ {
|
||||
@A(x = {1, 2})
|
||||
@B(x = "x", y = {1, 2}, z = "z")
|
||||
@C(a = @A(x = {1, 2}), b = @B(x = "x", y = {1, 2}, z = "z"))
|
||||
public static final void baz();// baz()
|
||||
|
||||
@A(x = {1})
|
||||
@B(x = "x", y = {1}, z = "z")
|
||||
@C(a = @A(x = {1}), b = @B(x = "x", y = {1}, z = "z"))
|
||||
public static final void bar();// bar()
|
||||
|
||||
@A(x = {})
|
||||
@B(x = "x", z = "z", y = {})
|
||||
@C(a = @A(x = {}), b = @B(x = "x", z = "z", y = {}))
|
||||
@D()
|
||||
@E(d = @D())
|
||||
public static final void foo();// foo()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface B /* B*/ {
|
||||
public abstract int[] y();// y()
|
||||
|
||||
public abstract java.lang.String x();// x()
|
||||
|
||||
public abstract java.lang.String z();// z()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface C /* C*/ {
|
||||
public abstract A a();// a()
|
||||
|
||||
public abstract B b();// b()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface D /* D*/ {
|
||||
public abstract java.lang.String[] x() default {"a", "b"};// x()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface E /* E*/ {
|
||||
public abstract D d();// d()
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
annotation class A(vararg val x: Int)
|
||||
annotation class B(val x: String, vararg val y: Int, val z: String)
|
||||
annotation class C(val a: A, val b: B)
|
||||
annotation class D(vararg val x: String = ["a", "b"])
|
||||
annotation class E(val d: D)
|
||||
|
||||
@A
|
||||
@B(x = "x", z = "z")
|
||||
@C(A(), B("x", z = "z"))
|
||||
@D()
|
||||
@E(d = D())
|
||||
fun foo() {}
|
||||
|
||||
@A(1)
|
||||
@B("x", 1, z = "z")
|
||||
@C(A(1), B("x", 1, z = "z"))
|
||||
fun bar() {}
|
||||
|
||||
@A(1, 2)
|
||||
@B("x", 1, 2, z = "z")
|
||||
@C(A(1, 2), B("x", 1, 2, z = "z"))
|
||||
fun baz() {}
|
||||
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface A /* A*/ {
|
||||
public abstract int[] x();// x()
|
||||
}
|
||||
|
||||
public final class AnnotationWithVaragArgumentsKt /* AnnotationWithVaragArgumentsKt*/ {
|
||||
@A(x = {1, 2})
|
||||
@B(x = "x", y = {1, 2}, z = "z")
|
||||
@C(a = @A(x = {1, 2}), b = @B(x = "x", y = {1, 2}, z = "z"))
|
||||
public static final void baz();// baz()
|
||||
|
||||
@A(x = {1})
|
||||
@B(x = "x", y = {1}, z = "z")
|
||||
@C(a = @A(x = {1}), b = @B(x = "x", y = {1}, z = "z"))
|
||||
public static final void bar();// bar()
|
||||
|
||||
@A(x = {})
|
||||
@B(x = "x", y = {}, z = "z")
|
||||
@C(a = @A(x = {}), b = @B(x = "x", y = {}, z = "z"))
|
||||
@D()
|
||||
@E(d = @D())
|
||||
public static final void foo();// foo()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface B /* B*/ {
|
||||
public abstract int[] y();// y()
|
||||
|
||||
public abstract java.lang.String x();// x()
|
||||
|
||||
public abstract java.lang.String z();// z()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface C /* C*/ {
|
||||
public abstract A a();// a()
|
||||
|
||||
public abstract B b();// b()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface D /* D*/ {
|
||||
public abstract java.lang.String[] x() default {"a", "b"};// x()
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface E /* E*/ {
|
||||
public abstract D d();// d()
|
||||
}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
/**
|
||||
* public final annotation class A : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>([I)V
|
||||
* public constructor(vararg x: kotlin/Int (* kotlin/IntArray *))
|
||||
*
|
||||
* // getter: x()[I
|
||||
* public final val x: kotlin/IntArray
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface A {
|
||||
|
||||
public abstract int[] x();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* package {
|
||||
*
|
||||
* // signature: bar()V
|
||||
* public final fun bar(): kotlin/Unit
|
||||
*
|
||||
* // signature: baz()V
|
||||
* public final fun baz(): kotlin/Unit
|
||||
*
|
||||
* // signature: foo()V
|
||||
* public final fun foo(): kotlin/Unit
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public final class AnnotationWithVaragArgumentsKt {
|
||||
|
||||
public AnnotationWithVaragArgumentsKt() {
|
||||
super();
|
||||
}
|
||||
|
||||
@A(x = {1})
|
||||
@B(x = "x", y = {1}, z = "z")
|
||||
@C(a = @A(x = {1}), b = @B(x = "x", y = {1}, z = "z"))
|
||||
public static final void bar() {
|
||||
}
|
||||
|
||||
@A(x = {1, 2})
|
||||
@B(x = "x", y = {1, 2}, z = "z")
|
||||
@C(a = @A(x = {1, 2}), b = @B(x = "x", y = {1, 2}, z = "z"))
|
||||
public static final void baz() {
|
||||
}
|
||||
|
||||
@A(x = {})
|
||||
@B(x = "x", z = "z", y = {})
|
||||
@C(a = @A(x = {}), b = @B(x = "x", z = "z", y = {}))
|
||||
@D()
|
||||
@E(d = @D())
|
||||
public static final void foo() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* public final annotation class B : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(Ljava/lang/String;[ILjava/lang/String;)V
|
||||
* public constructor(x: kotlin/String, vararg y: kotlin/Int (* kotlin/IntArray *), z: kotlin/String)
|
||||
*
|
||||
* // getter: x()Ljava/lang/String;
|
||||
* public final val x: kotlin/String
|
||||
* public final get
|
||||
*
|
||||
* // getter: y()[I
|
||||
* public final val y: kotlin/IntArray
|
||||
* public final get
|
||||
*
|
||||
* // getter: z()Ljava/lang/String;
|
||||
* public final val z: kotlin/String
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface B {
|
||||
|
||||
public abstract java.lang.String x();
|
||||
|
||||
public abstract int[] y();
|
||||
|
||||
public abstract java.lang.String z();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* public final annotation class C : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(LA;LB;)V
|
||||
* public constructor(a: A, b: B)
|
||||
*
|
||||
* // getter: a()LA;
|
||||
* public final val a: A
|
||||
* public final get
|
||||
*
|
||||
* // getter: b()LB;
|
||||
* public final val b: B
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface C {
|
||||
|
||||
public abstract A a();
|
||||
|
||||
public abstract B b();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* public final annotation class D : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(Lkotlin/Array;)V
|
||||
* public constructor(vararg x: kotlin/String (* kotlin/Array<out kotlin/String> *) (* = ... *))
|
||||
*
|
||||
* // getter: x()[Ljava/lang/String;
|
||||
* public final val x: kotlin/Array<out kotlin/String>
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface D {
|
||||
|
||||
public abstract java.lang.String[] x() default {"a", "b"};
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* public final annotation class E : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(LD;)V
|
||||
* public constructor(d: D)
|
||||
*
|
||||
* // getter: d()LD;
|
||||
* public final val d: D
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface E {
|
||||
|
||||
public abstract D d();
|
||||
}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class A : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>([I)V
|
||||
* public constructor(vararg x: kotlin/Int (* kotlin/IntArray *))
|
||||
*
|
||||
* // getter: x()[I
|
||||
* public final val x: kotlin/IntArray
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface A {
|
||||
|
||||
public abstract int[] x();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* package {
|
||||
*
|
||||
* // signature: bar()V
|
||||
* public final fun bar(): kotlin/Unit
|
||||
*
|
||||
* // signature: baz()V
|
||||
* public final fun baz(): kotlin/Unit
|
||||
*
|
||||
* // signature: foo()V
|
||||
* public final fun foo(): kotlin/Unit
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public final class AnnotationWithVaragArgumentsKt {
|
||||
|
||||
public AnnotationWithVaragArgumentsKt() {
|
||||
super();
|
||||
}
|
||||
|
||||
@A(x = {})
|
||||
@B(x = "x", z = "z", y = {})
|
||||
@C(a = @A(x = {}), b = @B(x = "x", y = {}, z = "z"))
|
||||
@D()
|
||||
@E(d = @D())
|
||||
public static final void foo() {
|
||||
}
|
||||
|
||||
@A(x = {1})
|
||||
@B(x = "x", y = {1}, z = "z")
|
||||
@C(a = @A(x = {1}), b = @B(x = "x", y = {1}, z = "z"))
|
||||
public static final void bar() {
|
||||
}
|
||||
|
||||
@A(x = {1, 2})
|
||||
@B(x = "x", y = {1, 2}, z = "z")
|
||||
@C(a = @A(x = {1, 2}), b = @B(x = "x", y = {1, 2}, z = "z"))
|
||||
public static final void baz() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class B : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(Ljava/lang/String;[ILjava/lang/String;)V
|
||||
* public constructor(x: kotlin/String, vararg y: kotlin/Int (* kotlin/IntArray *), z: kotlin/String)
|
||||
*
|
||||
* // getter: x()Ljava/lang/String;
|
||||
* public final val x: kotlin/String
|
||||
* public final get
|
||||
*
|
||||
* // getter: y()[I
|
||||
* public final val y: kotlin/IntArray
|
||||
* public final get
|
||||
*
|
||||
* // getter: z()Ljava/lang/String;
|
||||
* public final val z: kotlin/String
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface B {
|
||||
|
||||
public abstract java.lang.String x();
|
||||
|
||||
public abstract int[] y();
|
||||
|
||||
public abstract java.lang.String z();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class C : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(LA;LB;)V
|
||||
* public constructor(a: A, b: B)
|
||||
*
|
||||
* // getter: a()LA;
|
||||
* public final val a: A
|
||||
* public final get
|
||||
*
|
||||
* // getter: b()LB;
|
||||
* public final val b: B
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface C {
|
||||
|
||||
public abstract A a();
|
||||
|
||||
public abstract B b();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class D : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(Lkotlin/Array;)V
|
||||
* public constructor(vararg x: kotlin/String (* kotlin/Array<out kotlin/String> *) (* = ... *))
|
||||
*
|
||||
* // getter: x()[Ljava/lang/String;
|
||||
* public final val x: kotlin/Array<out kotlin/String>
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface D {
|
||||
|
||||
public abstract java.lang.String[] x() default {"a", "b"};
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class E : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(LD;)V
|
||||
* public constructor(d: D)
|
||||
*
|
||||
* // getter: d()LD;
|
||||
* public final val d: D
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface E {
|
||||
|
||||
public abstract D d();
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
annotation class A(vararg val x: Int)
|
||||
annotation class B(val x: String, vararg val y: Int, val z: String)
|
||||
annotation class C(val a: A, val b: B)
|
||||
annotation class D(vararg val x: String = ["a", "b"])
|
||||
annotation class E(val d: D)
|
||||
|
||||
@A
|
||||
@B(x = "x", z = "z")
|
||||
@C(A(), B("x", z = "z"))
|
||||
@D()
|
||||
@E(d = D())
|
||||
fun foo() {}
|
||||
|
||||
@A(1)
|
||||
@B("x", 1, z = "z")
|
||||
@C(A(1), B("x", 1, z = "z"))
|
||||
fun bar() {}
|
||||
|
||||
@A(1, 2)
|
||||
@B("x", 1, 2, z = "z")
|
||||
@C(A(1, 2), B("x", 1, 2, z = "z"))
|
||||
fun baz() {}
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class A : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>([I)V
|
||||
* public constructor(vararg x: kotlin/Int (* kotlin/IntArray *))
|
||||
*
|
||||
* // getter: x()[I
|
||||
* public final val x: kotlin/IntArray
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface A {
|
||||
|
||||
public abstract int[] x();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* package {
|
||||
*
|
||||
* // signature: bar()V
|
||||
* public final fun bar(): kotlin/Unit
|
||||
*
|
||||
* // signature: baz()V
|
||||
* public final fun baz(): kotlin/Unit
|
||||
*
|
||||
* // signature: foo()V
|
||||
* public final fun foo(): kotlin/Unit
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public final class AnnotationWithVaragArgumentsKt {
|
||||
|
||||
public AnnotationWithVaragArgumentsKt() {
|
||||
super();
|
||||
}
|
||||
|
||||
@A(x = {})
|
||||
@B(x = "x", z = "z", y = {})
|
||||
@C(a = @A(x = {}), b = @B(z = "z", y = {}, x = "x"))
|
||||
@D()
|
||||
@E(d = @D())
|
||||
public static final void foo() {
|
||||
}
|
||||
|
||||
@A(x = {1})
|
||||
@B(x = "x", y = {1}, z = "z")
|
||||
@C(a = @A(x = {1}), b = @B(z = "z", y = {1}, x = "x"))
|
||||
public static final void bar() {
|
||||
}
|
||||
|
||||
@A(x = {1, 2})
|
||||
@B(x = "x", y = {1, 2}, z = "z")
|
||||
@C(a = @A(x = {1, 2}), b = @B(z = "z", y = {1, 2}, x = "x"))
|
||||
public static final void baz() {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class B : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(Ljava/lang/String;[ILjava/lang/String;)V
|
||||
* public constructor(x: kotlin/String, vararg y: kotlin/Int (* kotlin/IntArray *), z: kotlin/String)
|
||||
*
|
||||
* // getter: x()Ljava/lang/String;
|
||||
* public final val x: kotlin/String
|
||||
* public final get
|
||||
*
|
||||
* // getter: y()[I
|
||||
* public final val y: kotlin/IntArray
|
||||
* public final get
|
||||
*
|
||||
* // getter: z()Ljava/lang/String;
|
||||
* public final val z: kotlin/String
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface B {
|
||||
|
||||
public abstract java.lang.String x();
|
||||
|
||||
public abstract int[] y();
|
||||
|
||||
public abstract java.lang.String z();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class C : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(LA;LB;)V
|
||||
* public constructor(a: A, b: B)
|
||||
*
|
||||
* // getter: a()LA;
|
||||
* public final val a: A
|
||||
* public final get
|
||||
*
|
||||
* // getter: b()LB;
|
||||
* public final val b: B
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface C {
|
||||
|
||||
public abstract A a();
|
||||
|
||||
public abstract B b();
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class D : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(Lkotlin/Array;)V
|
||||
* public constructor(vararg x: kotlin/String (* kotlin/Array<out kotlin/String> *) (* = ... *))
|
||||
*
|
||||
* // getter: x()[Ljava/lang/String;
|
||||
* public final val x: kotlin/Array<out kotlin/String>
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface D {
|
||||
|
||||
public abstract java.lang.String[] x() default {"a", "b"};
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class E : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>(LD;)V
|
||||
* public constructor(d: D)
|
||||
*
|
||||
* // getter: d()LD;
|
||||
* public final val d: D
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface E {
|
||||
|
||||
public abstract D d();
|
||||
}
|
||||
+6
@@ -55,6 +55,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/annotationWithFqNames.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
+6
@@ -55,6 +55,12 @@ public class IrClassFileToSourceStubConverterTestGenerated extends AbstractIrCla
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/annotationWithFqNames.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
+6
@@ -55,6 +55,12 @@ public class KotlinKapt4ContextTestGenerated extends AbstractKotlinKapt4ContextT
|
||||
runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/annotationWithFqNames.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationWithVaragArguments.kt")
|
||||
public void testAnnotationWithVaragArguments() throws Exception {
|
||||
runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/annotationWithVaragArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user