RFR: 8347359: RichTextArea API Tests [v8]
Kevin Rushforth
kcr at openjdk.org
Tue Apr 22 23:14:47 UTC 2025
On Tue, 22 Apr 2025 22:40:01 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> modules/jfx.incubator.richtext/src/test/java/test/jfx/incubator/scene/util/TUtil.java line 40:
>>
>>> 38:
>>> 39: /**
>>> 40: * There should be a common place for module-agnostic test utilities.
>>
>> javafx.base might eventually be a good place for this sort of utility.
>
> It might, or perhaps it could be packaged into a jar so we can run single source files + library via JEP 458 `--class-path 'libs/*'` argument?
>
> see "Using pre-compiled classes" section in
> https://openjdk.org/jeps/458
Unit tests already need to load the JavaFX modules, so I don't see how packaging it in a jar would help. All it would do it add one more thing to put on the path.
>> modules/jfx.incubator.richtext/src/test/java/test/jfx/incubator/scene/util/TUtil.java line 49:
>>
>>> 47: Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> {
>>> 48: if (throwable instanceof RuntimeException) {
>>> 49: throw (RuntimeException)throwable;
>>
>> Why is RuntimeException treated differently than checked Exception and Error?
>
> hmmm... This pattern was copied from some other test. We have 32 more instances of this pattern elsewhere.
>
> I suspect it is not avoid declaring a checked exception.
> What would you suggest? Forward the `throwable` to `Thread.currentThread().getThreadGroup().uncaughtException(thread, throwable);` unconditionally?
That's interesting that other tests do this. When re-throwing an exception you often need to special case checked exceptions (to wrap them so that the caller doesn't need to explicitly declare it), but the UncaughtExceptionHandler can handle both, so I don't know why it was done that way.
You might try just unconditionally forwarding all throwables, but not sure.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1677#discussion_r2055006813
PR Review Comment: https://git.openjdk.org/jfx/pull/1677#discussion_r2055005696
More information about the openjfx-dev
mailing list