$ cat Test.java
import jdk.incubator.http.*;
class Test {
int m() {
int i = 1/0;
return i;
}
}
$ javac --add-modules jdk.incubator.httpclient -Xlint -Werror Test.java
warning: using incubating module(s): jdk.incubator.httpclient
error: warnings found and -Werror specified
1 error
1 warning
javac stops when it detects the incubator warning and does not show any other warnings e.g. -Xlint is set.
It's common to turn on -Werror to ensure a warning-free compilation. When the application depends on an incubating API, I think -Werror should not turn it into an error since the application depends on it.
Incubating module warning is not suppressible. We should revisit the interaction of the incubator module warning and -Werror.
The current workaround is to use an internal --should-stop option.
$ javac --add-modules jdk.incubator.httpclient -Xlint -Werror --should-stop:ifError=PARSE Test.java
warning: using incubating module(s): jdk.incubator.httpclient
error: warnings found and -Werror specified
/tmp/TestIncub.java:5: warning: [divzero] division by zero
int i = 1/0;
^
1 error
2 warnings
import jdk.incubator.http.*;
class Test {
int m() {
int i = 1/0;
return i;
}
}
$ javac --add-modules jdk.incubator.httpclient -Xlint -Werror Test.java
warning: using incubating module(s): jdk.incubator.httpclient
error: warnings found and -Werror specified
1 error
1 warning
javac stops when it detects the incubator warning and does not show any other warnings e.g. -Xlint is set.
It's common to turn on -Werror to ensure a warning-free compilation. When the application depends on an incubating API, I think -Werror should not turn it into an error since the application depends on it.
Incubating module warning is not suppressible. We should revisit the interaction of the incubator module warning and -Werror.
The current workaround is to use an internal --should-stop option.
$ javac --add-modules jdk.incubator.httpclient -Xlint -Werror --should-stop:ifError=PARSE Test.java
warning: using incubating module(s): jdk.incubator.httpclient
error: warnings found and -Werror specified
/tmp/TestIncub.java:5: warning: [divzero] division by zero
int i = 1/0;
^
1 error
2 warnings
- csr for
-
JDK-8319230 -Werror turns incubator module warning to an error
- Closed