On Fri, 21 Aug 2026 10:47:07 GMT, Casper Norrbin <[email protected]> wrote:
>> Hi everyone, >> >> The `@Contended` notation is not supported on value classes. The intended >> behavior is for the annotation to be ignored without affecting the class >> layout. However, value classes are currently still marked as contended >> internally. When another class inherits from a value class marked as >> contended, this causes padding to be inserted between the inherited fields >> and the subclass fields, which causes a crash on debug builds. >> >> To fix this, I have changed the handling so that a class is only marked as >> contended if it is an identity class. Since value classes cannot be >> contended, filtering the annotation when it is processed avoids carrying an >> invalid state that would require extra checks later on. With this change, >> contended and non-contended value classes behave identically, and inheriting >> from a value class annotated with `@Contended` no longer introduces padding. >> >> Testing: >> - Oracle tiers 1-3 >> - A new regression test covering value and identity subclasses inheriting >> from contended and non-contended base value classes. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Casper Norrbin has updated the pull request incrementally with one additional > commit since the last revision: > > Updated contended javadoc Thank you for the reviews! ------------- PR Comment: https://git.openjdk.org/jdk/pull/32470#issuecomment-5394991548
