Skip to content

8355204: Consider simplifying type metadata stripping #24775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cushon
Copy link
Contributor

@cushon cushon commented Apr 21, 2025

This change removes support for stripMetadataIfNeeded. After JDK-8355065 there are only two uses of the method:

  • Types#directSupertypes, which is specified as preserving type annotations. This change means that type metadata will be preserved for supertypes that appear in source, as well as substituted types for transitive supertypes.
  • Trees#getTypeMirror, which doesn't specify whether or not type annotations are preserved.

stripMetadataIfNeeded was added for JDK-8031744. The unconditional stripMetadata was added for JDK-8144580. stripMetadata was substantially reworked to ensure it always stripped annotations in JDK-8042981, which also updated the spec for Types' utility methods to clarify when type annotations were preserved, added a public API for removing annotations from types, and replaced some calls to stripMetadataIfNeeded with stripMetadata because the former didn't strip annotations in some cases where stripping was actually needed.

I think it's worth considering removing stripMetadataIfNeeded. The bookkeeping to keep track of whether or not metadata should be stripped is fragile, and the API use-case can be supported by either preserving metadata or unconditionally stripping it.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires a CSR request matching fixVersion 26 to be approved (needs to be created)

Issue

  • JDK-8355204: Consider simplifying type metadata stripping (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24775/head:pull/24775
$ git checkout pull/24775

Update a local copy of the PR:
$ git checkout pull/24775
$ git pull https://git.openjdk.org/jdk.git pull/24775/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24775

View PR using the GUI difftool:
$ git pr show -t 24775

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24775.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 21, 2025

👋 Welcome back cushon! 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.

@openjdk
Copy link

openjdk bot commented Apr 21, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Apr 21, 2025

@cushon The following label will be automatically applied to this pull request:

  • compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@cushon cushon marked this pull request as ready for review April 29, 2025 14:59
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 29, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 29, 2025

Webrevs

@bridgekeeper
Copy link

bridgekeeper bot commented May 19, 2025

@cushon This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@vicente-romero-oracle
Copy link
Contributor

/csr

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Jun 2, 2025
@openjdk
Copy link

openjdk bot commented Jun 2, 2025

@vicente-romero-oracle has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@cushon please create a CSR request for issue JDK-8355204 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler [email protected] csr Pull request needs approved CSR before integration rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants