Better pre-1.6.20 compatibility fix for AnnotationImplementation
^KT-49428
This commit is contained in:
+4
-2
@@ -50,9 +50,11 @@ abstract class AnnotationImplementationTransformer(val context: BackendContext,
|
|||||||
|
|
||||||
override fun visitClassNew(declaration: IrClass): IrStatement {
|
override fun visitClassNew(declaration: IrClass): IrStatement {
|
||||||
declaration.takeIf { declaration.isAnnotationClass }?.constructors?.singleOrNull()?.apply {
|
declaration.takeIf { declaration.isAnnotationClass }?.constructors?.singleOrNull()?.apply {
|
||||||
// Compatibility hack. Now, frontend generates constructor body for annotations
|
// Compatibility hack. Now, frontend generates constructor body for annotations and makes them open
|
||||||
// but, if one gets annotation from pre-1.6.20 klib, it would have none, so we need to generate it's body
|
// but, if one gets annotation from pre-1.6.20 klib, it would have no constructor body and would be final,
|
||||||
|
// so we need to fix it
|
||||||
if (body == null) {
|
if (body == null) {
|
||||||
|
declaration.modality = Modality.OPEN
|
||||||
body = context.createIrBuilder(symbol)
|
body = context.createIrBuilder(symbol)
|
||||||
.irBlockBody(SYNTHETIC_OFFSET, SYNTHETIC_OFFSET) {
|
.irBlockBody(SYNTHETIC_OFFSET, SYNTHETIC_OFFSET) {
|
||||||
+irDelegatingConstructorCall(context.irBuiltIns.anyClass.owner.constructors.single())
|
+irDelegatingConstructorCall(context.irBuiltIns.anyClass.owner.constructors.single())
|
||||||
|
|||||||
Reference in New Issue
Block a user