Skip to content

ConstantAnnotation has unnecessary restrictions due to its Java heritage #11724

@lrytz

Description

@lrytz

For example, named arguments need to be used unless therese one single parameter called value. We should implement this restirction only for Java annotations.

scala> class a(x: Int) extends annotation.ConstantAnnotation
defined class a

scala> @a(1) val x = 0
          ^
       error: arguments to Java annotations or subclasses of ConstantAnnotation have to be supplied as named arguments
        ^
       error: annotation a is missing argument x

scala> class a(value: Int) extends annotation.ConstantAnnotation
defined class a

scala> @a(1) val x = 0
x: Int = 0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions