Parameter reflection without MethodParameters attribute

Paul Benedict pbenedict at apache.org
Fri Dec 7 16:13:52 PST 2012


Always returning Parameter objects seems like a good idea to me --
whether the information is available or not. However, if it's being
manufactured (as the parameter names are absent), I question the
utility of coming up with make-believe names.

I would opt to have a Parameter object have a null name and a flag
that says it's being synthesized.

Paul

On Fri, Dec 7, 2012 at 6:06 PM, Alex Buckley <alex.buckley at oracle.com> wrote:
> 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