JDK-8309979 : BootstrapMethods attribute is missing in class files recreated by SA
  • Type: Sub-task
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-13
  • Updated: 2023-09-06
  • Resolved: 2023-06-29
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 22
22 b05Fixed
Related Reports
Relates :  
Relates :  
Description
BootstrapMethods attribute is missing in class files recreated by SA (serviceability agent) using dumpclass or buildreplayjars command. The class files thus generated are not valid if there is a Dynamic or InvokeDynamic constant pool entry. Such classes cannot be used for replay compilation.

Class attribute are written by ClassWriter https://github.com/openjdk/jdk/blob/8aad881e803fddc26f45270f779ff0c0e5a095d8/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java#L665.
Comments
Changeset: 05c2b6cd Author: Ashutosh Mehra <asmehra@redhat.com> Committer: Kevin Walls <kevinw@openjdk.org> Date: 2023-06-29 14:16:15 +0000 URL: https://git.openjdk.org/jdk/commit/05c2b6cd47c68d96dcb7b3db594a334e05c6ee36
29-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14495 Date: 2023-06-15 15:06:54 +0000
15-06-2023

@Chris Plummer You are right - it won't solve all the problems and we need the StackMapTables as well. Thank you for pointing out the existing issue for missing StackMapTables. It is on my next list as I am hitting the VerifyError due to missing StackMapTable after adding the BootstrapMethods attribute. I am adding these changes on need basis as of now, so I am not entirely sure what else we would need. My use-case is to use SA's buildreplayjars to get hold of all the class files needed for replay compilation. I think it is a very useful mechanism to get the class files specially when the classes can be instrumented/generated at run time by the application/framework.
15-06-2023

See JDK-8242152 regarding missing StackMapTables and possibly other bits of the class file. It's not clear to me that fixing just the missing BootstrapMethods attribute will solve all your problems with class file dumping.
14-06-2023