Summary
-------
`java` command's `-Xdebug` and `-debug` options will be deprecated for removal.
Problem
-------
`java` command allows the `-Xdebug` and `-debug` options to be used during launch. The `-debug` option has been an alias for the `-Xdebug` option. `-debug` isn't documented but the `-Xdebug` is and as noted in the documentation (dating as far back as Java 8), this option is only there for backward compatibility and currently does nothing https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html#BGBCIEFC
> -Xdebug
>
> Does nothing. Provided for backward compatibility.
There are applications which currently pass this option when launching `java`. Most of these usages are of the form:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
These usages appear to be copy/pasted and are being used when launching `java` with debugging enabled. The use of `-Xdebug` and `-debug` plays no role in launching `java` in debug mode or any other functionality provided by `java`.
Solution
--------
`java` launcher will start printing a warning message if `-debug` or `-Xdebug` is passed. The warning message will state that the option is deprecated and will be removed in a future release:
java -debug -version
Warning: -debug option is deprecated and may be removed in a future release.
...
similarly:
java -Xdebug -version
OpenJDK 64-Bit Server VM warning: Option -Xdebug was deprecated in JDK 22 and will likely be removed in a future release.
...
Specification
-------------
There are no specification changes.