Class PrimitivePatternsFourthPreviewExamples

java.lang.Object
net.jrodolfo.java_evolution.java26.PrimitivePatternsFourthPreviewExamples

public class PrimitivePatternsFourthPreviewExamples extends Object
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.

  • Constructor Details

    • PrimitivePatternsFourthPreviewExamples

      public PrimitivePatternsFourthPreviewExamples()
  • Method Details

    • runPrimitivePatternsWorkflow

      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 written
      InterruptedException - when waiting for a child process is interrupted
    • probeSource

      public String probeSource()
      Source used by the child JVM to exercise Java 26 preview syntax.
      Returns:
      generated Java source
    • purpose

      public String purpose()
      Explains the feature goal.
      Returns:
      a short explanation
    • safetyGoal

      public String safetyGoal()
      Explains the safety benefit of primitive patterns.
      Returns:
      a short safety explanation
    • previewBoundary

      public String previewBoundary()
      Explains why this example uses a child process.
      Returns:
      the preview boundary
    • testBoundary

      public String testBoundary()
      Explains what this executable example can and cannot prove.
      Returns:
      the test boundary