JDK-8167182 : Exported elements referring to inaccessible types in jdk.accessibility
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.accessibility
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-10-05
  • Updated: 2017-05-17
  • Resolved: 2016-11-16
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
9 b150Fixed
Related Reports
Relates :  
Sub Tasks
JDK-8175548 :  
Description
Under JDK-8153362:
Add javac -Xlint warning to list exposed types which are not accessible

A new lint for javac is developed that warns about exported elements that refer to types that are potentially inaccessible to the client of the API (like package private or not exported types).

For jdk.accessibility, the warnings are:
---
.../jdk9/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java:219: warning: [exports] class AWTEventsListener in module jdk.accessibility is not accessible to clients that require this module
    static protected AWTEventsListener awtListener = new AWTEventsListener();
                     ^
error: warnings found and -Werror specified
.../jdk9/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java:66: warning: [exports] class AccessibilityEventListener in module jdk.accessibility is not accessible to clients that require this module
    static protected final AccessibilityEventListener accessibilityListener =
                           ^
.../jdk9/jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java:74: warning: [exports] class SwingEventListener in module jdk.accessibility is not accessible to clients that require this module
    static protected final SwingEventListener swingListener = new SwingEventListener();
                           ^
1 error
3 warnings
---

The lint will be disabled for jdk.accessibility. Please check if the warnings can be fixed, or needs to be suppressed.

Thanks.

Comments
release-note-yes note. This is strictly a binary incompatible change, although it is considered unlikely to affect any non-JDK code since the API is very specialised and there is no evidence it has been used and the APIs are source-code commented as internal only and are undocumented. However in the event it has been used, application code will need to be modified to avoid using these internal APIs.
14-11-2016

On line 218 of AWTEventMonitor.java (line 219 is flagged) is this: @Deprecated static protected AWTEventsListener awtListener = new AWTEventsListener(); static private final AWTEventsListener awtListener_private = new AWTEventsListener(); This change was made in the patch for JDK-8033991. This same protected to private change was not made in the other two flagged files. It would be interesting to review if that protected to private change was a proper change. I ask because it may be an issue for anyone wanting to subclass AWTEventsListener.
08-10-2016

I could make the three inner classes protected instead of package private. That way code in another package can subclass the outer class and have access to the protected field (as before) and (with the change) also to the methods on objects of the type of the field. That change gets rid of the NetBeans warning, "Exporting non-public type through public API". I don't see the new lint messages when I build but my build boot JDK is 8u92. How do I set up my build to check for the new messages? Will make jdk.accessibility be enough to check? Maybe I need to make clean-jdk first?
07-10-2016

Pete, this is High priority task for you
06-10-2016