Parameter reflection without MethodParameters attribute

Alex Buckley alex.buckley at oracle.com
Fri Dec 7 16:06:27 PST 2012


On 12/6/2012 5:32 PM, Joseph Darcy wrote:
> Alternatively, I think it is friendlier for the user for the
> implementation of Executable.getParameters() to manufacture placeholder
> names if none are available, "arg0", "arg1", etc.

I concede that Executable.getParameters() can _always_ return somewhat 
useful results, namely Parameter objects which expose annotations (if 
present) and class/type info. Along with placeholder names/values, this 
is a good argument for always getting non-null Parameter values from 
getParameters().

At the same time, a reflective client might want to know if the 
Parameter objects it's getting are made of placeholders or made from a 
real MethodParameters attribute. Executable.hasEnhancedMetadata() is a 
possibility, but it goes toward "quality of service" (i.e. are names 
normative?) which is out of scope for SE 8.

So for now, let's always return Parameter objects and synthesize 
placeholders as you suggest. I've updated the spec (section 2.2).

Alex



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