Fixed wrapper methods for interfaces and derived class overrides so that
they generate appropriate casts for return values as well as parameters.

As a consequence, foreach loop works over the codes in Strings now work.