Qualified exports to an unknown module

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Qualified exports to an unknown module

cowwoc
Administrator
Hi,

Back in 2016 you guys had a discussion about qualified exports to a module
that was not available at compile-time:
http://jigsaw-dev.1059479.n5.nabble.com/Issue-with-qualified-exports-td5712839.html

I could not find the conclusion to that discussion. How are users supposed
to use qualified exports to some module that is defined by some future
compilation? See https://stackoverflow.com/q/53670052/14731 for a concrete
example.

Thank you,
Gili



--
Sent from: http://jigsaw-dev.1059479.n5.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Qualified exports to an unknown module

Alex Buckley
On 12/7/2018 8:46 AM, cowwoc wrote:
> Back in 2016 you guys had a discussion about qualified exports to a module
> that was not available at compile-time:
> http://jigsaw-dev.1059479.n5.nabble.com/Issue-with-qualified-exports-td5712839.html
>
> I could not find the conclusion to that discussion. How are users supposed
> to use qualified exports to some module that is defined by some future
> compilation? See https://stackoverflow.com/q/53670052/14731 for a concrete
> example.

The decision was: Qualified exports/opens to a non-observable module is
NOT an error (see
https://docs.oracle.com/javase/specs/jls/se11/html/jls-7.html#jls-7.7.2-310).
javac will give an on-by-default lint warning instead.

The StackOverflow question says "Because I configured the compiler to
treat warnings as errors (-Werror), the build fails." so the questioner
should look at disabling the lint warning (see
https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9).

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Qualified exports to an unknown module

Alan Bateman
On 07/12/2018 18:59, Alex Buckley wrote:

>
> The decision was: Qualified exports/opens to a non-observable module
> is NOT an error (see
> https://docs.oracle.com/javase/specs/jls/se11/html/jls-7.html#jls-7.7.2-310).
> javac will give an on-by-default lint warning instead.
>
> The StackOverflow question says "Because I configured the compiler to
> treat warnings as errors (-Werror), the build fails." so the
> questioner should look at disabling the lint warning (see
> https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9).
The scenario in the post seems to be a Maven multi-module project so an
alternative to -Xlint:-module is to compile with --module-source-path so
that module B is observable when compiling A. This should work:
     javac --module-source-path project/"*"/src/main/java -d <output> -m A

although I don't know if the Maven compiler plugin can be configured to
use this option/syntax.

-Alan
Reply | Threaded
Open this post in threaded view
|

Re: Qualified exports to an unknown module

Remi Forax


----- Mail original -----
> De: "Alan Bateman" <[hidden email]>
> À: "jigsaw-dev" <[hidden email]>
> Envoyé: Samedi 8 Décembre 2018 09:44:05
> Objet: Re: Qualified exports to an unknown module

> On 07/12/2018 18:59, Alex Buckley wrote:
>>
>> The decision was: Qualified exports/opens to a non-observable module
>> is NOT an error (see
>> https://docs.oracle.com/javase/specs/jls/se11/html/jls-7.html#jls-7.7.2-310).
>> javac will give an on-by-default lint warning instead.
>>
>> The StackOverflow question says "Because I configured the compiler to
>> treat warnings as errors (-Werror), the build fails." so the
>> questioner should look at disabling the lint warning (see
>> https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9).
> The scenario in the post seems to be a Maven multi-module project so an
> alternative to -Xlint:-module is to compile with --module-source-path so
> that module B is observable when compiling A. This should work:
>     javac --module-source-path project/"*"/src/main/java -d <output> -m A
>
> although I don't know if the Maven compiler plugin can be configured to
> use this option/syntax.

Maven still can not do that, which is a bummer because compiling in multi-module mode is also faster when you starts to have quite a lot of classes.

>
> -Alan

Rémi