[lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v2]
Roger Riggs
rriggs at openjdk.java.net
Wed May 25 22:44:01 UTC 2022
On Wed, 25 May 2022 21:38:12 GMT, liach <duke at openjdk.java.net> wrote:
>> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Add Objects.requireIdentity(obj, Supplier<String> supplier);
>> update copyright
>
> src/java.base/share/classes/java/util/Objects.java line 206:
>
>> 204: Objects.requireNonNull(obj);
>> 205: var cl = obj.getClass();
>> 206: if (cl.isValue())
>
> Just curious, is it that all instances of `Object` (from `new Object()`) are identity, and all other classes that are neither value nor identity are abstract classes?
`obj.getClass()` is always concrete and either identity or value. So abstract doesn't really come into play when talking about instances.
This test really should be `!cl.isIdentity()` but that method doesn't exist (yet, TBD soon)
Aabstract classes and interfaces can be either identity or value, or neither. (But not both).
-------------
PR: https://git.openjdk.java.net/valhalla/pull/696
More information about the valhalla-dev
mailing list