I copied this code for another test in the Valhalla repo and thought it would be a good utility function. It might be better written using the Classfile API. Tested with test.
------------- Commit messages: - 8359707: Add classfile modification code to RedefineClassHelper Changes: https://git.openjdk.org/jdk/pull/25857/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25857&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8359707 Stats: 98 lines in 2 files changed: 53 ins; 43 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/25857.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25857/head:pull/25857 PR: https://git.openjdk.org/jdk/pull/25857