Generic type 'T' not available at runtime

Been trying so code which boils down to something like this…

public class DemoClass
{
public T someMethod()
{
var a = typeOf(T);
}
}

But when i compile i get Generic type ‘T’ not available at runtime should this compile or is it a limitation?

It’s a limitation of the Java (and Cocoa?) platforms, due to how genetics work.