fixed issue 307: Better generics support for mocks and stubs