A DESCRIPTION OF THE PROBLEM :
Follow-up forJDK-8248843
When using `java` in source-file mode (see JEP 330 /JDK-8192920), it displays Xlint compiler notes which suggest using options which are only available for `javac`.
This can be quite confusing because it causes an error and it is not directly clear how to use these options correctly.
Unlike withJDK-8248843, it might not desirable to simply enable and show all Xlint warnings by default (new users for whom `java` source-file mode is intended might be overwhelmed).
So maybe in this case the best way would be to allow usage of `-Xlint` command line arguments for `java` in source-file mode?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a file called 'Test.java' containing the source code provided below
2. Run `java ./Test.java`
(i) It suggests using the `-Xlint:deprecation` option
3. Run `java` with that option: `java -Xlint:deprecation ./Test.java`
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The compiler should show more detailed warnings.
ACTUAL -
Starting the JVM fails:
Unrecognized option: -Xlint:deprecation
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
---------- BEGIN SOURCE ----------
class Test {
<T> void test(T t, Object o) {
T t1 = (T) o;
}
static class Generic<T> {
T t;
void raw(Generic raw) {
raw.t = "";
}
}
void deprecation() {
Thread.currentThread().stop();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Run `javac` with that flag; though might not be obvious for new users (for whom the source-file mode is intended)
Follow-up for
When using `java` in source-file mode (see JEP 330 /
This can be quite confusing because it causes an error and it is not directly clear how to use these options correctly.
Unlike with
So maybe in this case the best way would be to allow usage of `-Xlint` command line arguments for `java` in source-file mode?
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a file called 'Test.java' containing the source code provided below
2. Run `java ./Test.java`
(i) It suggests using the `-Xlint:deprecation` option
3. Run `java` with that option: `java -Xlint:deprecation ./Test.java`
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The compiler should show more detailed warnings.
ACTUAL -
Starting the JVM fails:
Unrecognized option: -Xlint:deprecation
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
---------- BEGIN SOURCE ----------
class Test {
<T> void test(T t, Object o) {
T t1 = (T) o;
}
static class Generic<T> {
T t;
void raw(Generic raw) {
raw.t = "";
}
}
void deprecation() {
Thread.currentThread().stop();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Run `javac` with that flag; though might not be obvious for new users (for whom the source-file mode is intended)
- relates to
-
JDK-8248843 java in source-file mode suggests javac-only options
-
- Closed
-