JVM specs for <init> and <new> methods

Dan Smith daniel.smith at oracle.com
Tue Feb 11 00:28:07 UTC 2020

Here are spec change documents for two new JVM instance creation features that have been proposed to support inline classes.

They're both fairly small, but involve a handful of different design choices. We can further discuss those design choices in this thread.

1) Abstract instance initialization methods


Classes with abstract <init> methods require no code execution to initialize instances, and so are candidates to be superclasses of inline classes.

2) Unnamed factory methods


The special name '<new>' can be used to declare static factory methods, including in an inline class. (In the previous iteration, we used '<init>' with a non-'void' return. We since discussed avoiding this overloading and associated complexity by choosing a different name.)

More information about the valhalla-spec-observers mailing list