Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8312220

Deprecate the launcher -Xdebug/-debug flags that have not done anything since Java 6

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 22
    • tools
    • None
    • behavioral
    • minimal
    • Hide
      In their current form the -Xdebug and -debug are effectively a no-op. With the proposed deprecation a warning will be logged if any of these two options is used when launching java. Logging this message will cause applications which use -Xdebug or -debug to start seeing this message on their STDERR stream and could be considered unexpected by some applications. That however is no different than other similar warning messages that java command emits for deprecation notices.
      Show
      In their current form the -Xdebug and -debug are effectively a no-op. With the proposed deprecation a warning will be logged if any of these two options is used when launching java. Logging this message will cause applications which use -Xdebug or -debug to start seeing this message on their STDERR stream and could be considered unexpected by some applications. That however is no different than other similar warning messages that java command emits for deprecation notices.
    • add/remove/modify command line option
    • JDK

      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.

            jpai Jaikiran Pai
            dholmes David Holmes
            Alan Bateman, David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: