Diagnosing improper JavaFX thread access

With JavaFX many operations are expected to be done on the application thread. This isn't strictly enforced by the library in most cases, but not doing so can lead to non-deterministic behaviors or even exceptions. Finding out where these occur just by looking at code isn't easy when projects get beyond a certain size, so to facilitate this we created JavaFX Access Agent. Its a Java agent that you add to your VM options when running Recaf that logs where improper thread access occurs. The agent is configured in Recaf's Main.java to print to std-err.

Getting the agent

The agent can be downloaded on the GitHub project's releases page or on Maven Central.

Setup

In IntelliJ you can create a run config (See: ../arch/running.md) with custom VM options specified. In the VM input field you will add -javaagent:<path>=<package-list> where:

  • <path> is the path to the agent jar.
  • <package-list> is a semicolon separated list of internal package names. For instance: software/;org/;com/;javafx/