[webbeans-commits] Webbeans SVN: r2827 - ri/trunk/impl/src/main/java/org/jboss/webbeans and 23 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Jun 12 18:30:21 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-06-12 18:30:21 -0400 (Fri, 12 Jun 2009)
New Revision: 2827

Added:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingDecorator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanResolvableTransformer.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/AnnotatedAdaptor.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ForwardingResolvable.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolovableTransformer.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolvable.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableFactory.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Car.java
Removed:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/AnnotatedItemTransformer.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedItem.java
Modified:
   ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Annotated.java
   ri/trunk/api/src/main/java/javax/enterprise/inject/spi/InjectionPoint.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedClass.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
   ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/FiresOnNonEventTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event2/FiresOnEventWithoutTypeTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Animal.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/noninstance/NonInstanceTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/notypeparam/NoTypeParameterSpecifiedTest.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
Log:
Big update to resolver to allow for use in other situations (decorators), mark various tests as broken, fix decorator init

Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Annotated.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Annotated.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Annotated.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -5,7 +5,7 @@
 import java.util.Set;
 
 public interface Annotated {
-    Type getType();
+    public Type getType();
     public <T extends Annotation> T getAnnotation(Class<T> annotationType);
     public Set<Annotation> getAnnotations();
     public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);

Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/InjectionPoint.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/InjectionPoint.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/InjectionPoint.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -75,35 +75,9 @@
     */
    public Member getMember();
    
-   /**
-    * Get the annotation instance for the given annotation type of the field in
-    * the case of field injection, or annotations of the parameter in the case
-    * of method parameter or constructor parameter injection.
-    * 
-    * @param <T>
-    *           the type of the annotation
-    * @param annotationType
-    *           the type of the annotation
-    * @return the annotation of the specified annotationType, or null if no such
-    *         annotation exists
-    */
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType);
+   public Annotated getAnnotated();
    
-   /**
-    * Get the annotations of the field in the case of field injection, or
-    * annotations of the parameter in the case of method parameter or
-    * constructor parameter injection.
-    * 
-    * @return the annotations of the field
-    */
-   public Annotation[] getAnnotations();
+   public boolean isDelegate();
    
-   /**
-    * Determine if the specified annotation is present on the injection point
-    * 
-    * @param annotationType
-    *           the type of the annotation
-    * @return true if an annotation of the specified type is present, else false
-    */
-   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
+   public boolean isTransient();
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -66,7 +66,7 @@
 import javax.inject.DeploymentException;
 import javax.inject.DuplicateBindingTypeException;
 
-import org.jboss.webbeans.bean.DisposalMethodBean;
+import org.jboss.webbeans.bean.DecoratorBean;
 import org.jboss.webbeans.bean.EnterpriseBean;
 import org.jboss.webbeans.bean.NewEnterpriseBean;
 import org.jboss.webbeans.bean.RIBean;
@@ -81,6 +81,7 @@
 import org.jboss.webbeans.event.ObserverImpl;
 import org.jboss.webbeans.injection.NonContextualInjector;
 import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass;
+import org.jboss.webbeans.injection.resolution.ResolvableFactory;
 import org.jboss.webbeans.injection.resolution.Resolver;
 import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.log.Log;
@@ -190,6 +191,7 @@
     */  
    private transient final EventManager eventManager;
    private transient final Resolver resolver;
+   private transient final Resolver decoratorResolver;
    private final transient NonContextualInjector nonContextualInjector;
    private final transient ELResolver webbeansELResolver;
    
@@ -198,7 +200,8 @@
     * ********************************
     */
    private transient final ThreadLocal<Stack<InjectionPoint>> currentInjectionPoint;
-   private transient List<Bean<?>> beanWithManagers;
+   private transient final List<Bean<?>> beans;
+   private transient final List<Decorator<?>> decorators;
    private final transient Namespace rootNamespace;
    private final transient ConcurrentSetMultiMap<Type, EventObserver<?>> registeredObservers;
    private final transient Set<BeanManagerImpl> childActivities;
@@ -220,6 +223,7 @@
       return new BeanManagerImpl(
             serviceRegistry, 
             new CopyOnWriteArrayList<Bean<?>>(), 
+            new CopyOnWriteArrayList<Decorator<?>>(),
             new ConcurrentSetHashMultiMap<Type, EventObserver<?>>(),
             new Namespace(),
             new ConcurrentHashMap<Class<?>, EnterpriseBean<?>>(),
@@ -251,6 +255,7 @@
       return new BeanManagerImpl(
             parentManager.getServices(),
             beans,
+            parentManager.getDecorators(),
             registeredObservers,
             rootNamespace,
             parentManager.getNewEnterpriseBeanMap(), 
@@ -272,6 +277,7 @@
    private BeanManagerImpl(
          ServiceRegistry serviceRegistry, 
          List<Bean<?>> beans,
+         List<Decorator<?>> decorators,
          ConcurrentSetMultiMap<Type, EventObserver<?>> registeredObservers,
          Namespace rootNamespace,
          Map<Class<?>, EnterpriseBean<?>> newEnterpriseBeans, 
@@ -285,7 +291,8 @@
          )
    {
       this.services = serviceRegistry;
-      this.beanWithManagers = beans;
+      this.beans = beans;
+      this.decorators = decorators;
       this.newEnterpriseBeans = newEnterpriseBeans;
       this.riBeans = riBeans;
       this.clientProxyProvider = clientProxyProvider;
@@ -298,7 +305,8 @@
       this.ids = ids;
       this.id = ids.incrementAndGet();
       
-      this.resolver = new Resolver(this);
+      this.resolver = new Resolver(this, beans);
+      this.decoratorResolver = new Resolver(this, decorators);
       this.eventManager = new EventManager(this);
       this.nonContextualInjector = new NonContextualInjector(this);
       this.webbeansELResolver = new WebBeansELResolverImpl(this);
@@ -346,12 +354,12 @@
     */
    public void addBean(Bean<?> bean)
    {
-      if (beanWithManagers.contains(bean))
+      if (beans.contains(bean))
       {
          return;
       }
       resolver.clear();
-      beanWithManagers.add(bean);
+      beans.add(bean);
       registerBeanNamespace(bean);
       for (BeanManagerImpl childActivity : childActivities)
       {
@@ -360,29 +368,6 @@
       return;
    }
 
-   /**
-    * Resolve the disposal method for the given producer method. For internal
-    * use.
-    * 
-    * @param apiType The API type to match
-    * @param bindings The binding types to match
-    * @return The set of matching disposal methods
-    */
-   public <T> Set<DisposalMethodBean<T>> resolveDisposalBeans(Class<T> apiType, Annotation... bindings)
-   {
-      // Correct?
-      Set<Bean<?>> beans = getBeans(apiType, bindings);
-      Set<DisposalMethodBean<T>> disposalBeans = new HashSet<DisposalMethodBean<T>>();
-      for (Bean<?> bean : beans)
-      {
-         if (bean instanceof DisposalMethodBean)
-         {
-            disposalBeans.add((DisposalMethodBean<T>) bean);
-         }
-      }
-      return disposalBeans;
-   }
-
    public <T> Set<Observer<T>> resolveObservers(T event, Annotation... bindings)
    {
       Class<?> clazz = event.getClass();
@@ -465,12 +450,12 @@
    
    public Set<Bean<?>> getBeans(Type beanType, Annotation... bindings)
    {
-      return getBeans(ResolvableAnnotatedClass.of(beanType, bindings), bindings);
+      return getBeans(ResolvableAnnotatedClass.of(beanType, bindings, this), bindings);
    }
    
    public Set<Bean<?>> getBeans(AnnotatedItem<?, ?> element, Annotation... bindings)
    {
-      for (Annotation annotation : element.getAnnotationsAsSet())
+      for (Annotation annotation : element.getAnnotations())
       {
          if (!getServices().get(MetaDataCache.class).getBindingTypeModel(annotation.annotationType()).isValid())
          {
@@ -492,7 +477,7 @@
       {
          throw new DuplicateBindingTypeException("Duplicate bindings (" + Arrays.asList(bindings) + ") type passed " + element.toString());
       }
-      return resolver.get(element);
+      return resolver.get(ResolvableFactory.of(element));
    }
 
    public Set<Bean<?>> getBeans(InjectionPoint injectionPoint)
@@ -505,7 +490,7 @@
             currentInjectionPoint.get().push(injectionPoint);
          }
          // TODO Do this properly
-         return getBeans(ResolvableAnnotatedClass.of(injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0])));
+         return getBeans(ResolvableAnnotatedClass.of(injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0]), this));
       }
       finally
       {
@@ -530,15 +515,19 @@
    {
       synchronized (beans)
       {
-         this.beanWithManagers = new CopyOnWriteArrayList<Bean<?>>(beans);
          for (RIBean<?> bean : beans)
          {
             if (bean instanceof NewEnterpriseBean)
             {
                newEnterpriseBeans.put(bean.getType(), (EnterpriseBean<?>) bean);
             }
+            if (bean instanceof DecoratorBean)
+            {
+               decorators.add(DecoratorBean.wrapForResolver((Decorator<?>) bean));
+            }
             riBeans.put(bean.getId(), bean);
             registerBeanNamespace(bean);
+            this.beans.add(bean);
          }
          resolver.clear();
       }
@@ -575,8 +564,13 @@
     */
    public List<Bean<?>> getBeans()
    {
-      return Collections.unmodifiableList(beanWithManagers);
+      return Collections.unmodifiableList(beans);
    }
+   
+   public List<Decorator<?>> getDecorators()
+   {
+      return Collections.unmodifiableList(decorators);
+   }
 
    public Map<String, RIBean<?>> getRiBeans()
    {
@@ -749,7 +743,7 @@
          {
             currentInjectionPoint.get().push(injectionPoint);
          }
-         AnnotatedItem<?, ?> element = ResolvableAnnotatedClass.of(injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0]));
+         AnnotatedItem<?, ?> element = ResolvableAnnotatedClass.of(injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0]), this);
          Bean<?> resolvedBean = getBean(element, element.getBindingsAsArray());
          if (getServices().get(MetaDataCache.class).getScopeModel(resolvedBean.getScopeType()).isNormal() && !Proxies.isTypeProxyable(injectionPoint.getType()))
          {
@@ -794,7 +788,7 @@
    @Deprecated
    public <T> T getInstanceByType(Class<T> type, Annotation... bindings)
    {
-      AnnotatedItem<T, ?> element = ResolvableAnnotatedClass.of(type, bindings);
+      AnnotatedItem<T, ?> element = ResolvableAnnotatedClass.of(type, bindings, this);
       return (T) getReference(getBean(element, bindings), type);
    }
 
@@ -824,19 +818,23 @@
    }
 
    /**
-    * Resolves a list of decorators based on API types and binding types Os
+    * Resolves a list of decorators based on API types and binding types
     * 
     * @param types The set of API types to match
     * @param bindings The binding types to match
     * @return A list of matching decorators
     * 
-    * @see javax.enterprise.inject.spi.BeanManager#resolveDecorators(java.util.Set,
-    *      java.lang.annotation.Annotation[])
+    * @see javax.enterprise.inject.spi.BeanManager#resolveDecorators(java.util.Set, java.lang.annotation.Annotation[])
     */
    public List<Decorator<?>> resolveDecorators(Set<Type> types, Annotation... bindings)
    {
       throw new UnsupportedOperationException();
    }
+   
+   public List<Decorator<?>> resolveDecorators(Bean<?> bean)
+   {
+      throw new UnsupportedOperationException();
+   }
 
    /**
     * Resolves a list of interceptors based on interception type and interceptor

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-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -28,6 +28,7 @@
 
 import javax.enterprise.context.Dependent;
 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;
@@ -35,7 +36,6 @@
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.event.Event;
-import javax.enterprise.inject.Any;
 import javax.inject.DefinitionException;
 import javax.inject.InconsistentSpecializationException;
 import javax.inject.NullableDependencyException;
@@ -82,7 +82,7 @@
       {
          for (InjectionPoint injectionPoint : bean.getInjectionPoints())
          {
-            if (injectionPoint.getAnnotation(New.class) != null && injectionPoint.getBindings().size() > 1)
+            if (injectionPoint.getAnnotated().getAnnotation(New.class) != null && injectionPoint.getBindings().size() > 1)
             {
                throw new DefinitionException("The injection point " + injectionPoint + " is annotated with @New which cannot be combined with other binding types");
             }
@@ -104,7 +104,7 @@
             checkFacadeInjectionPoint(injectionPoint, Obtains.class, Instance.class);
             checkFacadeInjectionPoint(injectionPoint, Any.class, Event.class);
             Annotation[] bindings = injectionPoint.getBindings().toArray(new Annotation[0]);
-            AnnotatedItem<?, ?> annotatedItem = ResolvableAnnotatedClass.of(injectionPoint.getType(), bindings);
+            AnnotatedItem<?, ?> annotatedItem = ResolvableAnnotatedClass.of(injectionPoint.getType(), bindings, manager);
             Set<?> resolvedBeans = manager.getBeans(injectionPoint);
             if (resolvedBeans.isEmpty())
             {
@@ -161,7 +161,7 @@
    
    private void checkFacadeInjectionPoint(InjectionPoint injectionPoint, Class<? extends Annotation> annotationType, Class<?> type)
    {
-      if (injectionPoint.isAnnotationPresent(annotationType))
+      if (injectionPoint.getAnnotated().isAnnotationPresent(annotationType))
       {
          if (injectionPoint.getType() instanceof ParameterizedType)
          {

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/InstanceImpl.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -51,7 +51,7 @@
    public T get(Annotation... bindings) 
    {
       Annotation[] annotations = mergeInBindings(bindings);
-      Bean<T> bean = getManager().getBean(ResolvableAnnotatedClass.<T>of(getType(), annotations), annotations);
+      Bean<T> bean = getManager().getBean(ResolvableAnnotatedClass.<T>of(getType(), annotations, getManager()), annotations);
       
       @SuppressWarnings("unchecked")
       T instance = (T) getManager().getReference(bean, getType());

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -62,7 +62,8 @@
 public abstract class AbstractBean<T, E> extends RIBean<T>
 {
 
-   private static final Annotation ANY_BINDING = new AnyLiteral();
+   private static final Annotation ANY_LITERAL = new AnyLiteral();
+   private static final Annotation CURRENT_LITERAL = new CurrentLiteral();
 
    @SuppressWarnings("unchecked")
    private static Set<Class<?>> STANDARD_WEB_BEAN_CLASSES = new HashSet<Class<?>>(Arrays.asList(Event.class, BeanManagerImpl.class, ConversationImpl.class));
@@ -211,6 +212,7 @@
       this.bindings = new HashSet<Annotation>();
       this.bindings.addAll(getAnnotatedItem().getMetaAnnotations(BindingType.class));
       initDefaultBindings();
+      log.trace("Using binding types " + bindings + " specified by annotations");
    }
    
    protected abstract void initInjectionPoints();
@@ -220,18 +222,9 @@
       if (bindings.size() == 0)
       {
          log.trace("Adding default @Current binding type");
-         this.bindings.add(new CurrentLiteral());
-         this.bindings.add(ANY_BINDING);
+         this.bindings.add(CURRENT_LITERAL);
       }
-      else
-      {
-         if (!bindings.contains(ANY_BINDING))
-         {
-            bindings.add(ANY_BINDING);
-         }
-         if (log.isTraceEnabled())
-            log.trace("Using binding types " + bindings + " specified by annotations");
-      }
+      this.bindings.add(ANY_LITERAL);
    }
 
    /**

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -43,7 +43,6 @@
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.util.Beans;
-import org.jboss.webbeans.util.Reflections;
 import org.jboss.webbeans.util.Strings;
 
 /**
@@ -267,13 +266,7 @@
    /**
     * Validates the bean implementation
     */
-   protected void checkBeanImplementation()
-   {
-      if (Reflections.isAbstract(getType()))
-      {
-         throw new DefinitionException("Web Bean implementation class " + type + " cannot be declared abstract");
-      }
-   }
+   protected void checkBeanImplementation() {}
 
    @Override
    protected void preSpecialize(BeanDeployerEnvironment environment)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -5,6 +5,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.Set;
 
 import javax.enterprise.inject.Initializer;
@@ -21,6 +22,32 @@
 public class DecoratorBean<T> extends SimpleBean<T> implements Decorator<T>
 {
    
+   public static <T> Decorator<T> wrapForResolver(final Decorator<T> decorator)
+   {
+      return new ForwardingDecorator<T>()
+      {
+         
+         @Override
+         public Set<Annotation> getBindings()
+         {
+            return delegate().getDelegateBindings();
+         }
+         
+         @Override
+         public Set<Type> getTypes()
+         {
+            return delegate().getTypes();
+         }
+
+         @Override
+         protected Decorator<T> delegate()
+         {
+            return decorator;
+         }
+         
+      };
+   }
+   
    /**
     * Creates a decorator bean
     * 
@@ -50,8 +77,7 @@
       if (!isInitialized())
       {
          super.initialize(environment);
-         checkDecorates();
-         initDecorates();
+         initDelegate();
          initDecoratedTypes();
          initDelegateBindings();
          initDelegateType();
@@ -60,11 +86,12 @@
    
    protected void initDecoratedTypes()
    {
-      this.decoratedTypes = getAnnotatedItem().getInterfaceOnlyFlattenedTypeHierarchy();
+      this.decoratedTypes = new HashSet<Type>();
+      this.decoratedTypes.addAll(getAnnotatedItem().getInterfaceOnlyFlattenedTypeHierarchy());
       this.decoratedTypes.remove(Serializable.class);
    }
    
-   protected void initDecorates()
+   protected void initDelegate()
    {
       this.decorates = getDecoratesInjectionPoint().iterator().next();
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -173,6 +173,12 @@
    {
       return declaringBean.isSerializable();
    }
+   
+   @Override
+   public boolean isProxyable()
+   {
+      return true;
+   }
 
    public T create(CreationalContext<T> creationalContext)
    {

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingDecorator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingDecorator.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingDecorator.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,30 @@
+package org.jboss.webbeans.bean;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Decorator;
+
+public abstract class ForwardingDecorator<T> extends ForwardingBean<T> implements Decorator<T>
+{
+
+   @Override
+   protected abstract Decorator<T> delegate();
+
+   public Set<Type> getDecoratedTypes()
+   {
+      return delegate().getDecoratedTypes();
+   }
+
+   public Set<Annotation> getDelegateBindings()
+   {
+      return delegate().getDelegateBindings();
+   }
+
+   public Type getDelegateType()
+   {
+      return delegate().getDelegateType();
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingDecorator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -16,7 +16,6 @@
  */
 package org.jboss.webbeans.bean;
 
-import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.Set;
@@ -161,7 +160,7 @@
     */
    protected void initDisposalMethod(BeanDeployerEnvironment environment)
    {
-      Set<DisposalMethodBean<T>> disposalBeans = manager.resolveDisposalBeans(getType(), bindings.toArray(new Annotation[0]));
+      Set<DisposalMethodBean<T>> disposalBeans = environment.resolveDisposalBeans(getAnnotatedItem());
 
       if (disposalBeans.size() == 1)
       {

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/EventBean.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -28,7 +28,7 @@
 
 import org.jboss.webbeans.BeanManagerImpl;
 import org.jboss.webbeans.event.EventImpl;
-import org.jboss.webbeans.injection.resolution.AnnotatedItemTransformer;
+import org.jboss.webbeans.injection.resolution.ResolovableTransformer;
 import org.jboss.webbeans.literal.AnyLiteral;
 
 public class EventBean extends AbstractFacadeBean<Event<?>>
@@ -38,7 +38,7 @@
    private static final Set<Type>                        DEFAULT_TYPES             = new HashSet<Type>(Arrays.asList(TYPE, Object.class));
    private static final Annotation                       ANY                       = new AnyLiteral();
    private static final Set<Annotation>                  DEFAULT_BINDINGS          = new HashSet<Annotation>(Arrays.asList(ANY));
-   public static final AnnotatedItemTransformer          TRANSFORMER               = new FacadeBeanAnnotatedItemTransformer(Event.class, ANY);
+   public static final ResolovableTransformer          TRANSFORMER               = new FacadeBeanResolvableTransformer(Event.class, ANY);
    private static final Set<Class<? extends Annotation>> FILTERED_ANNOTATION_TYPES = new HashSet<Class<? extends Annotation>>(Arrays.asList(Obtains.class));
    
    

Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.bean.standard;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.event.Event;
-
-import org.jboss.webbeans.injection.resolution.AnnotatedItemTransformer;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
-
-/**
- * AnnotatedItem transformer which can be used for FacadeBeans
- * 
- * @author Pete Muir
- *
- */
-public class FacadeBeanAnnotatedItemTransformer implements AnnotatedItemTransformer
-{
-   
-   private final Class<?> clazz;
-   private final Annotation annotation;
-   private final Set<Annotation> annotations;
-   private final Set<Type> flattenedTypes;
-   
-   public FacadeBeanAnnotatedItemTransformer(Class<?> clazz, Annotation annotation)
-   {
-      this.clazz = clazz;
-      this.annotation = annotation;
-      this.annotations = new HashSet<Annotation>(Arrays.asList(annotation));
-      Type[] types = {Object.class, Event.class};
-      this.flattenedTypes = new HashSet<Type>(Arrays.asList(types));
-   }
-
-   public <T, S> AnnotatedItem<T, S> transform(final AnnotatedItem<T, S> element)
-   {
-      if (clazz.isAssignableFrom(element.getRawType()))
-      {
-         if (element.isAnnotationPresent(annotation.annotationType()))
-         {
-            
-            return new ForwardingAnnotatedItem<T, S>()
-            {
-               
-               @Override
-               public Type[] getActualTypeArguments()
-               {
-                  return new Type[0];
-               }
-               
-               @Override
-               public Set<Annotation> getBindings()
-               {
-                  return annotations;
-               }
-               
-               @SuppressWarnings("unchecked")
-               @Override
-               public Class<T> getRawType()
-               {
-                  return (Class<T>) clazz;
-               }
-               
-               @Override
-               public Type getType()
-               {
-                  return clazz;
-               }
-               
-               @Override
-               public Set<Type> getFlattenedTypeHierarchy()
-               {
-                  return flattenedTypes;
-               }
-
-               @Override
-               public AnnotatedItem<T, S> delegate()
-               {
-                  return element;
-               }
-               
-               @Override
-               public boolean isAssignableFrom(Set<? extends Type> types)
-               {
-                  return types.contains(clazz);
-               }
-
-            };
-         }
-      }
-      return element;
-   }
-   
-}

Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanResolvableTransformer.java (from rev 2821, ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanAnnotatedItemTransformer.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanResolvableTransformer.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanResolvableTransformer.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.bean.standard;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.injection.resolution.ForwardingResolvable;
+import org.jboss.webbeans.injection.resolution.ResolovableTransformer;
+import org.jboss.webbeans.injection.resolution.Resolvable;
+
+/**
+ * AnnotatedItem transformer which can be used for FacadeBeans
+ * 
+ * @author Pete Muir
+ *
+ */
+public class FacadeBeanResolvableTransformer implements ResolovableTransformer
+{
+   
+   private final Class<?> clazz;
+   private final Annotation annotation;
+   private final Set<Annotation> bindings;
+   private final HashSet<Type> types;
+   
+   public FacadeBeanResolvableTransformer(Class<?> clazz, Annotation annotation)
+   {
+      this.clazz = clazz;
+      this.annotation = annotation;
+      this.bindings = new HashSet<Annotation>(Arrays.asList(annotation));
+      this.types = new HashSet<Type>();
+      types.add(clazz);
+   }
+
+   public Resolvable transform(final Resolvable resolvable)
+   {
+      if (resolvable.isAssignableTo(clazz))
+      {
+         if (resolvable.isAnnotationPresent(annotation.annotationType()))
+         {
+            
+            return new ForwardingResolvable()
+            {
+
+               @Override
+               protected Resolvable delegate()
+               {
+                  return resolvable;
+               }
+               
+               @Override
+               public Set<Annotation> getBindings()
+               {
+                  return Collections.unmodifiableSet(bindings);
+               }
+               
+               @Override
+               public Set<Type> getTypes()
+               {
+                  return Collections.unmodifiableSet(types);
+               }
+               
+               @Override
+               public boolean isAssignableTo(Class<?> clazz)
+               {
+                  return clazz.isAssignableFrom(clazz);
+               }
+               
+               @Override
+               public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+               {
+                  return annotation.annotationType().equals(annotationType);
+               }
+               
+            };
+         }
+      }
+      return resolvable;
+   }
+   
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/FacadeBeanResolvableTransformer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/InstanceBean.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -28,7 +28,7 @@
 
 import org.jboss.webbeans.InstanceImpl;
 import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.injection.resolution.AnnotatedItemTransformer;
+import org.jboss.webbeans.injection.resolution.ResolovableTransformer;
 import org.jboss.webbeans.literal.ObtainsLiteral;
 
 public class InstanceBean extends AbstractFacadeBean<Instance<?>>
@@ -39,7 +39,7 @@
    private static final Obtains OBTAINS = new ObtainsLiteral();
    private static final Set<Annotation> DEFAULT_BINDINGS = new HashSet<Annotation>(Arrays.asList(OBTAINS));
    private static final Set<Class<? extends Annotation>> FILTERED_ANNOTATION_TYPES = new HashSet<Class<? extends Annotation>>(Arrays.asList(Obtains.class));
-   public static final AnnotatedItemTransformer TRANSFORMER = new FacadeBeanAnnotatedItemTransformer(TYPE, OBTAINS);
+   public static final ResolovableTransformer TRANSFORMER = new FacadeBeanResolvableTransformer(TYPE, OBTAINS);
    
    
    public static AbstractFacadeBean<Instance<?>> of(BeanManagerImpl manager)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -72,7 +72,7 @@
    public BeanDeployer(BeanManagerImpl manager, EjbDescriptorCache ejbDescriptors)
    {
       this.manager = manager;
-      this.environment = new BeanDeployerEnvironment(ejbDescriptors);
+      this.environment = new BeanDeployerEnvironment(ejbDescriptors, manager);
       this.classes = new HashSet<AnnotatedClass<?>>();
       this.classTransformer = new ClassTransformer();
    }
@@ -224,9 +224,7 @@
       for (AnnotatedMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Disposes.class))
       {
          DisposalMethodBean<?> disposalBean = DisposalMethodBean.of(manager, method, declaringBean);
-         environment.addAllDisposalBean(disposalBean);
-         manager.getResolver().addInjectionPoints(disposalBean.getAnnotatedInjectionPoints());
-         manager.addBean(disposalBean);
+         environment.addDisposalBean(disposalBean);
       }
    }
    

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -16,13 +16,17 @@
  */
 package org.jboss.webbeans.bootstrap;
 
-import java.lang.annotation.Annotation;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.webbeans.BeanManagerImpl;
 import org.jboss.webbeans.bean.AbstractClassBean;
 import org.jboss.webbeans.bean.DisposalMethodBean;
 import org.jboss.webbeans.bean.NewBean;
@@ -30,7 +34,8 @@
 import org.jboss.webbeans.bean.RIBean;
 import org.jboss.webbeans.ejb.EjbDescriptorCache;
 import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass;
+import org.jboss.webbeans.injection.resolution.ResolvableFactory;
+import org.jboss.webbeans.injection.resolution.Resolver;
 import org.jboss.webbeans.introspector.AnnotatedClass;
 import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -38,27 +43,29 @@
 public class BeanDeployerEnvironment
 {
 
-   private static final AnnotatedItem<?, ?> OTHER_BEANS_ANNOTATED_ITEM = ResolvableAnnotatedClass.of(BeanDeployerEnvironment.class, new Annotation[0]);
-
    private final Map<AnnotatedClass<?>, AbstractClassBean<?>> classBeanMap;
    private final Map<AnnotatedMethod<?>, ProducerMethodBean<?>> producerMethodBeanMap;
    private final Map<AnnotatedMethod<?>, DisposalMethodBean<?>> disposalMethodBeanMap;
    private final Set<RIBean<?>> beans;
    private final Set<ObserverImpl<?>> observers;
-   private final Set<DisposalMethodBean<?>> allDisposalBeans;
+   private final List<DisposalMethodBean<?>> allDisposalBeans;
    private final Set<DisposalMethodBean<?>> resolvedDisposalBeans;
    private final EjbDescriptorCache ejbDescriptors;
+   private final Resolver disposalMethodResolver;
+   private final BeanManagerImpl manager;
 
-   public BeanDeployerEnvironment(EjbDescriptorCache ejbDescriptors)
+   public BeanDeployerEnvironment(EjbDescriptorCache ejbDescriptors, BeanManagerImpl manager)
    {
       this.classBeanMap = new HashMap<AnnotatedClass<?>, AbstractClassBean<?>>();
       this.producerMethodBeanMap = new HashMap<AnnotatedMethod<?>, ProducerMethodBean<?>>();
       this.disposalMethodBeanMap = new HashMap<AnnotatedMethod<?>, DisposalMethodBean<?>>();
-      this.allDisposalBeans = new HashSet<DisposalMethodBean<?>>();
+      this.allDisposalBeans = new ArrayList<DisposalMethodBean<?>>();
       this.resolvedDisposalBeans = new HashSet<DisposalMethodBean<?>>();
       this.beans = new HashSet<RIBean<?>>();
       this.observers = new HashSet<ObserverImpl<?>>();
       this.ejbDescriptors = ejbDescriptors;
+      this.disposalMethodResolver = new Resolver(manager, allDisposalBeans);
+      this.manager = manager;
    }
 
    public ProducerMethodBean<?> getProducerMethod(AnnotatedMethod<?> method)
@@ -135,12 +142,12 @@
       return observers;
    }
 
-   public Set<DisposalMethodBean<?>> getAllDisposalBeans()
+   public List<DisposalMethodBean<?>> getAllDisposalBeans()
    {
       return allDisposalBeans;
    }
 
-   public void addAllDisposalBean(DisposalMethodBean<?> disposalBean)
+   public void addDisposalBean(DisposalMethodBean<?> disposalBean)
    {
       allDisposalBeans.add(disposalBean);
    }
@@ -159,5 +166,28 @@
    {
       return ejbDescriptors;
    }
+   
+   /**
+    * Resolve the disposal method for the given producer method. For internal
+    * use.
+    * 
+    * @param apiType The API type to match
+    * @param bindings The binding types to match
+    * @return The set of matching disposal methods
+    */
+   public <T> Set<DisposalMethodBean<T>> resolveDisposalBeans(AnnotatedItem<T, ?> annotatedItem)
+   {
+      // Correct?
+      Set<Bean<?>> beans = disposalMethodResolver.get(ResolvableFactory.of(annotatedItem));
+      Set<DisposalMethodBean<T>> disposalBeans = new HashSet<DisposalMethodBean<T>>();
+      for (Bean<?> bean : beans)
+      {
+         if (bean instanceof DisposalMethodBean)
+         {
+            disposalBeans.add((DisposalMethodBean<T>) bean);
+         }
+      }
+      return disposalBeans;
+   }
 
 }

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/AnnotatedAdaptor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/AnnotatedAdaptor.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/AnnotatedAdaptor.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,43 @@
+package org.jboss.webbeans.injection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Annotated;
+
+import org.jboss.webbeans.introspector.AnnotatedItem;
+
+public class AnnotatedAdaptor implements Annotated
+{
+
+   private final AnnotatedItem<?, ?> annotatedItem;
+   
+   public AnnotatedAdaptor(AnnotatedItem<?, ?> annotatedItem)
+   {
+      this.annotatedItem = annotatedItem;
+   }
+
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      return annotatedItem.getAnnotation(annotationType);
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      return annotatedItem.getAnnotations();
+   }
+
+   public Type getType()
+   {
+      return annotatedItem.getType();
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return annotationType.isAnnotationPresent(annotationType);
+   }
+
+   
+   
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/AnnotatedAdaptor.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -28,6 +28,7 @@
 import java.util.Set;
 
 import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
 import javax.enterprise.inject.spi.Bean;
 
 import org.jboss.webbeans.BeanManagerImpl;
@@ -81,11 +82,6 @@
       return constructor;
    }
 
-   public Annotation[] getAnnotations()
-   {
-      return delegate().getAnnotationStore().getAnnotations().toArray(EMPTY_ANNOTATION_ARRAY);
-   }
-
    public Bean<?> getBean()
    {
       return declaringBean;
@@ -180,4 +176,21 @@
       return getRawType();
    }
 
+   public Annotated getAnnotated()
+   {
+      return new AnnotatedAdaptor(delegate());
+   }
+
+   public boolean isDelegate()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
+   public boolean isTransient()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -23,6 +23,7 @@
 import java.util.Set;
 
 import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
 import javax.enterprise.inject.spi.Bean;
 
 import org.jboss.webbeans.BeanManagerImpl;
@@ -54,11 +55,6 @@
       return field;
    }
 
-   public Annotation[] getAnnotations()
-   {
-      return delegate().getAnnotationStore().getAnnotations().toArray(EMPTY_ANNOTATION_ARRAY);
-   }
-
    public Bean<?> getBean()
    {
       return declaringBean;
@@ -101,4 +97,15 @@
       }
    }
 
+   public Annotated getAnnotated()
+   {
+      return new AnnotatedAdaptor(delegate());
+   }
+
+   public boolean isDelegate()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -27,6 +27,7 @@
 import java.util.Set;
 
 import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
 import javax.enterprise.inject.spi.Bean;
 
 import org.jboss.webbeans.BeanManagerImpl;
@@ -80,11 +81,6 @@
       return method;
    }
 
-   public Annotation[] getAnnotations()
-   {
-      return delegate().getAnnotationStore().getAnnotations().toArray(EMPTY_ANNOTATION_ARRAY);
-   }
-
    public Bean<?> getBean()
    {
       return declaringBean;
@@ -265,5 +261,22 @@
       }
       return parameterValues;
    }
+
+   public Annotated getAnnotated()
+   {
+      return new AnnotatedAdaptor(delegate());
+   }
+
+   public boolean isDelegate()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
+   public boolean isTransient()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
    
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -21,6 +21,7 @@
 import java.util.Set;
 
 import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
 import javax.enterprise.inject.spi.Bean;
 
 import org.jboss.webbeans.BeanManagerImpl;
@@ -52,11 +53,6 @@
       return parameter;
    }
 
-   public Annotation[] getAnnotations()
-   {
-      return delegate().getAnnotationStore().getAnnotations().toArray(EMPTY_ANNOTATION_ARRAY);
-   }
-
    public Bean<?> getBean()
    {
       return declaringBean;
@@ -83,4 +79,21 @@
       return (T) manager.getInjectableReference(this, creationalContext);
    }
 
+   public Annotated getAnnotated()
+   {
+      return new AnnotatedAdaptor(delegate());
+   }
+
+   public boolean isDelegate()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
+   public boolean isTransient()
+   {
+      // TODO Auto-generated method stub
+      return false;
+   }
+
 }

Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/AnnotatedItemTransformer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/AnnotatedItemTransformer.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/AnnotatedItemTransformer.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.injection.resolution;
-
-import org.jboss.webbeans.introspector.AnnotatedItem;
-
-
-public interface AnnotatedItemTransformer
-{
-   
-   public <T, S> AnnotatedItem<T, S> transform(AnnotatedItem<T, S> element);
-   
-}

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ForwardingResolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ForwardingResolvable.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ForwardingResolvable.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,32 @@
+package org.jboss.webbeans.injection.resolution;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+public abstract class ForwardingResolvable implements Resolvable
+{
+   
+   protected abstract Resolvable delegate();
+
+   public Set<Annotation> getBindings()
+   {
+      return delegate().getBindings();
+   }
+   
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return delegate().isAnnotationPresent(annotationType);
+   }
+   
+   public Set<Type> getTypes()
+   {
+      return delegate().getTypes();
+   }
+   
+   public boolean isAssignableTo(Class<?> clazz)
+   {
+      return delegate().isAssignableTo(clazz);
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ForwardingResolvable.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolovableTransformer.java (from rev 2821, ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/AnnotatedItemTransformer.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolovableTransformer.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolovableTransformer.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.injection.resolution;
+
+
+
+public interface ResolovableTransformer
+{
+   
+   public Resolvable transform(Resolvable element);
+   
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolovableTransformer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolvable.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolvable.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,24 @@
+package org.jboss.webbeans.injection.resolution;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+/**
+ * Something that is resovable by the resolver
+ * 
+ * @author pmuir
+ *
+ */
+public interface Resolvable
+{
+   
+   public Set<Annotation> getBindings();
+   
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
+   
+   public boolean isAssignableTo(Class<?> clazz);
+   
+   public Set<Type> getTypes();
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolvable.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedClass.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedClass.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -23,55 +23,46 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
 import javax.enterprise.inject.TypeLiteral;
 import javax.enterprise.inject.spi.InjectionPoint;
 
+import org.jboss.webbeans.BeanManagerImpl;
 import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
 import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.introspector.AnnotationStore;
 import org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem;
 import org.jboss.webbeans.util.Names;
+import org.jboss.webbeans.util.Reflections;
 
-public class ResolvableAnnotatedClass<T> extends AbstractAnnotatedItem<T, Class<T>>
+public class ResolvableAnnotatedClass<T> extends AbstractAnnotatedItem<T, Class<T>> implements Resolvable
 {
    
    private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+   private static final Set<Annotation> EMPTY_ANNOTATION_SET = Collections.emptySet();
+   
    private final Class<T> rawType;
+   private final Set<Type> types;
    private final Type[] actualTypeArguments;
    
    private final String _string;
    
-   public static <T> AnnotatedItem<T, Class<T>> of(TypeLiteral<T> typeLiteral, Annotation[] annotations)
-   {
-      return new ResolvableAnnotatedClass<T>(typeLiteral.getRawType(), typeLiteral.getType(), annotations);
-   }
+   private final BeanManagerImpl manager;
    
-   public static <T> AnnotatedItem<T, Class<T>> of(Class<T> clazz, Annotation[] annotations)
+   public static <T> AnnotatedItem<T, Class<T>> of(TypeLiteral<T> typeLiteral, Annotation[] annotations, BeanManagerImpl manager)
    {
-      return new ResolvableAnnotatedClass<T>(clazz, clazz, annotations);
+      return new ResolvableAnnotatedClass<T>(typeLiteral.getType(), annotations, manager);
    }
    
-   public static <T> AnnotatedItem<T, Class<T>> of(Type type, Annotation[] annotations)
+   public static <T> AnnotatedItem<T, Class<T>> of(Type type, Annotation[] annotations, BeanManagerImpl manager)
    {
-      if (type instanceof Class)
-      {
-         return new ResolvableAnnotatedClass<T>((Class<T>) type, type, annotations);
-      }
-      else if (type instanceof ParameterizedType)
-      {
-         return new ResolvableAnnotatedClass<T>((Class<T>) ((ParameterizedType) type).getRawType(), type, annotations);
-      }
-      else 
-      {
-         throw new UnsupportedOperationException("Cannot create annotated item of " + type);
-      }
+      return new ResolvableAnnotatedClass<T>(type, annotations, manager);
    }
-   
-   
-   public static <T> AnnotatedItem<T, Class<T>> of(InjectionPoint injectionPoint)
+
+   public static <T> AnnotatedItem<T, Class<T>> of(InjectionPoint injectionPoint, BeanManagerImpl manager)
    {
       if (injectionPoint instanceof AnnotatedInjectionPoint)
       {
@@ -81,19 +72,19 @@
       }
       else
       {
-         return of(injectionPoint.getType(), injectionPoint.getAnnotations());
+         return new ResolvableAnnotatedClass<T>(injectionPoint.getType(), injectionPoint.getAnnotated().getAnnotations(), manager);
       }
    }
    
-   public static <T> AnnotatedItem<T, Class<T>> of(Member member, Annotation[] annotations)
+   public static <T> AnnotatedItem<T, Class<T>> of(Member member, Annotation[] annotations, BeanManagerImpl manager)
    {
       if (member instanceof Field)
       {
-         return new ResolvableAnnotatedClass<T>((Class<T>) ((Field) member).getType(), ((Field) member).getGenericType(), annotations);
+         return new ResolvableAnnotatedClass<T>(((Field) member).getGenericType(), annotations, manager);
       }
       else if (member instanceof Method)
       {
-         return new ResolvableAnnotatedClass<T>((Class<T>) ((Method) member).getReturnType(), ((Method) member).getGenericReturnType(), annotations);
+         return new ResolvableAnnotatedClass<T>(((Method) member).getGenericReturnType(), annotations, manager);
       }
       else
       {
@@ -101,21 +92,49 @@
       }
    }
    
-   private ResolvableAnnotatedClass(Class<T> rawType, Type type, Annotation[] annotations)
+   private ResolvableAnnotatedClass(Type type, AnnotationStore annotationStore, BeanManagerImpl manager)
    {
-      super(AnnotationStore.of(annotations, EMPTY_ANNOTATION_ARRAY));
-      this.rawType = rawType;
+      super(annotationStore);
+      
+      this.manager = manager;
+      
       if (type instanceof ParameterizedType)
       {
+         ParameterizedType parameterizedType = (ParameterizedType) type;
+         if (parameterizedType.getRawType() instanceof Class)
+         {
+            this.rawType = (Class<T>) parameterizedType.getRawType();
+         }
+         else
+         {
+            throw new IllegalArgumentException("Cannot extract rawType from " + type);
+         }
          this.actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
-         this._string = rawType.toString() + "<" + Arrays.asList(actualTypeArguments).toString() + ">; binding types = " + Names.annotationsToString(new HashSet<Annotation>(Arrays.asList(annotations)));
+         this._string = rawType.toString() + "<" + Arrays.asList(actualTypeArguments).toString() + ">; binding types = " + Names.annotationsToString(annotationStore.getBindings());
       }
-      else
+      else if (type instanceof Class)
       {
+         this.rawType = (Class<T>) type;
          this.actualTypeArguments = new Type[0];
-         this._string = rawType.toString() +"; binding types = " + Names.annotationsToString(new HashSet<Annotation>(Arrays.asList(annotations)));
+         this._string = rawType.toString() +"; binding types = " + Names.annotationsToString(annotationStore.getBindings());
       }
+      else
+      {
+         throw new IllegalArgumentException("Unable to extract type information from " + type);
+      }
+      this.types = new HashSet<Type>();
+      types.add(type);
    }
+   
+   private ResolvableAnnotatedClass(Type type, Annotation[] annotations, BeanManagerImpl manager)
+   {
+      this(type, AnnotationStore.of(annotations, EMPTY_ANNOTATION_ARRAY), manager);
+   }
+   
+   private ResolvableAnnotatedClass(Type type, Set<Annotation>annotations, BeanManagerImpl manager)
+   {
+      this(type, AnnotationStore.of(annotations, EMPTY_ANNOTATION_SET), manager);
+   }
 
    @Override
    public String toString()
@@ -179,4 +198,14 @@
       throw new UnsupportedOperationException();
    }
 
+   public Set<Type> getTypes()
+   {
+      return types;
+   }
+
+   public boolean isAssignableTo(Class<?> clazz)
+   {
+      return Reflections.isAssignableFrom(clazz, getType());
+   }
+
 }
\ No newline at end of file

Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedItem.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableAnnotatedItem.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -1,69 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.injection.resolution;
-
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
-
-/**
- * Extension of an element which bases equality not only on type, but also on
- * binding type
- */
-abstract class ResolvableAnnotatedItem<T, S> extends ForwardingAnnotatedItem<T, S>
-{
-   
-   public static <T1, S1> ResolvableAnnotatedItem<T1, S1> of(final AnnotatedItem<T1, S1> delegate)
-   {
-      return new ResolvableAnnotatedItem<T1, S1>()
-      {
-         @Override
-         protected AnnotatedItem<T1, S1> delegate()
-         {
-            return delegate;
-         }
-      };
-   }
-   
-   private static final long serialVersionUID = 1L;
-
-   @Override
-   public boolean equals(Object other)
-   {
-      if (other instanceof AnnotatedItem)
-      {
-         AnnotatedItem<?, ?> that = (AnnotatedItem<?, ?>) other;
-         return delegate().isAssignableFrom(that) && that.getBindings().equals(this.getBindings());
-      }
-      else
-      {
-         return false;
-      }
-   }
-
-   @Override
-   public int hashCode()
-   {
-      return delegate().hashCode();
-   }
-
-   @Override
-   public String toString()
-   {
-      return "Resolvable annotated item for " + delegate();
-   }
-
-}
\ No newline at end of file

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableFactory.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableFactory.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,70 @@
+package org.jboss.webbeans.injection.resolution;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.util.Reflections;
+
+public class ResolvableFactory
+{
+   
+   public static Resolvable of(AnnotatedItem<?, ?> element)
+   {
+      if (element instanceof Resolvable)
+      {
+         return (Resolvable) element;
+      }
+      else
+      {
+         Set<Type> types = new HashSet<Type>();
+         types.add(element.getType());
+         return new ResolvableImpl(element.getBindings(), types);
+      }
+   }
+   
+   private ResolvableFactory() {}
+   
+   private static class ResolvableImpl implements Resolvable
+   {
+      
+      private final Set<Annotation> bindings;
+      private final Set<Class<? extends Annotation>> annotationTypes;
+      private final Set<Type> types;
+      
+      public ResolvableImpl(Set<Annotation> bindings, Set<Type> types)
+      {
+         this.bindings = bindings;
+         this.annotationTypes = new HashSet<Class<? extends Annotation>>();
+         this.types = types;
+         for (Annotation annotation : bindings)
+         {
+            annotationTypes.add(annotation.annotationType());
+         }
+      }
+
+      public Set<Annotation> getBindings()
+      {
+         return bindings;
+      }
+
+      public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+      {
+         return annotationTypes.contains(annotationType);
+      }
+      
+      public Set<Type> getTypes()
+      {
+         return types;
+      }
+      
+      public boolean isAssignableTo(Class<?> clazz)
+      {
+         return Reflections.isAssignableFrom(clazz, types);
+      }
+      
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableFactory.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/Resolver.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -17,6 +17,7 @@
 package org.jboss.webbeans.injection.resolution;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -26,16 +27,15 @@
 import java.util.TreeSet;
 import java.util.concurrent.Callable;
 
-import javax.enterprise.inject.TypeLiteral;
 import javax.enterprise.inject.spi.Bean;
 
 import org.jboss.webbeans.BeanManagerImpl;
 import org.jboss.webbeans.bean.standard.EventBean;
 import org.jboss.webbeans.bean.standard.InstanceBean;
 import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.metadata.BindingTypeModel;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.util.Beans;
 import org.jboss.webbeans.util.ListComparator;
+import org.jboss.webbeans.util.Reflections;
 import org.jboss.webbeans.util.collections.ConcurrentCache;
 
 /**
@@ -46,30 +46,66 @@
 public class Resolver
 {
    private static final long serialVersionUID = 1L;
-
-   private static final Class<AnnotatedItem<Object, Object>> ANNOTATED_ITEM_GENERIFIED_WITH_OBJECT_OBJECT = new TypeLiteral<AnnotatedItem<Object, Object>>(){}.getRawType();
    
+   private static abstract class MatchingResolvable extends ForwardingResolvable
+   {
+      
+      private final BeanManagerImpl manager;
+      
+      public MatchingResolvable(BeanManagerImpl manager)
+      {
+         this.manager = manager;
+      }
+      
+      public boolean matches(Set<Type> types, Set<Annotation> bindings)
+      {
+         return Reflections.isAssignableFrom(this.getTypes(), types) && Beans.containsAllBindings(this.getBindings(), bindings, manager);
+      }
+      
+      @Override
+      public boolean equals(Object obj)
+      {
+         if (obj instanceof Resolvable)
+         {
+            Resolvable that = (Resolvable) obj;
+            return this.matches(that.getTypes(), that.getBindings());
+         }
+         else
+         {
+            return false;
+         }
+      }
+      
+   }
+   
    // The resolved injection points
-   private ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>> resolvedInjectionPoints;
+   private ConcurrentCache<Resolvable, Set<Bean<?>>> resolvedInjectionPoints;
    // The registerd injection points
    private Set<AnnotatedItem<?, ?>> injectionPoints;
    // The resolved names
    private ConcurrentCache<String, Set<Bean<?>>> resolvedNames;
+   
+   // The beans to search
+   private final List<? extends Bean<?>> beans;
+   
    // The Web Beans manager
    private final BeanManagerImpl manager;
-   private final Set<AnnotatedItemTransformer> transformers;
+   
+   // Annotation transformers used to mutate annotations during resolution
+   private final Set<ResolovableTransformer> transformers;
 
    /**
     * Constructor
     * 
     */
-   public Resolver(BeanManagerImpl manager)
+   public Resolver(BeanManagerImpl manager, List<? extends Bean<?>> beans)
    {
       this.manager = manager;
+      this.beans = beans;
       this.injectionPoints = new HashSet<AnnotatedItem<?, ?>>();
-      this.resolvedInjectionPoints = new ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>>();
+      this.resolvedInjectionPoints = new ConcurrentCache<Resolvable, Set<Bean<?>>>();
       this.resolvedNames = new ConcurrentCache<String, Set<Bean<?>>>();
-      this.transformers = new HashSet<AnnotatedItemTransformer>();
+      this.transformers = new HashSet<ResolovableTransformer>();
       transformers.add(EventBean.TRANSFORMER);
       transformers.add(InstanceBean.TRANSFORMER);
    }
@@ -92,18 +128,27 @@
     * @param element The injection point to add
     * @return A set of matching beans for the injection point
     */
-   private Set<Bean<?>> registerInjectionPoint(final ResolvableAnnotatedItem<?, ?> element)
+   private Set<Bean<?>> registerInjectionPoint(final Resolvable element)
    {
+      final MatchingResolvable wrapped = new MatchingResolvable(manager)
+      {
+
+         @Override
+         protected Resolvable delegate()
+         {
+            return element;
+         }
+
+      };
       Callable<Set<Bean<?>>> callable = new Callable<Set<Bean<?>>>()
       {
-
          public Set<Bean<?>> call() throws Exception
          {
-            return retainHighestPrecedenceBeans(getMatchingBeans(element, manager.getBeans()), manager.getEnabledDeploymentTypes());
+            return retainHighestPrecedenceBeans(getMatchingBeans(wrapped, beans), manager.getEnabledDeploymentTypes());
          }
 
       };
-      return resolvedInjectionPoints.putIfAbsent(element, callable);
+      return resolvedInjectionPoints.putIfAbsent(wrapped, callable);
    }
 
    /**
@@ -112,7 +157,7 @@
     */
    public void clear()
    {
-      this.resolvedInjectionPoints = new ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>>();
+      this.resolvedInjectionPoints = new ConcurrentCache<Resolvable, Set<Bean<?>>>();
       resolvedNames = new ConcurrentCache<String, Set<Bean<?>>>();
    }
 
@@ -124,17 +169,7 @@
    {
       for (final AnnotatedItem<? extends Object, ? extends Object> injectable : injectionPoints)
       {
-         
-         registerInjectionPoint(new ResolvableAnnotatedItem<Object, Object>()
-         {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public AnnotatedItem<Object, Object> delegate()
-            {
-               return ANNOTATED_ITEM_GENERIFIED_WITH_OBJECT_OBJECT.cast(injectable); 
-            }
-         });
+         registerInjectionPoint(ResolvableFactory.of(injectable));
       }
    }
 
@@ -144,15 +179,15 @@
     * @param key The resolving criteria
     * @return An unmodifiable set of matching beans
     */
-   public Set<Bean<?>> get(final AnnotatedItem<?, ?> key)
+   public Set<Bean<?>> get(final Resolvable key)
    {
-      Set<Bean<?>> beans = registerInjectionPoint(ResolvableAnnotatedItem.of(transformElement(key)));
+      Set<Bean<?>> beans = registerInjectionPoint(transformElement(key));
       return Collections.unmodifiableSet(beans);
    }
    
-   private <T, S> AnnotatedItem<T, S> transformElement(AnnotatedItem<T, S> element)
+   private Resolvable transformElement(Resolvable element)
    {
-      for (AnnotatedItemTransformer transformer : transformers)
+      for (ResolovableTransformer transformer : transformers)
       {
          element = transformer.transform(element);
       }
@@ -173,15 +208,15 @@
          public Set<Bean<? extends Object>> call() throws Exception
          {
             
-            Set<Bean<?>> beans = new HashSet<Bean<?>>();
-            for (Bean<?> bean : manager.getBeans())
+            Set<Bean<?>> matchedBeans = new HashSet<Bean<?>>();
+            for (Bean<?> bean : beans)
             {
                if ((bean.getName() == null && name == null) || (bean.getName() != null && bean.getName().equals(name)))
                {
-                  beans.add(bean);
+                  matchedBeans.add(bean);
                }
             }
-            return retainHighestPrecedenceBeans(beans, manager.getEnabledDeploymentTypes());
+            return retainHighestPrecedenceBeans(matchedBeans, manager.getEnabledDeploymentTypes());
          }
 
       });
@@ -236,12 +271,12 @@
     * @param beans The beans to filter
     * @return A set of filtered beans
     */
-   private Set<Bean<?>> getMatchingBeans(AnnotatedItem<?, ?> element, List<Bean<?>> beans)
+   private static Set<Bean<?>> getMatchingBeans(MatchingResolvable resolvable, List<? extends Bean<?>> beans)
    {
       Set<Bean<?>> resolvedBeans = new HashSet<Bean<?>>();
       for (Bean<?> bean : beans)
       {
-         if (element.isAssignableFrom(bean.getTypes()) && containsAllBindings(element, bean.getBindings()))
+         if (resolvable.matches(bean.getTypes(), bean.getBindings()))
          {
             resolvedBeans.add(bean);
          }
@@ -250,41 +285,6 @@
    }
 
    /**
-    * Checks if binding criteria fulfill all binding types
-    * 
-    * @param element The binding criteria to check
-    * @param bindings The binding types to check
-    * @return True if all matches, false otherwise
-    */
-   private boolean containsAllBindings(AnnotatedItem<?, ?> element, Set<Annotation> bindings)
-   {
-      for (Annotation binding : element.getBindings())
-      {
-         BindingTypeModel<?> bindingType = manager.getServices().get(MetaDataCache.class).getBindingTypeModel(binding.annotationType());
-         if (bindingType.getNonBindingTypes().size() > 0)
-         {
-            boolean matchFound = false;
-            for (Annotation otherBinding : bindings)
-            {
-               if (bindingType.isEqual(binding, otherBinding))
-               {
-                  matchFound = true;
-               }
-            }
-            if (!matchFound)
-            {
-               return false;
-            }
-         }
-         else if (!bindings.contains(binding))
-         {
-            return false;
-         }
-      }
-      return true;
-   }
-
-   /**
     * Gets a string representation
     * 
     * @return A string representation

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -47,7 +47,7 @@
     * @return A set of annotations. Returns an empty set if there are no
     *         matches.
     */
-   public <A extends Annotation> Set<A> getAnnotationsAsSet();
+   public <A extends Annotation> Set<A> getAnnotations();
 
    /**
     * Gets all annotations which are annotated with the given meta annotation
@@ -162,17 +162,16 @@
     * @return True if assignable, false otherwise.
     */
    public boolean isAssignableFrom(AnnotatedItem<?, ?> that);
-
+   
    /**
-    * Checks if any of the types provided are assignable to this, using
-    * the extended assignability algorithm provided by AnnotatedItem.
+    * Extends Java Class assignability such that actual type parameters are also
+    * considered
     * 
-    * The types are assumed to contain their own actual type parameterization.
-    * 
-    * @param types The set of types to match
-    * @return True if assignable, false otherwise.
+    * @param type The type to compare against
+    * @param actualTypeArguments The type arguments
+    * @return True is assignable, false otherwise
     */
-   public boolean isAssignableFrom(Set<? extends Type> types);
+   public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments);
 
    /**
     * Gets the actual type arguments for any parameterized types that this

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -91,6 +91,11 @@
       return new AnnotationStore(buildAnnotationMap(annotations), buildAnnotationMap(declaredAnnotations));
    }
    
+   public static AnnotationStore of(Set<Annotation> annotations, Set<Annotation> declaredAnnotations)
+   {
+      return new AnnotationStore(buildAnnotationMap(annotations), buildAnnotationMap(declaredAnnotations));
+   }
+   
    public static AnnotationStore wrap(AnnotationStore annotationStore, Set<Annotation> annotations, Set<Annotation> declaredAnnotations)
    {
       Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -50,9 +50,9 @@
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public Set<Annotation> getAnnotationsAsSet()
+   public Set<Annotation> getAnnotations()
    {
-      return delegate().getAnnotationsAsSet();
+      return delegate().getAnnotations();
    }
 
    /**
@@ -131,12 +131,9 @@
       return delegate().isAssignableFrom(that);
    }
 
-   /**
-    * @see org.jboss.webbeans.introspector.AnnotatedItem
-    */
-   public boolean isAssignableFrom(Set<? extends Type> types)
+   public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
    {
-      return delegate().isAssignableFrom(types);
+      return delegate().isAssignableFrom(type, actualTypeArguments);
    }
 
    /**

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -48,7 +48,7 @@
       return getAnnotationStore().getAnnotation(annotationType);
    }
 
-   public Set<Annotation> getAnnotationsAsSet()
+   public Set<Annotation> getAnnotations()
    {
       return getAnnotationStore().getAnnotations();
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -52,7 +52,7 @@
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public Set<Annotation> getAnnotationsAsSet()
+   public Set<Annotation> getAnnotations()
    {
       return getAnnotationStore().getAnnotations();
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -54,7 +54,7 @@
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public Set<Annotation> getAnnotationsAsSet()
+   public Set<Annotation> getAnnotations()
    {
       return getAnnotationStore().getAnnotations();
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -59,7 +59,7 @@
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public Set<Annotation> getAnnotationsAsSet()
+   public Set<Annotation> getAnnotations()
    {
       return getAnnotationStore().getAnnotations();
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -19,7 +19,6 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
@@ -28,7 +27,6 @@
 import org.jboss.webbeans.introspector.AnnotationStore;
 import org.jboss.webbeans.util.Proxies;
 import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Types;
 
 /**
  * Represents functionality common for all annotated items, mainly different
@@ -134,7 +132,7 @@
       return getMetaAnnotations(metaAnnotationType).toArray(new Annotation[0]);
    }
 
-   public Set<Annotation> getAnnotationsAsSet()
+   public Set<Annotation> getAnnotations()
    {
       return getAnnotationStore().getAnnotations();
    }
@@ -164,7 +162,7 @@
       if (other instanceof AnnotatedItem)
       {
          AnnotatedItem<?, ?> that = (AnnotatedItem<?, ?>) other;
-         return this.getAnnotationsAsSet().equals(that.getAnnotationsAsSet()) && this.getRawType().equals(that.getRawType());
+         return this.getAnnotations().equals(that.getAnnotations()) && this.getRawType().equals(that.getRawType());
       }
       return false;
    }
@@ -183,51 +181,14 @@
       return isAssignableFrom(that.getRawType(), that.getActualTypeArguments());
    }
 
-   /**
-    * Checks if this item is assignable from any one a set of types
-    * 
-    * @param types The set of types to check against
-    * @return True if assignable, false otherwise
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedItem#isAssignableFrom(Set)
-    */
-   public boolean isAssignableFrom(Set<? extends Type> types)
+   public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
    {
-      for (Type type : types)
-      {
-         if (type instanceof Class)
-         {
-            Class<?> clazz = (Class<?>) type;
-            if (isAssignableFrom(clazz, new Type[0]))
-            {
-               return true;
-            }
-         }
-         else if (type instanceof ParameterizedType)
-         {
-            ParameterizedType parameterizedType = (ParameterizedType) type;
-            if (parameterizedType.getRawType() instanceof Class)
-            {
-               if (isAssignableFrom((Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments()))
-               {
-                  return true;
-               }
-            }
-         }
-      }
-      return false;
+      return Reflections.isAssignableFrom(getRawType(), getActualTypeArguments(), type, actualTypeArguments);
    }
-
-   /**
-    * Helper method for doing actual assignability check
-    * 
-    * @param type The type to compare against
-    * @param actualTypeArguments The type arguments
-    * @return True is assignable, false otherwise
-    */
-   private boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
+   
+   public boolean isAssignableFrom(Type type)
    {
-      return Types.boxedType(getRawType()).isAssignableFrom(Types.boxedType(type)) && Arrays.equals(getActualTypeArguments(), actualTypeArguments);
+      return Reflections.isAssignableFrom(getType(), type);
    }
 
    /**

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -79,7 +79,7 @@
       {
          AnnotatedMethod<?> annotatedMethod = AnnotatedMethodImpl.of(member, this);
          members.add(annotatedMethod);
-         for (Annotation annotation : annotatedMethod.getAnnotationsAsSet())
+         for (Annotation annotation : annotatedMethod.getAnnotations())
          {
             annotatedMembers.put(annotation.annotationType(), annotatedMethod);
          }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -138,7 +138,7 @@
                this.declaredFields.add(annotatedField);
                this.declaredFieldsByName.put(annotatedField.getName(), annotatedField);
             }
-            for (Annotation annotation : annotatedField.getAnnotationsAsSet())
+            for (Annotation annotation : annotatedField.getAnnotations())
             {
                this.annotatedFields.put(annotation.annotationType(), annotatedField);
                if (c == rawType)
@@ -177,7 +177,7 @@
          
          this.declaredConstructorsBySignature.put(annotatedConstructor.getSignature(), annotatedConstructor);
          
-         for (Annotation annotation : annotatedConstructor.getAnnotationsAsSet())
+         for (Annotation annotation : annotatedConstructor.getAnnotations())
          {
             if (!annotatedConstructors.containsKey(annotation.annotationType()))
             {
@@ -218,7 +218,7 @@
                this.declaredMethods.add(annotatedMethod);
                this.declaredMethodsBySignature.put(annotatedMethod.getSignature(), annotatedMethod);
             }
-            for (Annotation annotation : annotatedMethod.getAnnotationsAsSet())
+            for (Annotation annotation : annotatedMethod.getAnnotations())
             {
                annotatedMethods.put(annotation.annotationType(), annotatedMethod);
                if (c == rawType)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -93,7 +93,7 @@
             AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, type, this);
             parameters.add(parameter);
 
-            for (Annotation annotation : parameter.getAnnotationsAsSet())
+            for (Annotation annotation : parameter.getAnnotations())
             {
                annotatedParameters.put(annotation.annotationType(), parameter);
             }
@@ -113,7 +113,7 @@
             AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(new Annotation[0], clazz, type, this);
             parameters.add(parameter);
 
-            for (Annotation annotation : parameter.getAnnotationsAsSet())
+            for (Annotation annotation : parameter.getAnnotations())
             {
                annotatedParameters.put(annotation.annotationType(), parameter);
             }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -99,7 +99,7 @@
             Type type = method.getGenericParameterTypes()[i];
             AnnotatedParameter<?> parameter = AnnotatedParameterImpl.of(method.getParameterAnnotations()[i], (Class<Object>) clazz, type, this);
             this.parameters.add(parameter);
-            for (Annotation annotation : parameter.getAnnotationsAsSet())
+            for (Annotation annotation : parameter.getAnnotations())
             {
                if (MAPPED_PARAMETER_ANNOTATIONS.contains(annotation.annotationType()))
                {

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -16,9 +16,11 @@
  */
 package org.jboss.webbeans.util;
 
+import java.lang.annotation.Annotation;
 import java.util.HashSet;
 import java.util.Set;
 
+import javax.decorator.Decorates;
 import javax.enterprise.inject.BindingType;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.Bean;
@@ -30,6 +32,7 @@
 import org.jboss.webbeans.injection.FieldInjectionPoint;
 import org.jboss.webbeans.introspector.AnnotatedClass;
 import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.metadata.BindingTypeModel;
 import org.jboss.webbeans.metadata.MetaDataCache;
 
 /**
@@ -82,21 +85,65 @@
       Set<FieldInjectionPoint<?>> injectableFields = new HashSet<FieldInjectionPoint<?>>();
       for (AnnotatedField<?> annotatedField : annotatedItem.getMetaAnnotatedFields(BindingType.class))
       {
-         if (!annotatedField.isAnnotationPresent(Produces.class))
+         addFieldInjectionPoint(annotatedField, injectableFields, declaringBean);
+      }
+      for (AnnotatedField<?> annotatedField : annotatedItem.getAnnotatedFields(Decorates.class))
+      {
+         addFieldInjectionPoint(annotatedField, injectableFields, declaringBean);
+      }
+      return injectableFields;
+   }
+   
+   private static void addFieldInjectionPoint(AnnotatedField<?> annotatedField, Set<FieldInjectionPoint<?>> injectableFields, Bean<?> declaringBean)
+   {
+      if (!annotatedField.isAnnotationPresent(Produces.class))
+      {
+         if (annotatedField.isStatic())
          {
-            if (annotatedField.isStatic())
+            throw new DefinitionException("Don't place binding annotations on static fields " + annotatedField);
+         }
+         if (annotatedField.isFinal())
+         {
+            throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
+         }
+         FieldInjectionPoint<?> fieldInjectionPoint = FieldInjectionPoint.of(declaringBean, annotatedField);
+         injectableFields.add(fieldInjectionPoint);
+      }
+   }
+   
+   /**
+    * Checks if binding criteria fulfill all binding types
+    * 
+    * @param element The binding criteria to check
+    * @param bindings2 The binding types to check
+    * @return True if all matches, false otherwise
+    */
+   public static boolean containsAllBindings(Set<Annotation> bindings1, Set<Annotation> bindings2, BeanManagerImpl manager)
+   {
+      for (Annotation binding : bindings1)
+      {
+         BindingTypeModel<?> bindingType = manager.getServices().get(MetaDataCache.class).getBindingTypeModel(binding.annotationType());
+         if (bindingType.getNonBindingTypes().size() > 0)
+         {
+            boolean matchFound = false;
+            for (Annotation otherBinding : bindings2)
             {
-               throw new DefinitionException("Don't place binding annotations on static fields " + annotatedField);
+               if (bindingType.isEqual(binding, otherBinding))
+               {
+                  matchFound = true;
+               }
             }
-            if (annotatedField.isFinal())
+            if (!matchFound)
             {
-               throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
+               return false;
             }
-            FieldInjectionPoint<?> fieldInjectionPoint = FieldInjectionPoint.of(declaringBean, annotatedField);
-            injectableFields.add(fieldInjectionPoint);
          }
+         else if (!bindings2.contains(binding))
+         {
+            return false;
+         }
       }
-      return injectableFields;
+      return true;
    }
    
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -227,5 +227,16 @@
       }
    }
 
+   /**
+    * Indicates if an instance is a Javassist proxy
+    * 
+    * @param instance The instance to examine
+    * @return True if proxy, false otherwise
+    */
+   public static boolean isProxy(Object instance)
+   {
+      return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
+   }
 
+
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -544,20 +544,7 @@
       throw new NoSuchMethodException("Method " + methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")") + " not implemented by instance " + c.getName());
    }
    
-   
-
    /**
-    * Indicates if an instance is a Javassist proxy
-    * 
-    * @param instance The instance to examine
-    * @return True if proxy, false otherwise
-    */
-   public static boolean isProxy(Object instance)
-   {
-      return instance.getClass().getName().indexOf("_$$_javassist_") > 0;
-   }
-
-   /**
     * Checks the bindingType to make sure the annotation was declared properly
     * as a binding type (annotated with @BindingType).
     * 
@@ -575,6 +562,101 @@
       }
       return isBindingAnnotation;
    }
+   
+   /**
+    * Check the assignability of one type to another, taking into account the
+    * actual type arguements
+    * 
+    * @param rawType1 the raw type of the class to check
+    * @param actualTypeArguments1 the actual type arguements to check, or an empty array if not a parameterized type
+    * @param rawType2 the raw type of the class to check
+    * @param actualTypeArguments2 the actual type arguements to check, or an empty array if not a parameterized type
+    * @return
+    */
+   public static boolean isAssignableFrom(Class<?> rawType1, Type[] actualTypeArguments1, Class<?> rawType2, Type[] actualTypeArguments2)
+   {
+      return Types.boxedType(rawType1).isAssignableFrom(Types.boxedType(rawType2)) && Arrays.equals(actualTypeArguments1, actualTypeArguments2);
+   }
+   
+   public static boolean isAssignableFrom(Type type1, Set<? extends Type> types2)
+   {
+      for (Type type2 : types2)
+      {
+         if (isAssignableFrom(type1, type2))
+         {
+            return true;
+         }
+      }
+      return false;
+   }
+   
+   public static boolean isAssignableFrom(Type type1, Type type2)
+   {
+      if (type1 instanceof Class)
+      {
+         Class<?> clazz = (Class<?>) type1;
+         if (isAssignableFrom(clazz, new Type[0], type2))
+         {
+            return true;
+         }
+      }
+      else if (type1 instanceof ParameterizedType)
+      {
+         ParameterizedType parameterizedType = (ParameterizedType) type1;
+         if (parameterizedType.getRawType() instanceof Class)
+         {
+            if (isAssignableFrom((Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments(), type2))
+            {
+               return true;
+            }
+         }
+      }
+      return false;
+   }
+   
+   public static boolean isAssignableFrom(Class<?> rawType1, Type[] actualTypeArguments1, Type type2)
+   {
+      if (type2 instanceof Class)
+      {
+         Class<?> clazz = (Class<?>) type2;
+         if (isAssignableFrom(rawType1, actualTypeArguments1, clazz, new Type[0]))
+         {
+            return true;
+         }
+      }
+      else if (type2 instanceof ParameterizedType)
+      {
+         ParameterizedType parameterizedType = (ParameterizedType) type2;
+         if (parameterizedType.getRawType() instanceof Class)
+         {
+            if (isAssignableFrom(rawType1, actualTypeArguments1, (Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments()))
+            {
+               return true;
+            }
+         }
+      }
+      return false;
+   }
+   
+   /**
+    * Check the assiginability of a set of <b>flattened</b> types. This algorithm
+    * will check whether any of the types1 matches a type in types2
+    * 
+    * @param types1
+    * @param types2
+    * @return
+    */
+   public static boolean isAssignableFrom(Set<Type> types1, Set<Type> types2)
+   {
+      for (Type type : types1)
+      {
+         if (isAssignableFrom(type, types2))
+         {
+            return true;
+         }
+      }
+      return false;
+   }
 
    public static boolean isSerializable(Class<?> clazz)
    {

Modified: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
===================================================================
--- ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -8,7 +8,7 @@
 import org.jboss.webbeans.context.AbstractContext;
 import org.jboss.webbeans.ejb.spi.EjbDescriptor;
 import org.jboss.webbeans.ejb.spi.EjbServices;
-import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.util.Proxies;
 
 /**
  * Implements the Beans SPI for the TCK specifically for the JBoss RI.
@@ -67,7 +67,7 @@
    
    public boolean isProxy(Object instance)
    {
-      return Reflections.isProxy(instance);
+      return Proxies.isProxy(instance);
    }
 
    public <T> T getEnterpriseBean(Class<? extends T> beanType, Class<T> localInterface)

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractResourceServices.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -20,7 +20,7 @@
     */
    public Object resolveResource(InjectionPoint injectionPoint)
    {
-      if (!injectionPoint.isAnnotationPresent(Resource.class))
+      if (!injectionPoint.getAnnotated().isAnnotationPresent(Resource.class))
       {
          throw new IllegalArgumentException("No @Resource annotation found on injection point " + injectionPoint);
       }
@@ -72,7 +72,7 @@
    
    protected String getResourceName(InjectionPoint injectionPoint)
    {
-      Resource resource = injectionPoint.getAnnotation(Resource.class);
+      Resource resource = injectionPoint.getAnnotated().getAnnotation(Resource.class);
       String mappedName = resource.mappedName();
       if (!mappedName.equals(""))
       {

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/NewEnterpriseBeanTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -1,6 +1,5 @@
 package org.jboss.webbeans.test.unit.implementation;
 
-import java.lang.annotation.Annotation;
 import java.util.Set;
 
 import javax.enterprise.inject.New;
@@ -13,7 +12,6 @@
 import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.literal.NewLiteral;
 import org.jboss.webbeans.test.AbstractWebBeansTest;
-import org.jboss.webbeans.util.Proxies.TypeInfo;
 import org.testng.annotations.Test;
 
 @Artifact
@@ -61,12 +59,4 @@
       assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
    }
    
-   @Test(groups = { "new" })
-   public void testNewBeanHasNoDisposalMethods()
-   {
-      initNewBean();
-      Class<?> type = TypeInfo.ofTypes(newEnterpriseBean.getTypes()).getSuperClass();
-      assert getCurrentManager().resolveDisposalBeans(type, newEnterpriseBean.getBindings().toArray(new Annotation[0])).isEmpty();
-   }   
-   
 }

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -25,7 +25,7 @@
    public void testDeclaredAnnotations()
    {
       AnnotatedClass<Order> annotatedElement = AnnotatedClassImpl.of(Order.class, transformer);
-      assert annotatedElement.getAnnotationsAsSet().size() == 1;
+      assert annotatedElement.getAnnotations().size() == 1;
       assert annotatedElement.getAnnotation(Production.class) != null;
       assert annotatedElement.getRawType().equals(Order.class);
    }
@@ -48,7 +48,7 @@
       assert annotatedElement.getAnnotation(Stereotype.class) == null;
       assert annotatedElement.getMetaAnnotations(Stereotype.class).size() == 0;
       AnnotatedClass<Antelope> classWithNoAnnotations = AnnotatedClassImpl.of(Antelope.class, transformer);
-      assert classWithNoAnnotations.getAnnotationsAsSet().size() == 0;
+      assert classWithNoAnnotations.getAnnotations().size() == 0;
    }
    
 }

Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -149,7 +149,7 @@
          @Override
          protected void execute() throws Exception
          {
-            getCurrentManager().getInstanceByType(Violation.class).ping();
+            createContextualInstance(Violation.class).ping();
          }
          
       }.run();

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -14,7 +14,6 @@
 import javax.enterprise.context.spi.Context;
 import javax.enterprise.inject.TypeLiteral;
 import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 
 import org.jboss.jsr299.tck.api.JSR299Configuration;
@@ -147,7 +146,7 @@
    
    public <T> Set<Bean<T>> getBeans(Class<T> type, Annotation... bindings)
    {
-      return (Set<Bean<T>>)(Set)getCurrentManager().getBeans(type, bindings);
+      return (Set) getCurrentManager().getBeans(type, bindings);
    }
    
    public <T> Set<Bean<T>> getBeans(TypeLiteral<T> type, Annotation... bindings)

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/ActivitiesTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -13,6 +13,7 @@
 import javax.enterprise.inject.AnnotationLiteral;
 import javax.enterprise.inject.UnsatisfiedResolutionException;
 import javax.enterprise.inject.deployment.Production;
+import javax.enterprise.inject.spi.Annotated;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.InjectionPoint;
@@ -108,16 +109,6 @@
       InjectionPoint injectionPoint = new InjectionPoint()
       {
 
-         public <T extends Annotation> T getAnnotation(Class<T> annotationType)
-         {
-            return null;
-         }
-
-         public Annotation[] getAnnotations()
-         {
-            return new Annotation[0];
-         }
-
          public Bean<?> getBean()
          {
             return bean;
@@ -138,10 +129,20 @@
             return injectionPointType;
          }
 
-         public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+         public Annotated getAnnotated()
          {
+            return null;
+         }
+
+         public boolean isDelegate()
+         {
             return false;
          }
+
+         public boolean isTransient()
+         {
+            return false;
+         }
          
       };
       injectionPoints.add(injectionPoint);

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/DeploymentTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -17,9 +17,6 @@
 
 package org.jboss.jsr299.tck.tests.deployment.lifecycle;
 
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
 import org.jboss.jsr299.tck.AbstractJSR299Test;

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/FiresOnNonEventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/FiresOnNonEventTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event1/FiresOnNonEventTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -36,7 +36,8 @@
 @ExpectedDeploymentException(DefinitionException.class)
 public class FiresOnNonEventTest extends AbstractJSR299Test
 {
-   @Test(groups = { "events" })
+   @Test(groups = { "events", "broken" })
+   // Erm, not right anymore :-) PLM
    @SpecAssertion(section = "7.6", id = "j")
    public void testFiresAnnotationOnNonEventTypeInjectionPointFails() throws Exception
    {

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event2/FiresOnEventWithoutTypeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event2/FiresOnEventWithoutTypeTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/event2/FiresOnEventWithoutTypeTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -36,8 +36,9 @@
 @ExpectedDeploymentException(DefinitionException.class)
 public class FiresOnEventWithoutTypeTest extends AbstractJSR299Test
 {
-   @Test(groups = { "events" })
+   @Test(groups = { "events", "broken" })
    @SpecAssertion(section = "7.6", id = "k")
+   // TODO I don't think this matches any more
    public void testFiresAnnotationOnInjectionPointWithoutTypeParameterFails()
    {
       assert false;

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Animal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Animal.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Animal.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -1,8 +1,6 @@
 package org.jboss.jsr299.tck.tests.implementation.simple.definition;
 
-import javax.enterprise.inject.deployment.Production;
 
- at Production
 interface Animal
 {
 

Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Car.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Car.java	                        (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Car.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.implementation.simple.definition;
+
+public interface Car
+{
+
+}


Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/Car.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/definition/SimpleBeanDefinitionTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -61,15 +61,8 @@
    @SpecAssertion(section = "3.2.1", id = "cb")
    public void testInterfaceNotDiscoveredAsSimpleBean()
    {
-      assert getBeans(Animal.class).size() == 0;
+      assert getBeans(Car.class).size() == 0;
    }
-   
-   @Test
-   @SpecAssertion(section = "3.2.1", id = "e")
-   public void testEntityClassesNotDiscoveredAsSimpleBean()
-   {
-      assert getBeans(MockEntity.class).size() == 0;
-   }
 
    @Test
    @SpecAssertions( { 

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dependency/resolution/DependencyResolutionTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -10,6 +10,7 @@
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.inject.UnproxyableResolutionException;
 import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Annotated;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 
@@ -40,17 +41,7 @@
          this.member = member;
          this.bindings = bindings;
       }
-      
-      public <T extends Annotation> T getAnnotation(Class<T> arg0)
-      {
-         return null;
-      }
 
-      public Annotation[] getAnnotations()
-      {
-         return null;
-      }
-
       public Bean<?> getBean()
       {
          return beanWithManager;
@@ -71,9 +62,22 @@
          return type;
       }
 
-      public boolean isAnnotationPresent(Class<? extends Annotation> arg0)
+      public Annotated getAnnotated()
       {
+         // TODO Auto-generated method stub
+         return null;
+      }
+
+      public boolean isDelegate()
+      {
+         // TODO Auto-generated method stub
          return false;
+      }
+
+      public boolean isTransient()
+      {
+         // TODO Auto-generated method stub
+         return false;
       }      
    }
    

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/noninstance/NonInstanceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/noninstance/NonInstanceTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/noninstance/NonInstanceTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -16,7 +16,8 @@
 @ExpectedDeploymentException(DefinitionException.class)
 public class NonInstanceTest extends AbstractJSR299Test
 {
-   @Test
+   @Test(groups = "broken")
+   // TODO Now @Any... plm
    @SpecAssertion(section = "5.8", id = "g")
    public void TestInjectionPointMustBeInstance()
    {

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/notypeparam/NoTypeParameterSpecifiedTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/notypeparam/NoTypeParameterSpecifiedTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/notypeparam/NoTypeParameterSpecifiedTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -17,7 +17,8 @@
 @ExpectedDeploymentException(DefinitionException.class)
 public class NoTypeParameterSpecifiedTest extends AbstractJSR299Test
 {
-   @Test
+   @Test(groups="broken")
+   // TODO Out of date I think (PLM)
    @SpecAssertion(section = "5.8", id = "h")
    public void TestInjectionPointMustHaveTypeParameter()
    {

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java	2009-06-12 14:22:03 UTC (rev 2826)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java	2009-06-12 22:30:21 UTC (rev 2827)
@@ -20,15 +20,14 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
 import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.Current;
 import javax.enterprise.inject.deployment.Standard;
-import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.hibernate.tck.annotations.SpecAssertion;
 import org.hibernate.tck.annotations.SpecAssertions;
@@ -192,7 +191,7 @@
             FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
             BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
             assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            assert beanWithInjectionPoint.getInjectedMetadata().getAnnotation(AnimalStereotype.class) != null;
+            assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated().getAnnotation(AnimalStereotype.class) != null;
          }
       }.run();
    }
@@ -211,7 +210,7 @@
             FieldInjectionPointBean beanWithInjectedBean = getInstanceByType(FieldInjectionPointBean.class,new CurrentLiteral());
             BeanWithInjectionPointMetadata beanWithInjectionPoint = beanWithInjectedBean.getInjectedBean();
             assert beanWithInjectionPoint.getInjectedMetadata() != null;
-            Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(beanWithInjectionPoint.getInjectedMetadata().getAnnotations()));
+            Set<Annotation> annotations = new HashSet<Annotation>(beanWithInjectionPoint.getInjectedMetadata().getAnnotated().getAnnotations());
             assert annotations.size() > 0;
             assert annotations.contains(new CurrentLiteral());
             assert annotations.contains(new AnimalStereotypeAnnotationLiteral());




More information about the weld-commits mailing list