Class StableValuesPreviewExamples
java.lang.Object
net.jrodolfo.java_evolution.java25.stable_values.StableValuesPreviewExamples
Demonstrates Java 25 Stable Values, previewed by JEP 502.
The repository itself does not compile against preview APIs. Instead, this
example writes a small Java 25 source file, compiles it with
javac --enable-preview --release 25, and runs it with
java --enable-preview when the active toolchain is JDK 25. That
keeps the main Maven build stable while still demonstrating the real preview
API.
-
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 Java 25 feature goal.Explains why this example uses a child process.Source used by the child JVM to exercise the Java 25 preview API.problem()Explains the problem that Stable Values address.runStableValuesWorkflow(Path workspace) Runs a real Java 25 preview Stable Values workflow in a temporary workspace.Explains what this executable example can and cannot prove.
-
Constructor Details
-
StableValuesPreviewExamples
public StableValuesPreviewExamples()
-
-
Method Details
-
runStableValuesWorkflow
public StableValuesPreviewExamples.StableValuesWorkflowResult runStableValuesWorkflow(Path workspace) throws IOException, InterruptedException Runs a real Java 25 preview Stable Values workflow in a temporary workspace. Full child-compilation execution requires a JDK 25 preview compiler.- Parameters:
workspace- temporary directory for generated source and class files- 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 Java 25 preview API.- Returns:
- generated Java source
-
problem
Explains the problem that Stable Values address.- Returns:
- a short problem statement
-
java25Idea
-
previewBoundary
Explains why this example uses a child process.- Returns:
- the preview boundary
-
testBoundary
Explains what this executable example can and cannot prove.- Returns:
- the test boundary
-