[lworld] RFR: 8281463: [lworld] VALUE / PRIMITIVE modifiers should be supported by reflection

Mandy Chung mchung at openjdk.java.net
Tue Feb 8 22:36:33 UTC 2022


On Tue, 8 Feb 2022 21:23:30 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> Update java.lang.reflection.Modifier to reflect the JVMS specified bits in the modifier.
> 
> The re-use of bits between method and class modifiers poses a problem for this API.
> Previously, all bits were distinct and the modifiers do not include any indication of whether
> the modifier bits are from a class, field, or method. As a result there is ambiguity as two which
> of two meanings a bit takes on.  NATIVE vs VALUE and STRICT vs PRIMITIVE.
> 
> Please review for discussion purposes.

`ACC_VALUE`, `ACC_PRIMITIVE`, and `ACC_PERMITS_VALUE` are class modifiers.   Not every class modifiers defined in JVMS  is defined in the `java.lang.reflect.Modifier` API for example ACC_ENUM, ACC_ANNOTATION and ACC_MODULE.   But instead a test method such as `Class::isEnum`, `Class::isAnnotation` is provided in the `java.lang.Class` API.

For value and primitive class, a new `Class::isValue` and `Class::isPrimitiveClass` API (subject to the final terminology for B2 and B3) would suffice.   I'm not sure yet if an API is needed for `ACC_PERMITS_VALUE` since this is mostly used by JVM.

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

PR: https://git.openjdk.java.net/valhalla/pull/640



More information about the valhalla-dev mailing list