I'd like to use the @NonNull annotation in Android, but I can't figure out just the right way to do it.
I propose you this example:
public void doStuff(@NonNull String s){
     //do work with s...    
}
So when i call doStuff(null) the IDE will give me a warning. The problem is that I cannot rely on this annotation since, like this question points out, they don't propagate very far. So I'd like to put a null check on my method, like this:
 if(s==null) throw new IllegalAgrumentException();
But the IDE, assuming that s!=null, will warn me that s==null is always false. I'd like to know what is the best way to do this.
I personally think that there should be an annotation like @ShouldntBeNull that only checks and warns that null isn't passed to it, but doesn't complains when the value is null checked.
 
     
     
     
    