JDK-8312073 : Deprecate for removal the -Xnoagent option
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 22
  • Submitted: 2023-07-14
  • Updated: 2023-07-17
  • Resolved: 2023-07-17
Related Reports
CSR :  
Description
Summary
-------

`java` command's `-Xnoagent` option will be deprecated for removal.

Problem
-------

`java` command currently allows the `-Xnoagent` option. The implementation currently ignores this option and provides no functionality for it. This option isn't documented (doesn't appear in help text nor in its man page).

There are applications which currently pass this option when launching `java`. Most of these usages are of the form:

    -Xdebug -Xnoagent -Djava.compiler=NONE -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 `-Xnoagent` in recent versions of the JDK 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 `-Xnoagent` is passed. The warning message will state that the option is deprecated and will be removed in a future release:

    java -Xnoagent -version                 
    OpenJDK 64-Bit Server VM warning: Option -Xnoagent was deprecated in JDK 22 and will likely be removed in a future release.
    ...

Specification
-------------

There are no specification changes.
Comments
I see a release note is already planned; moving to Approved.
17-07-2023

This dates from Classic VM and the debugger agent sun.tools.agent.Agent that existed before JPDA. It's been obsolete for 20+ years but it is possible that some ancients scripts have it baked in, maybe copied from somewhere. A warning is good in advance of removing it.
14-07-2023