Java inheritance and generics Today i had discussion with my colleague about casting.

Our case:
We have root class

abstract class RootFoo&lt;R extends RooFoo&gt; {
   ...
   abstract R getThis();
}


and we implement method getThis in subclasses. 

To save (in my opinion) unnecessary implementation getThis method in every subclass i showed my solution:

abstract class RootFoo&lt;R extends RooFoo&gt; {
   ...
   R getThis() {
       return (R) this;
   }
}


Could you help me understand why my idea is wrong?
I think that both approaches are incorrect.

Why would you need to cast an object to its own type, while it is already typed to a type that inherits from its parent abstract type?

The method getThis() is absolutely senseless, because if you have an instance of an object, it is typed by definition.