[lworld] RFR: 8287692: Move Class primitive APIs to jdk.internal.value.PrimitiveClass

Mandy Chung mchung at openjdk.org
Fri Sep 9 22:22:04 UTC 2022


On Fri, 9 Sep 2022 17:06:30 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> Move Class primitive APIs to jdk.internal.value.PrimitiveClass.
> 
> Update hotspot tests to use PrimitiveClass instead of Class.xxx methods.
> Add imports of jdk.internal.value.PrimitiveClass
> Add --add-exports java.base/jdk.internal.value=ALL-UNNAMED

Looks okay in general.

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

> 204:     private static final int ENUM       = 0x00004000;
> 205:     private static final int SYNTHETIC  = 0x00001000;
> 206:     private static final int VALUE_CLASS     = 0x00000040;

Is this a merge error?  That was removed by JDK-8281463.

src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java line 272:

> 270: 
> 271:             // check receiver type
> 272:             if (!PrimitiveClass.asPrimaryType(implClass).isAssignableFrom(PrimitiveClass.asPrimaryType(receiverClass))) {

Maybe a convenient method `PrimitiveClass::isAssignableFrom`  is useful to add.

src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 971:

> 969:                     false);
> 970:             if (PrimitiveClass.isPrimitiveValueType(cl)) {
> 971:               mv.visitMethodInsn(INVOKESTATIC,

nit: it's existing formatting issue.  use 4-space indentation.

src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 541:

> 539:      * Creates a new StackWalker
> 540:      */
> 541:     StackWalker newStackWalkerInstance(Set<StackWalker.Option> options, ContinuationScope contScope, Continuation continuation);

Is the formatting change in this file (this line and above) accidental done by IDE?

I expect the change should just be the addition of the new methods below.

src/java.base/share/classes/jdk/internal/value/PrimitiveClass.java line 39:

> 37: 
> 38:     // ACC_PRIMITIVE from JEP 401
> 39:     private static final int PRIMITIVE_CLASS = 0x00000800;

perhaps make this public to have a single place in the libraries to define this constant and remove `Class::PRIMITIVE_CLASS`.

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

PR: https://git.openjdk.org/valhalla/pull/752



More information about the valhalla-dev mailing list