[FIR2IR] Simplify logic around annotationMode

#KT-58005 Fixed
This commit is contained in:
Ivan Kylchik
2023-04-28 18:01:40 +02:00
committed by Space Team
parent 59ea7717dd
commit 73cc73115e
10 changed files with 156 additions and 60 deletions
@@ -0,0 +1,66 @@
// TARGET_BACKEND: JVM
// FILE: ComponentScans.java
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ComponentScans {
ComponentScan[] value();
}
// FILE: ComponentScan.java
import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Repeatable(ComponentScans.class)
public @interface ComponentScan {
String[] a() default {};
String[] b() default {};
String[] c() default {};
}
// FILE: main.kt
@ComponentScans(
value = [
ComponentScan(
a = ["String" <!EVALUATED("StringA")!>+ "A"<!>],
c = ["String" <!EVALUATED("StringC")!>+ "C"<!>],
b = ["String" <!EVALUATED("StringB")!>+ "B"<!>],
)
]
)
class JavaTest
annotation class KtComponentScans(
val value: Array<KtComponentScan> = [],
)
annotation class KtComponentScan(
val a: Array<String> = [],
val b: Array<String> = [],
val c: Array<String> = [],
)
@ComponentScans(
value = [
ComponentScan(
a = ["String" <!EVALUATED("StringA")!>+ "A"<!>],
c = ["String" <!EVALUATED("StringC")!>+ "C"<!>],
b = ["String" <!EVALUATED("StringB")!>+ "B"<!>],
)
]
)
class KtTest
fun box(): String {
return "OK"
}