Generation of synthesized parameters

Peter Jensen peter.jensen at oracle.com
Fri Feb 1 16:22:08 PST 2013


On 02/01/13 15:42, Alex Buckley wrote:
> On 2/1/2013 2:50 PM, Peter Jensen wrote:
>
>
>> - For synthetic or mandated parameters, the compiler generates names on
>> the form "argI", except when the specification names the
>>    implied parameter  for  an enum valueOf(). The JLS give the parameter
>> name as "name" (maybe by accident, but nevertheless, it's there).
>
> The JLS imposes no constraints on the names of parameters which are 
> implicitly declared. The JLS doesn't care at all about parameters 
> which are not explicitly OR implicitly declared. So a Java compiler 
> has a lot of freedom with names here. Where are you seeing "name" in 
> the JLS? Section 2.3 of the enhanced-metadata spec requires name 
> generation by core reflection, but that's "arg".

8.9.2 Enum Body Declarations

The text says an enum "has the following implicitly declared static 
methods:"

Anything in the following declarations, that a compiler is normally 
expected to handle, must
thus be handled as if explicitly included in the source. This now 
include parameter names,
and the javadoc comments, for that matter (need to check if javadoc does 
this)

BTW: the javadoc comments are missing a bit of markup, if this is to be 
taken completely literally.




More information about the compiler-dev mailing list