Skip to content

Constant Expressions not allowed as ClassfileAnnotation annotation arguments: Array(""); constant value definition containing class, or Array #3183

Closed
@scabug

Description

@scabug

I would expect all of these to compile.

class T(value: Any) extends ClassfileAnnotation
 
object Holder {
   final val as = Array(1, 2, 3)
   final val a = 1
   final val cint = classOf[Int]
}

import Holder._
 
@T(classOf[Int])
@T(cint) // error: annotation argument needs to be a constant; found: cint
@T(Array("", "", "")) // error: annotation argument needs to be a constant; found: as
@T(as) // error: annotation argument needs to be a constant; found: as
@T(1)
@T(a)
class Target

Tested with 2.8.0.Beta1 and 2.8.0.r21166-b20100315020141.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions