JEP-118: Why are parameter names not mandatory?
Alex Buckley
alex.buckley at oracle.com
Wed May 1 16:59:16 PDT 2013
On 5/1/2013 3:18 PM, Jesper Steen Møller wrote:
> I'm currently examining these two JEPs, and was curious: Why not make
> the ParameterNames attribute mandatory at least for non-private
> methods. I don't quite get why it makes sense to add this info which
> will be useful for introspection, IDE's and annotation processing,
> but only make it optional - even defaulting to 'off'?
Please see the introduction to chapter 2 of
http://cr.openjdk.java.net/~abuckley/8misc.pdf.
The bottom line is that for every programmer you please by including
parameter names by default, you intensely anger another. Some people
dislike the extra class file size; some dislike the new compatibility
surface; some regard it as exposing sensitive information.
So you need an opt-in mechanism. If you want it in the Java language,
you need to define syntax and scope. See the first thread at
http://mail.openjdk.java.net/pipermail/enhanced-metadata-spec-discuss/2012-November/thread.html.
Personally I would focus on simplicity (@ReifyParameters on a type decl
means store p-names of public methods) but that did not meet others'
needs. For once, I felt not standardizing was the right answer. This
freed us to focus on getting the interaction right between
java.lang.reflect.Parameter, type annotations, and repeating
annotations. I hope to standardize the opt-in mechanism in SE 9.
Alex
More information about the enhanced-metadata-spec-discuss
mailing list