Integrated: 8290561: Coalesce incubator-module warnings for single-file source-code programs
Jan Lahoda
jlahoda at openjdk.org
Tue Sep 6 09:31:51 UTC 2022
On Fri, 22 Jul 2022 06:58:03 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> Consider a trivial code like:
>
> public class Main {
> public static void main(String... args) {}
> }
>
>
> And an execution like:
>
> $ java --add-modules jdk.incubator.concurrent Main.java
> WARNING: Using incubator modules: jdk.incubator.concurrent
> warning: using incubating module(s): jdk.incubator.concurrent
> 1 warning
>
>
> Having two warnings (one from runtime, one from javac) seems unnecessary. The patch proposed herein tries to avoid the javac warning, keeping only the runtime one. The conditions under which an incubator module is ignored w.r.t. this warning are:
>
> * the boot Module layer has the module (hence, presumably, the runtime already provided the warning)
> * the javac run is (likely) from the source launcher. This is being done using a custom javac option, `-XDsourceLauncher` (which can possibly be used in other cases).
>
> This is to avoid cases where we would incorrectly suppress the incubator warning, e.g. when `-XDsourceLauncher` would be passed on the command line.
>
> There are other ways to attempt to detect javac invocations from the source launcher - a distinct file manager is used by the source launcher (but detection of the specific file manager does not feel in line with general javac approach); or use of the `jdk.internal.javac.source` system property set by the native launcher (but this is only set when `--source` option is used, as far as I know, and javac also typically does not check system properties).
>
> Note that there is JDK-8290563 to improve the text of the javac warning.
This pull request has now been integrated.
Changeset: 26f2a978
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/26f2a978f6c601e677a236054be4ddc39d9b6e55
Stats: 102 lines in 3 files changed: 100 ins; 0 del; 2 mod
8290561: Coalesce incubator-module warnings for single-file source-code programs
Reviewed-by: mcimadamore
-------------
PR: https://git.openjdk.org/jdk/pull/9607
More information about the compiler-dev
mailing list