On Sep 11, 2021, at 6:48 AM, Brian Goetz <brian.go...@oracle.com<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” will also be absorbed by Object[], so in Valhalla the switch statement is not required, but may be simply a hand-optimization (to get hand-specialized code for some known types). That sort of hand-optimization wants to be replaced by JVM and language support for template-like specialization. Putting Object[] at the top forces a re-evaluation when Valhalla comes, since the code will break.