Skip to content

Conversation

@jddarcy
Copy link
Member

@jddarcy jddarcy commented Dec 6, 2025

Partial implementation of a spec refactoring to get some feedback before writing similar changes for other core reflection types.


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 CSR request JDK-8373223 to be approved

Issues

  • JDK-8373186: Improve readability of core reflection toString specifications (Enhancement - P4)
  • JDK-8373223: Improve readability of core reflection toString specifications (CSR)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28688

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 6, 2025

👋 Welcome back darcy! 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 Dec 6, 2025

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

@openjdk openjdk bot changed the title JDK-8373186: Improve readability of core reflection toString specifications 8373186: Improve readability of core reflection toString specifications Dec 6, 2025
@openjdk openjdk bot added csr Pull request needs approved CSR before integration core-libs core-libs-dev@openjdk.org labels Dec 6, 2025
@openjdk
Copy link

openjdk bot commented Dec 6, 2025

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

  • core-libs

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.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 6, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 6, 2025

Webrevs

* public static final int java.lang.Thread.MIN_PRIORITY
* private int java.io.FileDescriptor.fd
* public static java.util.List Foo.bar
* </pre>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having such examples here means this method has a specified output that users can parse. We should move this to some non-normative section like an implementation note.

(Don't know why github mobile didn't capture my comment before, I already commented yesterday)

* by the field type, followed by a space, followed by
* the fully-qualified name of the class declaring the field,
* followed by a period, followed by the name of the field.
* {@return a string describing this {@code Field}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field::toString has been specified this way since JDK 1.1 and we have to assume there are frameworks or libraries that would break if we were ever change the format of the String representation. Would it be possible to put more context for the proposal in the JBS or PR? I think I'm mostly trying to understand if this is just about readability or whether an incompatible change to the string representation might follow.

* by the field type, followed by a space, followed by
* the fully-qualified name of the class declaring the field,
* followed by a period, followed by the name of the field.
* {@return a string describing this {@code Field}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a compelling reason to backtrack on the format of toString.
Its likely to break some application or description of the field to a user.

Comment on lines +362 to +365
* @apiNote
* Specific information about {@linkplain #getModifiers()
* modifiers} or other aspects of the field should be retrieved
* using methods for that purpose.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needlessly vague and gives an opportunity to reinforce the preferred order of modifiers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org 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.

4 participants