JDK-8300786 - No longer require super() and this() to appear first in a constructor

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Feb 2 15:46:15 UTC 2023


On 31/01/2023 21:29, Tagir Valeev wrote:
> #2 would unlock some more refactorings, notably "Convert ?: to
> if-else", if ?: operator appears in this/super invocation. But in
> general, it adds much less benefit.

True. Note however, that even w/o #2, you can get something similar, by 
initializing a local variable which contains the desired value with an 
if/else before the (single) super call. I believe the JEP has one such 
example. So perhaps (speculating here :-) ), the IDE could still provide 
the refactoring, but the code you end up with would be slightly different.

Maurizio



More information about the amber-spec-observers mailing list