JDK-8156591 : IllegalAccessError in JFXPanel after fix for JDK-8080395
  • Type: Bug
  • Component: javafx
  • Sub-Component: swing
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-05-09
  • Updated: 2016-05-09
  • Resolved: 2016-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Fixed
Related Reports
Relates :  
Relates :  
Description
To reproduce this, run any JFXPanel application with a recent JDK (e.g., jdk-9+117) such as HelloJFXPanel and click on the JFXPanel to give it focus.

$ java HelloJFXPanel
Exception in thread "AWT-EventQueue-0" java.lang.IllegalAccessError: failed to access class sun.awt.CausedFocusEvent from class javafx.embed.swing.JFXPanel
	at javafx.embed.swing.JFXPanel.sendFocusEventToFX(javafx.swing@9-internal/JFXPanel.java:595)
	at javafx.embed.swing.JFXPanel.processFocusEvent(javafx.swing@9-internal/JFXPanel.java:616)
	at java.awt.Component.processEvent(java.desktop@9-internal/Component.java:6357)
	at java.awt.Container.processEvent(java.desktop@9-internal/Container.java:2258)
...


The fix for JDK-8080395 introduced new public API for getting the cause of a FocusEvent. It also made the existing import sun.awt.CausedFocusEvent class package-private. JFXPanel references this class, so we get the above error at run time when clicking on a JFXPanel to give it focus.
Comments
http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/5b64910ad0b7
09-05-2016

+1
09-05-2016

Note: I filed JDK-8156592 as a follow-on bug to re-enable it using the new public API.
09-05-2016

Webrev for review: http://cr.openjdk.java.net/~kcr/8156591/webrev.00/
09-05-2016

The focus cause is currently unused, so the fix will be to comment that code out. I will file a follow-on bug to get the cause using the new API. However, that will be a very low priority bug until such time as we actually do anything with the focus cause.
09-05-2016