alvr
03/14/2025, 9:52 AMresolvedType
of an annotation argument? I'm using this in FirDeclarationGenerationExtension
to create a function with a specific returnType:
val annotation = resolvedAnnotationsWithArguments.getAnnotationByClassId(annotationClassId, session) ?: return null
val returnTypeArgument = annotation.findArgumentByName(returnTypeArg, false) as? FirGetClassCall
val returnType = returnTypeArgument?.resolvedType
The annotation is like: @Generate(returnType = MyClass::class)
. If the value is present, then the return type will be the specified, or the type of the class otherwise.
But Caused by: org.jetbrains.kotlin.utils.exceptions.KotlinIllegalArgumentExceptionWithAttachments: Expected expression 'FirGetClassCallImpl' to be resolved
is thrown.dmitriy.novozhilov
03/14/2025, 9:52 AMFirDeclarationGenerationExtension
could be called before the arguments of annotation are resolved, so the answer is no for the general casealvr
03/14/2025, 10:06 AMFirStatusTransformerExtension
?dmitriy.novozhilov
03/14/2025, 10:06 AM