openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1797208 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java webbeans-tck/standalone-suite.xml
Date Thu, 01 Jun 2017 11:54:29 GMT
Author: struberg
Date: Thu Jun  1 11:54:29 2017
New Revision: 1797208

URL: http://svn.apache.org/viewvc?rev=1797208&view=rev
Log:
OWB-1189 observer methods must not be @Observes and @ObservesAsync at the same time

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
    openwebbeans/trunk/webbeans-tck/standalone-suite.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java?rev=1797208&r1=1797207&r2=1797208&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
Thu Jun  1 11:54:29 2017
@@ -127,7 +127,7 @@ public class ObserverMethodsBuilder<T>
         
         AnnotatedMethod<?> annotatedMethod = (AnnotatedMethod<?>)annotatedParameter.getDeclaringCallable();
 
-        if (annotatedMethod.isAnnotationPresent(Produces.class) 
+        if (annotatedMethod.isAnnotationPresent(Produces.class)
                 || annotatedMethod.isAnnotationPresent(Inject.class))
         {
             throw new WebBeansConfigurationException("Observer method : " + annotatedMethod.getJavaMember().getName()
+ " in class : " 
@@ -148,13 +148,21 @@ public class ObserverMethodsBuilder<T>
             //Check Reception
             Reception reception;
             Observes observes = annotatedParameter.getAnnotation(Observes.class);
+            ObservesAsync observesAsync = annotatedParameter.getAnnotation(ObservesAsync.class);
+
+            if (observes != null && observesAsync != null)
+            {
+                throw new WebBeansConfigurationException("Observer method : " + annotatedMethod.getJavaMember().getName()
+ " in class : "
+                    + annotatedMethod.getJavaMember().getDeclaringClass().getName()
+                    + " can not be annotated with both @Observes *and* @ObservesAsync!");
+            }
+
             if (observes != null)
             {
                 reception = observes.notifyObserver();
             }
             else
             {
-                ObservesAsync observesAsync = annotatedParameter.getAnnotation(ObservesAsync.class);
                 reception = observesAsync.notifyObserver();
             }
 

Modified: openwebbeans/trunk/webbeans-tck/standalone-suite.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/standalone-suite.xml?rev=1797208&r1=1797207&r2=1797208&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/standalone-suite.xml (original)
+++ openwebbeans/trunk/webbeans-tck/standalone-suite.xml Thu Jun  1 11:54:29 2017
@@ -121,6 +121,11 @@
                 <methods><exclude name=".*"/></methods>
             </class>
 
+            <!-- https://issues.jboss.org/browse/CDITCK-586 -->
+            <class name="org.jboss.cdi.tck.tests.event.observer.async.basic.MixedObserversTest">
+                <methods><exclude name="testAsyncObserversCalledInDifferentThread"/></methods>
+            </class>
+
 
 
             <!--



Mime
View raw message