> 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

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/32470/files
  - new: https://git.openjdk.org/jdk/pull/32470/files/e4d0b235..300b7f18

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=32470&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=32470&range=00-01

  Stats: 6 lines in 1 file changed: 6 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/32470.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32470/head:pull/32470

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

Reply via email to