JDK-8153362: [jigsaw] Add javac -Xlint warning to list exposed types which are not accessible

Jan Lahoda jan.lahoda at oracle.com
Tue Jun 14 12:24:00 UTC 2016


Hi Phil,

Thanks for the comments. I was preferring @SuppressWarnings over 
-Xlint:-unexportedinapi because it allows to disable the check only on 
selected elements (as opposed to disabling it for a whole module, where 
a newly added API might inadvertently still cause a new warning); and 
also because it would be slightly easier to phase the change in. But I 
have no problem with using -Xlint:-unexportedinapi, I'll work on that.

Thanks,
     Jan

On 13.6.2016 19:59, Phil Race wrote:
> Hmm .. given that the majority of the jdk changes are in client -
> specifically
> swing & accessibility -  including the swing mailing list would have
> increased the
> likelihood of the right people clicking on this webrev link.
>
> IMO,  we should remove these unusable fields from the Swing API - where
> we can - and I think some we can, and really it ought to be all.
>
> So I suggest that you leave alone those files and submit
> bugs against swing & accessibility and the area owner
> can then make the decision as to the appropriate treatment.
>
> You can keep the JDK buildable in the meanwhile by suppressing the
> lint warnings on the desktop module.
>
> -phil.
>
>
> On 06/13/2016 09:12 AM, Jan Lahoda wrote:
>> Hello,
>>
>> There is:
>> https://bugs.openjdk.java.net/browse/JDK-8153362
>>
>> which is about a new warning that should be produced by javac when
>> exported API refers to types not exported/accessible to the API clients.
>>
>> I've put my current javac change here:
>> http://cr.openjdk.java.net/~jlahoda/8153362/langtools.00/
>>
>> There are some warnings produced for existing code in the hotspot and
>> jdk repositories (see the end for the warnings), I was using these
>> patches to keep JDK buildable:
>> hotspot repository:
>> http://cr.openjdk.java.net/~jlahoda/8153362/hotspot.00/
>> jdk repository:
>> http://cr.openjdk.java.net/~jlahoda/8153362/jdk.00/
>>
>> Any help with those (esp. those in the hotspot repository) would be
>> wholeheartedly welcome.
>>
>> Any feedback on this is welcome!
>>
>> Thanks,
>>    Jan
>>
>> The warnings:
>> -hotspot repository:
>> .../hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java:72:
>> warning: unexported type referenced in exported API
>>     public abstract JVMCICompiler createCompiler(JVMCIRuntime runtime);
>>                     ^
>> .../hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/services/JVMCICompilerFactory.java:72:
>> warning: unexported type referenced in exported API
>>     public abstract JVMCICompiler createCompiler(JVMCIRuntime runtime);
>>                                                  ^
>> error: warnings found and -Werror specified
>> .../hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java:54:
>> warning: unexported type referenced in exported API
>>     public int getCompilationLevelAdjustment(HotSpotVMConfig config) {
>>                                              ^
>> .../hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotJVMCICompilerFactory.java:73:
>> warning: unexported type referenced in exported API
>>     public int adjustCompilationLevel(HotSpotVMConfig config, Class<?>
>> declaringClass, String name, String signature, boolean isOsr, int
>> level) {
>>                                       ^
>> .../hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java:70:
>> warning: unexported type referenced in exported API
>>     public void notifyInstall(HotSpotCodeCacheProvider
>> hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode
>> compiledCode) {
>>                               ^
>> .../hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java:70:
>> warning: unexported type referenced in exported API
>>     public void notifyInstall(HotSpotCodeCacheProvider
>> hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode
>> compiledCode) {
>>
>>           ^
>> .../hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/services/HotSpotVMEventListener.java:70:
>> warning: unexported type referenced in exported API
>>     public void notifyInstall(HotSpotCodeCacheProvider
>> hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode
>> compiledCode) {
>>
>>                                        ^
>> 1 error
>> 7 warnings
>>
>> -jdk/java.desktop:
>> .../jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java:333:
>> warning: inaccessible type referenced in exported API
>>     protected DefaultAction defaultPressAction;
>>               ^
>> .../jdk/src/java.desktop/share/classes/javax/swing/JRootPane.java:344:
>> warning: inaccessible type referenced in exported API
>>     protected DefaultAction defaultReleaseAction;
>>               ^
>> error: warnings found and -Werror specified
>> .../jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalBorders.java:742:
>> warning: inaccessible type referenced in exported API
>>         protected MetalBumps bumps = new MetalBumps( 10, 10,
>>                   ^
>> .../jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java:926:
>> warning: inaccessible type referenced in exported API
>>     protected DirectoryComboBoxRenderer
>> createDirectoryComboBoxRenderer(JFileChooser fc) {
>>               ^
>> .../jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java:65:
>> warning: inaccessible type referenced in exported API
>>     protected MetalBumps bumps;
>>               ^
>> Note: Some input files use or override a deprecated API.
>> Note: Recompile with -Xlint:deprecation for details.
>> 1 error
>> 5 warnings
>>
>>
>> -jdk/java.naming:
>> .../jdk/src/java.naming/share/classes/javax/naming/CompoundName.java:156:
>> warning: inaccessible type referenced in exported API
>>     protected transient NameImpl impl;
>>                         ^
>> error: warnings found and -Werror specified
>> 1 error
>> 1 warning
>>
>>
>> -jdk/jdk.accessibility:
>> .../jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AWTEventMonitor.java:219:
>> warning: inaccessible type referenced in exported API
>>     static protected AWTEventsListener awtListener = new
>> AWTEventsListener();
>>                      ^
>> error: warnings found and -Werror specified
>> .../jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/AccessibilityEventMonitor.java:66:
>> warning: inaccessible type referenced in exported API
>>     static protected final AccessibilityEventListener
>> accessibilityListener =
>>                            ^
>> .../jdk/src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/SwingEventMonitor.java:74:
>> warning: inaccessible type referenced in exported API
>>     static protected final SwingEventListener swingListener = new
>> SwingEventListener();
>>                            ^
>> 1 error
>> 3 warnings
>>
>>
>> -jdk/jdk.jsobject:
>> .../jdk/src/jdk.jsobject/share/classes/netscape/javascript/JSObject.java:153:
>> warning: type from a module referenced in exported API that is not
>> requires public from this module
>>     public static JSObject getWindow(Applet applet) throws JSException {
>>                                      ^
>> error: warnings found and -Werror specified
>> 1 error
>> 1 warning
>>
>> -jdk/jdk.security.jgss:
>> .../jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java:42:
>> warning: type that is invisible for some modules which read this
>> package referenced in exported API
>>     static class ExtendedGSSContextImpl extends GSSContextImpl
>>                                                 ^
>> .../jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSContext.java:45:
>> warning: type that is invisible for some modules which read this
>> package referenced in exported API
>>         public ExtendedGSSContextImpl(GSSContextImpl old) {
>>                                       ^
>> error: warnings found and -Werror specified
>> .../jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSCredential.java:38:
>> warning: type that is invisible for some modules which read this
>> package referenced in exported API
>>     static class ExtendedGSSCredentialImpl extends GSSCredentialImpl
>>                                                    ^
>> .../jdk/src/jdk.security.jgss/share/classes/com/sun/security/jgss/ExtendedGSSCredential.java:41:
>> warning: type that is invisible for some modules which read this
>> package referenced in exported API
>>         public ExtendedGSSCredentialImpl(GSSCredentialImpl old) {
>>                                          ^
>> 1 error
>> 4 warnings
>


More information about the compiler-dev mailing list