From 8b2e7d289b83bf8754d253e327c48cb157a30e16 Mon Sep 17 00:00:00 2001 From: Michael Zhou Date: Mon, 10 Dec 2012 22:55:18 -0600 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0jetbrain=20annotations?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/util/pom.xml | 4 ++++ .../main/java/com/alibaba/citrus/util/Assert.java | 14 ++++++++++---- pom.xml | 5 +++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/common/util/pom.xml b/common/util/pom.xml index 80a0aa376..c668ce6e2 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -28,5 +28,9 @@ ${project.groupId} citrus-common-servlet + + com.intellij + annotations + diff --git a/common/util/src/main/java/com/alibaba/citrus/util/Assert.java b/common/util/src/main/java/com/alibaba/citrus/util/Assert.java index e0fc8ebd8..ee8216b2b 100644 --- a/common/util/src/main/java/com/alibaba/citrus/util/Assert.java +++ b/common/util/src/main/java/com/alibaba/citrus/util/Assert.java @@ -19,6 +19,9 @@ import static com.alibaba.citrus.util.Assert.ExceptionType.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + /** * 断言工具,用来实现Fail-Fast。 @@ -66,17 +69,20 @@ */ public final class Assert { /** 确保对象不为空,否则抛出IllegalArgumentException。 */ - public static T assertNotNull(T object) { + @NotNull + public static T assertNotNull(@Nullable T object) { return assertNotNull(object, null, null, (Object[]) null); } /** 确保对象不为空,否则抛出IllegalArgumentException。 */ - public static T assertNotNull(T object, String message, Object... args) { + @NotNull + public static T assertNotNull(@Nullable T object, String message, Object... args) { return assertNotNull(object, null, message, args); } /** 确保对象不为空,否则抛出指定异常,默认为IllegalArgumentException。 */ - public static T assertNotNull(T object, ExceptionType exceptionType, String message, Object... args) { + @NotNull + public static T assertNotNull(@Nullable T object, ExceptionType exceptionType, String message, Object... args) { if (object == null) { if (exceptionType == null) { exceptionType = ILLEGAL_ARGUMENT; @@ -187,7 +193,7 @@ public static T unsupportedOperation(String message, Object... args) { } /** 取得带参数的消息。 */ - private static String getMessage(String message, Object[] args, String defaultMessage) { + private static String getMessage(@Nullable String message, @Nullable Object[] args, @NotNull String defaultMessage) { if (message == null) { message = defaultMessage; } diff --git a/pom.xml b/pom.xml index 73ae781e9..3c4ec4088 100644 --- a/pom.xml +++ b/pom.xml @@ -577,6 +577,11 @@ 3.0.1 compile + + com.intellij + annotations + 9.0.4 +