RFR: 8311102: Write annotations in the classfile dumped by SA [v3]

Ashutosh Mehra duke at openjdk.org
Tue Jul 11 19:56:25 UTC 2023


> Please review this PR that enables ClassWriter to write annotations to the class file being dumped.
> 
> The fields annotations are stored in `Annotations::_fields_annotations` which is of type `Array<Array<u1>*>`. There is no class in SA that can represent it. I have added ArrayOfU1Array to correspond to the type `Array<Array<u1>*>` and it works. I believe there are better approaches but that would require a bit more refactoring of the classes representing Array types. I will leave that for future work for now.
> 
> Testing: `test/hotspot/jtreg/serviceability/sa` and `test/jdk/sun/tools/jhsdb`
> Tested it manually by dumping j.l.String class and comparing the annotations with the original class using javap.
> The test case mentioned in [JDK-8311101](https://bugs.openjdk.org/browse/JDK-8311101) would provide better coverage.

Ashutosh Mehra has updated the pull request incrementally with one additional commit since the last revision:

  Some code motion and factoring out common code
  
  Signed-off-by: Ashutosh Mehra <asmehra at redhat.com>

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/14735/files
  - new: https://git.openjdk.org/jdk/pull/14735/files/889537fd..1d79e734

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=14735&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14735&range=01-02

  Stats: 123 lines in 1 file changed: 63 ins; 56 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/14735.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14735/head:pull/14735

PR: https://git.openjdk.org/jdk/pull/14735


More information about the serviceability-dev mailing list