It seems to have a special meaning in annotations - it allows you to skip the parameter names when instaniating an annotation.
@Foo(bar = "abc") // a normal instantiation of an annotation
@Foo("abc") // if bar were renamed 'value'
Where is this documented? Is value
a keyword or not? See also.
It's not a regular keyword, as it's not listed in section 3.9 of the JLS. In particular, you can use it as an identifier anywhere you like, as far as I'm aware.
The use of value
by default for an annotation value is specified in section 9.7:
The third form of annotation, single-element annotation, is a shorthand designed for use with single-element annotation types:
SingleElementAnnotation: @ TypeName ( ElementValue )
It is shorthand for the normal annotation:
@TypeName ( value = ElementValue )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With