1 package javax.annotation; 2 3 import java.lang.annotation.Documented; 4 import java.lang.annotation.Retention; 5 import java.lang.annotation.RetentionPolicy; 6 7 import javax.annotation.meta.TypeQualifier; 8 import javax.annotation.meta.TypeQualifierValidator; 9 import javax.annotation.meta.When; 10 11 @Documented 12 @TypeQualifier 13 @Retention(RetentionPolicy.RUNTIME) 14 public @interface Nonnull { when()15 When when() default When.ALWAYS; 16 17 static class Checker implements TypeQualifierValidator<Nonnull> { 18 forConstantValue(Nonnull qualifierqualifierArgument, Object value)19 public When forConstantValue(Nonnull qualifierqualifierArgument, 20 Object value) { 21 if (value == null) 22 return When.NEVER; 23 return When.ALWAYS; 24 } 25 } 26 } 27