Review request: update javac to properly output mandated parameters in MethodParameters attributes

Alex Buckley alex.buckley at oracle.com
Thu Feb 7 11:32:15 PST 2013


In http://cr.openjdk.java.net/~abuckley/8misc.pdf, see JLS 13.1 for new 
information about explicitly and implicitly declared constructs. Also, 
see JVMS 4.7.22 for how a compiler emitting class files can mark formal 
parameters as required by JLS 13.1.

On 2/7/2013 10:45 AM, Maurizio Cimadamore wrote:
> Uhm - the definition of ACC_MANADATE seems to imply that there's a spec
> demanding a given extra parameter. But that's not the case for, i.e.
> extra constructor arguments generated in this case:
>
> class Foo {
>      void m() {
>          final Object o = null;
>          new Object() { };
>      }
> }
>
> the constructor of the anonymous inner class will accept and extra
> Object argument. Is that mandated by the spec?

No. I don't know why the anonymous class's ctor would need a parameter 
for this code.

> class Outer {
>      class Inner { }
>      void m(Outer outer) {
>          outer.new Inner() { };
>      }
> }
>
> Extra argument here (enclosing this).

Yes, the argument is implicitly declared in JLS 8.8.9.

Alex



More information about the compiler-dev mailing list