On Sep 11, 2021, at 11:42 AM, John Rose
mailto:john.r.r...@oracle.com>> wrote:
Putting Object[] at the top forces a re-evaluation
when Valhalla comes, since the code will break.
P.S. I wonder if there is a compatibility move where
errors which arise from changed type relations
(int <: Object) ar
On Sep 11, 2021, at 6:48 AM, Brian Goetz
mailto:brian.go...@oracle.com>> wrote:
You would need to reorder this switch! Because byte[] will be a subtype of
Object[].
In Valhalla, that is. Putting Object[] at the bottom
will absorb any and all “new primitives”. In fact,
the “old primitives” wi
Thanks Tagir, this is a helpful exploration. There are lots of places
in the JDK (and the world beyond) that assume "eight primitive types, no
more"; finding them is a game of whack-a-mole. The real question is how
many of them would fall back to something reasonable when the ninth
primitive
Hello!
I just was thinking about good samples where switch patterns could be
useful. One idea I have is Arrays.deepHashCode. The current
implementation uses a helper method and queries getClass():
public static int deepHashCode(Object a[]) {
if (a == null)
return 0;
int result =