You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/10/06 22:14:45 UTC

[2/3] git commit: DELTASPIKE-278 remove unecessary checks for Message return values

DELTASPIKE-278 remove unecessary checks for Message return values

Why should we restrict the return value?


Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/279d85bb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/279d85bb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/279d85bb

Branch: refs/heads/master
Commit: 279d85bb562cc3dd2b20549d037f9ef44ffdbcff
Parents: b0caefe
Author: Mark Struberg <st...@apache.org>
Authored: Sat Oct 6 21:25:13 2012 +0200
Committer: Mark Struberg <st...@apache.org>
Committed: Sat Oct 6 21:25:13 2012 +0200

----------------------------------------------------------------------
 .../core/impl/message/MessageBundleExtension.java  |   31 +++------------
 1 files changed, 6 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/279d85bb/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
index f17993c..511b794 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/message/MessageBundleExtension.java
@@ -39,7 +39,6 @@ import javax.enterprise.inject.spi.ProcessAnnotatedType;
 import javax.enterprise.inject.spi.ProcessProducerMethod;
 
 import org.apache.deltaspike.core.api.message.Message;
-import org.apache.deltaspike.core.api.message.MessageContext;
 import org.apache.deltaspike.core.api.message.annotation.MessageBundle;
 import org.apache.deltaspike.core.api.message.annotation.MessageTemplate;
 import org.apache.deltaspike.core.util.bean.WrappingBeanBuilder;
@@ -115,34 +114,16 @@ public class MessageBundleExtension implements Extension, Deactivatable
 
             if (Message.class.isAssignableFrom(currentMethod.getReturnType()))
             {
-                ok |= validateMessageContextAwareMethod(currentMethod);
-            }
-            else
-            {
-                deploymentErrors.add(currentMethod.getReturnType().getName() + " isn't supported. Details: " +
-                        currentMethod.getDeclaringClass().getName() + "#" + currentMethod.getName() +
-                        " only " + String.class.getName() + " or " + Message.class.getName());
-                ok = false;
+                continue;
             }
-        }
-
-        return ok;
-    }
 
-    private boolean validateMessageContextAwareMethod(Method currentMethod)
-    {
-        for (Class currentParameterType : currentMethod.getParameterTypes())
-        {
-            if (MessageContext.class.isAssignableFrom(currentParameterType))
-            {
-                return true;
-            }
+            deploymentErrors.add(currentMethod.getReturnType().getName() + " isn't supported. Details: " +
+                    currentMethod.getDeclaringClass().getName() + "#" + currentMethod.getName() +
+                    " only " + String.class.getName() + " or " + Message.class.getName());
+            ok = false;
         }
 
-        deploymentErrors.add("No " + MessageContext.class.getName() + " parameter found at: " +
-                currentMethod.getDeclaringClass().getName() + "#" + currentMethod.getName() +
-                ". That is required for return-type " + Message.class.getName());
-        return false;
+        return ok;
     }
 
     /**