FIR Java: make type annotations lazy

This commit is contained in:
Mikhail Glukhikh
2020-12-24 13:32:07 +03:00
parent 776c4ba6ca
commit 1239a8629e
3 changed files with 46 additions and 23 deletions
@@ -92,9 +92,12 @@ internal fun FirTypeRef.toConeKotlinTypeProbablyFlexible(
}
internal fun JavaType.toFirJavaTypeRef(session: FirSession, javaTypeParameterStack: JavaTypeParameterStack): FirJavaTypeRef {
val annotations = (this as? JavaClassifierType)?.annotations.orEmpty()
return buildJavaTypeRef {
annotations.mapTo(this.annotations) { it.toFirAnnotationCall(session, javaTypeParameterStack) }
annotationBuilder = {
(this@toFirJavaTypeRef as? JavaClassifierType)?.annotations.orEmpty().map {
it.toFirAnnotationCall(session, javaTypeParameterStack)
}
}
type = this@toFirJavaTypeRef
}
}