Parameter reflection: parameters with "" as their name
Eric McCorkle
eric.mccorkle at oracle.com
Thu Jan 24 12:47:08 PST 2013
On 01/24/13 15:35, Alex Buckley wrote:
> // See new recipients of this mail.
>
> // No re-posting of content between lists with different licenses, please.
>
> On 1/24/2013 11:33 AM, Eric McCorkle wrote:
>> The current version of the spec for parameter reflection, found here:
>>
>> http://cr.openjdk.java.net/~abuckley/8misc.pdf
>>
>> states that if a parameter has no name, then the reflection API should
>> synthesize a name of the form "argN", where N is the index of the
>> parameter. It also states that if a MethodParameters attribute has a
>> name index of 0, then it indicates a parameter with no name.
>>
>> The question I have is, what if a MethodParameters attribute indicates a
>> name of "" (meaning, the empty string)? Does this count as a valid
>> name, or should it be treated as a parameter with no name?
>
> For simplicity, I would be OK with saying that the name of a method
> parameter is an "unqualified name" per JVMS 4.2.2. That bans . ; [ / and
> allows everything else. For compilers targeting the ClassFile format,
> this is a reasonable trade-off between freedom and convention.
>
> I would also say that an unqualified name (regardless of its role as a
> field name, parameter name, etc) must consist of at least one ASCII
> character in addition to not containing certain characters. That is, I'm
> happy to declare "" out of bounds for MethodParameters to avoid
> confusion with a 0 index (which I think remains a useful escape hatch
> for compilers).
>
> How does all that sound?
>
That sounds fine to me.
More information about the enhanced-metadata-spec-discuss
mailing list