I have a generically typed class Builder<T>
that takes a constructor argument Class<T>
so I can keep the type around. This is a class that I use a lot in java code so I don't want to change the signature.
When I try to use the constructor like this:
Builder<List<Number>>(List<Number>::class)
I get an error: "Only classes are allowed on the left hand side of a class literal"
Any way to resolve this?
I can't change the constructor for Builder
, too many java classes rely upon it.
I understand the whole type erasure issue, I really just want to make the compiler happy.