You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.
I Use APT to append annotation to a field. When I used in kotlin. It not work.
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FIELD)
@Retention(AnnotationRetention.SOURCE)
@MustBeDocumented
annotation class Inject(
val value: String = ""
)
When It annotation on a field, I want to replace it to javax.inject.Inject.
so I extends AbstractProcessor and init context.
override fun init(processingEnv: ProcessingEnvironment) {
val trees = JavacTrees.instance(processingEnv as JavacProcessingEnvironment)
}
It throws
[ERROR] [kapt] An exception occurred: java.lang.ClassCastException: com.sun.tools.javac.processing.JavacProcessingEnvironment cannot be cast to com.sun.tools.javac.processing.JavacProcessingEnvironment
[ERROR] at com.meitu.rec.starter.annotation.processor.InjectProcessor.init(InjectProcessor.kt:73)
[ERROR] at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.init(incrementalProcessors.kt:31)
[ERROR] at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.init(annotationProcessing.kt:156)
[ERROR] at com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(JavacProcessingEnvironment.java:500)
I don't know how to solve it.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I Use APT to append annotation to a field. When I used in kotlin. It not work.
When It annotation on a field, I want to replace it to javax.inject.Inject.
so I extends AbstractProcessor and init context.
It throws
I don't know how to solve it.
The text was updated successfully, but these errors were encountered: