JDK-8327248 : VM.classes help output for Flags annotations is in the wrong place
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 19,20,21,22,23
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2024-03-04
  • Updated: 2024-08-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
The VM.classes help output doesn't properly document the Flags annotations:

-------------------------------
)$ jcmd 24089 help VM.classes 
24089:
VM.classes
Print all loaded classes

Impact: Medium: Depends on number of loaded classes.

Syntax : VM.classes [options]

Options: (options must be specified using the <key> or <key>=<value> syntax)
	-verbose : [optional] Dump the detailed content of a Java class. Some classes are annotated with flags: F = has, or inherits, a non-empty finalize method, f = has final method, W = methods rewritten, C = marked with @Contended annotation, R = has been redefined, S = is shared class (BOOLEAN, false)
-------------------------------

Under the -verbose option, the various Flags annotations are documented. However, these annotations always appear in the output, even without using -verbose.

$ jcmd 24089  VM.classes 
24089:
KlassAddr           Size  State                 Flags    ClassName  
...
0x00007f29000c2410   145  fully_initialized     fWS      java.nio.CharBuffer  
0x00007f29000c28a0    65  linked                WS       java.lang.Readable  
0x00007f29001a5830    67  fully_initialized     WS       java.util.TimSort  
0x00007f29001a6710    66  fully_initialized     WS       java.util.Arrays$LegacyMergeSort  
0x00007f2901046c10    84  fully_initialized     fW       java.util.Map$Entry$$Lambda/0x00007f2901046c10  
...

The description of these flags should be printed as part of the dcmd description, which is implemented by the description() method.

The Flags feature was added by JDK-8275775. There was a little bit of discussion about documenting them during the review, with mention of not knowing where to put this type of help, so it appears that is why it ended up in the -verbose description.