@@ -206,17 +206,15 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
206
206
implicit val ConstantClassTag : ClassTag [Constant ] = ClassTag [Constant ](classOf [Constant ])
207
207
implicit val ClosureTag : ClassTag [Closure ] = ClassTag [Closure ](classOf [Closure ])
208
208
209
- def isRuntimeVisible (annot : Annotation ): Boolean = {
210
- annot.atp.typeSymbol.getAnnotation(AnnotationRetentionAttr ) match {
211
- case Some (retentionAnnot) =>
212
- retentionAnnot.tree.find(_.symbol == AnnotationRetentionRuntimeAttr ).isDefined
213
- case _ =>
214
- // SI-8926: if the annotation class symbol doesn't have a @RetentionPolicy annotation, the
215
- // annotation is emitted with visibility `RUNTIME`
216
- // dotty bug: #389
217
- true
209
+ def isRuntimeVisible (annot : Annotation ): Boolean =
210
+ if (toDenot(annot.atp.typeSymbol).hasAnnotation(AnnotationRetentionAttr ))
211
+ retentionPolicyOf(annot) == AnnotationRetentionRuntimeAttr
212
+ else {
213
+ // SI-8926: if the annotation class symbol doesn't have a @RetentionPolicy annotation, the
214
+ // annotation is emitted with visibility `RUNTIME`
215
+ // dotty bug: #389
216
+ true
218
217
}
219
- }
220
218
221
219
def shouldEmitAnnotation (annot : Annotation ): Boolean = {
222
220
annot.symbol.isJavaDefined &&
@@ -226,7 +224,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
226
224
227
225
private def retentionPolicyOf (annot : Annotation ): Symbol =
228
226
annot.atp.typeSymbol.getAnnotation(AnnotationRetentionAttr ).
229
- flatMap(_.argument (0 ).map(_.symbol )).getOrElse(AnnotationRetentionClassAttr )
227
+ flatMap(_.argumentConstant (0 ).map(_.symbolValue )).getOrElse(AnnotationRetentionClassAttr )
230
228
231
229
private def emitArgument (av : AnnotationVisitor ,
232
230
name : String ,
0 commit comments