Class LazyConstantsSecondPreviewExamples
java.lang.Object
net.jrodolfo.java_evolution.java26.lazy_constants.LazyConstantsSecondPreviewExamples
Demonstrates the second preview of Lazy Constants from JEP 526.
The preview API is exercised in an isolated child JVM. The generated probe
verifies deferred initialization, one-time supplier evaluation, stable reuse,
and the non-initializing orElse operation without external state.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult from one child process invocation.static final recordResult from compiling and running the generated preview source. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExplains the relationship to ordinary final fields.Explains why the preview API runs in a child process.Source used by the child JVM to exercise the preview Lazy Constants API.problem()Explains the problem addressed by Lazy Constants.runLazyConstantsWorkflow(Path workspace) Runs the Java 26 preview Lazy Constants workflow.status()Describes the Java 26 maturity level.
-
Constructor Details
-
LazyConstantsSecondPreviewExamples
public LazyConstantsSecondPreviewExamples()
-
-
Method Details
-
runLazyConstantsWorkflow
public LazyConstantsSecondPreviewExamples.LazyConstantsWorkflowResult runLazyConstantsWorkflow(Path workspace) throws IOException, InterruptedException Runs the Java 26 preview Lazy Constants workflow.- Parameters:
workspace- temporary directory for generated source and classes- Returns:
- result containing compilation and execution output
- Throws:
IOException- when the source file cannot be writtenInterruptedException- when waiting for a child process is interrupted
-
probeSource
Source used by the child JVM to exercise the preview Lazy Constants API.- Returns:
- generated Java source
-
problem
Explains the problem addressed by Lazy Constants.- Returns:
- a short problem statement
-
comparisonWithFinalFields
Explains the relationship to ordinary final fields.- Returns:
- a short comparison
-
status
-
previewBoundary
Explains why the preview API runs in a child process.- Returns:
- the preview boundary
-