Draft Spec for Second Preview of Flexible Constructor Bodies (JEP 482)
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu May 30 22:55:28 UTC 2024
On 30/05/2024 23:24, Archie Cobbs wrote:
> Remember pre-construction context includes superclass constructor
> parameters, and developers are already commonly referring to 2nd
> enclosing instances in code looking like this example:
>
> class Outer {
> String getName() {
> return "fred";
> }
> class Inner extends Thread {
> Inner() {
> super(new Runnable() {
> @Override
> public void run() {
> System.out.println("hello from " +
> Outer.this.getName());
> }
> });
> }
> }
> }
Sure, I know that super constructor arguments are part of the issue (in
fact that's the angle I was looking this problem at before I realized it
also impacted JEP 482).
That said, I'm not sure how common of a pattern this really is. All the
examples I've seen so far have a certain artificial vibe to them. The
kind of stuff compiler writers like us might want to write in a test :-)
It would be helpful I think to run some analysis and get some numbers.
I'll see if I can do that, I think I know where to look.
Maurizio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-experts/attachments/20240530/1c7d072d/attachment.htm>
More information about the amber-spec-experts
mailing list