Author: pete.muir(a)jboss.org
Date: 2009-06-26 07:43:37 -0400 (Fri, 26 Jun 2009)
New Revision: 2898
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java
Log:
WBRI-282
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-06-26 11:27:58
UTC (rev 2897)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-06-26 11:43:37
UTC (rev 2898)
@@ -30,7 +30,6 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.enterprise.inject.AmbiguousResolutionException;
-import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.New;
import javax.enterprise.inject.UnproxyableResolutionException;
@@ -38,7 +37,6 @@
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Obtains;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.DecoratorBean;
@@ -101,8 +99,8 @@
}
}
}
- checkFacadeInjectionPoint(injectionPoint, Obtains.class, Instance.class);
- checkFacadeInjectionPoint(injectionPoint, Any.class, Event.class);
+ checkFacadeInjectionPoint(injectionPoint, Instance.class);
+ checkFacadeInjectionPoint(injectionPoint, Event.class);
Annotation[] bindings = injectionPoint.getBindings().toArray(new
Annotation[0]);
WBAnnotated<?, ?> annotatedItem =
ResolvableWBClass.of(injectionPoint.getType(), bindings, manager);
Set<?> resolvedBeans = manager.getInjectableBeans(injectionPoint);
@@ -193,29 +191,25 @@
return comparator.compare(deploymentType, otherDeploymentType) > 0;
}
- private void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<?
extends Annotation> annotationType, Class<?> type)
+ private void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<?>
type)
{
- if (injectionPoint.getAnnotated().isAnnotationPresent(annotationType))
+ if (injectionPoint.getAnnotated().getBaseType().equals(type))
{
if (injectionPoint.getType() instanceof ParameterizedType)
{
ParameterizedType parameterizedType = (ParameterizedType)
injectionPoint.getType();
- if (!type.isAssignableFrom((Class<?>) parameterizedType.getRawType()))
- {
- throw new DefinitionException("An injection point annotated " +
annotationType + " must have type " + type + " " + injectionPoint);
- }
if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable)
{
- throw new DefinitionException("An injection point annotated " +
annotationType + " cannot have a type variable type parameter " +
injectionPoint);
+ throw new DefinitionException("An injection point of type " +
type + " cannot have a type variable type parameter " + injectionPoint);
}
if (parameterizedType.getActualTypeArguments()[0] instanceof WildcardType)
{
- throw new DefinitionException("An injection point annotated " +
annotationType + " cannot have a wildcard type parameter " + injectionPoint);
+ throw new DefinitionException("An injection point of type " +
type + " cannot have a wildcard type parameter " + injectionPoint);
}
}
else
{
- throw new DefinitionException("An injection point annotated " +
annotationType + " must have a type parameter " + injectionPoint);
+ throw new DefinitionException("An injection point of type " + type
+ " must have a type parameter " + injectionPoint);
}
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java 2009-06-26
11:27:58 UTC (rev 2897)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/any/AnyInjectionTest.java 2009-06-26
11:43:37 UTC (rev 2898)
@@ -7,7 +7,7 @@
@Artifact
public class AnyInjectionTest extends AbstractJSR299Test
{
- @Test(groups = "ri-broken")
+ @Test
public void testAnyInjectionIfExactlyOneBeanForType()
{
assert getInstanceByType(Customer.class).drink != null;