I learned that Java's type system follows a broken subtyping rule in that it treats arrays as covariant. I've read online that if a method's argument will be read from and modified, the only type-safe option is invariance which makes sense and we can provide some simple examples of that in Java.
Is Java's patch of this rule by dynamically type checking the type of an object being stored noticeable in terms of performance? I can't imagine that it would be more than one or two additional instructions to check the type of the object. A follow up question is, ignoring any performance differences at runtime, is this equivalent to having a non-broken subtyping rule for arrays? Forgive me if my questions are elementary!