Instantiation of annotations for JVM IR with the corresponding feature flag

Seperate checker for platforms that do not support this language feature yet

Synthetic implementations of annotations are generated on-demand with proper 
equals, hashCode, and annotationType methods

#KT-47699 Fixed
This commit is contained in:
Leonid Startsev
2021-07-21 10:23:51 +00:00
committed by Space
parent 4bc521249b
commit ce0a3a57df
59 changed files with 1589 additions and 64 deletions
@@ -1103,6 +1103,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt");
}
@Test
@TestMetadata("ConstructorCallAllowed.kt")
public void testConstructorCallAllowed() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/ConstructorCallAllowed.kt");
}
@Test
@TestMetadata("DanglingMixed.kt")
public void testDanglingMixed() throws Exception {
@@ -1103,6 +1103,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt");
}
@Test
@TestMetadata("ConstructorCallAllowed.kt")
public void testConstructorCallAllowed() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/ConstructorCallAllowed.kt");
}
@Test
@TestMetadata("DanglingMixed.kt")
public void testDanglingMixed() throws Exception {
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -380,6 +380,76 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/annotations/instances")
@TestDataPath("$PROJECT_ROOT")
public class Instances {
@Test
public void testAllFilesPresentInInstances() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations/instances"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("annotationEnclosingName.kt")
public void testAnnotationEnclosingName() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/annotationEnclosingName.kt");
}
@Test
@TestMetadata("annotationEqHc.kt")
public void testAnnotationEqHc() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/annotationEqHc.kt");
}
@Test
@TestMetadata("annotationInstances.kt")
public void testAnnotationInstances() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/annotationInstances.kt");
}
@Test
@TestMetadata("annotationInstancesEmptyDefault.kt")
public void testAnnotationInstancesEmptyDefault() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/annotationInstancesEmptyDefault.kt");
}
@Test
@TestMetadata("annotationToString.kt")
public void testAnnotationToString() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/annotationToString.kt");
}
@Test
@TestMetadata("annotationType.kt")
public void testAnnotationType() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/annotationType.kt");
}
@Test
@TestMetadata("javaAnnotation.kt")
public void testJavaAnnotation() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/javaAnnotation.kt");
}
@Test
@TestMetadata("multifileEqHc.kt")
public void testMultifileEqHc() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/multifileEqHc.kt");
}
@Test
@TestMetadata("multimoduleInlining.kt")
public void testMultimoduleInlining() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/multimoduleInlining.kt");
}
@Test
@TestMetadata("multiplatformInstantiation.kt")
public void testMultiplatformInstantiation() throws Exception {
runTest("compiler/testData/codegen/box/annotations/instances/multiplatformInstantiation.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/annotations/kClassMapping")
@TestDataPath("$PROJECT_ROOT")
@@ -25,6 +25,28 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/annotations")
@TestDataPath("$PROJECT_ROOT")
public class Annotations {
@Test
public void testAllFilesPresentInAnnotations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("annotationInstanceInlining.kt")
public void testAnnotationInstanceInlining() throws Exception {
runTest("compiler/testData/codegen/boxInline/annotations/annotationInstanceInlining.kt");
}
@Test
@TestMetadata("instanceInAnonymousClass.kt")
public void testInstanceInAnonymousClass() throws Exception {
runTest("compiler/testData/codegen/boxInline/annotations/instanceInAnonymousClass.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject")
@TestDataPath("$PROJECT_ROOT")