JDK-8167178 : Exported elements referring to inaccessible types in java.naming
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-10-05
  • Updated: 2017-05-17
  • Resolved: 2017-01-25
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 10 JDK 9
10Fixed 9 b156Fixed
Related Reports
Relates :  
Sub Tasks
JDK-8176352 :  
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 java.naming, the warning is:
---
.../jdk9/jdk/src/java.naming/share/classes/javax/naming/CompoundName.java:156: warning: [exports] class NameImpl in module java.naming is not accessible to clients that require this module
    protected transient NameImpl impl;
                        ^
error: warnings found and -Werror specified
1 error
1 warning
---

The lint will be disabled for java.naming. Please check if the warning can be fixed, or needs to be suppressed.

Thanks.

Comments
When this issue is resolved, make/CompileJavaModules.gmk should be updated to take out -Xlint:-exports so that it will catch similar issues from happening in the future. java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*' -Xlint:-exports
23-01-2017

I don't see any reason why this field is protected, it may have been an oversight in the original implementation. The compatibility impact of changing this to package private or private should be minimal as nothing can depend on it. This change will need a CCC because it is technically an API change.
12-10-2016