RFR: 8373186: Improve readability of core reflection toString specifications

Roger Riggs rriggs at openjdk.org
Mon Dec 8 22:30:57 UTC 2025


On Sat, 6 Dec 2025 21:35:57 GMT, Joe Darcy <darcy at openjdk.org> wrote:

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

src/java.base/share/classes/java/lang/reflect/Field.java line 349:

> 347: 
> 348:     /**
> 349:      * {@return a string describing this {@code Field}}

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.

src/java.base/share/classes/java/lang/reflect/Field.java line 365:

> 363:      * Specific information about {@linkplain #getModifiers()
> 364:      * modifiers} or other aspects of the field should be retrieved
> 365:      * using methods for that purpose.

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

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28688#discussion_r2600352283
PR Review Comment: https://git.openjdk.org/jdk/pull/28688#discussion_r2600354349


More information about the core-libs-dev mailing list