Suppose I\'m trying to write a function to return an instance of the current type. Is there a way to make T refer to the exact subtype (so T should
T
If you want something akin to Scala's
trait T { def foo() : this.type }
then no, this is not possible in Java. You should also note that there is not much you can return from a similarly typed function in Scala, apart from this.
this