Added a few more type checking constraints - in Java, they are enforced by the bytecode verifier, but in Dex they aren't. I added it unconditionally since the semantics is the same for both Dex and Java, so it doesn't hurt to have them.
improved error handling for (hopefully rare) cases in which the broken code is processed
added some checks in case the base local of an array is not of an array type, but of type Object which is still cast-compatible