I have a value class with generic type:
class TestValue<T> {
TestValue(T value) {
}
}
And a method that expects TestValue with a specific SomeObject type:
public void setValue(TestValue<SomeObject> value) { }
Is there a way to show a compiler error when calling this method with a value that is not of SomeObject type?
eg show a compiler error when calling this with Double instead of SomeObject
TestValue t = new TestValue(1d);
setValue(t);
^^ this should show an error