[External] : Re: Object as a concrete class
Brian Goetz
brian.goetz at oracle.com
Fri Apr 1 14:19:59 UTC 2022
> The careful API design will be key as I can see a lot of corner cases
> related to `obj.getClass().isIdentityClass() != obj.hasIdentity()`.
> Do we have a sketch of what the apis for this would look like? I'm
> assuming these are just for expository purposes as isIdentityClass()
> really needs to return a trinary value - {true, false, maybe}.
Let's step back and ask "what is the purpose of
Class::isIdentityClass". It kind of got conflated with the dynamic
check of "does this object have identity", but really, this should be a
query about how the class is declared -- identity class, value class, or
identity-agnostic class. The latter bucket includes all interfaces,
Object, and some abstract classes. So to the extent we have this method
at all, a tri-value return seems almost a forced move.
More information about the valhalla-spec-observers
mailing list