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

Stephan Herrmann stephan.herrmann at berlin.de
Tue Jun 11 12:37:42 UTC 2024


Am 10.06.24 um 19:10 schrieb Maurizio Cimadamore:
> On 10/06/2024 17:32, Archie Cobbs wrote:
> 
>> On Mon, Jun 10, 2024 at 4:24 AM Maurizio Cimadamore 
>> [...]
>>     Historically, the JLS used to treat this/super calls as a static context
>>     (8.8.7.1).
>>
>>
>> That's what the JLS said, but of course that's not what the compiler ever 
>> implemented (JDK-8301649).
> 
> Sure. What about ecj? What did that compiler implement? (This is more a question 
> for Stephan).

A quick sample shows that flags insideConstructorCall and insideStaticContext 
differ only in what exact error message ecj gives. So, generally ecj does 
implement that rule. Relevant code sections go back to some time around 2003. I 
see no reason to consider that rule as a failure.


> What I’m trying to say is that “because javac does it” is not always a good 
> reason for doing something.

I couldn't agree more :)


Am 10.06.24 um 11:24 schrieb Maurizio Cimadamore:
 > So, for this particular JEP, I think there's a choice in front of us:
 >
 > * do we keep JLS as is (and fix javac to do what the spec has always said the
 > behavior was) ?
 > * or, do we keep javac as is and then tweak the JLS to model what the
 > implemented behavior is?

Which state of JLS are you referring to? Current stable version? Version as of 
JEP 447, latest draft for JEP 482? If stable version, how should 
early-construction context be integrated in your opinion?

My current reading is: JEP 482 draft is consistent. I'm not aware of an 
alternative specification with the same effect concerning the core intentions of 
that JEP. If a consistent draft is provided, I'll be happy to review it.

regards,
Stephan




More information about the amber-spec-experts mailing list