Spec updates for method parameter reflection

Remi Forax forax at univ-mlv.fr
Sat Nov 10 04:40:53 PST 2012


On 11/09/2012 09:31 PM, Alex Buckley wrote:
> I have updated the spec to describe the core reflection API and 
> language model API for method (and constructor) parameters.
>
> I also give a rationale for Oracle's new policy of _not_ storing 
> parameter names in class files by default.
>
> For repeating annotations, there is a clarification of the rule about 
> mixing annotations of repeatable and containing annotation types on 
> the same declaration (see page 8), and minor corrections to the core 
> reflection API examples and the language model API description.
>
> The spec is at http://cr.openjdk.java.net/~abuckley/8misc.pdf as usual.
>
> Alex

I've only read the parameter name part of the spec*.
The way the method attribute "MethodParameters_atttribute" is defined is 
cleaner.

I think the default policy (don't include parameter names) is not the 
good one.
While I agree that enable reified parameter everywhere can severely 
impact class file size
(the runtime part can be lazy), there is a third option between enable 
and disable,
enable parameter names selectively.

I propose the following default policy, parameter names are enabled by 
default only
if the methods is annotated with an annotation with the retention CLASS 
or RUNTIME.

The idea is that if the method is annotated,
the parameter names should be visible by a class enhancer or the 
reflection API.

cheers,
Rémi
* I suppose that I should mention that I still think that @ContainedBy 
is superfluous.




More information about the enhanced-metadata-spec-discuss mailing list