Fixed problem with overriding method with non-trivial raw type (when erased type parameter has upper bound)

Also added cases for the code which was changed.