RFR: 8299934: LocalExecutionControl replaces default uncaught exception handler

Jan Lahoda jlahoda at openjdk.org
Tue Apr 22 11:37:00 UTC 2025


On Wed, 5 Mar 2025 18:01:27 GMT, Chen Liang <liach at openjdk.org> wrote:

>> The JShell's `LocalExecutionControl` set the global default uncaught exception handler, causing problems to external code that might rely on it (even if only for logging/debugging purposes).
>> 
>> The proposal here is to do what the bug is suggesting, and only handling the exception inside the `ThreadGroup` that JShell creates. The patch does not strive to do further changes to how the exception handling is done.
>
> test/langtools/jdk/jshell/LocalExecutionControlExceptionTest.java line 138:
> 
>> 136:             //run in a ThreadGroup which does not handle the uncaught exceptions, and let them
>> 137:             //pass to the default uncaught handler for the test:
>> 138:             var thread = new Thread(Thread.currentThread().getThreadGroup().getParent(), "test-group") {
> 
> Is there a reason we cannot use this for `outsideOfJShell` above so we don't need this aop thing?

Sorry, I don't quite get the question.

IIRC, the purpose o this code is to avoid/opt-out from the auto-handling of "unhandled" exceptions.

I think the `outsideOfJShell` part above is there mostly to make sure this opt-out works correctly, and is not checking JShell as such.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/12982#discussion_r2053926480


More information about the kulla-dev mailing list