RFR JDK-8167442: Langtools ant build not working after addition of -Xlint:exports

forax at univ-mlv.fr forax at univ-mlv.fr
Tue Oct 11 11:57:59 UTC 2016


>>>
>>>>
>>>> It means that the methods are public or the class is in an exported
>>>> package but it should not.
>>>
>>> In the specific jdk.jshell case (which we are discussing here), the
>>> warning is even more strict: in jdk.jshell there are methods like:
>>> JDIExecutionControl.vm()com.sun.jdi.VirtualMachine
>>>
>>> com.sun.jdi.VirtualMachine is a public exported type, but in jdk.jdi
>>> module which the jdk.jshell module does not "re-export" (i.e. the
>>> jdk.jshell module does not requires public jdk.jdi). So every client of
>>> this method needs to require jdk.jdi themselves. Whether that is a
>>> problem in this specific case, I am not sure (I am personally not sure
>>> if the use of the offending classes in jdk.jshell will be mainstream
>>> enough to push jdk.jdi to each client of the API).
>>
>> Using require transitive is one way to solve the warnings,
>> but i agree with you that this is not the good way to solve that issue.
>> Here, i think the API should either not be public or put in a non exported
>> package, even if it means creating a non exported package for things like Util.
> 
> Not sure if that's what should be done: the classes are intentionally
> public and exported, so that (some) clients may use them. But I am not
> sure if the use will be widespread enough to force jdk.jdi to all other
> clients of the API as well. (Esp. given those that need to use a
> JDI-related method can simply do "requires jdk.jdi" themselves.)
> 
> Jan

I see,
maybe another solution is to add a note in the overview of the class about the fact that some methods may require jdk.jdi and to use @SuppressWarnings to avoid the lint warnings. 

Rémi

> 
>>
>>>
>>>>
>>>> Hiding this kind of info is harmful IMO.
>>>
>>> In this specific case, we are discussing disabling the lint in the
>>> developer-only ant build script for langtools. The current state blocks
>>> everyone using the developer-only ant build script (or forces them to
>>> use private workaround), and I am not sure we should rush some decision
>>> on whether jdk.jshell should requires public jdk.jdi just to unblock
>>> people that are using ant.
>>>
>>> Jan
>>
>> Rémi
>>
>>>
>>>>
>>>> Rémi
>>>>
>>>> On October 10, 2016 6:37:39 PM GMT+02:00, Jan Lahoda
>>>> <jan.lahoda at oracle.com> wrote:
>>>>
>>>>      Bug:
>>>>      https://bugs.openjdk.java.net/browse/JDK-8167442
>>>>
>>>>      Proposed solution is to disable the exports lint when compiling the
>>>>      langtools sources (the lint is disabled for the jdk.jshell module when
>>>>      building using the make buildsystem).
>>>>
>>>>      Webrev:
>>>>      http://cr.openjdk.java.net/~jlahoda/8167442/webrev.00/
>>>>
>>>>      Any feedback is welcome.
>>>>
>>>>      Thanks,
>>>>            Jan
>>>>
>>>>
>>>> --
> >>> Sent from my Android device with K-9 Mail. Please excuse my brevity.


More information about the compiler-dev mailing list