[lworld] RFR: Add Class.isIdentity

Roger Riggs rriggs at openjdk.java.net
Wed Jun 1 17:02:01 UTC 2022


On Tue, 31 May 2022 18:35:40 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Add j.l.Class.isIdentity() as a complement to Class.isValue() and Class.isPrimitiveClass.
>> 
>> Class.getModifiers() is updated to remove VM was suppressing the ACC_IDENTITY bit (previously known as ACC_SUPER).
>> 
>> Updated Class.toString() to reflect the addition of ACC_IDENTITY.
>> For regular identity classes and interfaces, there is no change to toString.
>> 
>> Removed the obsolete test for ACC_SUPER
>> 
>> This PR may need to wait for corresponding VM changes.
>
> src/hotspot/share/oops/instanceKlass.cpp line 3398:
> 
>> 3396:     }
>> 3397:   }
>> 3398:   // Do not strip ACC_SUPER, its ACC_IDENTITY now
> 
> I think this should apply only if `EnableValhalla` (or `--enable-preview` is set).

The semantics of the bit are dependent on (at least) the class file version.
That's part of the modifier problem, the bit(s) are/will/need to be interpreted differently depending on the class file version and source  (class vs member).  Solution is TBD.
Preview is not implemented yet.

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

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



More information about the valhalla-dev mailing list