Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConstantAnnotation has unnecessary restrictions due to its Java inheritage #11724

Open
lrytz opened this issue Sep 4, 2019 · 0 comments

Comments

@lrytz
Copy link
Member

commented Sep 4, 2019

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.