Class PrimitivePatternsThirdPreviewExamples

java.lang.Object
net.jrodolfo.java_evolution.java25.PrimitivePatternsThirdPreviewExamples

public class PrimitivePatternsThirdPreviewExamples extends Object
Demonstrates primitive patterns, previewed for the third time in Java 25 by JEP 507.

The repository itself does not compile against preview syntax. 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 syntax.

  • Constructor Details

    • PrimitivePatternsThirdPreviewExamples

      public PrimitivePatternsThirdPreviewExamples()
  • Method Details

    • runPrimitivePatternsWorkflow

      Runs a real Java 25 preview primitive-pattern workflow. 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 written
      InterruptedException - when waiting for a child process is interrupted
    • probeSource

      public String probeSource()
      Source used by the child JVM to exercise Java 25 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