I'm reading section 4.10.2.2 of the specification for JVM version 8 (https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html) how to verify bytecode. In this case what happens in control flow, when the stack now contains a slot with an int[] when coming from one source and a String[] when coming from another source.
I read the following, which was not present in the JVM versions 7 docs:
If corresponding values are both array reference types, then their dimensions are examined. If the array types have the same dimensions, then the merged value is a reference to an instance of an array type which is first common supertype of both array types. (If either or both of the array types has a primitive element type, then Object is used as the element type instead.)
...
Even int[] and String[] can be merged; the result is Object[], because Object is used instead of int when computing the first common supertype.
This does not make any sense to me, because that would mean that an int[] could be cast to an Object[]. But in Java arrays of primitive types cannot be cast to Object[].
Could anyone explain the rationale behind this?