Class StructuredConcurrencyFifthPreviewExamples

java.lang.Object
net.jrodolfo.java_evolution.java25.structured_concurrency.StructuredConcurrencyFifthPreviewExamples

public class StructuredConcurrencyFifthPreviewExamples extends Object
Demonstrates Structured Concurrency, previewed for the fifth time in Java 25 by JEP 505.

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.

  • Constructor Details

    • StructuredConcurrencyFifthPreviewExamples

      public StructuredConcurrencyFifthPreviewExamples()
  • Method Details

    • runStructuredConcurrencyWorkflow

      Runs a real Java 25 preview structured-concurrency 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 the Java 25 preview API.
      Returns:
      generated Java source
    • problem

      public String problem()
      Explains the problem that structured concurrency addresses.
      Returns:
      a short problem statement
    • commonAlternative

      public String commonAlternative()
      Explains how this problem is commonly handled without structured concurrency.
      Returns:
      a short before-Java-25 explanation
    • java25Idea

      public String java25Idea()
      Explains the Java 25 structured-concurrency idea.
      Returns:
      a short feature 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