jdk
jdk copied to clipboard
JDK-8315575: Retransform of record class with record component annotation fails with CFE
RecordComponent class has _attributes_count field. The only user of the field is JvmtiClassFileReconstituter. Incorrect value of the field causes producing incorrect data for Record attribute. Parsing Record attribute ClassFileParser skips unknown attributes and may skip RuntimeInvisibleAnnotations/RuntimeInvisibleTypeAnnotations. Also annotations can be changed (added/removed) by class redefinition. The fix removes attributes_count from RecordComponent; JvmtiClassFileReconstituter calculates correct attributes_count generating class bytes.
Testing:
- tier1,tier2,hs-tier5-svc;
- redefineClasses/retransformClasses tests:
- test/jdk/java/lang/instrument
- test/hotspot/jtreg/serviceability/jvmti/RedefineClasses
- test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses
- test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses
Progress
- [x] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8315575: Retransform of record class with record component annotation fails with CFE (Bug - P3)
Reviewers
- Serguei Spitsyn (@sspitsyn - Reviewer) ⚠️ Review applies to f82e432a
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18161/head:pull/18161
$ git checkout pull/18161
Update a local copy of the PR:
$ git checkout pull/18161
$ git pull https://git.openjdk.org/jdk.git pull/18161/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18161
View PR using the GUI difftool:
$ git pr show -t 18161
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18161.diff
Webrev
:wave: Welcome back amenkov! A progress list of the required criteria for merging this PR into master
will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
@alexmenkov The following labels will be automatically applied to this pull request:
-
core-libs
-
hotspot-runtime
-
serviceability
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.
Webrevs
- 06: Full - Incremental (84ad8e37)
- 05: Full - Incremental (93256d90)
- 04: Full - Incremental (9a53d4ca)
- 03: Full - Incremental (671c71e1)
- 02: Full - Incremental (f82e432a)
- 01: Full - Incremental (1ad6997d)
- 00: Full (5f1d0116)
Could you, please, update the CR with your analysis and conclusion about a root cause?
@alexmenkov This change now passes all automated pre-integration checks.
ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.
After integration, the commit message for the final commit will be:
8315575: Retransform of record class with record component annotation fails with CFE
Reviewed-by: sspitsyn, coleenp
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.
At the time when this comment was updated there had been 349 new commits pushed to the master
branch:
- db01fcd6d8c24b01a1f23c71b2917ff396b0686f: 8328827: Convert java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.html applet test to main
- 89e0889ab3beb96103ee381d9a54614e49e6d9d7: 8328858: More runtime/stack tests fail intermittently on libgraal
- 153410f480c372604e5825bfcd3a63f137e6a013: 8328930: [AIX] remove pase related coding
- da8a095a19c90e7ee2b45fab9b533a1092887023: 8328928: Serial: Use IsGCActiveMark instead of AutoModifyRestore in SerialHeap::do_collection
- 472fcb6e6e5fce4d5166a73894d1e7e4bd91bc58: 8328508: Unify the signatures of the methods address_for_index() and index_for() in BOT implementations
- cc1800fa4de3c1369efd46f5ca967ea82763f5d5: 8327998: Enable java/lang/ProcessBuilder/JspawnhelperProtocol.java on Mac
- b9c76dedf4aa2248a5e561a535c9e3e181f7836a: 8329074: AIX build fails after JDK-8328824
- 7b1f2c801fee6366ee37e873cda29c1ae7ad7e74: 8327493: Update minimum Xcode version in docs
- 9d441e3e56e733d64dbadde6854761e4545c1c70: 8283223: gc/stringdedup/TestStringDeduplicationFullGC.java#Parallel failed with "RuntimeException: String verification failed"
- 44549b605a7aad1e3143a4058ef6504a7c04167a: 8329012: IGV: Update required JDK version in README.md
- ... and 339 more: https://git.openjdk.org/jdk/compare/045eea11307f5df89071c7c7e366effdc23a22db...master
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
➡️ To integrate this PR with the above commit message to the master
branch, type /integrate in a new comment.
/label remove core-libs
@AlanBateman
The core-libs
label was successfully removed.
It is interesting that if an invisible attribute of a
RecordComponent
was not ignored because thePreserveAllAnnotations
is enabled then it theJvmtiClassFileReconstituter
treats it as a visible attribute. Not sure, if we should treat it as a bug.
Yes, if PreserveAllAnnotations is enabled, in the reconstituted class file the annotations become visible. I suppose this is considered normal because effectively PreserveAllAnnotations makes annotations "visible" (i.e.VM sees them).
But we have an issue here. if PreserveAllAnnotations is enabled and class has only RuntimeInvisibleAnnotations (no RuntimeVisibleAnnotations), the class constant pool does not contain "RuntimeVisibleAnnotations" and JvmtiClassFileReconstituter fails. I'll file a separate issue for this.
But we have an issue here. if PreserveAllAnnotations is enabled and class has only RuntimeInvisibleAnnotations (no RuntimeVisibleAnnotations), the class constant pool does not contain "RuntimeVisibleAnnotations" and JvmtiClassFileReconstituter fails. I'll file a separate issue for this.
Nice catch. I felt there is something fishy there.
Can I get 2nd review plase
/integrate
Going to push as commit 8fc9097b3720314ef7efaf1f3ac31898c8d6ca19.
Since your change was applied there have been 350 commits pushed to the master
branch:
- 2725405ac9d93761e26812d010d315a48f86071c: 8327991: Improve HttpClient documentation with regard to reclaiming resources
- db01fcd6d8c24b01a1f23c71b2917ff396b0686f: 8328827: Convert java/awt/print/PrinterJob/PrinterDialogsModalityTest/PrinterDialogsModalityTest.html applet test to main
- 89e0889ab3beb96103ee381d9a54614e49e6d9d7: 8328858: More runtime/stack tests fail intermittently on libgraal
- 153410f480c372604e5825bfcd3a63f137e6a013: 8328930: [AIX] remove pase related coding
- da8a095a19c90e7ee2b45fab9b533a1092887023: 8328928: Serial: Use IsGCActiveMark instead of AutoModifyRestore in SerialHeap::do_collection
- 472fcb6e6e5fce4d5166a73894d1e7e4bd91bc58: 8328508: Unify the signatures of the methods address_for_index() and index_for() in BOT implementations
- cc1800fa4de3c1369efd46f5ca967ea82763f5d5: 8327998: Enable java/lang/ProcessBuilder/JspawnhelperProtocol.java on Mac
- b9c76dedf4aa2248a5e561a535c9e3e181f7836a: 8329074: AIX build fails after JDK-8328824
- 7b1f2c801fee6366ee37e873cda29c1ae7ad7e74: 8327493: Update minimum Xcode version in docs
- 9d441e3e56e733d64dbadde6854761e4545c1c70: 8283223: gc/stringdedup/TestStringDeduplicationFullGC.java#Parallel failed with "RuntimeException: String verification failed"
- ... and 340 more: https://git.openjdk.org/jdk/compare/045eea11307f5df89071c7c7e366effdc23a22db...master
Your commit was automatically rebased without conflicts.
@alexmenkov Pushed as commit 8fc9097b3720314ef7efaf1f3ac31898c8d6ca19.
:bulb: You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.