Support object array annotation arguments in deserialization
This commit is contained in:
+17
-2
@@ -157,8 +157,23 @@ public class VirtualFileKotlinClass implements KotlinJvmBinaryClass {
|
||||
|
||||
@Override
|
||||
public org.jetbrains.org.objectweb.asm.AnnotationVisitor visitArray(String name) {
|
||||
AnnotationArgumentVisitor av = v.visitArray(Name.guess(name));
|
||||
return av == null ? null : convertAnnotationVisitor(av);
|
||||
final AnnotationArrayArgumentVisitor arv = v.visitArray(Name.guess(name));
|
||||
return arv == null ? null : new org.jetbrains.org.objectweb.asm.AnnotationVisitor(ASM5) {
|
||||
@Override
|
||||
public void visit(String name, Object value) {
|
||||
arv.visit(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnum(String name, String desc, String value) {
|
||||
arv.visitEnum(classNameFromAsmDesc(desc), Name.identifier(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
arv.visitEnd();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
//ALLOW_AST_ACCESS
|
||||
package test
|
||||
|
||||
import java.lang.annotation.ElementType
|
||||
|
||||
annotation class Anno(vararg t: ElementType)
|
||||
|
||||
Anno(ElementType.METHOD, ElementType.FIELD) fun foo() {}
|
||||
|
||||
Anno(ElementType.PACKAGE) val bar = 42
|
||||
|
||||
Anno() fun baz() {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package test
|
||||
|
||||
test.Anno(t = {ElementType.PACKAGE}: kotlin.Array<java.lang.annotation.ElementType>) internal val bar: kotlin.Int = 42
|
||||
internal fun <get-bar>(): kotlin.Int
|
||||
test.Anno(t = {}: kotlin.Array<java.lang.annotation.ElementType>) internal fun baz(): kotlin.Unit
|
||||
test.Anno(t = {ElementType.METHOD, ElementType.FIELD}: kotlin.Array<java.lang.annotation.ElementType>) internal fun foo(): kotlin.Unit
|
||||
|
||||
internal final annotation class Anno : kotlin.Annotation {
|
||||
/*primary*/ public constructor Anno(/*0*/ vararg t: java.lang.annotation.ElementType /*kotlin.Array<java.lang.annotation.ElementType>*/)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
//ALLOW_AST_ACCESS
|
||||
package test
|
||||
|
||||
annotation class Anno(vararg t: String)
|
||||
|
||||
Anno("live", "long") fun foo() {}
|
||||
|
||||
Anno("prosper") val bar = 42
|
||||
|
||||
Anno() fun baz() {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package test
|
||||
|
||||
test.Anno(t = {"prosper"}: kotlin.Array<kotlin.String>) internal val bar: kotlin.Int = 42
|
||||
internal fun <get-bar>(): kotlin.Int
|
||||
test.Anno(t = {}: kotlin.Array<kotlin.String>) internal fun baz(): kotlin.Unit
|
||||
test.Anno(t = {"live", "long"}: kotlin.Array<kotlin.String>) internal fun foo(): kotlin.Unit
|
||||
|
||||
internal final annotation class Anno : kotlin.Annotation {
|
||||
/*primary*/ public constructor Anno(/*0*/ vararg t: kotlin.String /*kotlin.Array<kotlin.String>*/)
|
||||
}
|
||||
@@ -1715,6 +1715,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
||||
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/EnumArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumArrayArgument.kt")
|
||||
public void testEnumArrayArgument() throws Exception {
|
||||
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/EnumArrayArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/Function.kt");
|
||||
@@ -1735,6 +1740,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
||||
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/Setter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StringArrayArgument.kt")
|
||||
public void testStringArrayArgument() throws Exception {
|
||||
doTestCompiledKotlin("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/StringArrayArgument.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/annotations/parameters")
|
||||
|
||||
+10
@@ -183,6 +183,11 @@ public class LazyResolveRecursiveComparingTestGenerated extends AbstractLazyReso
|
||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/EnumArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumArrayArgument.kt")
|
||||
public void testEnumArrayArgument() throws Exception {
|
||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/EnumArrayArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/Function.kt");
|
||||
@@ -203,6 +208,11 @@ public class LazyResolveRecursiveComparingTestGenerated extends AbstractLazyReso
|
||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/Setter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("StringArrayArgument.kt")
|
||||
public void testStringArrayArgument() throws Exception {
|
||||
doTestCheckingPrimaryConstructorsAndAccessors("compiler/testData/loadJava/compiledKotlin/annotations/packageMembers/StringArrayArgument.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/annotations/parameters")
|
||||
|
||||
Reference in New Issue
Block a user