Number of formal parameters of anonymous class constructor
konstantin barzilovich
konstantin.barzilovich at oracle.com
Mon Aug 3 12:47:54 UTC 2015
Hello Dan,
In chapter 15.9.5.1 in JLS signature of anonymous constructor is described.
In case S is inner non-static class (see the minimal example)
class Outer {
public Outer() {}
class A {
public A() {}
}
public void foo(){
A a =new Outer().new A(){};
}
}
we expect to have one formal parameter of type Outer according to
jls-15.9.5.1-100-B and jls-15.9.5.1-100-B.1.
But I try to get parameters of constructor via reflection and it has two
parameters both of type Outer.
I guess, the second one is a receiver parameter, but it isn't mentioned
in jls-15.9.5.1-100-B.1.
Could you please clarify this situation?
Thanks,
Konstantin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20150803/988aed2f/attachment.html>
More information about the compiler-dev
mailing list