Changes to JEP 453
Attila Kelemen
attila.kelemen85 at gmail.com
Thu May 18 19:54:32 UTC 2023
Thanks for the improvements, I think all of them are for the better.
Just a few remarks:
This does not affect the JEP itself, but in
`StructuredTaskScope.SubtaskImpl.get()`, can we have some small
quality of life improvement:
>From this:
```
if (result instanceof AltResult) {
if (result == RESULT_NULL) return null;
} else if (result != null) {
@SuppressWarnings("unchecked")
T r = (T) result;
return r;
}
throw new IllegalStateException("Task not completed or did not
complete successfully");
```
to this:
```
if (result instanceof AltResult alt) {
if (result == RESULT_NULL) return null;
throw new IllegalStateException("Task did not complete
successfully", alt.exception());
} else if (result != null) {
@SuppressWarnings("unchecked")
T r = (T) result;
return r;
}
throw new IllegalStateException("Task not completed");
```
Since the information is known, it would help debugging when people
make a mistake, rather than punishing them by hiding the exception
(even though it is readily available).
> 4. We've added the com.sun.management.Threads.currentThreadEnclosingScopes() method that returns a string with the description of the current structured context -- i.e. the stack trace for the current thread and the enclosing scopes with their owners' respective stack traces -- all the way up the hierarchy.
>
Very minor thing: There is a typo in the javadoc: it says "purpoes"
instead of "purpose".
Attila
More information about the loom-dev
mailing list