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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.