A Java tool that transforms a Java jar to an Einherjar to go to Valhalla.
einherjar is a simple Java tool that takes a jar with classes annotated with the annotation @ValueType (or your own annotation), checks that the annotated classes can be value classes and generate an Einherjar.
An Einherjar, the generated jar, is a Multi-Release jar that
- run as usual with any VM able to run the input jar,
- run the annotated classes seen as value classes with a Valhalla enabled VM (and '--enable-preview').
With any Java 21+ distribution.
mvn packagegenerates a file named einherjar.jar in target.
With any Java 8+ distribution.
Running einherjar with no action, prints the help
java -jar target/einherjar.jareinherjar provides several actions:
findthat helps you find the potential value classes,checkthat verifies that the annotated classes can be transformed to value classes,enhancethat generates the Einherjar.
and several options:
--annotation nameto set the name of the annotation (e.g. com.github.forax.einherjar.api.ValueType)--classes namesto set the name of classes to be checked/enhanced (e.g. com.acme.Foo,com.acme.Bar)--output pathto set the name of the generated Einherjar--version versionto set the classfile version of the generated value classes (always in preview)