JDK-8305490 : CLHSDB "dumpclass" command produces classes with invalid field descriptors
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-04-03
  • Updated: 2023-09-18
  • Resolved: 2023-04-05
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.
JDK 21
21 b17Fixed
Related Reports
Relates :  
Relates :  
Description
CommandProcessor command "dumpclass" produces classes with invalid field descriptors.

`ClhsdbDumpclass` uses javap to verify classes validity.
Javap prints errors related to invalid constant pool entries, however the exit code is 0 and `ClhsdbDumpclass` test pass with invalid entries.
 
Work on JDK-8294969 "Convert jdk.jdeps javap to use the Classfile API" triggered `ClhsdbDumpclass` test to start failing on invalid entries.

Root cause of the problem is in `sun.jvm.hotspot.oops.InstanceKlass::getFieldSignatureIndex` returning `getGenericSignatureIndex` instead of `getSignatureIndex`.



Comments
Changeset: 78ff454f Author: Adam Sotona <asotona@openjdk.org> Date: 2023-04-05 13:19:27 +0000 URL: https://git.openjdk.org/jdk/commit/78ff454f1986abdb9b72d3c6c5b1f3bbab823540
05-04-2023

Here's an example of a passing ClhsdbDumpclass that shows the javap errors: > javap jdk/test/lib/apps/LingeredApp.class [2023-04-04T17:25:37.599235Z] Gathering output for process 23660 Compiled from "LingeredApp.java" public class jdk.test.lib.apps.LingeredApp { Error: invalid index #0 protected ??? appProcess; Error: invalid index #0 protected ??? output; Error: invalid index #0 protected static final ??? appWaitTime; Error: invalid index #0 protected static final ??? appCoreWaitTime; Error: invalid index #0 protected final ??? lockFileName; Error: invalid index #0 protected ??? logFileName; Error: invalid index #0 protected ??? forceCrash; public jdk.test.lib.apps.LingeredApp(java.lang.String); public jdk.test.lib.apps.LingeredApp(); static {}; public static void main(java.lang.String[]); public boolean useDefaultClasspath(); public void waitAppReadyOrCrashed(long) throws java.io.IOException; public void waitAppReadyOrCrashed() throws java.io.IOException; protected void runAddAppName(java.util.List<java.lang.String>); public void printCommandLine(java.util.List<java.lang.String>); public jdk.test.lib.process.OutputBuffer getOutput(); public void deleteLock() throws java.io.IOException; public void waitAppTerminate(); public void createLock() throws java.io.IOException; public void runAppExactJvmOpts(java.lang.String[]) throws java.io.IOException; public static void checkForDumps(); public java.lang.Process getProcess(); public static void stopApp(jdk.test.lib.apps.LingeredApp) throws java.io.IOException; public void stopApp() throws java.io.IOException; public static void startAppExactJvmOpts(jdk.test.lib.apps.LingeredApp, java.lang.String...) throws java.io.IOException; public static jdk.test.lib.apps.LingeredApp startApp(java.lang.String...) throws java.io.IOException; public static void startApp(jdk.test.lib.apps.LingeredApp, java.lang.String...) throws java.io.IOException; public void setForceCrash(boolean); public java.lang.String getLockFileName(); public void setLogFileName(java.lang.String); public long getPid(); public java.lang.String getProcessStdout(); public void setUseDefaultClasspath(boolean); public static boolean isLastModifiedWorking(); } [2023-04-04T17:25:40.098074Z] Waiting for completion for process 23660 [2023-04-04T17:25:40.098211Z] Waiting for completion finished for process 23660 LingeredApp stdout: []; LingeredApp stderr: [] LingeredApp exitValue = 0
04-04-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/13321 Date: 2023-04-04 07:44:40 +0000
04-04-2023

[~cjplummer] You are right, it was introduced by typo in JDK-8292818 commit. see: https://github.com/openjdk/jdk/commit/bfb812a8ff8bca70aed7695c73f019ae66ac6f33#r107436784 or: https://github.com/openjdk/jdk/blob/master/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java#L303
04-04-2023

[~asotona]This code was recently changed by JDK-8292818. Can you verify if this issue existed before then?
03-04-2023