On Thu, 7 May 2026 01:10:15 GMT, Dan Smith <[email protected]> wrote:

> Two changes:
> 
> - Remove the `Class.isIdentity` method, which is redundant given the 
> `Class.isValue` method
> - Clean up `Class.isValue` so that it only returns true for value classes, 
> not other non-identity things (interfaces, primitives)
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Marked as reviewed by liach (Committer).

src/java.base/share/classes/java/lang/Class.java line 643:

> 641:     @PreviewFeature(feature = PreviewFeature.Feature.VALUE_OBJECTS, 
> reflective=true)
> 642:     public boolean isValue() {
> 643:         return !identity && !primitive && !isInterface();

We can update the VM representation to change `identity` injection to `value` 
injection as a separate RFE probably for post lworld.

src/java.base/share/classes/jdk/internal/value/ValueClass.java line 55:

> 53:     /// This excludes abstract value classes.
> 54:     public static boolean isConcreteValueClass(Class<?> clazz) {
> 55:         return clazz.isValue() && 
> !Modifier.isAbstract(clazz.getModifiers());

Now this can be `clazz.isValue() && Modifier.isFinal(clazz.getModifiers())`, 
before primitives would report they are value but they are `abstract final` and 
thus fails the old test.

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

PR Review: 
https://git.openjdk.org/valhalla/pull/2397#pullrequestreview-4242575599
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2397#discussion_r3200225415
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2397#discussion_r3200209149

Reply via email to