[External] : Re: Proposal: Static/final constructors for bucket-3 primitive classes.
John Rose
john.r.rose at oracle.com
Thu Dec 9 08:45:11 UTC 2021
On Dec 8, 2021, at 11:12 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>
> I fully agree, i think it's better to do the opposite
I snapped a few neurons trying to read that the first time.
> and force the fact that all primitive value classes (Bucket 3) must have a default constructor and that constructor have a fixed bytecode instructions.
Heavy on ceremony even for Java especially if you can’t do anything valuable in the constructor body.
>
> If a user does not provide a constructor without parameter, the compiler will provide one and the verifier will check that this constructor exist.
That’s JVM ceremony, to what end?
Maybe we should disallow no-arg constructors altogether and leave room for a possible future feature along the lines of the special init phase. That future feature would run ad hoc byte codes at class preparation time to build thyroid default value and would throw an error if it touched the class. Kind of like superclass init actions; after those and before the proper clinit call.
It’s possible but not a priority, because of the various expenses I sketched. So we could leave space for it to put in later if the costs were justified after all.
More information about the valhalla-spec-observers
mailing list