freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [freemarker] 02/04: _NullArgumentException.check now returns its parameter
Date Thu, 17 Jan 2019 10:00:46 GMT
This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch 3
in repository https://gitbox.apache.org/repos/asf/freemarker.git

commit c74794d34d56c775caad9e38f58216f01faa63af
Author: ddekany <ddekany@apache.org>
AuthorDate: Thu Jan 17 10:57:31 2019 +0100

    _NullArgumentException.check now returns its parameter
---
 .../org/apache/freemarker/core/util/_NullArgumentException.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java
b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java
index d9cdad9..5ee2eba 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/util/_NullArgumentException.java
@@ -40,19 +40,21 @@ public class _NullArgumentException extends IllegalArgumentException {
     /**
      * Convenience method to protect against a {@code null} argument.
      */
-    public static void check(String argumentName, Object argumentValue) {
+    public static <T> T check(String argumentName, T argumentValue) {
         if (argumentValue == null) {
             throw new _NullArgumentException(argumentName);
         }
+        return argumentValue;
     }
 
     /**
      * Convenience method to protect against a {@code null} argument.
      */
-    public static void check(Object argumentValue) {
+    public static <T> T check(T argumentValue) {
         if (argumentValue == null) {
             throw new _NullArgumentException();
         }
+        return argumentValue;
     }
     
 }


Mime
View raw message