Kapt3: Allow annotations with Kotlin-only targets, such as PROPERTY (KT-15697)
This commit is contained in:
committed by
Yan Zhulanow
parent
6ded5939eb
commit
1819194a4c
@@ -45,7 +45,8 @@ class KaptJavaLog(
|
|||||||
"compiler.err.name.clash.same.erasure.no.override",
|
"compiler.err.name.clash.same.erasure.no.override",
|
||||||
"compiler.err.name.clash.same.erasure.no.override.1",
|
"compiler.err.name.clash.same.erasure.no.override.1",
|
||||||
"compiler.err.name.clash.same.erasure.no.hide",
|
"compiler.err.name.clash.same.erasure.no.hide",
|
||||||
"compiler.err.already.defined")
|
"compiler.err.already.defined",
|
||||||
|
"compiler.err.annotation.type.not.applicable")
|
||||||
|
|
||||||
internal fun preRegister(context: Context, messageCollector: MessageCollector) {
|
internal fun preRegister(context: Context, messageCollector: MessageCollector) {
|
||||||
context.put(Log.logKey, Context.Factory<Log> {
|
context.put(Log.logKey, Context.Factory<Log> {
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ class ClassFileToSourceStubConverter(
|
|||||||
"java.lang.Deprecated", "kotlin.Deprecated", // Deprecated annotations
|
"java.lang.Deprecated", "kotlin.Deprecated", // Deprecated annotations
|
||||||
"java.lang.Synthetic",
|
"java.lang.Synthetic",
|
||||||
"synthetic.kotlin.jvm.GeneratedByJvmOverloads", // kapt3-related annotation for marking JvmOverloads-generated methods
|
"synthetic.kotlin.jvm.GeneratedByJvmOverloads", // kapt3-related annotation for marking JvmOverloads-generated methods
|
||||||
"java.lang.annotation.", // Java annotations
|
|
||||||
"kotlin.jvm.", "kotlin.Metadata" // Kotlin annotations from runtime
|
"kotlin.jvm.", "kotlin.Metadata" // Kotlin annotations from runtime
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
public abstract @interface Anno1 {
|
public abstract @interface Anno1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
public abstract @interface Anno2 {
|
public abstract @interface Anno2 {
|
||||||
|
|
||||||
public abstract int i() default 5;
|
public abstract int i() default 5;
|
||||||
@@ -28,6 +30,7 @@ public abstract @interface Anno2 {
|
|||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
public abstract @interface Anno3 {
|
public abstract @interface Anno3 {
|
||||||
|
|
||||||
public abstract java.lang.String value();
|
public abstract java.lang.String value();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package test;
|
package test;
|
||||||
|
|
||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
@Anno(value = "anno-class")
|
@Anno(value = "anno-class")
|
||||||
public abstract @interface Anno {
|
public abstract @interface Anno {
|
||||||
|
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
public abstract @interface Anno1 {
|
public abstract @interface Anno1 {
|
||||||
|
|
||||||
public abstract java.lang.String value();
|
public abstract java.lang.String value();
|
||||||
|
|||||||
+4
-1
@@ -1,6 +1,9 @@
|
|||||||
annotation class Anno
|
annotation class Anno
|
||||||
|
|
||||||
|
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS)
|
||||||
|
annotation class Anno2
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
@property:Anno
|
@property:[Anno Anno2]
|
||||||
val prop = "A"
|
val prop = "A"
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,24 @@
|
|||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
public abstract @interface Anno {
|
public abstract @interface Anno {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
@java.lang.annotation.Target(value = {java.lang.annotation.ElementType.TYPE})
|
||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
|
@kotlin.annotation.Target(allowedTargets = {kotlin.annotation.AnnotationTarget.PROPERTY, kotlin.annotation.AnnotationTarget.CLASS})
|
||||||
|
public abstract @interface Anno2 {
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
|
||||||
|
|
||||||
public final class Test {
|
public final class Test {
|
||||||
@org.jetbrains.annotations.NotNull()
|
@org.jetbrains.annotations.NotNull()
|
||||||
private final java.lang.String prop = "A";
|
private final java.lang.String prop = "A";
|
||||||
|
|
||||||
|
@Anno2()
|
||||||
@Anno()
|
@Anno()
|
||||||
private static void prop$annotations() {
|
private static void prop$annotations() {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package test.another;
|
package test.another;
|
||||||
|
|
||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
public abstract @interface Anno {
|
public abstract @interface Anno {
|
||||||
|
|
||||||
public abstract java.lang.String value();
|
public abstract java.lang.String value();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package test;
|
package test;
|
||||||
|
|
||||||
|
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||||
public abstract @interface MyAnnotation {
|
public abstract @interface MyAnnotation {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user