@@ -240,7 +240,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
240240 private def emitArgument (av : AnnotationVisitor ,
241241 name : String ,
242242 arg : Tree , bcodeStore : BCodeHelpers )(innerClasesStore : bcodeStore.BCInnerClassGen ): Unit = {
243- ( normalizeArgument(arg) : @ unchecked ) match {
243+ normalizeArgument(arg) match {
244244 case Literal (const @ Constant (_)) =>
245245 const.tag match {
246246 case BooleanTag | ByteTag | ShortTag | CharTag | IntTag | LongTag | FloatTag | DoubleTag => av.visit(name, const.value)
@@ -257,10 +257,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
257257 av.visit(name, t.args.head.tpe.classSymbol.denot.info.toTypeKind(bcodeStore)(innerClasesStore).toASMType)
258258 case Ident (nme.WILDCARD ) =>
259259 // An underscore argument indicates that we want to use the default value for this parameter, so do not emit anything
260- case t : tpd.RefTree =>
261- assert(t.symbol.denot.owner.isAllOf(Flags .JavaEnumTrait ),
262- i " not an enum: $t / ${t.symbol} / ${t.symbol.denot.owner} / ${t.symbol.denot.owner.isTerm} / ${t.symbol.denot.owner.flagsString}" )
263-
260+ case t : tpd.RefTree if t.symbol.denot.owner.isAllOf(Flags .JavaEnumTrait ) =>
264261 val edesc = innerClasesStore.typeDescriptor(t.tpe.asInstanceOf [bcodeStore.int.Type ]) // the class descriptor of the enumeration class.
265262 val evalue = t.symbol.name.mangledString // value the actual enumeration value.
266263 av.visitEnum(name, edesc, evalue)
@@ -306,6 +303,9 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
306303 val desc = innerClasesStore.typeDescriptor(typ.asInstanceOf [bcodeStore.int.Type ]) // the class descriptor of the nested annotation class
307304 val nestedVisitor = av.visitAnnotation(name, desc)
308305 emitAssocs(nestedVisitor, assocs, bcodeStore)(innerClasesStore)
306+
307+ case t =>
308+ ctx.error(ex " Annotation argument is not a constant " , t.sourcePos)
309309 }
310310 }
311311
0 commit comments