diff options
Diffstat (limited to 'platform/annotations/src/org/jetbrains/annotations/NotNull.java')
-rw-r--r-- | platform/annotations/src/org/jetbrains/annotations/NotNull.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/annotations/src/org/jetbrains/annotations/NotNull.java b/platform/annotations/src/org/jetbrains/annotations/NotNull.java index aa7c78b3d225..3ad6003f554c 100644 --- a/platform/annotations/src/org/jetbrains/annotations/NotNull.java +++ b/platform/annotations/src/org/jetbrains/annotations/NotNull.java @@ -30,5 +30,17 @@ import java.lang.annotation.*; @Retention(RetentionPolicy.CLASS) @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE}) public @interface NotNull { + /** + * @return Custom exception message + */ String value() default ""; + + /** + * @return Custom exception type that should be thrown when not-nullity contract is violated. + * The exception class should have a constructor with one String argument (message). + * + * By default, {@link java.lang.IllegalArgumentException} is thrown on null method arguments and + * {@link java.lang.IllegalStateException} — on null return value. + */ + Class<? extends Exception> exception() default Exception.class; } |