I am 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 check the bytecode. In this case, what happens in the control flow when the stack now contains a slot with int [] when exiting from one source and String [] when switching from another source.
I read the following, which was not in versions 7 of the JVM versions:
If the corresponding values are types of reference array types, then their sizes are checked. If the array types are the same size, then the combined value is a reference to an instance of the array type, which is the first common supertype of both types of arrays. (If one or both array types are of a primitive element type, then an object is used instead.)
...
Even int [] and String [] can be combined; the result is Object [], because Object is used instead of int when calculating the first common supertype.
This makes no sense to me, because it would mean that int [] could be passed to object []. But in Java arrays, primitive types cannot be ported to Object [].
Can anyone explain the rationale for this?