import org.eclipse.jdt.annotation.NonNull;
public class NullAnnotationTest {
public void meth1(@NonNull String in) {
System.out.println(in.length());
}
public static void main(String[] args) {
NullAnnotationTest test = new NullAnnotationTest();
test.meth1(null);
}
}
If we have @NonNull annotation, i thought we will get compile time error if we call meth1 with a null argument. But i am not seeing any sort of errors or warning in the above program. Can some correct me?
Aucun commentaire:
Enregistrer un commentaire