philglass
01/27/2022, 9:19 AMgetAnnotationsByType? Is it expected that KClass annotation parameters that reference user-defined classes won’t work?
Both of these examples fail with a KSTypesNotPresentException ultimately caused by a ClassNotFoundException if I try to access the includes property on the proxy:
@Module class First
@Module(includes = [First::class]) Second
@Module(includes = [FromUpstreamModule::class]) Third
This works (it’s invalid for unrelated reasons, but the class lookup works):
@Module(includes = [Unit::class]) Fourth
This fails with the same exception but for a slightly different reason - it’s trying to look up kotlin.String at runtime (presumably it should be translated to java.lang.String at some point for JVM projects):
@Module(includes = [String::class]) FifthJiaxiang
01/27/2022, 9:38 AMincludes property on the proxy”?philglass
01/27/2022, 9:41 AMannotated.getAnnotationsByType(Module::class).single().includesJiaxiang
01/27/2022, 9:44 AMphilglass
01/27/2022, 9:44 AM@Module is defined like this (my actual use case is slightly different but fundamentally the same):
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.BINARY)
annotation class Module(val includes: Array<KClass<*>> = [])Jiaxiang
01/27/2022, 9:46 AMModule defined in another compile module as well?philglass
01/27/2022, 9:48 AMJiaxiang
01/27/2022, 9:48 AMThird and Fifth, I will take a note.philglass
01/27/2022, 9:52 AMKSAnnotation.arguments works fine, I get a List<KSType> as the argument value. I guess I was wondering what the use case for getAnnotationsByType is if things like this are expected to blow up - is it more of a convenience for annotations with primitive/`String` etc. parameters?Jiaxiang
01/31/2022, 9:41 PMapi util module meaning it can be implemented by processor users themselves, and added there just for some convenienceglureau
11/14/2022, 7:51 PMglureau
11/14/2022, 8:56 PM