Add structured-concurrency-final module: StructuredTaskScope final in JDK 28 (JEP 543), run on 28-ea, 27, 26 and 25
Runnable demos for the ankurm.com structured-concurrency-java article: the ExecutorService thread leak and its fix, every built-in Joiner, structure violations, timeouts, a custom Joiner, JSON thread dumps (in-process and jcmd), scoped values, javap diffs of the API on 25, 26, 27 and 28-ea, compiler output for six pieces of 25/26-era code, and the preview class-file trap between 27 and 28. Transcripts in output/. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
$ javac --enable-preview --release 26 broken/MissingCatch.java (26.0.2.1+1)
|
||||
exit=0
|
||||
|
||||
$ javac broken/MissingCatch.java (28-beta+21-ea)
|
||||
broken/MissingCatch.java:8: error: unreported exception ExecutionException; must be caught or declared to be thrown
|
||||
scope.join();
|
||||
^
|
||||
1 error
|
||||
exit=1
|
||||
|
||||
$ javac --enable-preview --release 26 broken/OldFailedException.java (26.0.2.1+1)
|
||||
exit=0
|
||||
|
||||
$ javac broken/OldFailedException.java (28-beta+21-ea)
|
||||
broken/OldFailedException.java:9: error: cannot find symbol
|
||||
} catch (StructuredTaskScope.FailedException e) {
|
||||
^
|
||||
symbol: class FailedException
|
||||
location: interface StructuredTaskScope
|
||||
1 error
|
||||
exit=1
|
||||
|
||||
$ javac --enable-preview --release 26 broken/OldTimeoutException.java (26.0.2.1+1)
|
||||
exit=0
|
||||
|
||||
$ javac broken/OldTimeoutException.java (28-beta+21-ea)
|
||||
broken/OldTimeoutException.java:11: error: cannot find symbol
|
||||
} catch (StructuredTaskScope.TimeoutException e) {
|
||||
^
|
||||
symbol: class TimeoutException
|
||||
location: interface StructuredTaskScope
|
||||
1 error
|
||||
exit=1
|
||||
|
||||
$ javac --enable-preview --release 26 broken/AwaitAll.java (26.0.2.1+1)
|
||||
exit=0
|
||||
|
||||
$ javac broken/AwaitAll.java (28-beta+21-ea)
|
||||
broken/AwaitAll.java:7: error: cannot find symbol
|
||||
try (var scope = StructuredTaskScope.open(Joiner.<String>awaitAll())) {
|
||||
^
|
||||
symbol: method <String>awaitAll()
|
||||
location: interface Joiner
|
||||
1 error
|
||||
exit=1
|
||||
|
||||
$ javac --enable-preview --release 26 broken/OldJoiner.java (26.0.2.1+1)
|
||||
exit=0
|
||||
|
||||
$ javac broken/OldJoiner.java (28-beta+21-ea)
|
||||
broken/OldJoiner.java:7: error: wrong number of type arguments; required 3
|
||||
public class OldJoiner<T> implements Joiner<T, List<T>> {
|
||||
^
|
||||
1 error
|
||||
exit=1
|
||||
|
||||
$ javac --enable-preview --release 26 broken/ShutdownOnFailure.java (26.0.2.1+1)
|
||||
broken/ShutdownOnFailure.java:6: error: cannot find symbol
|
||||
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
|
||||
^
|
||||
symbol: class ShutdownOnFailure
|
||||
location: interface StructuredTaskScope
|
||||
1 error
|
||||
exit=1
|
||||
|
||||
$ javac broken/ShutdownOnFailure.java (28-beta+21-ea)
|
||||
broken/ShutdownOnFailure.java:6: error: cannot find symbol
|
||||
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
|
||||
^
|
||||
symbol: class ShutdownOnFailure
|
||||
location: interface StructuredTaskScope
|
||||
1 error
|
||||
exit=1
|
||||
|
||||
# the same sources on JDK 25 for ShutdownOnFailure
|
||||
$ javac --enable-preview --release 25 broken/ShutdownOnFailure.java (25.0.5+8-LTS)
|
||||
broken/ShutdownOnFailure.java:6: error: cannot find symbol
|
||||
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
|
||||
^
|
||||
symbol: class ShutdownOnFailure
|
||||
location: interface StructuredTaskScope
|
||||
1 error
|
||||
exit=1
|
||||
Reference in New Issue
Block a user