Vladimir Tagakov
08/03/2022, 7:10 AM//Module A
public class MyJavaClass {
public @interface MyAnnotation {}
}
//Module B with KSP Processor
class MyKotlinClass(@MyJavaClass.MyAnnotation val myProp: Any)
Hi! In my KSP Processor I’m trying to resolve KSTypeReference
of annotation type MyJavaClass.MyAnnotation
which I face during analysis of `MyKotlinClass`’s constructor and for some reason it could not be resolved (KSType#isError
returns true).
If I move MyAnnotation
to the top-level everything works fine.
I am not sure how I can debug this issue, any ideas? =\resolver.getClassDeclarationByName
by its FQCN everything works just fine, so I think it means that theoretically it could be resolvedJiaxiang
08/03/2022, 5:23 PMMyAnnotation
is already at top level? Do you mean you are not able to resolve the type when the annotation is on the constructor parameter?Vladimir Tagakov
08/03/2022, 5:56 PMMyAnnotation
is declared inside MyJavaClass
. So it’s canonical name is MyJavaClass$MyAnnotation
. When I declare MyAnnotation
at the top-level, so its canonical name becomes just MyAnnotation
(assuming I am using default empty package there) it could be resolved just fine.Jiaxiang
08/03/2022, 6:28 PMVladimir Tagakov
08/03/2022, 6:44 PM1.6.21-1.0.5
Jiaxiang
08/04/2022, 7:01 PM