diff options
author | Dmitry Petrashko <dark@d-d.me> | 2016-12-16 10:55:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-16 10:55:42 +0100 |
commit | 653698ef67a5cf8f5e0fd0fcdcd1f631f1dc96e2 (patch) | |
tree | 9ba2ced6eca5d58190dcdb40422be3e0ff2380be /compiler/src/dotty/tools/backend | |
parent | 50bcb1ac954436d011cf11a30ef0ee4a066c00d1 (diff) | |
parent | 9411539eac8aaa8f052b7e6701d5d1d2b833d409 (diff) | |
download | dotty-653698ef67a5cf8f5e0fd0fcdcd1f631f1dc96e2.tar.gz dotty-653698ef67a5cf8f5e0fd0fcdcd1f631f1dc96e2.tar.bz2 dotty-653698ef67a5cf8f5e0fd0fcdcd1f631f1dc96e2.zip |
Merge pull request #1763 from dotty-staging/fix/annotations
Fix emission of annotations
Diffstat (limited to 'compiler/src/dotty/tools/backend')
-rw-r--r-- | compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala index 397382c2f..ed32d2df9 100644 --- a/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala +++ b/compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala @@ -206,18 +206,15 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma implicit val ConstantClassTag: ClassTag[Constant] = ClassTag[Constant](classOf[Constant]) implicit val ClosureTag: ClassTag[Closure] = ClassTag[Closure](classOf[Closure]) - /* dont emit any annotations for now*/ - def isRuntimeVisible(annot: Annotation): Boolean = { - annot.atp.typeSymbol.getAnnotation(AnnotationRetentionAttr) match { - case Some(retentionAnnot) => - retentionAnnot.tree.find(_.symbol == AnnotationRetentionRuntimeAttr).isDefined - case _ => - // SI-8926: if the annotation class symbol doesn't have a @RetentionPolicy annotation, the - // annotation is emitted with visibility `RUNTIME` - // dotty bug: #389 - true + def isRuntimeVisible(annot: Annotation): Boolean = + if (toDenot(annot.atp.typeSymbol).hasAnnotation(AnnotationRetentionAttr)) + retentionPolicyOf(annot) == AnnotationRetentionRuntimeAttr + else { + // SI-8926: if the annotation class symbol doesn't have a @RetentionPolicy annotation, the + // annotation is emitted with visibility `RUNTIME` + // dotty bug: #389 + true } - } def shouldEmitAnnotation(annot: Annotation): Boolean = { annot.symbol.isJavaDefined && @@ -227,7 +224,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma private def retentionPolicyOf(annot: Annotation): Symbol = annot.atp.typeSymbol.getAnnotation(AnnotationRetentionAttr). - flatMap(_.argument(0).map(_.symbol)).getOrElse(AnnotationRetentionClassAttr) + flatMap(_.argumentConstant(0).map(_.symbolValue)).getOrElse(AnnotationRetentionClassAttr) private def emitArgument(av: AnnotationVisitor, name: String, @@ -708,7 +705,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma } else Nil - def annotations: List[Annotation] = Nil + def annotations: List[Annotation] = toDenot(sym).annotations def companionModuleMembers: List[Symbol] = { // phase travel to exitingPickler: this makes sure that memberClassesOf only sees member classes, // not local classes of the companion module (E in the exmaple) that were lifted by lambdalift. |