7 ms·
But then you are representing two distinct types as the same underlying type, String. MyType extends String; void foo(String s); foo(new MyType()); // is
by buerkle 1y ago
But then you are representing two distinct types as the same underlying type, String.
MyType extends String;
void foo(String s);
foo(new MyType()); // is valid
Leading to the original problem. I don't want to represent MyType as a String because it's not.
- qcnguy 1y agoIt has to work that way or else you can't use the standard library. What you want to block is not: StringUtils.trim(String foo); but myApp.doSomething(AnotherMyType amt); The latter is saying "I need not any string but a specific kind of string".