I\'m trying to do something like this in Java:
public static T foo() { return (T) bar(T); } public static Object bar(Class> klaz) { re
There's no way to get the type. Java's generics use type erasure so even java itself does not know what T is at runtime.
As for workarounds: you could define foo to take a parameter of type Class<T> and then use that.
Class<T>