Review request: update javac to properly output mandated parameters in MethodParameters attributes
Alex Buckley
alex.buckley at oracle.com
Thu Feb 7 12:32:49 PST 2013
On 2/7/2013 12:08 PM, maurizio cimadamore wrote:
> On 07-Feb-13 7:32 PM, Alex Buckley wrote:
>> No. I don't know why the anonymous class's ctor would need a parameter
>> for this code.
> Ok - so this is a case where Eirc's implementation would mark the extra
> parameter added by javac as MANDATED - which I think it's not right, no?
I checked what javac does for:
class Foo {
void m() {
final Object o = null;
new Object() { };
}
}
javac generates Foo$1 for the anonymous class, with a ctor that has a
single Foo parameter (not Object) representing the immediately enclosing
instance.
For reasons explained in JLS 8.8.9, that single parameter is _not_
implicitly declared by the language. Since it's not explicitly declared
either, it should be marked ACC_SYNTHETIC in the class file.
Alex
More information about the compiler-dev
mailing list