Author: dallen6
Date: 2009-07-25 07:18:51 -0400 (Sat, 25 Jul 2009)
New Revision: 3208
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
Log:
Changed exception conditions on the event objects
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-25
00:56:08 UTC (rev 3207)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-07-25
11:18:51 UTC (rev 3208)
@@ -791,11 +791,17 @@
*/
public void fireEvent(Object event, Annotation... bindings)
{
- // Check the event object for template parameters which are not allowed by
- // the spec.
+ // Make sure the event object above is not parameterized with a type
+ // variable
if (Reflections.isParameterizedType(event.getClass()))
{
- throw new IllegalArgumentException("Event type " +
event.getClass().getName() + " is not allowed because it is a generic");
+ for (Type type : Reflections.getActualTypeArguments(event.getClass()))
+ {
+ if (type instanceof TypeVariable<?>)
+ {
+ throw new IllegalArgumentException("Cannot use a type variable "
+ type + " in an parameterized type " + toString());
+ }
+ }
}
// Also check that the binding types are truly binding types
for (Annotation binding : bindings)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java 2009-07-25
00:56:08 UTC (rev 3207)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java 2009-07-25
11:18:51 UTC (rev 3208)
@@ -23,7 +23,6 @@
import java.util.Set;
import javax.enterprise.event.Event;
-import javax.enterprise.event.Observer;
import javax.enterprise.inject.TypeLiteral;
import org.jboss.webbeans.BeanManagerImpl;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-07-25
00:56:08 UTC (rev 3207)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-07-25
11:18:51 UTC (rev 3208)
@@ -111,7 +111,7 @@
{
for (Type type : eventParam.getActualTypeArguments())
{
- if (type instanceof TypeVariable)
+ if (type instanceof TypeVariable<?>)
{
throw new DefinitionException("Cannot use a type variable " +
type + " in an parameterized type " + toString());
}