Draft Spec for Second Preview of Flexible Constructor Bodies (JEP 482)

Archie Cobbs archie.cobbs at gmail.com
Sun Jun 2 20:05:03 UTC 2024


On Thu, May 30, 2024 at 5:55 PM Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:

> 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.
>
I'm definitely interested in what you find.

This is purely anecdotal, but in my experience *some* developers seem to be
very fond of nested classes (where "fond of" might be a euphemism here).

And of course those developers expect to be able to reference all of their
"outer stuff" from wherever. They treat "cannot reference x before
superclass constructor" errors as an annoying irritation to be worked
around if possible. Hopefully JEP 482 will make some of their various
gymnastics less necessary, not more.

So I guess I'm saying nested classes in an early construction context that
reference "outer stuff" may not be the most elegant way to code a solution
in many cases, but I've seen it done that way. Of course in any case real
data would be more enlightening.

-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-experts/attachments/20240602/1aa4161e/attachment.htm>


More information about the amber-spec-experts mailing list