Because you use a wildcard in the declaration of house, the compiler no longer knows it is a AnimalHouse<Cat>. For all it knows it could be an AnimalHouse<Dog>, AnimalHouse<Bird> or even AnimalHouse<
String>*. You need to replace the "?" with either "Cat" or "? super Cat".
* Change the declaration of AnimalHouse to this:
This way the generic type is bound to be Animal or any subtype.