[webbeans-commits] Webbeans SVN: r1262 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/bean and 9 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Wed Jan 28 09:14:13 EST 2009


Author: pete.muir at jboss.org
Date: 2009-01-28 09:14:12 -0500 (Wed, 28 Jan 2009)
New Revision: 1262

Added:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java
Removed:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/AnnotatedInjectionPoint.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedConstructor.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedMethod.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Air.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Bird.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/House.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Planet.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Space.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Violation.java
Log:
Initial wiring of creational context (needs tidying up)

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -63,12 +63,12 @@
 import org.jboss.webbeans.ejb.spi.EjbResolver;
 import org.jboss.webbeans.event.EventManager;
 import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
 import org.jboss.webbeans.injection.InjectionPointProvider;
 import org.jboss.webbeans.introspector.AnnotatedClass;
 import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.lookup.Resolver;
 import org.jboss.webbeans.resources.spi.NamingContext;
 import org.jboss.webbeans.resources.spi.ResourceLoader;
 import org.jboss.webbeans.util.Beans;
@@ -129,7 +129,9 @@
    // The Naming (JNDI) access
    private transient final NamingContext namingContext;
    
-   private final Map<Bean<?>, Bean<?>> specializedBeans;
+   private final transient Map<Bean<?>, Bean<?>> specializedBeans;
+   
+   private final transient ThreadLocal<Map<Bean<?>, ?>> incompleteInstances;
 
    /**
     * Create a new manager
@@ -153,7 +155,16 @@
       this.ejbDescriptorCache = new EjbDescriptorCache();
       this.injectionPointProvider = new InjectionPointProvider();
       this.specializedBeans = new HashMap<Bean<?>, Bean<?>>();
-
+      this.incompleteInstances = new ThreadLocal<Map<Bean<?>,?>>()
+      {
+        
+         @Override
+         protected Map<Bean<?>, ?> initialValue()
+         {
+            return new HashMap<Bean<?>, Object>();
+         }
+         
+      };
       List<Class<? extends Annotation>> defaultEnabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
       defaultEnabledDeploymentTypes.add(0, Standard.class);
       defaultEnabledDeploymentTypes.add(1, Production.class);
@@ -553,6 +564,18 @@
       return getInstance(bean, true);
    }
    
+   public <T> T getInstance(Bean<T> bean, boolean create)
+   {
+      if (create)
+      {
+         return getInstance(bean, new CreationalContextImpl<T>(bean));
+      }
+      else
+      {
+         return getInstance(bean, null);
+      }
+   }
+   
    /**
     * Returns an instance of a bean
     * 
@@ -561,36 +584,51 @@
     * 
     * @see javax.inject.manager.Manager#getInstance(javax.inject.manager.Bean)
     */
-   public <T> T getInstance(Bean<T> bean, boolean create)
+   private <T> T getInstance(Bean<T> bean, CreationalContextImpl<T> creationalContext)
    {
       if (specializedBeans.containsKey(bean))
       {
-         return getInstance((Bean<T>) specializedBeans.get(bean), create);
+         return getInstance((Bean<T>) specializedBeans.get(bean), creationalContext);
       }
       else if (MetaDataCache.instance().getScopeModel(bean.getScopeType()).isNormal())
       {
-         return (T) proxyPool.getClientProxy(bean, create);
+         return (T) proxyPool.getClientProxy(bean, creationalContext != null);
       }
       else
       {
-         return getContext(bean.getScopeType()).get(bean, new CreationalContextImpl<T>());
+         return getContext(bean.getScopeType()).get(bean, creationalContext);
       }
    }
    
    public <T> T getInstanceToInject(InjectionPoint injectionPoint)
    {
-      throw new UnsupportedOperationException();
+      return getInstanceToInject(AnnotatedClassImpl.of((Class<T>) injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0])), null);
    }
    
    public <T> T getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
    {
-      throw new UnsupportedOperationException();
+      return getInstanceToInject(AnnotatedClassImpl.of((Class<T>) injectionPoint.getType(), injectionPoint.getBindings().toArray(new Annotation[0])), creationalContext);
    }
    
-   public <T> T getInstanceToInject(AnnotatedInjectionPoint<T, ?> injectionPoint, CreationalContext<?> creationalContext)
+   private <T> T getInstanceToInject(AnnotatedItem<T, ?> element, CreationalContext<?> creationalContext)
    {
-      Bean<T> bean = getBeanByType(injectionPoint, injectionPoint.getBindings().toArray(EMPTY_ANNOTATION_ARRAY));
-      return getInstance(bean);
+      Bean<T> bean = getBeanByType(element, element.getBindingTypesAsArray());
+      if (creationalContext instanceof CreationalContextImpl)
+      {
+         CreationalContextImpl<?> ctx = (CreationalContextImpl<?>) creationalContext;
+         if (ctx.containsIncompleteInstance(bean))
+         {
+            return ctx.getIncompleteInstance(bean);
+         }
+         else
+         {
+            return getInstance(bean, ctx.getCreationalContext(bean));
+         }
+      }
+      else
+      {
+         return getInstance(bean);
+      }
    }
 
    /**
@@ -658,7 +696,7 @@
     * @param bindingTypes The binding types to match
     * @return An instance of the bean
     */
-   public <T> T getInstanceByType(AnnotatedItem<T, ?> element, Annotation... bindings)
+   private <T> T getInstanceByType(AnnotatedItem<T, ?> element, Annotation... bindings)
    {
       return getInstance(getBeanByType(element, bindings));
    }

Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -1,388 +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;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.concurrent.Callable;
-
-import javax.inject.TypeLiteral;
-import javax.inject.manager.Bean;
-import javax.inject.manager.Decorator;
-import javax.inject.manager.InjectionPoint;
-import javax.inject.manager.InterceptionType;
-import javax.inject.manager.Interceptor;
-
-import org.jboss.webbeans.bean.InjectionPointBean;
-import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
-import org.jboss.webbeans.model.BindingTypeModel;
-import org.jboss.webbeans.util.ConcurrentCache;
-import org.jboss.webbeans.util.ListComparator;
-
-/**
- * Implementation of Web Beans type safe and name based bean resolution
- * 
- * @author Pete Muir
- */
-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 final Class<Set<Bean<Object>>> BEAN_SET_GENERIFIED_WITH_OBJECT = new TypeLiteral<Set<Bean<Object>>>(){}.getRawType();
-   private static final Class<Set<Bean<?>>> BEAN_SET_GENERIFIED_WITH_WILDCARD = new TypeLiteral<Set<Bean<?>>>(){}.getRawType();
-   
-   /**
-    * Extension of an element which bases equality not only on type, but also on
-    * binding type
-    */
-   private abstract class ResolvableAnnotatedItem<T, S> extends ForwardingAnnotatedItem<T, S>
-   {
-      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.getBindingTypes().equals(this.getBindingTypes());
-         }
-         else
-         {
-            return false;
-         }
-      }
-
-      @Override
-      public int hashCode()
-      {
-         return delegate().hashCode();
-      }
-
-      @Override
-      public String toString()
-      {
-         return "Resolvable annotated item for " + delegate();
-      }
-
-   }
-
-   // The resolved injection points
-   private ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>> resolvedInjectionPoints;
-   // The registerd injection points
-   private Set<AnnotatedItem<?, ?>> injectionPoints;
-   // The resolved names
-   private ConcurrentCache<String, Set<Bean<?>>> resolvedNames;
-   // The Web Beans manager
-   private ManagerImpl manager;
-
-   /**
-    * Constructor
-    * 
-    * @param manager The Web Beans manager
-    */
-   public Resolver(ManagerImpl manager)
-   {
-      this.injectionPoints = new HashSet<AnnotatedItem<?, ?>>();
-      this.resolvedInjectionPoints = new ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>>();
-      this.resolvedNames = new ConcurrentCache<String, Set<Bean<?>>>();
-      this.manager = manager;
-   }
-
-   /**
-    * Add multiple injection points for later resolving using
-    * {@link #registerInjectionPoint(AnnotatedItem)}. Useful during bootstrap.
-    * 
-    * @param elements The injection points to add
-    */
-   public void addInjectionPoints(Collection<? extends AnnotatedItem<?, ?>> elements)
-   {
-      injectionPoints.addAll(elements);
-   }
-
-   /**
-    * Registers an injection point
-    * 
-    * @param <T>
-    * @param <S>
-    * @param element The injection point to add
-    * @return A set of matching beans for the injection point
-    */
-   private <T, S> Set<Bean<T>> registerInjectionPoint(final ResolvableAnnotatedItem<T, S> element)
-   {
-      Callable<Set<Bean<T>>> callable = new Callable<Set<Bean<T>>>()
-      {
-
-         public Set<Bean<T>> call() throws Exception
-         {
-            return retainHighestPrecedenceBeans(getMatchingBeans(element, manager.getBeans()), manager.getEnabledDeploymentTypes());
-         }
-
-      };
-      return resolvedInjectionPoints.putIfAbsent(element, callable);
-   }
-
-   /**
-    * Reset all cached injection points. You must reset all cached injection
-    * points when you add a bean to the manager
-    */
-   public void clear()
-   {
-      this.resolvedInjectionPoints = new ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>>();
-      resolvedNames = new ConcurrentCache<String, Set<Bean<?>>>();
-   }
-
-   /**
-    * Resolve all injection points added using
-    * {@link #addInjectionPoints(Collection)}
-    */
-   public void resolveInjectionPoints()
-   {
-      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); 
-            }
-         });
-      }
-   }
-
-   /**
-    * Get the possible beans for the given element
-    * 
-    * @param key The resolving criteria
-    * @return An unmodifiable set of matching beans
-    */
-   public <T, S> Set<Bean<T>> get(final AnnotatedItem<T, S> key)
-   {
-      Set<Bean<T>> beans = new HashSet<Bean<T>>();
-
-      final ResolvableAnnotatedItem<T, S> element = new ResolvableAnnotatedItem<T, S>()
-      {
-
-         @Override
-         public AnnotatedItem<T, S> delegate()
-         {
-            return key;
-         }
-
-      };
-
-      if (InjectionPoint.class.isAssignableFrom(element.getType()))
-      {
-         beans.add(InjectionPointBean.of(key, manager));
-      }
-      else
-      {
-         beans = registerInjectionPoint(element);
-      }
-      return Collections.unmodifiableSet(beans);
-   }
-
-   /**
-    * Get the possible beans for the given name
-    * 
-    * @param name The name to match
-    * @return The set of matching beans
-    */
-   public Set<Bean<? extends Object>> get(final String name)
-   {
-      return resolvedNames.putIfAbsent(name, new Callable<Set<Bean<?>>>()
-      {
-
-         public Set<Bean<? extends Object>> call() throws Exception
-         {
-            
-            Set<Bean<?>> beans = new HashSet<Bean<?>>();
-            for (Bean<?> bean : manager.getBeans())
-            {
-               if ((bean.getName() == null && name == null) || (bean.getName() != null && bean.getName().equals(name)))
-               {
-                  beans.add(bean);
-               }
-            }
-            return retainHighestPrecedenceBeans(beans, manager.getEnabledDeploymentTypes());
-         }
-         
-         // Helper method to deal with dynamic casts being needed
-         private Set<Bean<?>> retainHighestPrecedenceBeans(Set<Bean<?>> beans, List<Class<? extends Annotation>> enabledDeploymentTypes)
-         {
-            return BEAN_SET_GENERIFIED_WITH_WILDCARD.cast(Resolver.retainHighestPrecedenceBeans(BEAN_SET_GENERIFIED_WITH_OBJECT.cast(beans), enabledDeploymentTypes));
-         }
-
-      });
-   }
-   
-   
-
-   /**
-    * Filters out the beans with the highest enabled deployment type
-    * 
-    * @param <T>
-    * @param beans The beans to filter
-    * @param enabledDeploymentTypes The enabled deployment types
-    * @return The filtered beans
-    */
-   private static <T> Set<Bean<T>> retainHighestPrecedenceBeans(Set<Bean<T>> beans, List<Class<? extends Annotation>> enabledDeploymentTypes)
-   {
-      if (beans.size() > 0)
-      {
-         SortedSet<Class<? extends Annotation>> possibleDeploymentTypes = new TreeSet<Class<? extends Annotation>>(new ListComparator<Class<? extends Annotation>>(enabledDeploymentTypes));
-         for (Bean<?> bean : beans)
-         {
-            possibleDeploymentTypes.add(bean.getDeploymentType());
-         }
-         possibleDeploymentTypes.retainAll(enabledDeploymentTypes);
-         Set<Bean<T>> trimmed = new HashSet<Bean<T>>();
-         if (possibleDeploymentTypes.size() > 0)
-         {
-            Class<? extends Annotation> highestPrecedencePossibleDeploymentType = possibleDeploymentTypes.last();
-
-            for (Bean<T> bean : beans)
-            {
-               if (bean.getDeploymentType().equals(highestPrecedencePossibleDeploymentType))
-               {
-                  trimmed.add(bean);
-               }
-            }
-         }
-         return trimmed;
-      }
-      else
-      {
-         return beans;
-      }
-   }
-
-   /**
-    * Gets the matching beans for binding criteria from a list of beans
-    * 
-    * @param <T> The type of the beans
-    * @param element The binding criteria
-    * @param beans The beans to filter
-    * @return A set of filtered beans
-    */
-   private <T> Set<Bean<T>> getMatchingBeans(AnnotatedItem<T, ?> element, List<Bean<?>> beans)
-   {
-      Set<Bean<T>> resolvedBeans = new HashSet<Bean<T>>();
-      for (Bean<?> bean : beans)
-      {
-         if (element.isAssignableFrom(bean.getTypes()) && containsAllBindingBindingTypes(element, bean.getBindings()))
-         {
-            @SuppressWarnings("unchecked")
-            Bean<T> b = (Bean<T>) bean;
-            resolvedBeans.add(b);
-         }
-      }
-      return resolvedBeans;
-   }
-
-   /**
-    * Checks if binding criteria fulfill all binding types
-    * 
-    * @param element The binding criteria to check
-    * @param bindingTypes The binding types to check
-    * @return True if all matches, false otherwise
-    */
-   private boolean containsAllBindingBindingTypes(AnnotatedItem<?, ?> element, Set<Annotation> bindingTypes)
-   {
-      for (Annotation bindingType : element.getBindingTypes())
-      {
-         BindingTypeModel<?> bindingTypeModel = MetaDataCache.instance().getBindingTypeModel(bindingType.annotationType());
-         if (bindingTypeModel.getNonBindingTypes().size() > 0)
-         {
-            boolean matchFound = false;
-            for (Annotation otherBindingType : bindingTypes)
-            {
-               if (bindingTypeModel.isEqual(bindingType, otherBindingType))
-               {
-                  matchFound = true;
-               }
-            }
-            if (!matchFound)
-            {
-               return false;
-            }
-         }
-         else if (!bindingTypes.contains(bindingType))
-         {
-            return false;
-         }
-      }
-      return true;
-   }
-
-   /**
-    * Resolves decorators according to binding criteria
-    * 
-    * @param types The set of API types to match
-    * @param bindingTypes The binding types to match
-    * @return The set of matching decorators
-    */
-   public List<Decorator> resolveDecorators(Set<Type> types, Annotation[] bindingTypes)
-   {
-      // TODO Implement decorators
-      return Collections.emptyList();
-   }
-
-   /**
-    * Resolves interceptors according to binding criteria
-    * 
-    * @param types The set of API types to match
-    * @param bindingTypes The binding types to match
-    * @return The set of matching interceptors
-    */
-   public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation[] interceptorBindings)
-   {
-      // TODO Implement interceptors
-      return null;
-   }
-
-   /**
-    * Gets a string representation
-    * 
-    * @return A string representation
-    */
-   @Override
-   public String toString()
-   {
-      StringBuilder buffer = new StringBuilder();
-      buffer.append("Resolver\n");
-      buffer.append("Injection points: " + injectionPoints.size() + "\n");
-      buffer.append("Resolved injection points: " + resolvedInjectionPoints.size() + "\n");
-      buffer.append("Resolved names points: " + resolvedNames.size() + "\n");
-      return buffer.toString();
-   }
-
-}

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -21,6 +21,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import javax.context.CreationalContext;
 import javax.context.Dependent;
 import javax.context.ScopeType;
 import javax.event.Observes;
@@ -35,9 +36,12 @@
 import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.injection.FieldInjectionPoint;
 import org.jboss.webbeans.injection.InjectionPointProvider;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
+import org.jboss.webbeans.injection.ParameterInjectionPoint;
 import org.jboss.webbeans.introspector.AnnotatedClass;
 import org.jboss.webbeans.introspector.AnnotatedField;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.log.LogProvider;
 import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.util.Reflections;
@@ -60,7 +64,7 @@
    // The injectable fields
    private Set<FieldInjectionPoint<?>> injectableFields;
    // The initializer methods
-   private Set<AnnotatedMethod<?>> initializerMethods;
+   private Set<MethodInjectionPoint<?>> initializerMethods;
 
    /**
     * Constructor
@@ -92,7 +96,7 @@
     * 
     * @param instance The instance to inject into
     */
-   protected void injectBoundFields(T instance)
+   protected void injectBoundFields(T instance, CreationalContext<T> creationalContext)
    {
       InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
       for (FieldInjectionPoint<?> injectableField : injectableFields)
@@ -100,7 +104,7 @@
          injectionPointProvider.pushInjectionPoint(injectableField);
          try
          {
-            injectableField.inject(instance, manager);
+            injectableField.inject(instance, manager, creationalContext);
          }
          finally
          {
@@ -108,6 +112,19 @@
          }
       }
    }
+   
+   /**
+    * Calls all initializers of the bean
+    * 
+    * @param instance The bean instance
+    */
+   protected void callInitializers(T instance, CreationalContext<T> creationalContext)
+   {
+      for (MethodInjectionPoint<?> initializer : getInitializerMethods())
+      {
+         initializer.invoke(instance, manager, creationalContext);
+      }
+   }
 
    /**
     * Initializes the bean type
@@ -141,6 +158,13 @@
             super.injectionPoints.add(fieldInjectionPoint);
          }
       }
+      for (AnnotatedMethod<?> initializer : getInitializerMethods())
+      {
+         for (AnnotatedParameter<?> parameter : initializer.getParameters())
+         {
+            injectionPoints.add(ParameterInjectionPoint.of(this, parameter));
+         }
+      }
    }
 
    /**
@@ -148,28 +172,28 @@
     */
    protected void initInitializerMethods()
    {
-      initializerMethods = new HashSet<AnnotatedMethod<?>>();
-      for (AnnotatedMethod<?> annotatedMethod : annotatedItem.getAnnotatedMethods(Initializer.class))
+      initializerMethods = new HashSet<MethodInjectionPoint<?>>();
+      for (AnnotatedMethod<?> method : annotatedItem.getAnnotatedMethods(Initializer.class))
       {
-         if (annotatedMethod.isStatic())
+         if (method.isStatic())
          {
-            throw new DefinitionException("Initializer method " + annotatedMethod.toString() + " cannot be static");
+            throw new DefinitionException("Initializer method " + method.toString() + " cannot be static");
          }
-         else if (annotatedMethod.getAnnotation(Produces.class) != null)
+         else if (method.getAnnotation(Produces.class) != null)
          {
-            throw new DefinitionException("Initializer method " + annotatedMethod.toString() + " cannot be annotated @Produces");
+            throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Produces");
          }
-         else if (annotatedMethod.getAnnotatedParameters(Disposes.class).size() > 0)
+         else if (method.getAnnotatedParameters(Disposes.class).size() > 0)
          {
-            throw new DefinitionException("Initializer method " + annotatedMethod.toString() + " cannot have parameters annotated @Disposes");
+            throw new DefinitionException("Initializer method " + method.toString() + " cannot have parameters annotated @Disposes");
          }
-         else if (annotatedMethod.getAnnotatedParameters(Observes.class).size() > 0)
+         else if (method.getAnnotatedParameters(Observes.class).size() > 0)
          {
-            throw new DefinitionException("Initializer method " + annotatedMethod.toString() + " cannot be annotated @Observes");
+            throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Observes");
          }
          else
          {
-            initializerMethods.add(annotatedMethod);
+            initializerMethods.add(MethodInjectionPoint.of(this, method));
          }
       }
    }
@@ -308,7 +332,7 @@
     * 
     * @return The set of annotated methods
     */
-   public Set<AnnotatedMethod<?>> getInitializerMethods()
+   public Set<? extends MethodInjectionPoint<?>> getInitializerMethods()
    {
       return initializerMethods;
    }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -305,7 +305,7 @@
             DependentContext.INSTANCE.setCurrentInjectionInstance(dependentCollector);
          }
          DependentContext.INSTANCE.setActive(true);
-         T instance = produceInstance();
+         T instance = produceInstance(creationalContext);
          checkReturnValue(instance);
          return instance;
       }
@@ -333,7 +333,7 @@
       }
    }
 
-   protected abstract T produceInstance();
+   protected abstract T produceInstance(CreationalContext<T> creationalContext);
 
    /**
     * Gets a string representation

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -126,15 +126,6 @@
       checkObserverMethods();
    }
 
-   /**
-    * Initializes the injection points
-    */
-   @Override
-   protected void initInjectionPoints()
-   {
-      super.initInjectionPoints();
-   }
-
    protected void initTypes()
    {
       types = new LinkedHashSet<Type>();
@@ -217,6 +208,7 @@
       {
          DependentContext.INSTANCE.setActive(true);
          T instance = proxyClass.newInstance();
+         creationalContext.push(instance);
          ((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler(this, ejbDescriptor.getRemoveMethods()));
          if (log.isTraceEnabled())
             log.trace("Enterprise bean instance created for bean " + this);
@@ -254,19 +246,8 @@
       }
    }
 
-   /**
-    * Calls all initializers of the bean
-    * 
-    * @param instance The bean instance
-    */
-   protected void callInitializers(T instance)
-   {
-      for (AnnotatedMethod<?> initializer : getInitializerMethods())
-      {
-         initializer.invoke(manager, instance);
-      }
-   }
 
+
    /**
     * Injects EJBs and common fields
     */
@@ -314,19 +295,23 @@
    {
       try
       {
-         manager.getInjectionPointProvider().pushBean(this);
+         CreationalContext<T> creationalContext = new CreationalContext<T>() 
+         { 
+            
+            public void push(T incompleteInstance) {};
+            
+         };
          DependentContext.INSTANCE.setCurrentInjectionInstance(instance);
          DependentContext.INSTANCE.setActive(true);
          bindDecorators();
          bindInterceptors();
          injectEjbAndCommonFields();
-         injectBoundFields(instance);
-         callInitializers(instance);
+         injectBoundFields(instance, creationalContext);
+         callInitializers(instance, creationalContext);
       }
       finally
       {
          DependentContext.INSTANCE.clearCurrentInjectionInstance(instance);
-         manager.getInjectionPointProvider().popBean();
          DependentContext.INSTANCE.setActive(false);
       }
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -19,6 +19,8 @@
 
 import java.lang.reflect.Field;
 
+import javax.context.CreationalContext;
+
 import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.introspector.AnnotatedField;
 import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
@@ -78,7 +80,7 @@
 
 
    @Override
-   public T produceInstance()
+   protected T produceInstance(CreationalContext<T> creationalContext)
    {
       return field.get(getReceiver());
    }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -21,12 +21,14 @@
 import java.lang.reflect.Method;
 import java.util.Set;
 
+import javax.context.CreationalContext;
 import javax.event.Observes;
 import javax.inject.DefinitionException;
 import javax.inject.Disposes;
 
 import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.MetaDataCache;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
 import org.jboss.webbeans.injection.ParameterInjectionPoint;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.introspector.AnnotatedParameter;
@@ -43,7 +45,7 @@
 public class ProducerMethodBean<T> extends AbstractProducerBean<T, Method>
 {
    // The underlying method
-   private AnnotatedMethod<T> method;
+   private MethodInjectionPoint<T> method;
 
    private AnnotatedMethod<?> disposalMethod;
    
@@ -70,13 +72,13 @@
    protected ProducerMethodBean(AnnotatedMethod<T> method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
    {
       super(declaringBean, manager);
-      this.method = method;
+      this.method = MethodInjectionPoint.of(this, method);
       init();
    }
 
-   public T produceInstance()
+   protected T produceInstance(CreationalContext<T> creationalContext)
    {
-      return method.invoke(getReceiver(), manager);
+      return method.invoke(getReceiver(), manager, creationalContext);
    }
 
    /**

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -35,6 +35,7 @@
 import org.jboss.webbeans.MetaDataCache;
 import org.jboss.webbeans.context.DependentContext;
 import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
+import org.jboss.webbeans.injection.ConstructorInjectionPoint;
 import org.jboss.webbeans.injection.FieldInjectionPoint;
 import org.jboss.webbeans.injection.InjectionPointProvider;
 import org.jboss.webbeans.injection.MethodInjectionPoint;
@@ -64,7 +65,7 @@
    // Empty list representing no-args
    private static List<Class<?>> NO_ARGUMENTS = Collections.emptyList();
    // The constructor
-   private AnnotatedConstructor<T> constructor;
+   private ConstructorInjectionPoint<T> constructor;
    // The post-construct method
    private AnnotatedMethod<?> postConstruct;
    // The pre-destroy method
@@ -125,23 +126,22 @@
       {
          DependentContext.INSTANCE.setActive(true);
          InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
-         injectionPointProvider.pushBean(this);
          T instance = null;
          try
          {
-            instance = constructor.newInstance(manager);
+            instance = constructor.newInstance(manager, creationalContext);
+            creationalContext.push(instance);
             DependentContext.INSTANCE.setCurrentInjectionInstance(instance);
             bindDecorators();
             bindInterceptors();
             injectEjbAndCommonFields(instance);
-            injectBoundFields(instance);
-            callInitializers(instance);
+            injectBoundFields(instance, creationalContext);
+            callInitializers(instance, creationalContext);
             callPostConstruct(instance);
          }
          finally
          {
             DependentContext.INSTANCE.clearCurrentInjectionInstance(instance);
-            injectionPointProvider.popBean();
          }
          return instance;
       }
@@ -187,7 +187,7 @@
          try
          {
             // note: RI supports injection into @PreDestroy
-            preDestroy.invoke(instance, manager);
+            preDestroy.invoke(instance);
          }
          catch (Exception e)
          {
@@ -208,8 +208,7 @@
       {
          try
          {
-            // note: RI supports injection into @PostConstruct
-            postConstruct.invoke(instance, manager);
+            postConstruct.invoke(instance);
          }
          catch (Exception e)
          {
@@ -217,19 +216,6 @@
          }
       }
    }
-
-   /**
-    * Calls any initializers
-    * 
-    * @param instance The instance to invoke the initializers on
-    */
-   protected void callInitializers(T instance)
-   {
-      for (AnnotatedMethod<?> initializer : getInitializerMethods())
-      {
-         initializer.invoke(instance, manager);
-      }
-   }
    
    protected void initEjbInjectionPoints()
    {
@@ -331,13 +317,6 @@
       {
          injectionPoints.add(ParameterInjectionPoint.of(this, parameter));
       }
-      for (AnnotatedMethod<?> initializer : getInitializerMethods())
-      {
-         for (AnnotatedParameter<?> parameter : initializer.getParameters())
-         {
-            injectionPoints.add(ParameterInjectionPoint.of(this, parameter));
-         }
-      }
    }
 
    /**
@@ -408,7 +387,7 @@
       }
       else if (initializerAnnotatedConstructors.size() == 1)
       {
-         this.constructor = initializerAnnotatedConstructors.iterator().next();
+         this.constructor = ConstructorInjectionPoint.of(this, initializerAnnotatedConstructors.iterator().next());
          log.trace("Exactly one constructor (" + constructor + ") annotated with @Initializer defined, using it as the bean constructor for " + getType());
          return;
       }
@@ -416,7 +395,7 @@
       if (getAnnotatedItem().getConstructor(NO_ARGUMENTS) != null)
       {
 
-         this.constructor = getAnnotatedItem().getConstructor(NO_ARGUMENTS);
+         this.constructor = ConstructorInjectionPoint.of(this, getAnnotatedItem().getConstructor(NO_ARGUMENTS));
          log.trace("Exactly one constructor (" + constructor + ") defined, using it as the bean constructor for " + getType());
          return;
       }
@@ -515,7 +494,7 @@
    public String toString()
    {
       StringBuilder buffer = new StringBuilder();
-      buffer.append("Annotated " + Names.scopeTypeToString(getScopeType()));
+      buffer.append(Names.scopeTypeToString(getScopeType()));
       if (getName() == null)
       {
          buffer.append("unnamed simple bean");
@@ -524,8 +503,8 @@
       {
          buffer.append("simple bean '" + getName() + "'");
       }
-      buffer.append(" [" + getType().getName() + "]\n");
-      buffer.append("   API types " + getTypes() + ", binding types " + getBindings() + "\n");
+      buffer.append(" ").append(getType().getName()).append(", ");
+      buffer.append(" API types = ").append(Names.typesToString(getTypes())).append(", binding types = " + Names.annotationsToString(getBindings()));
       return buffer.toString();
    }
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/proxy/ClientProxyMethodHandler.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -98,7 +98,7 @@
    private <T> T getProxiedInstance(Bean<T> bean)
    {
       Context context = CurrentManager.rootManager().getContext(bean.getScopeType());
-      return context.get(bean, CreationalContextImpl.<T>newInstance());
+      return context.get(bean, new CreationalContextImpl<T>(bean));
    }
 
    /**

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/context/CreationalContextImpl.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -1,19 +1,47 @@
 package org.jboss.webbeans.context;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.context.CreationalContext;
+import javax.inject.manager.Bean;
 
 public class CreationalContextImpl<T> implements CreationalContext<T>
 {
    
-   public static final <T> CreationalContextImpl<T> newInstance()
+   private final Map<Bean<?>, Object> incompleteInstances;
+   private final Bean<T> bean;
+   
+   public CreationalContextImpl(Bean<T> bean)
    {
-      return new CreationalContextImpl<T>();
+      this.incompleteInstances = new HashMap<Bean<?>, Object>();
+      this.bean = bean;
    }
    
+   private CreationalContextImpl(Bean<T> bean, Map<Bean<?>, Object> incompleteInstances)
+   {
+      this.incompleteInstances = incompleteInstances;
+      this.bean = bean;
+   }
+   
    public void push(T incompleteInstance)
    {
-      // TODO Auto-generated method stub
-      
+      incompleteInstances.put(bean, incompleteInstance);
    }
    
+   public <S> CreationalContextImpl<S> getCreationalContext(Bean<S> bean)
+   {
+      return new CreationalContextImpl<S>(bean, incompleteInstances);
+   }
+   
+   public <S> S getIncompleteInstance(Bean<S> bean)
+   {
+      return (S) incompleteInstances.get(bean);
+   }
+   
+   public boolean containsIncompleteInstance(Bean<?> bean)
+   {
+      return incompleteInstances.containsKey(bean);
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -44,6 +44,7 @@
 import org.jboss.webbeans.bean.AbstractBean;
 import org.jboss.webbeans.bean.AbstractClassBean;
 import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.transaction.UserTransaction;
@@ -72,7 +73,7 @@
    }
 
    private final Bean<?> observerBean;
-   private final AnnotatedMethod<?> observerMethod;
+   private final MethodInjectionPoint<?> observerMethod;
    private TransactionObservationPhase transactionObservationPhase;
    private final boolean conditional;
    private ManagerImpl manager;
@@ -104,7 +105,7 @@
    {
       this.manager = manager;
       this.observerBean = observerBean;
-      this.observerMethod = observer;
+      this.observerMethod = MethodInjectionPoint.of(observerBean, observer);
       checkObserverMethod();
 
       @SuppressWarnings("unchecked")
@@ -200,7 +201,7 @@
             DependentContext.INSTANCE.setCurrentInjectionInstance(dependentsCollector);
          }
          // Get the most specialized instance of the component
-         instance = manager.getInstance(observerBean, !isConditional());
+         instance = getInstance(observerBean);
          if (instance == null)
          {
             return;
@@ -211,7 +212,7 @@
          }
          else
          {
-            observerMethod.invokeWithSpecialValue(instance, Observes.class, event, manager);
+            observerMethod.invokeWithSpecialValue(instance, Observes.class, event, manager, null);
          }
       }
       catch (ExecutionException e)
@@ -238,6 +239,11 @@
          }
       }
    }
+   
+   private <B> B getInstance(Bean<B> observerBean)
+   {
+      return manager.getInstance(observerBean, !isConditional());
+   }
 
    /**
     * Checks if there is currently a transaction active

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/AnnotatedInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/AnnotatedInjectionPoint.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/AnnotatedInjectionPoint.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -1,7 +1,6 @@
 package org.jboss.webbeans.injection;
 
 import javax.inject.manager.InjectionPoint;
-import javax.inject.manager.Manager;
 
 import org.jboss.webbeans.introspector.AnnotatedItem;
 
@@ -9,14 +8,6 @@
 {
    
    /**
-    * Injects using the value provided by the manager.
-    * 
-    * @param declaringInstance The instance to inject into
-    * @param manager The Web Beans manager
-    */
-   public void inject(Object declaringInstance, Manager manager);
-   
-   /**
     * Injects an instance
     * 
     * 

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -0,0 +1,155 @@
+package org.jboss.webbeans.injection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.util.AbstractList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.context.CreationalContext;
+import javax.inject.Produces;
+import javax.inject.manager.Bean;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedConstructor;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.ForwardingAnnotatedConstructor;
+
+public class ConstructorInjectionPoint<T> extends ForwardingAnnotatedConstructor<T> implements AnnotatedInjectionPoint<T, Constructor<T>>
+{
+   
+   private abstract class ForwardingParameterInjectionPointList extends AbstractList<ParameterInjectionPoint<?>>
+   {
+      
+      protected abstract List<? extends AnnotatedParameter<?>> delegate();
+      
+      protected abstract Bean<?> declaringBean();;
+
+      @Override
+      public ParameterInjectionPoint<?> get(int index)
+      {
+         return ParameterInjectionPoint.of(declaringBean, delegate().get(index));
+      }
+      
+      @Override
+      public int size()
+      {
+         return delegate().size();
+      }
+      
+   }
+   
+   private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
+   
+   private final Bean<?> declaringBean;
+   private final AnnotatedConstructor<T> constructor;
+
+   public static <T> ConstructorInjectionPoint<T> of(Bean<?> declaringBean, AnnotatedConstructor<T> constructor)
+   {
+      return new ConstructorInjectionPoint<T>(declaringBean, constructor);
+   }
+   
+   protected ConstructorInjectionPoint(Bean<?> declaringBean, AnnotatedConstructor<T> constructor)
+   {
+      this.declaringBean = declaringBean;
+      this.constructor = constructor;
+   }
+   
+   @Override
+   protected AnnotatedConstructor<T> delegate()
+   {
+      return constructor;
+   }
+
+   public Annotation[] getAnnotations()
+   {
+      return delegate().getAnnotationStore().getAnnotations().toArray(EMPTY_ANNOTATION_ARRAY);
+   }
+
+   public Bean<?> getBean()
+   {
+      return declaringBean;
+   }
+
+   public Set<Annotation> getBindings()
+   {
+      return delegate().getBindingTypes();
+   }
+   
+   public T newInstance(ManagerImpl manager, CreationalContext<?> creationalContext)
+   {
+      return delegate().newInstance(getParameterValues(getParameters(), null, null, manager, creationalContext));
+   }
+   
+   @Override
+   public List<ParameterInjectionPoint<?>> getParameters()
+   {
+      final List<? extends AnnotatedParameter<?>> delegate = super.getParameters();
+      return new ForwardingParameterInjectionPointList()
+      {
+
+         @Override
+         protected Bean<?> declaringBean()
+         {
+            return declaringBean;
+         }
+
+         @Override
+         protected List<? extends AnnotatedParameter<?>> delegate()
+         {
+            return delegate;
+         }
+         
+      };
+   }
+   
+   public void inject(Object declaringInstance, Object value)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   /**
+    * Helper method for getting the current parameter values from a list of
+    * annotated parameters.
+    * 
+    * @param parameters The list of annotated parameter to look up
+    * @param manager The Web Beans manager
+    * @return The object array of looked up values
+    */
+   protected Object[] getParameterValues(List<ParameterInjectionPoint<?>> parameters, Object specialVal, Class<? extends Annotation> specialParam, ManagerImpl manager, CreationalContext<?> creationalContext)
+   {
+      Object[] parameterValues = new Object[parameters.size()];
+      boolean producerMethod = this.isAnnotationPresent(Produces.class);
+      InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
+      Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
+      for (int i = 0; i < parameterValues.length; i++)
+      {
+         ParameterInjectionPoint<?> param = iterator.next();
+         if (specialParam != null && param.isAnnotationPresent(specialParam))
+         {
+            parameterValues[i] = specialVal;
+         }
+         else
+         {
+            if (!producerMethod)
+            {
+               injectionPointProvider.pushInjectionPoint(param);
+            }
+            try
+            {
+               parameterValues[i] = param.getValueToInject(manager, creationalContext);
+            }
+            finally
+            {
+               if (!producerMethod)
+               {
+                  injectionPointProvider.popInjectionPoint();
+               }
+            }
+         }
+      }
+      return parameterValues;
+   }
+
+}


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

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -4,8 +4,10 @@
 import java.lang.reflect.Field;
 import java.util.Set;
 
+import javax.context.CreationalContext;
 import javax.inject.manager.Bean;
 
+import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.introspector.AnnotatedField;
 import org.jboss.webbeans.introspector.ForwardingAnnotatedField;
 
@@ -47,6 +49,11 @@
    public Set<Annotation> getBindings()
    {
       return delegate().getAnnotationStore().getBindingTypes();
-   }   
-      
+   }
+
+   public void inject(Object declaringInstance, ManagerImpl manager, CreationalContext<?> creationalContext)
+   {
+      delegate().inject(declaringInstance, manager.getInstanceToInject(this, creationalContext));
+   }
+
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/InjectionPointProvider.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -19,11 +19,8 @@
 
 import java.util.Stack;
 
-import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
 
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-
 /**
  * Provides injection point metadata
  * 
@@ -32,35 +29,10 @@
  */
 public class InjectionPointProvider
 {
-   // The stack of beans
-   private final Stack<Bean<?>> beans = new Stack<Bean<?>>();
    // The stack of injection points
    private final Stack<InjectionPoint> injectionPoints = new Stack<InjectionPoint>();
 
-   
    /**
-    * Pushes a bean to the stack
-    * 
-    * @param currentBean The bean to push
-    */
-   public void pushBean(Bean<?> currentBean)
-   {
-      beans.push(currentBean);
-   }
-
-   /**
-    * Pops a bean from the stack
-    */
-   public void popBean()
-   {
-      if (beans.isEmpty())
-      {
-         return;
-      }
-      beans.pop();
-   }
-
-   /**
     * Pushes an injection point to the stack
     * 
     * @param injectionPoint The injection point to push
@@ -68,26 +40,7 @@
    public void pushInjectionPoint(AnnotatedInjectionPoint<?, ?> injectionPoint)
    {
       injectionPoints.push(injectionPoint);
-      if (beans.size() != injectionPoints.size())
-      {
-         throw new IllegalStateException("Number of beans on stack is inconsistent with number of injection points: " + this);
-      }
    }
-   
-   /**
-    * Pushes an injection point to the stack
-    * 
-    * @param injectionPoint The injection point to push
-    */
-   // TODO Not sure if this is right, we should be able to push the current bean in somehow
-   public void pushInjectionPoint(AnnotatedParameter<?> parameter)
-   {
-      injectionPoints.push(ParameterInjectionPoint.of(getCurrentBean(), parameter));
-      if (beans.size() != injectionPoints.size())
-      {
-         throw new IllegalStateException("Number of beans on stack is inconsistent with number of injection points: " + this);
-      }
-   }
 
    /**
     * Pops an injection point
@@ -121,30 +74,10 @@
       return injectionPoints.size() < 2 ? null : injectionPoints.elementAt(injectionPoints.size() - 2);
    }
 
-   /**
-    * Gets the current bean
-    * 
-    * @return The current bean or null if there is none on the stack
-    */
-   protected Bean<?> getCurrentBean()
-   {
-      return beans.isEmpty() ? null : beans.peek();
-   }
-
-   /**
-    * Gets the previous bean
-    * 
-    * @return The previous bean or null if there is none on the stack
-    */
-   protected Bean<?> getPreviousBean()
-   {
-      return beans.size() < 2 ? null : beans.elementAt(beans.size() - 2);
-   }
-
    @Override
    public String toString()
    {
-      return "InjectionPointProvider: Bean stack = " + beans.toString() + " InjectionPoint stack = " + injectionPoints.toString();
+      return "InjectionPoint stack = " + injectionPoints.toString();
    }
 
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -2,17 +2,44 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.util.AbstractList;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
 
+import javax.context.CreationalContext;
+import javax.inject.Produces;
 import javax.inject.manager.Bean;
-import javax.inject.manager.Manager;
 
+import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.introspector.ForwardingAnnotatedMethod;
 
 public class MethodInjectionPoint<T> extends ForwardingAnnotatedMethod<T> implements AnnotatedInjectionPoint<T, Method>
 {
    
+   private abstract class ForwardingParameterInjectionPointList extends AbstractList<ParameterInjectionPoint<?>>
+   {
+      
+      protected abstract List<? extends AnnotatedParameter<?>> delegate();
+      
+      protected abstract Bean<?> declaringBean();;
+
+      @Override
+      public ParameterInjectionPoint<?> get(int index)
+      {
+         return ParameterInjectionPoint.of(declaringBean, delegate().get(index));
+      }
+      
+      @Override
+      public int size()
+      {
+         return delegate().size();
+      }
+      
+   }
+   
    private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
    
    private final Bean<?> declaringBean;
@@ -50,14 +77,84 @@
       return delegate().getBindingTypes();
    }
    
-   public void inject(Object declaringInstance, Manager manager)
+   public T invoke(Object declaringInstance, ManagerImpl manager, CreationalContext<?> creationalContext)
    {
-      delegate().invoke(declaringInstance, manager);
+      return delegate().invoke(declaringInstance, getParameterValues(getParameters(), null, null, manager, creationalContext));
    }
    
+   public T invokeWithSpecialValue(Object declaringInstance, Class<? extends Annotation> annotatedParameter, Object parameter, ManagerImpl manager, CreationalContext<?> creationalContext)
+   {
+      return delegate().invoke(declaringInstance, getParameterValues(getParameters(), annotatedParameter, parameter, manager, creationalContext));
+   }
+   
+   @Override
+   public List<ParameterInjectionPoint<?>> getParameters()
+   {
+      final List<? extends AnnotatedParameter<?>> delegate = super.getParameters();
+      return new ForwardingParameterInjectionPointList()
+      {
+
+         @Override
+         protected Bean<?> declaringBean()
+         {
+            return declaringBean;
+         }
+
+         @Override
+         protected List<? extends AnnotatedParameter<?>> delegate()
+         {
+            return delegate;
+         }
+         
+      };
+   }
+   
    public void inject(Object declaringInstance, Object value)
    {
       delegate().invoke(declaringInstance, value);
    }
+
+   /**
+    * Helper method for getting the current parameter values from a list of
+    * annotated parameters.
+    * 
+    * @param parameters The list of annotated parameter to look up
+    * @param manager The Web Beans manager
+    * @return The object array of looked up values
+    */
+   protected Object[] getParameterValues(List<ParameterInjectionPoint<?>> parameters, Class<? extends Annotation> specialParam, Object specialVal, ManagerImpl manager, CreationalContext<?> creationalContext)
+   {
+      Object[] parameterValues = new Object[parameters.size()];
+      boolean producerMethod = this.isAnnotationPresent(Produces.class);
+      InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
+      Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
+      for (int i = 0; i < parameterValues.length; i++)
+      {
+         ParameterInjectionPoint<?> param = iterator.next();
+         if (specialParam != null && param.isAnnotationPresent(specialParam))
+         {
+            parameterValues[i] = specialVal;
+         }
+         else
+         {
+            if (!producerMethod)
+            {
+               injectionPointProvider.pushInjectionPoint(param);
+            }
+            try
+            {
+               parameterValues[i] = param.getValueToInject(manager, creationalContext);
+            }
+            finally
+            {
+               if (!producerMethod)
+               {
+                  injectionPointProvider.popInjectionPoint();
+               }
+            }
+         }
+      }
+      return parameterValues;
+   }
    
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -4,9 +4,10 @@
 import java.lang.reflect.Member;
 import java.util.Set;
 
+import javax.context.CreationalContext;
 import javax.inject.manager.Bean;
-import javax.inject.manager.Manager;
 
+import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.introspector.ForwardingAnnotatedParameter;
 
@@ -55,14 +56,14 @@
       return delegate().getDeclaringMember().getMember();
    }
    
-   public void inject(Object declaringInstance, Manager manager)
+   public void inject(Object declaringInstance, Object value)
    {
       throw new UnsupportedOperationException();
    }
    
-   public void inject(Object declaringInstance, Object value)
+   public T getValueToInject(ManagerImpl manager, CreationalContext<?> creationalContext)
    {
-      throw new UnsupportedOperationException();
+      return manager.<T>getInstanceToInject(this, creationalContext);
    }
 
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedConstructor.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -21,8 +21,6 @@
 import java.lang.reflect.Constructor;
 import java.util.List;
 
-import org.jboss.webbeans.ManagerImpl;
-
 /**
  * Represents a Class Constructor
  * 
@@ -38,7 +36,7 @@
     * @return A set of abstracted parameters. Returns an empty set if there are
     *         no parameters
     */
-   public List<AnnotatedParameter<?>> getParameters();
+   public List<? extends AnnotatedParameter<?>> getParameters();
 
    /**
     * Gets all parameters to the constructor which are annotated with
@@ -53,10 +51,9 @@
    /**
     * Creates a new instance of the class, using this constructor
     * 
-    * @param manager The Web Beans manager
     * @return The created instance
     */
-   public T newInstance(ManagerImpl manager);
+   public T newInstance(Object... parameters);
 
    /**
     * Gets the declaring class of the annotation

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedField.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -39,14 +39,6 @@
    public Field getAnnotatedField();
    
    /**
-    * Injects into the field using the value provided by the manager.
-    * 
-    * @param declaringInstance The instance to inject into
-    * @param manager The Web Beans manager
-    */
-   public void inject(Object declaringInstance, Manager manager);
-   
-   /**
     * Injects an instance
     * 
     * 
@@ -67,18 +59,6 @@
     */
    public void injectIntoInstance(Object declaringInstance, Object value);
    
-   /**
-    * Injects an instance
-    * 
-    * Unlike {@link #inject(Object, Manager)} the field injected into is 
-    * discovered from the declaring instance. This is slower, but safe to use
-    * with proxies.
-    * 
-    * @param declaringInstance The instance to inject
-    * @param manager The Web Beans manager
-    */
-   public void injectIntoInstance(Object declaringInstance, Manager manager);
-   
    public T get(Object instance);
    
    /**

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -33,8 +33,6 @@
 import javax.event.Observes;
 import javax.inject.Disposes;
 
-import org.jboss.webbeans.ManagerImpl;
-
 /**
  * AnnotatedType provides a uniform access to the annotations on an annotated
  * class defined either in Java or XML
@@ -53,7 +51,7 @@
     * @return A list of parameters. Returns an empty list if no parameters are
     *         present.
     */
-   public List<AnnotatedParameter<?>> getParameters();
+   public List<? extends AnnotatedParameter<?>> getParameters();
 
    /**
     * Gets the list of annotated parameters for a given annotation
@@ -73,10 +71,10 @@
     * Invokes the method
     * 
     * @param instance The instance to invoke
-    * @param manager The Web Beans manager
+    * @param parameters The method parameters
     * @return A reference to the instance
     */
-   public T invoke(Object instance, ManagerImpl manager);
+   public T invoke(Object instance, Object... parameters);
    
    /**
     * Invokes the method on the class of the passed instance, not the declaring 
@@ -86,28 +84,9 @@
     * @param manager The Web Beans manager
     * @return A reference to the instance
     */
-   public T invokeOnInstance(Object instance, ManagerImpl manager);
+   public T invokeOnInstance(Object instance, Object... parameters);
 
    /**
-    * Invokes the observer method
-    * 
-    * @param instance The instance to invoke
-    * @param event the event object
-    * @param manager The Web Beans manager
-    * @return A reference to the instance
-    */
-   public T invokeWithSpecialValue(Object instance, Class<? extends Annotation> specialParam, Object specialVal, ManagerImpl manager);
-
-   /**
-    * Invokes the method
-    * 
-    * @param instance The instance to invoke
-    * @param parameters The method parameters
-    * @return A reference to the instance
-    */
-   public T invoke(Object instance, Object... parameters);
-
-   /**
     * Gets the declaring class
     * 
     * @return An abstraction of the declaring class

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedConstructor.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedConstructor.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -21,8 +21,6 @@
 import java.util.List;
 import java.util.Set;
 
-import org.jboss.webbeans.ManagerImpl;
-
 public abstract class ForwardingAnnotatedConstructor<T> extends ForwardingAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
 {
 
@@ -39,14 +37,14 @@
       return delegate().getDeclaringClass();
    }
 
-   public List<AnnotatedParameter<?>> getParameters()
+   public List<? extends AnnotatedParameter<?>> getParameters()
    {
       return delegate().getParameters();
    }
 
-   public T newInstance(ManagerImpl manager)
+   public T newInstance(Object... parameters)
    {
-      return delegate().newInstance(manager);
+      return delegate().newInstance(parameters);
    }
 
    public AnnotatedConstructor<T> wrap(Set<Annotation> annotations)

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedField.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -20,8 +20,6 @@
 import java.lang.reflect.Field;
 import java.util.Set;
 
-import javax.inject.manager.Manager;
-
 public abstract class ForwardingAnnotatedField<T> extends ForwardingAnnotatedMember<T, Field> implements AnnotatedField<T>
 {
 
@@ -48,11 +46,6 @@
       return delegate().getPropertyName();
    }
 
-   public void inject(Object declaringInstance, Manager manager)
-   {
-      delegate().inject(declaringInstance, manager);
-   }
-
    public void inject(Object declaringInstance, Object value)
    {
       delegate().inject(declaringInstance, value);
@@ -63,11 +56,6 @@
       delegate().injectIntoInstance(declaringInstance, value);
    }
 
-   public void injectIntoInstance(Object declaringInstance, Manager manager)
-   {
-      delegate().injectIntoInstance(declaringInstance, manager);
-   }
-
    public boolean isTransient()
    {
       return delegate().isTransient();

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -45,7 +45,7 @@
     */
    public <A extends Annotation> A getAnnotation(Class<A> annotationType)
    {
-      return getAnnotationStore().getAnnotation(annotationType);
+      return delegate().getAnnotation(annotationType);
    }
 
    /**
@@ -53,7 +53,7 @@
     */
    public Set<Annotation> getAnnotationsAsSet()
    {
-      return getAnnotationStore().getAnnotations();
+      return delegate().getAnnotationsAsSet();
    }
 
    /**
@@ -61,7 +61,7 @@
     */
    public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
    {
-      return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
+      return delegate().getMetaAnnotations(metaAnnotationType);
    }
 
    /**
@@ -69,7 +69,7 @@
     */
    public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
    {
-      return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
+      return delegate().getMetaAnnotationsAsArray(metaAnnotationType);
    }
 
    /**
@@ -78,7 +78,7 @@
    @Deprecated
    public Set<Annotation> getBindingTypes()
    {
-      return getAnnotationStore().getBindingTypes();
+      return delegate().getBindingTypes();
    }
 
    /**
@@ -87,31 +87,36 @@
    @Deprecated
    public Annotation[] getBindingTypesAsArray()
    {
-      return getAnnotationStore().getBindingTypesAsArray();
+      return delegate().getBindingTypesAsArray();
    }
-
+   
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public String getName()
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
    {
-      return delegate().getName();
+      return delegate().isAnnotationPresent(annotationType);
    }
+   
+   public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return delegate().getDeclaredMetaAnnotations(metaAnnotationType);
+   }
 
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public Class<T> getType()
+   public String getName()
    {
-      return delegate().getType();
+      return delegate().getName();
    }
 
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   public Class<T> getType()
    {
-      return getAnnotationStore().isAnnotationPresent(annotationType);
+      return delegate().getType();
    }
 
    /**
@@ -191,11 +196,6 @@
    {
       return delegate().toString();
    }
-   
-   public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
-   {
-      return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
-   }
 
    /**
     * Gets the annotated item

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedMethod.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedMethod.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -49,7 +49,7 @@
       return delegate().getParameterTypesAsArray();
    }
 
-   public List<AnnotatedParameter<?>> getParameters()
+   public List<? extends AnnotatedParameter<?>> getParameters()
    {
       return delegate().getParameters();
    }
@@ -69,16 +69,11 @@
       return delegate().invoke(instance, parameters);
    }
 
-   public T invokeOnInstance(Object instance, ManagerImpl manager)
+   public T invokeOnInstance(Object instance, Object... parameters)
    {
-      return delegate().invokeOnInstance(instance, manager);
+      return delegate().invokeOnInstance(instance, parameters);
    }
 
-   public T invokeWithSpecialValue(Object instance, Class<? extends Annotation> specialParam, Object specialVal, ManagerImpl manager)
-   {
-      return delegate().invokeWithSpecialValue(instance, specialParam, specialVal, manager);
-   }
-
    public boolean isEquivalent(Method method)
    {
       return delegate().isEquivalent(method);

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedClass.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -43,4 +43,67 @@
       return annotationStore;
    }
    
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public <A extends Annotation> A getAnnotation(Class<A> annotationType)
+   {
+      return getAnnotationStore().getAnnotation(annotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getAnnotationsAsSet()
+   {
+      return getAnnotationStore().getAnnotations();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Set<Annotation> getBindingTypes()
+   {
+      return getAnnotationStore().getBindingTypes();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Annotation[] getBindingTypesAsArray()
+   {
+      return getAnnotationStore().getBindingTypesAsArray();
+   }
+   
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return getAnnotationStore().isAnnotationPresent(annotationType);
+   }
+   
+   public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedField.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -42,4 +42,67 @@
       return annotationStore;
    }
    
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public <A extends Annotation> A getAnnotation(Class<A> annotationType)
+   {
+      return getAnnotationStore().getAnnotation(annotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getAnnotationsAsSet()
+   {
+      return getAnnotationStore().getAnnotations();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Set<Annotation> getBindingTypes()
+   {
+      return getAnnotationStore().getBindingTypes();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Annotation[] getBindingTypesAsArray()
+   {
+      return getAnnotationStore().getBindingTypesAsArray();
+   }
+   
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return getAnnotationStore().isAnnotationPresent(annotationType);
+   }
+   
+   public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedMethod.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -43,4 +43,67 @@
       return annotationStore;
    }
    
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public <A extends Annotation> A getAnnotation(Class<A> annotationType)
+   {
+      return getAnnotationStore().getAnnotation(annotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getAnnotationsAsSet()
+   {
+      return getAnnotationStore().getAnnotations();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Set<Annotation> getBindingTypes()
+   {
+      return getAnnotationStore().getBindingTypes();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Annotation[] getBindingTypesAsArray()
+   {
+      return getAnnotationStore().getBindingTypesAsArray();
+   }
+   
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return getAnnotationStore().isAnnotationPresent(annotationType);
+   }
+   
+   public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/WrappedAnnotatedParameter.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -48,4 +48,67 @@
       return annotationStore;
    }
    
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public <A extends Annotation> A getAnnotation(Class<A> annotationType)
+   {
+      return getAnnotationStore().getAnnotation(annotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getAnnotationsAsSet()
+   {
+      return getAnnotationStore().getAnnotations();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Set<Annotation> getBindingTypes()
+   {
+      return getAnnotationStore().getBindingTypes();
+   }
+
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   @Deprecated
+   public Annotation[] getBindingTypesAsArray()
+   {
+      return getAnnotationStore().getBindingTypesAsArray();
+   }
+   
+   /**
+    * @see org.jboss.webbeans.introspector.AnnotatedItem
+    */
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+   {
+      return getAnnotationStore().isAnnotationPresent(annotationType);
+   }
+   
+   public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends Annotation> metaAnnotationType)
+   {
+      return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -22,16 +22,12 @@
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
 import javax.inject.BindingType;
-import javax.inject.Produces;
 import javax.inject.manager.Manager;
 
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.injection.InjectionPointProvider;
 import org.jboss.webbeans.introspector.AnnotatedMember;
 import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.introspector.AnnotationStore;
@@ -200,60 +196,4 @@
       return getDelegate();
    }
 
-   /**
-    * Helper method for getting the current parameter values from a list of
-    * annotated parameters.
-    * 
-    * @param parameters The list of annotated parameter to look up
-    * @param manager The Web Beans manager
-    * @return The object array of looked up values
-    */
-   protected Object[] getParameterValues(List<AnnotatedParameter<?>> parameters, ManagerImpl manager)
-   {
-      return getParameterValues(parameters, null, null, manager);
-   }
-
-   /**
-    * Helper method for getting the current parameter values from a list of
-    * annotated parameters.
-    * 
-    * @param parameters The list of annotated parameter to look up
-    * @param manager The Web Beans manager
-    * @return The object array of looked up values
-    */
-   protected Object[] getParameterValues(List<AnnotatedParameter<?>> parameters, Object specialVal, Class<? extends Annotation> specialParam, ManagerImpl manager)
-   {
-      Object[] parameterValues = new Object[parameters.size()];
-      boolean producerMethod = this.isAnnotationPresent(Produces.class);
-      InjectionPointProvider injectionPointProvider = manager.getInjectionPointProvider();
-      Iterator<AnnotatedParameter<?>> iterator = parameters.iterator();
-      for (int i = 0; i < parameterValues.length; i++)
-      {
-         AnnotatedParameter<?> param = iterator.next();
-         if (specialParam != null && param.isAnnotationPresent(specialParam))
-         {
-            parameterValues[i] = specialVal;
-         }
-         else
-         {
-            if (!producerMethod)
-            {
-               injectionPointProvider.pushInjectionPoint(param);
-            }
-            try
-            {
-               parameterValues[i] = param.getValue(manager);
-            }
-            finally
-            {
-               if (!producerMethod)
-               {
-                  injectionPointProvider.popInjectionPoint();
-               }
-            }
-         }
-      }
-      return parameterValues;
-   }
-
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -623,7 +623,7 @@
       {
          return toString;
       }
-      toString = "Annotated class " + Names.class2String(getDelegate());
+      toString = "Annotated class " + Names.classToString(getDelegate());
       return toString;
    }
    

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -192,11 +192,11 @@
     * 
     * @see org.jboss.webbeans.introspector.AnnotatedConstructor#newInstance(ManagerImpl)
     */
-   public T newInstance(ManagerImpl manager)
+   public T newInstance(Object... parameters)
    {
       try
       {
-         return getDelegate().newInstance(getParameterValues(parameters, manager));
+         return getDelegate().newInstance(parameters);
       }
       catch (IllegalArgumentException e)
       {
@@ -269,7 +269,7 @@
       {
          return toString;
       }
-      toString = "Annotated method " + Names.constructor2String(constructor);
+      toString = "Annotated method " + Names.constructorToString(constructor);
       return toString;
    }
    

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -21,8 +21,6 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
-import javax.inject.manager.Manager;
-
 import org.jboss.webbeans.introspector.AnnotatedField;
 import org.jboss.webbeans.introspector.AnnotatedType;
 import org.jboss.webbeans.introspector.AnnotationStore;
@@ -114,25 +112,7 @@
    {
       return actualTypeArguments;
    }
-
-   /**
-    * Gets the current value and injects this instance into an instance
-    * 
-    * @param instance The instance to inject into
-    * @param manager The Web Beans manager
-    * @see org.jboss.webbeans.introspector.AnnotatedField#inject(Object,
-    *      Manager)
-    */
-   public void inject(Object instance, Manager manager)
-   {
-      Reflections.setAndWrap(getDelegate(), instance, getValue(manager));
-   }
    
-   public void injectIntoInstance(Object instance, Manager manager)
-   {
-      Reflections.setAndWrap(getName(), instance, getValue(manager));
-   }
-   
    public void inject(Object instance, Object value)
    {
       Reflections.setAndWrap(getDelegate(), instance, value);
@@ -185,7 +165,7 @@
       {
          return toString;
       }
-      toString = "Annotated field " + Names.field2String(field);
+      toString = "Annotated field " + Names.fieldToString(field);
       return toString;
    }
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -26,7 +26,6 @@
 import java.util.Collections;
 import java.util.List;
 
-import org.jboss.webbeans.ManagerImpl;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.introspector.AnnotatedParameter;
 import org.jboss.webbeans.introspector.AnnotatedType;
@@ -231,56 +230,19 @@
       return this.getDeclaringClass().isEquivalent(method.getDeclaringClass()) && this.getName().equals(method.getName()) && Arrays.equals(this.getParameterTypesAsArray(), method.getParameterTypes());
    }
 
-   /**
-    * Gets the hash code (of the delegate)
-    * 
-    * @return The hash code
-    */
    @Override
    public int hashCode()
    {
       return getDelegate().hashCode();
    }
-
-   /**
-    * Invokes the method on an instance with current parameters from manager
-    * 
-    * @param instance The instance to invoke on
-    * @param manager The Web Beans manager
-    * @return The return value of the invocation 
-    * @see org.jboss.webbeans.introspector.AnnotatedMethod#invoke(ManagerImpl,
-    *      Object)
-    */
-   public T invoke(Object instance, ManagerImpl manager)
-   {
-      @SuppressWarnings("unchecked")
-      T result = (T) Reflections.invokeAndWrap(getDelegate(), instance, getParameterValues(parameters, manager));
-      return result;
-   }
    
-   public T invokeOnInstance(Object instance, ManagerImpl manager)
+   public T invokeOnInstance(Object instance, Object...parameters)
    {
       @SuppressWarnings("unchecked")
-      T result = (T) Reflections.invokeAndWrap(getName(), getParameterTypesAsArray(), instance, getParameterValues(parameters, manager));
+      T result = (T) Reflections.invokeAndWrap(getName(), getParameterTypesAsArray(), instance, parameters);
       return result;
    }
 
-   public T invokeWithSpecialValue(Object instance, Class<? extends Annotation> specialParam, Object specialVal, ManagerImpl manager)
-   {
-      @SuppressWarnings("unchecked")
-      T result = (T) Reflections.invokeAndWrap(getDelegate(), instance, getParameterValues(parameters, specialVal, specialParam, manager));
-      return result;
-   }
-
-   /**
-    * Invokes the method on an instance with given parameters
-    * 
-    * @param instance The instance to invoke on
-    * @param parameters The parameters
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedMethod#invoke(Object,
-    *      Object...)
-    */
    public T invoke(Object instance, Object... parameters)
    {
       @SuppressWarnings("unchecked")
@@ -324,7 +286,7 @@
       {
          return toString;
       }
-      toString = "Annotated method " + Names.method2String(method);
+      toString = "Annotated method " + Names.methodToString(method);
       return toString;
    }
       

Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java (from rev 1246, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/Resolver.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/lookup/Resolver.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -0,0 +1,390 @@
+/*
+ * 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.lookup;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import java.util.concurrent.Callable;
+
+import javax.inject.TypeLiteral;
+import javax.inject.manager.Bean;
+import javax.inject.manager.Decorator;
+import javax.inject.manager.InjectionPoint;
+import javax.inject.manager.InterceptionType;
+import javax.inject.manager.Interceptor;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.MetaDataCache;
+import org.jboss.webbeans.bean.InjectionPointBean;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.ForwardingAnnotatedItem;
+import org.jboss.webbeans.model.BindingTypeModel;
+import org.jboss.webbeans.util.ConcurrentCache;
+import org.jboss.webbeans.util.ListComparator;
+
+/**
+ * Implementation of Web Beans type safe and name based bean resolution
+ * 
+ * @author Pete Muir
+ */
+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 final Class<Set<Bean<Object>>> BEAN_SET_GENERIFIED_WITH_OBJECT = new TypeLiteral<Set<Bean<Object>>>(){}.getRawType();
+   private static final Class<Set<Bean<?>>> BEAN_SET_GENERIFIED_WITH_WILDCARD = new TypeLiteral<Set<Bean<?>>>(){}.getRawType();
+   
+   /**
+    * Extension of an element which bases equality not only on type, but also on
+    * binding type
+    */
+   private abstract class ResolvableAnnotatedItem<T, S> extends ForwardingAnnotatedItem<T, S>
+   {
+      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.getBindingTypes().equals(this.getBindingTypes());
+         }
+         else
+         {
+            return false;
+         }
+      }
+
+      @Override
+      public int hashCode()
+      {
+         return delegate().hashCode();
+      }
+
+      @Override
+      public String toString()
+      {
+         return "Resolvable annotated item for " + delegate();
+      }
+
+   }
+
+   // The resolved injection points
+   private ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>> resolvedInjectionPoints;
+   // The registerd injection points
+   private Set<AnnotatedItem<?, ?>> injectionPoints;
+   // The resolved names
+   private ConcurrentCache<String, Set<Bean<?>>> resolvedNames;
+   // The Web Beans manager
+   private ManagerImpl manager;
+
+   /**
+    * Constructor
+    * 
+    * @param manager The Web Beans manager
+    */
+   public Resolver(ManagerImpl manager)
+   {
+      this.injectionPoints = new HashSet<AnnotatedItem<?, ?>>();
+      this.resolvedInjectionPoints = new ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>>();
+      this.resolvedNames = new ConcurrentCache<String, Set<Bean<?>>>();
+      this.manager = manager;
+   }
+
+   /**
+    * Add multiple injection points for later resolving using
+    * {@link #registerInjectionPoint(AnnotatedItem)}. Useful during bootstrap.
+    * 
+    * @param elements The injection points to add
+    */
+   public void addInjectionPoints(Collection<? extends AnnotatedItem<?, ?>> elements)
+   {
+      injectionPoints.addAll(elements);
+   }
+
+   /**
+    * Registers an injection point
+    * 
+    * @param <T>
+    * @param <S>
+    * @param element The injection point to add
+    * @return A set of matching beans for the injection point
+    */
+   private <T, S> Set<Bean<T>> registerInjectionPoint(final ResolvableAnnotatedItem<T, S> element)
+   {
+      Callable<Set<Bean<T>>> callable = new Callable<Set<Bean<T>>>()
+      {
+
+         public Set<Bean<T>> call() throws Exception
+         {
+            return retainHighestPrecedenceBeans(getMatchingBeans(element, manager.getBeans()), manager.getEnabledDeploymentTypes());
+         }
+
+      };
+      return resolvedInjectionPoints.putIfAbsent(element, callable);
+   }
+
+   /**
+    * Reset all cached injection points. You must reset all cached injection
+    * points when you add a bean to the manager
+    */
+   public void clear()
+   {
+      this.resolvedInjectionPoints = new ConcurrentCache<ResolvableAnnotatedItem<?, ?>, Set<Bean<?>>>();
+      resolvedNames = new ConcurrentCache<String, Set<Bean<?>>>();
+   }
+
+   /**
+    * Resolve all injection points added using
+    * {@link #addInjectionPoints(Collection)}
+    */
+   public void resolveInjectionPoints()
+   {
+      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); 
+            }
+         });
+      }
+   }
+
+   /**
+    * Get the possible beans for the given element
+    * 
+    * @param key The resolving criteria
+    * @return An unmodifiable set of matching beans
+    */
+   public <T, S> Set<Bean<T>> get(final AnnotatedItem<T, S> key)
+   {
+      Set<Bean<T>> beans = new HashSet<Bean<T>>();
+
+      final ResolvableAnnotatedItem<T, S> element = new ResolvableAnnotatedItem<T, S>()
+      {
+
+         @Override
+         public AnnotatedItem<T, S> delegate()
+         {
+            return key;
+         }
+
+      };
+
+      if (InjectionPoint.class.isAssignableFrom(element.getType()))
+      {
+         beans.add(InjectionPointBean.of(key, manager));
+      }
+      else
+      {
+         beans = registerInjectionPoint(element);
+      }
+      return Collections.unmodifiableSet(beans);
+   }
+
+   /**
+    * Get the possible beans for the given name
+    * 
+    * @param name The name to match
+    * @return The set of matching beans
+    */
+   public Set<Bean<? extends Object>> get(final String name)
+   {
+      return resolvedNames.putIfAbsent(name, new Callable<Set<Bean<?>>>()
+      {
+
+         public Set<Bean<? extends Object>> call() throws Exception
+         {
+            
+            Set<Bean<?>> beans = new HashSet<Bean<?>>();
+            for (Bean<?> bean : manager.getBeans())
+            {
+               if ((bean.getName() == null && name == null) || (bean.getName() != null && bean.getName().equals(name)))
+               {
+                  beans.add(bean);
+               }
+            }
+            return retainHighestPrecedenceBeans(beans, manager.getEnabledDeploymentTypes());
+         }
+         
+         // Helper method to deal with dynamic casts being needed
+         private Set<Bean<?>> retainHighestPrecedenceBeans(Set<Bean<?>> beans, List<Class<? extends Annotation>> enabledDeploymentTypes)
+         {
+            return BEAN_SET_GENERIFIED_WITH_WILDCARD.cast(Resolver.retainHighestPrecedenceBeans(BEAN_SET_GENERIFIED_WITH_OBJECT.cast(beans), enabledDeploymentTypes));
+         }
+
+      });
+   }
+   
+   
+
+   /**
+    * Filters out the beans with the highest enabled deployment type
+    * 
+    * @param <T>
+    * @param beans The beans to filter
+    * @param enabledDeploymentTypes The enabled deployment types
+    * @return The filtered beans
+    */
+   private static <T> Set<Bean<T>> retainHighestPrecedenceBeans(Set<Bean<T>> beans, List<Class<? extends Annotation>> enabledDeploymentTypes)
+   {
+      if (beans.size() > 0)
+      {
+         SortedSet<Class<? extends Annotation>> possibleDeploymentTypes = new TreeSet<Class<? extends Annotation>>(new ListComparator<Class<? extends Annotation>>(enabledDeploymentTypes));
+         for (Bean<?> bean : beans)
+         {
+            possibleDeploymentTypes.add(bean.getDeploymentType());
+         }
+         possibleDeploymentTypes.retainAll(enabledDeploymentTypes);
+         Set<Bean<T>> trimmed = new HashSet<Bean<T>>();
+         if (possibleDeploymentTypes.size() > 0)
+         {
+            Class<? extends Annotation> highestPrecedencePossibleDeploymentType = possibleDeploymentTypes.last();
+
+            for (Bean<T> bean : beans)
+            {
+               if (bean.getDeploymentType().equals(highestPrecedencePossibleDeploymentType))
+               {
+                  trimmed.add(bean);
+               }
+            }
+         }
+         return trimmed;
+      }
+      else
+      {
+         return beans;
+      }
+   }
+
+   /**
+    * Gets the matching beans for binding criteria from a list of beans
+    * 
+    * @param <T> The type of the beans
+    * @param element The binding criteria
+    * @param beans The beans to filter
+    * @return A set of filtered beans
+    */
+   private <T> Set<Bean<T>> getMatchingBeans(AnnotatedItem<T, ?> element, List<Bean<?>> beans)
+   {
+      Set<Bean<T>> resolvedBeans = new HashSet<Bean<T>>();
+      for (Bean<?> bean : beans)
+      {
+         if (element.isAssignableFrom(bean.getTypes()) && containsAllBindingBindingTypes(element, bean.getBindings()))
+         {
+            @SuppressWarnings("unchecked")
+            Bean<T> b = (Bean<T>) bean;
+            resolvedBeans.add(b);
+         }
+      }
+      return resolvedBeans;
+   }
+
+   /**
+    * Checks if binding criteria fulfill all binding types
+    * 
+    * @param element The binding criteria to check
+    * @param bindingTypes The binding types to check
+    * @return True if all matches, false otherwise
+    */
+   private boolean containsAllBindingBindingTypes(AnnotatedItem<?, ?> element, Set<Annotation> bindingTypes)
+   {
+      for (Annotation bindingType : element.getBindingTypes())
+      {
+         BindingTypeModel<?> bindingTypeModel = MetaDataCache.instance().getBindingTypeModel(bindingType.annotationType());
+         if (bindingTypeModel.getNonBindingTypes().size() > 0)
+         {
+            boolean matchFound = false;
+            for (Annotation otherBindingType : bindingTypes)
+            {
+               if (bindingTypeModel.isEqual(bindingType, otherBindingType))
+               {
+                  matchFound = true;
+               }
+            }
+            if (!matchFound)
+            {
+               return false;
+            }
+         }
+         else if (!bindingTypes.contains(bindingType))
+         {
+            return false;
+         }
+      }
+      return true;
+   }
+
+   /**
+    * Resolves decorators according to binding criteria
+    * 
+    * @param types The set of API types to match
+    * @param bindingTypes The binding types to match
+    * @return The set of matching decorators
+    */
+   public List<Decorator> resolveDecorators(Set<Type> types, Annotation[] bindingTypes)
+   {
+      // TODO Implement decorators
+      return Collections.emptyList();
+   }
+
+   /**
+    * Resolves interceptors according to binding criteria
+    * 
+    * @param types The set of API types to match
+    * @param bindingTypes The binding types to match
+    * @return The set of matching interceptors
+    */
+   public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation[] interceptorBindings)
+   {
+      // TODO Implement interceptors
+      return null;
+   }
+
+   /**
+    * Gets a string representation
+    * 
+    * @return A string representation
+    */
+   @Override
+   public String toString()
+   {
+      StringBuilder buffer = new StringBuilder();
+      buffer.append("Resolver\n");
+      buffer.append("Injection points: " + injectionPoints.size() + "\n");
+      buffer.append("Resolved injection points: " + resolvedInjectionPoints.size() + "\n");
+      buffer.append("Resolved names points: " + resolvedNames.size() + "\n");
+      return buffer.toString();
+   }
+
+}


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

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Names.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -22,9 +22,11 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -50,9 +52,16 @@
       String scopeName = scopeType.getSimpleName();
       Matcher matcher = CAPITAL_LETTERS.matcher(scopeName);
       StringBuilder result = new StringBuilder();
+      int i = 0;
       while (matcher.find())
       {
-         result.append(matcher.group().toLowerCase() + " ");
+         String name = matcher.group();
+         if (i > 0)
+         {
+            name = name.toLowerCase();
+         }
+         result.append(name).append(" ");
+         i++;
       }
       return result.toString();
    }
@@ -80,7 +89,7 @@
     * @param delimiter The delimeter
     * @return The string representation
     */
-   private static String list2String(List<String> list, String delimiter)
+   private static String listToString(List<String> list, String delimiter)
    {
       StringBuilder buffer = new StringBuilder();
       for (String item : list)
@@ -157,7 +166,7 @@
     * @param annotations The annotations
     * @return The string representation
     */
-   public static String annotations2String(Annotation[] annotations)
+   private static String annotationsToString(Annotation[] annotations)
    {
       StringBuilder buffer = new StringBuilder();
       for (Annotation annotation : annotations)
@@ -174,13 +183,13 @@
     * @param field The field
     * @return The string representation
     */
-   public static String field2String(Field field)
+   public static String fieldToString(Field field)
    {
       if (!field.isAccessible())
       {
          field.setAccessible(true);
       }
-      return "  Field " + annotations2String(field.getAnnotations()) + list2String(parseModifiers(field.getModifiers()), " ") + field.getName() + ";\n";
+      return "  Field " + annotationsToString(field.getAnnotations()) + listToString(parseModifiers(field.getModifiers()), " ") + field.getName();
    }
 
    /**
@@ -189,13 +198,13 @@
     * @param method The method
     * @return The string representation
     */
-   public static String method2String(Method method)
+   public static String methodToString(Method method)
    {
       if (!method.isAccessible())
       {
          method.setAccessible(true);
       }
-      return "  Method " + method.getReturnType().getSimpleName() + " " + annotations2String(method.getAnnotations()) + list2String(parseModifiers(method.getModifiers()), " ") + method.getName() + "(" + parameters2String(method.getParameterTypes(), method.getParameterAnnotations(), false) + ");\n";
+      return "  Method " + method.getReturnType().getSimpleName() + " " + annotationsToString(method.getAnnotations()) + listToString(parseModifiers(method.getModifiers()), " ") + method.getName() + "(" + parametersToString(method.getParameterTypes(), method.getParameterAnnotations(), false) + ");\n";
    }
 
    /**
@@ -204,9 +213,9 @@
     * @param annotation The annotation
     * @return The string representation
     */
-   public static String annotation2String(Annotation annotation)
+   public static String annotationToString(Annotation annotation)
    {
-      return "Annotation " + annotations2String(annotation.annotationType().getAnnotations()) + annotation.annotationType().getSimpleName();
+      return "Annotation " + annotationsToString(annotation.annotationType().getAnnotations()) + annotation.annotationType().getSimpleName();
    }
 
    /**
@@ -215,9 +224,9 @@
     * @param constructor The method
     * @return The string representation
     */
-   public static String constructor2String(Constructor<?> constructor)
+   public static String constructorToString(Constructor<?> constructor)
    {
-      return "  Constructor " + annotations2String(constructor.getAnnotations()) + list2String(parseModifiers(constructor.getModifiers()), " ") + constructor.getDeclaringClass().getSimpleName() + "(" + parameters2String(constructor.getParameterTypes(), constructor.getParameterAnnotations(), true) + ");\n";
+      return "  Constructor " + annotationsToString(constructor.getAnnotations()) + listToString(parseModifiers(constructor.getModifiers()), " ") + constructor.getDeclaringClass().getSimpleName() + "(" + parametersToString(constructor.getParameterTypes(), constructor.getParameterAnnotations(), true) + ");\n";
    }
 
    /**
@@ -228,7 +237,7 @@
     * @param annotations The annotation map
     * @return The string representation
     */
-   private static String parameters2String(Class<?>[] parameterTypes, Annotation[][] annotations, boolean constructor)
+   private static String parametersToString(Class<?>[] parameterTypes, Annotation[][] annotations, boolean constructor)
    {
       StringBuilder buffer = new StringBuilder();
       int start = constructor ? 1 : 0;
@@ -238,7 +247,7 @@
          {
             buffer.append(", ");
          }
-         buffer.append(annotations2String(annotations[i]) + type2String(parameterTypes[i]));
+         buffer.append(annotationsToString(annotations[i]) + typeToString(parameterTypes[i]));
       }
       return buffer.toString();
    }
@@ -249,9 +258,9 @@
     * @param clazz The type
     * @return The string representation
     */
-   public static String type2String(Class<?> clazz)
+   private static String typeToString(Class<?> clazz)
    {
-      return annotations2String(clazz.getAnnotations()) + clazz.getName();
+      return annotationsToString(clazz.getAnnotations()) + clazz.getSimpleName();
    }
 
    /**
@@ -260,23 +269,66 @@
     * @param clazz The class
     * @return The string representation
     */
-   public static String class2String(Class<?> clazz)
+   public static String classToString(Class<?> clazz)
    {
       StringBuilder buffer = new StringBuilder();
-      buffer.append("Class " + type2String(clazz) + "\n");
+      buffer.append("Class " + typeToString(clazz) + "\n");
       for (Field field : clazz.getFields())
       {
-         buffer.append(field2String(field));
+         buffer.append(fieldToString(field));
       }
       for (Constructor<?> constructor : clazz.getConstructors())
       {
-         buffer.append(constructor2String(constructor));
+         buffer.append(constructorToString(constructor));
       }
       for (Method method : clazz.getMethods())
       {
-         buffer.append(method2String(method));
+         buffer.append(methodToString(method));
       }
       return buffer.toString();
    }
+   
+   public static String typesToString(Set<Type> types)
+   {
+      StringBuilder buffer = new StringBuilder();
+      int i = 0;
+      buffer.append("[");
+      for (Type type : types)
+      {
+         if (i > 0)
+         {
+            buffer.append(", ");
+         }
+         if (type instanceof Class<?>)
+         {
+            buffer.append(((Class<?>) type).getSimpleName());
+         }
+         else
+         {
+            buffer.append(type.toString());
+         }
+         i++;
+      }
+      buffer.append("]");
+      return buffer.toString();
+   }
+   
+   public static String annotationsToString(Set<Annotation> annotations)
+   {
+      StringBuilder buffer = new StringBuilder();
+      int i = 0;
+      buffer.append("[");
+      for (Annotation annotation : annotations)
+      {
+         if (i > 0)
+         {
+            buffer.append(", ");
+         }
+         buffer.append("@").append(annotation.annotationType().getSimpleName());
+         i++;
+      }
+      buffer.append("]");
+      return buffer.toString();
+   }
 
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Air.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Air.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Air.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -6,8 +6,14 @@
 @ApplicationScoped
 class Air
 {
+   
+   public Air()
+   {
+   
+   }
+   
    @Initializer
-   public Air(Fish fish)
+   public Air(Bird bird)
    {
    }
    

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Bird.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Bird.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Bird.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -7,12 +7,17 @@
 class Bird
 {
    
-   private Water water;
+   private Air air;
    
+   public Bird()
+   {
+      
+   }
+   
    @Initializer
-   public Bird(Water water)
+   public Bird(Air air)
    {
-      this.water = water;
+      this.air = air;
    }
    
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/CircularDependencyTest.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -7,7 +7,7 @@
 {
   
    
-   @Test(groups="broken")
+   @Test(groups="broken", timeOut=1000)
    public void testCircularInjectionOnTwoNormalBeans() throws Exception
    {
       deployBeans(Pig.class, Food.class);
@@ -16,17 +16,46 @@
       assert Food.success;
    }
    
-   @Test(groups="broken")
+   @Test
    public void testCircularInjectionOnOneNormalAndOneDependentBean() throws Exception
    {
       deployBeans(Car.class, Petrol.class);
-      manager.getInstanceByType(Petrol.class).getName();
-      assert Petrol.success;
-      assert Car.success;
+      new RunInDependentContext()
+      {
+
+         @Override
+         protected void execute() throws Exception
+         {
+            manager.getInstanceByType(Car.class).getName();
+            assert Petrol.success;
+            assert Car.success;
+         }
+         
+      }.run();
+      
    }
    
+   @Test
+   public void testCircularInjectionOnOneDependentAndOneNormalBean() throws Exception
+   {
+      deployBeans(Car.class, Petrol.class);
+      new RunInDependentContext()
+      {
+
+         @Override
+         protected void execute() throws Exception
+         {
+            manager.getInstanceByType(Petrol.class).getName();
+            assert Petrol.success;
+            assert Car.success;
+         }
+         
+      }.run();
+      
+   }
    
-   @Test(groups="broken")
+   
+   @Test(timeOut=1000)
    public void testCircularInjectionOnTwoSimpleDependentBeans() throws Exception
    {
       deployBeans(Foo.class, Bar.class);
@@ -44,7 +73,7 @@
       }.run();
    }
    
-   @Test(groups="broken")
+   @Test(groups="broken", timeOut=1000)
    public void testDependentProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean() throws Exception
    {
       deployBeans(DependentSelfConsumingDependentProducer.class);
@@ -124,7 +153,7 @@
       }.run();
    }
    
-   @Test(groups="broken")
+   @Test(groups="broken", timeOut=1000)
    public void testDependentSelfConsumingProducer() throws Exception
    {
       deployBeans(DependentLoopingProducer.class);
@@ -140,7 +169,7 @@
       }.run();
    }
 
-   @Test(groups="broken")
+   @Test(groups="broken", timeOut=1000)
    public void testDependentCircularConstructors() throws Exception
    {
       deployBeans(Water.class, Fish.class);
@@ -156,7 +185,7 @@
       }.run();
    }
    
-   @Test(groups="broken")
+   @Test(timeOut=1000)
    public void testNormalCircularConstructors() throws Exception
    {
       deployBeans(Bird.class, Air.class);
@@ -172,7 +201,7 @@
       }.run();
    }
    
-   @Test(groups="broken")
+   @Test(timeOut=1000)
    public void testNormalAndDependentCircularConstructors() throws Exception
    {
       deployBeans(Space.class, Planet.class);
@@ -188,7 +217,7 @@
       }.run();
    }
    
-   @Test(groups="broken")
+   @Test(groups="broken", timeOut=1000)
    public void testSelfConsumingConstructorsOnDependentBean() throws Exception
    {
       deployBeans(Farm.class);
@@ -204,7 +233,7 @@
       }.run();
    }
    
-   @Test(groups="broken")
+   @Test(timeOut=1000)
    public void testSelfConsumingConstructorsOnNormalBean() throws Exception
    {
       deployBeans(House.class);

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/House.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/House.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/House.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -7,9 +7,20 @@
 class House
 {
    
+   public House()
+   {
+      // TODO Auto-generated constructor stub
+   }
+   
    @Initializer
-   public House(House farm)
+   public House(House house)
    {
+      house.ping();
    }
    
+   private void ping()
+   {
+      
+   }
+   
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Planet.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Planet.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Planet.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -5,12 +5,12 @@
 class Planet
 {
    
-   private Water water;
+   private Space space;
    
    @Initializer
-   public Planet(Water water)
+   public Planet(Space space)
    {
-      this.water = water;
+      this.space = space;
    }
    
 }

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Space.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Space.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Space.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -6,8 +6,14 @@
 @ApplicationScoped
 class Space
 {
+   
+   public Space()
+   {
+      // TODO Auto-generated constructor stub
+   }
+   
    @Initializer
-   public Space(Fish fish)
+   public Space(Planet planet)
    {
    }
    

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Violation.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Violation.java	2009-01-28 14:08:40 UTC (rev 1261)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/unit/lookup/circular/Violation.java	2009-01-28 14:14:12 UTC (rev 1262)
@@ -1,6 +1,8 @@
 package org.jboss.webbeans.test.unit.lookup.circular;
 
-class Violation
+import java.io.Serializable;
+
+class Violation implements Serializable
 {
    
    public void ping()




More information about the weld-commits mailing list