On Thu, 5 Mar 2026 17:54:14 GMT, Chen Liang <[email protected]> wrote:

> In project valhalla development, we discovered that `Modifier.toString` 
> becomes more problematic than helpful: there's now a mix-and-match of 
> modifiers from access flags and other class file sources, for example, 
> classes now can have ACC_IDENTITY, which clashes with ACC_SYNCHRONIZED, and 
> the correct modifier to reflect, "value", must be deduced by the users 
> manually.
> 
> With fewer bits available for the access flags, it becomes more apparent that 
> future source modifiers will no longer be reflected by `Modifier.toString`, 
> and future access flags are more likely to be reflected incorrectly. Thus, we 
> should dissuade users from this API in the long run.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: cb8860a7
Author:    Chen Liang <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/cb8860a7501d886317009c254f0e9835d7356b96
Stats:     281 lines in 16 files changed: 127 ins; 53 del; 101 mod

8379337: Deprecate Modifier.toString

Reviewed-by: alanb

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

PR: https://git.openjdk.org/jdk/pull/30093

Reply via email to