RFR: 8373125: Add defensive screening of modifiers for Field and Parameter toString() results

Alan Bateman alanb at openjdk.org
Fri Dec 5 16:53:36 UTC 2025


On Fri, 5 Dec 2025 05:14:05 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> The modifiers in core reflection and just modeled using the bits of an int. For methods and constructors, there are collisions on the reuse of modifier bits on different kinds of constructs. Printing misleading information is avoid by masking out the modfiers using information from the Modifer class.
> 
> While Field and Parameter don't currently have such collisions, they may under Valhalla and adding defensive screenings now would add robustness.

Maybe a bit mature to be concerned with this but I think the change looks okay.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28672#pullrequestreview-3545569951


More information about the core-libs-dev mailing list