I\'m not sure if this is possible or not, but what I want to accomplish is this:
public static B makeB(A thing) {...}
I think the problem here is that you want to return a B
from this method.
You specify B
as a type parameter, but it never appears anywhere else in the method signature.
How is the compiler supposed to infer the return type from the arguments????
There is no opportunity for the client code to specify what B
is.
It seems like you should return either a SomeClass
or an A
.
Either one can be a B
under the hood, but should appear as a SomeClass
or an A
to the client code.