On Thu, 22 Oct 2026 09:59:53 GMT, Vicente Romero <[email protected]> wrote:

> Fix for [JDK-8271623](https://bugs.openjdk.org/browse/JDK-8271623) introduced 
> a sensible optimization: omitting the generation of enclosing instance fields 
> for classes not using it. We have decided not to apply this optimization to 
> value classes, as it could be problematic. See related discussion 
> [here](https://mail.openjdk.org/archives/list/[email protected]/thread/DROHHBNWIWPQZMJOWUNJGKMJO76MO4FS/)
> 
> TIA
> 
> 
> 
> 
> ---------
> - [X] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

The javac parts seem OK to me, and the change makes sense to me.

test/jdk/java/lang/reflect/valhalla/ValueClassesReflectionTest.java line 103:

> 101:         assertTrue(pair.cls.isValue());
> 102:         Field[] fields = pair.cls.getDeclaredFields();
> 103:         assertTrue(fields.length == pair.numberOfFields);

Nit: the declaration of `numberOfFields` field in the top-level class can 
probably be dropped/removed right?

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

Marked as reviewed by jlahoda (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33507#pullrequestreview-5615057711
PR Review Comment: https://git.openjdk.org/jdk/pull/33507#discussion_r4348965804

Reply via email to