I am trying to improve the type safety of the following method:
A<String> method(B<String> arg);
How do I make sure that this method is not called with a raw type B and that compiler always checks for String type specified?
You can't prevent someone from calling a method with a raw type.
The reason is for backward compatibility with pre-generic versions of java.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With