Class PrimitivePatternsFourthPreviewExamples
java.lang.Object
net.jrodolfo.java_evolution.java26.PrimitivePatternsFourthPreviewExamples
Demonstrates primitive patterns, previewed for the fourth time in Java 26 by
JEP 530.
The repository itself does not compile against preview syntax. Instead, this
example writes a small Java 26 source file, compiles it with
javac --enable-preview --release 26, and runs it with
java --enable-preview. That keeps preview flags isolated from the
main Maven build while exercising the real syntax.
-
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 why this example uses a child process.Source used by the child JVM to exercise Java 26 preview syntax.purpose()Explains the feature goal.runPrimitivePatternsWorkflow(Path workspace) Runs a real Java 26 preview primitive-pattern workflow.Explains the safety benefit of primitive patterns.Explains what this executable example can and cannot prove.
-
Constructor Details
-
PrimitivePatternsFourthPreviewExamples
public PrimitivePatternsFourthPreviewExamples()
-
-
Method Details
-
runPrimitivePatternsWorkflow
public PrimitivePatternsFourthPreviewExamples.PrimitivePatternsWorkflowResult runPrimitivePatternsWorkflow(Path workspace) throws IOException, InterruptedException Runs a real Java 26 preview primitive-pattern workflow.- 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 Java 26 preview syntax.- Returns:
- generated Java source
-
purpose
-
safetyGoal
Explains the safety benefit of primitive patterns.- Returns:
- a short safety explanation
-
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
-