On Mon, 26 May 2025 17:08:45 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
> SonarCloud complains that since > [JDK-8356080](https://bugs.openjdk.org/browse/JDK-8356080) we are using > `Boolean` boxes in `ReverseOrderListView`. This change `boolean` -> `Boolean` > was made in [JDK-8356080](https://bugs.openjdk.org/browse/JDK-8356080) to > allow `@Stable` folding of boolean field. But it is very awkward to trade in > the existence of the boxed object to allow optional constant folding. > > We can flatten this field to `byte` and check the specific non-zero values. > The field is final, so it is never actually in `0` state. > > Additional testing: > - [x] Linux x86_64 server fastdebug, `java/util` Indeed, I think we don't particularly need this stableness. For lack of `@Stable` on boolean: `java.lang` is a trusted package, so all final fields are considered constant foldable even if the value is the default value. If a field is `@Stable`, the stable mechanism takes over, and the stable mechanism refuses to trust zero bit pattern values. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25456#issuecomment-2921273777