pmd-designer icon indicating copy to clipboard operation
pmd-designer copied to clipboard

Upgrade org.openjfx to 14.0.2.1 to enable development from Mac OSX

Open jsotuyod opened this issue 1 year ago • 2 comments

Running on Mac OSX with a version of JavaFX older than 14 produces garbled text as shown below.

image

In #53 we introduce a check to avoid running unsupported JavaFX versions under Mac OSX, but that currently means it's only possible to develop under Mac OSX by manually changing the referenced JavaFX libraries.

Bumping org.openjfx to 14.0.2.1 fixes this, but unfortunately introduces a number of new issues.

Firstly, the first test to use CodeArea will fail, as internally it will try to animate the text, find that the JFX toolkit was never initialized and incur in a NPE. This is down to internal changes in JavaFX.

Fixing this by manually initializing the platform through Platform.startup(new Runnable() {}) will work locally, but fail in CI, as it can't run in headless mode. Therefore, it seems we need to introduce TestFX to properly support JavaFX testing and headless support.

jsotuyod avatar Aug 11 '22 12:08 jsotuyod

Thanks for investigating this. I'm not sure we can upgrade and also keep compatibility with older versions of JavaFX, because we use some internal JavaFX APIs, or our dependencies might (eg controlsfx).

About testfx, I found this old commit in master, which may be a starting point: d2e45daa7

oowekyala avatar Aug 11 '22 13:08 oowekyala

The dependencies for javafx have scope provided, are not shipped in the binary, as we rely on the installed JavaFX of the client (OS dependent). The public API has no changes, bumping the version still builds the code as-is (only regression is on the tests as pointed out). The change only has impact during testing / running from the IDE.

Notice that, in practice, users are already using the designer against newer JavaFX versions (ie: I've used 15, 17 and I'm currently using 18 locally).

jsotuyod avatar Aug 11 '22 13:08 jsotuyod