JVM IR: generate source-retained annotations in kapt mode

#KT-49682
This commit is contained in:
Alexander Udalov
2021-12-09 00:59:20 +01:00
parent 1df2851611
commit fc2c0eea27
8 changed files with 150 additions and 7 deletions
@@ -186,7 +186,7 @@ abstract class AnnotationCodegen(
private fun genAnnotation(annotation: IrConstructorCall, path: TypePath?, isTypeAnnotation: Boolean): String? {
val annotationClass = annotation.annotationClass
val retentionPolicy = getRetentionPolicy(annotationClass)
if (retentionPolicy == RetentionPolicy.SOURCE) return null
if (retentionPolicy == RetentionPolicy.SOURCE && !context.state.classBuilderMode.generateSourceRetentionAnnotations) return null
// FlexibleNullability is an internal annotation, used only inside the compiler
if (annotationClass.fqNameWhenAvailable in internalAnnotations) return null