Serialize/deserialize annotations on types

This commit is contained in:
Alexander Udalov
2015-04-09 21:12:08 +03:00
parent 88abcdbde5
commit 0732b78853
25 changed files with 420 additions and 128 deletions
@@ -92,6 +92,11 @@ class AnnotationLoaderForStubBuilder(
errorReporter: ErrorReporter
) : AbstractBinaryClassAnnotationAndConstantLoader<ClassId, Unit>(
LockBasedStorageManager.NO_LOCKS, kotlinClassFinder, errorReporter) {
override fun loadTypeAnnotations(type: ProtoBuf.Type, nameResolver: NameResolver): MutableList<ClassId> {
// TODO: support type annotations in cls stubs
throw UnsupportedOperationException()
}
override fun loadConstant(desc: String, initializer: Any) = null
override fun loadAnnotation(annotationClassId: ClassId, result: MutableList<ClassId>): KotlinJvmBinaryClass.AnnotationArgumentVisitor? {
@@ -417,6 +417,33 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest {
doTest(fileName);
}
}
@TestMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Types extends AbstractResolveByStubTest {
public void testAllFilesPresentInTypes() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/loadJava/compiledKotlin/annotations/types"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("ReceiverParameter.kt")
public void testReceiverParameter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/ReceiverParameter.kt");
doTest(fileName);
}
@TestMetadata("SimpleTypeAnnotation.kt")
public void testSimpleTypeAnnotation() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/SimpleTypeAnnotation.kt");
doTest(fileName);
}
@TestMetadata("TypeAnnotationWithArguments.kt")
public void testTypeAnnotationWithArguments() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/annotations/types/TypeAnnotationWithArguments.kt");
doTest(fileName);
}
}
}
@TestMetadata("compiler/testData/loadJava/compiledKotlin/class")