Fix deserialization of enum annotation arguments at runtime

This commit is contained in:
Alexander Udalov
2015-02-27 17:22:02 +03:00
parent f36ef6f546
commit 4fb420f3f1
12 changed files with 177 additions and 13 deletions
@@ -409,6 +409,12 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
doTestCompiledJava(fileName);
}
@TestMetadata("EnumArgumentWithCustomToString.java")
public void testEnumArgumentWithCustomToString() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/annotations/EnumArgumentWithCustomToString.java");
doTestCompiledJava(fileName);
}
@TestMetadata("EnumInParam.java")
public void testEnumInParam() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/annotations/EnumInParam.java");
@@ -1907,6 +1913,12 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
doTestCompiledKotlin(fileName);
}
@TestMetadata("EnumArgumentWithCustomToString.kt")
public void testEnumArgumentWithCustomToString() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/EnumArgumentWithCustomToString.kt");
doTestCompiledKotlin(fileName);
}
@TestMetadata("SimpleAnnotation.kt")
public void testSimpleAnnotation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/SimpleAnnotation.kt");
@@ -149,9 +149,12 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
else if (header == null ||
(header.kind == KotlinClassHeader.Kind.CLASS && header.classKind == JvmAnnotationNames.KotlinClass.Kind.CLASS)) {
// Either a normal Kotlin class or a Java class
val classDescriptor = module.findClassAcrossModuleDependencies(klass.classId).sure("Couldn't resolve class $className")
if (DescriptorUtils.isTopLevelDeclaration(classDescriptor)) {
scope.addClassifierDescriptor(classDescriptor)
val classId = klass.classId
if (!classId.isLocal()) {
val classDescriptor = module.findClassAcrossModuleDependencies(classId).sure("Couldn't resolve class $className")
if (DescriptorUtils.isTopLevelDeclaration(classDescriptor)) {
scope.addClassifierDescriptor(classDescriptor)
}
}
}
}
@@ -87,6 +87,12 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
doTest(fileName);
}
@TestMetadata("EnumArgumentWithCustomToString.kt")
public void testEnumArgumentWithCustomToString() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/EnumArgumentWithCustomToString.kt");
doTest(fileName);
}
@TestMetadata("SimpleAnnotation.kt")
public void testSimpleAnnotation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/SimpleAnnotation.kt");
@@ -3433,6 +3439,12 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
doTest(fileName);
}
@TestMetadata("EnumArgumentWithCustomToString.java")
public void testEnumArgumentWithCustomToString() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/annotations/EnumArgumentWithCustomToString.java");
doTest(fileName);
}
@TestMetadata("EnumInParam.java")
public void testEnumInParam() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/annotations/EnumInParam.java");