From c69997491fd34c2e5807a962139b0c2eaf1d92ba Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 16 Sep 2019 12:31:56 +0200 Subject: [PATCH] JVM IR: generate file annotations on file facade classes --- .../jetbrains/kotlin/backend/jvm/lower/FileClassLowering.kt | 4 +++- .../codegen/box/annotations/fileClassWithFileAnnotation.kt | 2 -- .../box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FileClassLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FileClassLowering.kt index dfa71c6800a..2e72746eb11 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FileClassLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/FileClassLowering.kt @@ -101,6 +101,9 @@ private class FileClassLowering(val context: JvmBackendContext) : FileLoweringPa it.backingField?.let { it.parent = this } } } + + annotations += irFile.annotations + metadata = irFile.metadata val partClassType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(fileClassInfo.fileClassFqName) @@ -114,6 +117,5 @@ private class FileClassLowering(val context: JvmBackendContext) : FileLoweringPa context.multifileFacadesToAdd.getOrPut(jvmClassName) { ArrayList() }.add(this) } } - // TODO file annotations } } diff --git a/compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt b/compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt index cf2fbd538d6..959f79f2aa2 100644 --- a/compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt +++ b/compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt @@ -1,6 +1,4 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM - // WITH_RUNTIME @file:StringHolder("OK") diff --git a/compiler/testData/codegen/box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt b/compiler/testData/codegen/box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt index f42152696b2..34d7f33f24c 100644 --- a/compiler/testData/codegen/box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt +++ b/compiler/testData/codegen/box/jvmName/fileFacades/javaAnnotationOnFileFacade.kt @@ -1,6 +1,4 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM - // WITH_RUNTIME // FILE: StringHolder.java