[weld-commits] Weld SVN: r4179 - api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi and 16 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sun Oct 18 08:47:28 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-10-18 08:47:27 -0400 (Sun, 18 Oct 2009)
New Revision: 4179

Added:
   api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
Removed:
   api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java
Modified:
   api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java
   api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java
   core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
   core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java
   core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
   core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
   core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
   core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
   core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
   core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java
   core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
   core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java
   core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java
   core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java
   core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java
   core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java
   core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java
   core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java
   core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
   core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
Log:
introduce @Typed, add support for extracting the resolved generic type, add more explicit cleanup code

Deleted: api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -1,44 +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 javax.enterprise.inject;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Allows the bean types of a bean to be explicitly specified by the user,
- * instead of using the transitive closure of the type hierarchy
- * 
- * @author Pete Muir
- */
-
- at Target( { FIELD, METHOD, TYPE })
- at Retention(RUNTIME)
- at Documented
-public @interface BeanTypes
-{
-
-   Class<?>[] value() default {};
-
-}

Copied: api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java (from rev 3982, api/trunk/cdi/src/main/java/javax/enterprise/inject/BeanTypes.java)
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java	                        (rev 0)
+++ api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,44 @@
+/*
+ * 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 javax.enterprise.inject;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Allows the bean types of a bean to be explicitly specified by the user,
+ * instead of using the transitive closure of the type hierarchy
+ * 
+ * @author Pete Muir
+ */
+
+ at Target( { FIELD, METHOD, TYPE })
+ at Retention(RUNTIME)
+ at Documented
+public @interface Typed
+{
+
+   Class<?>[] value() default {};
+
+}


Property changes on: api/trunk/cdi/src/main/java/javax/enterprise/inject/Typed.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java
===================================================================
--- api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ api/trunk/weld-spi/src/main/java/org/jboss/weld/bootstrap/spi/Deployment.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -19,6 +19,7 @@
 import java.util.Collection;
 
 import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
 
 /**
  * Represents a deployment of a CDI application.
@@ -134,10 +135,13 @@
     * Load the {@link BeanDeploymentArchive} containing the given class.
     * 
     * If the deployment archive containing the given class is not currently a
-    * bean deployment archive, it should be added to the bean deployment archive
+    * bean deployment archive, it must be added to the bean deployment archive
     * graph and returned. If the deployment archive is currently a bean
     * deployment archive it should be returned.
     * 
+    * If beanClass is the bean class of an EJB session bean, an {@link EjbDescriptor}
+    * for the bean must be returned by {@link BeanDeploymentArchive#getEjbs()}.
+    * 
     * @param beanClass the bean class to load
     * @return the {@link BeanDeploymentArchive} containing the bean class
     */

Modified: api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java
===================================================================
--- api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ api/trunk/weld-spi/src/main/java/org/jboss/weld/manager/api/WeldManager.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -21,6 +21,7 @@
 import java.lang.annotation.Annotation;
 
 import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.InjectionTarget;
@@ -66,6 +67,10 @@
     * The injection target for the given EJB, or null if Weld was not
     * given this descriptor in the deployment.
     * 
+    * This should only be used to create an inject contextual EJBs by 
+    * the EJB container. {@link #fireProcessInjectionTarget()} must be used
+    * to obtain an {@link InjectionTarget} for non-contextual EJB injection.
+    * 
     * @param <T>
     * @param descriptor
     * @return
@@ -96,5 +101,20 @@
     * @return
     */
    public ServiceRegistry getServices();
+   
+   /**
+    * Fire a ProcessInjectionTarget event for the given type.
+    * 
+    * A helper method to allow integration code to easily fire the ProcessInjectionTarget
+    * for Java EE component classes supporting injection
+    * 
+    * The container must use the returned InjectionTarget to create, inject, dispose of
+    * and call the lifecycle callbacks for the Java EE components
+    * 
+    * @param <X>
+    * @param type
+    * @return
+    */
+   public <X> InjectionTarget<X> fireProcessInjectionTarget(AnnotatedType<X> type);
 
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -62,9 +62,10 @@
 import org.jboss.weld.bean.SessionBean;
 import org.jboss.weld.bean.proxy.ClientProxyProvider;
 import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.events.AbstractProcessInjectionTarget;
 import org.jboss.weld.context.CreationalContextImpl;
+import org.jboss.weld.context.SerializableContextual;
 import org.jboss.weld.context.WeldCreationalContext;
-import org.jboss.weld.context.SerializableContextual;
 import org.jboss.weld.ejb.EjbDescriptors;
 import org.jboss.weld.ejb.spi.EjbDescriptor;
 import org.jboss.weld.el.Namespace;
@@ -607,7 +608,7 @@
       }
       bindingAnnotations.add(new AnyLiteral());
       Set<ObserverMethod<?, T>> observers = new HashSet<ObserverMethod<?, T>>();
-      Set<ObserverMethod<?,?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new Reflections.HierarchyDiscovery(eventType).getFlattenedTypes(),  bindingAnnotations, null));
+      Set<ObserverMethod<?,?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new Reflections.HierarchyDiscovery(eventType).getTypeClosureAsSet(),  bindingAnnotations, null));
       for (ObserverMethod<?,?> observer : eventObservers)
       {
          observers.add((ObserverMethod<?, T>) observer);
@@ -1399,6 +1400,27 @@
    {
       services.cleanup();
       this.currentInjectionPoint.remove();
+      this.accessibleManagers.clear();
+      this.beanResolver.clear();
+      this.beans.clear();
+      this.childActivities.clear();
+      this.clientProxyProvider.clear();
+      this.contexts.clear();
+      this.currentActivities.clear();
+      this.decoratorResolver.clear();
+      this.decorators.clear();
+      this.enabledDecoratorClasses.clear();
+      this.enabledInterceptorClasses.clear();
+      this.enabledPolicyClasses.clear();
+      this.enabledPolicyStereotypes.clear();
+      this.enterpriseBeans.clear();
+      this.interceptorResolver.clear();
+      this.interceptors.clear();
+      this.nameBasedResolver.clear();
+      this.namespaces.clear();
+      this.observerResolver.clear();
+      this.observers.clear();
+      this.specializedBeans.clear();
    }
 
    public InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> getCdiInterceptorsRegistry()
@@ -1410,4 +1432,9 @@
    {
       return declaredInterceptorsRegistry;
    }
+   
+   public <X> InjectionTarget<X> fireProcessInjectionTarget(AnnotatedType<X> annotatedType)
+   {
+      return AbstractProcessInjectionTarget.fire(this, annotatedType, createInjectionTarget(annotatedType));
+   }
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ContextualStore.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -120,5 +120,6 @@
    public void cleanup()
    {
       contextuals.clear();
+      passivationCapableContextuals.clear();
    }
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -19,13 +19,14 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import javax.decorator.Decorates;
 import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.BeanTypes;
 import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.Typed;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.stereotype.Stereotype;
 import javax.inject.Named;
@@ -46,7 +47,6 @@
 import org.jboss.weld.metadata.cache.MergedStereotypes;
 import org.jboss.weld.metadata.cache.MetaAnnotationStore;
 import org.jboss.weld.util.Reflections;
-import org.jboss.weld.util.collections.Arrays2;
 
 /**
  * An abstract bean representation common for all beans
@@ -174,15 +174,36 @@
     */
    protected void initTypes()
    {
-      if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
+      if (getAnnotatedItem().isAnnotationPresent(Typed.class))
       {
-         types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
+         this.types = getTypedTypes(getAnnotatedItem().getTypeClosureAsMap(), getAnnotatedItem().getJavaClass(), getAnnotatedItem().getAnnotation(Typed.class));
       }
       else
       {
-         types = getAnnotatedItem().getTypeClosure();
+         this.types = getAnnotatedItem().getTypeClosure();
+         if (getType().isInterface())
+         {
+            this.types.add(Object.class);
+         }
       }
    }
+   
+   protected static Set<Type> getTypedTypes(Map<Class<?>, Type> typeClosure, Class<?> rawType, Typed typed)
+   {
+      Set<Type> types = new HashSet<Type>();
+      for (Class<?> specifiedClass : typed.value())
+      {
+         if (!typeClosure.containsKey(specifiedClass))
+         {
+            throw new DefinitionException("@Typed class " + specifiedClass.getName() + " is not present in the type hierarchy " + rawType);
+         }
+         else
+         {
+            types.add(typeClosure.get(specifiedClass));
+         }
+      }
+      return types;
+   }
 
    /**
     * Initializes the binding types

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -30,7 +30,6 @@
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.NormalScope;
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.BeanTypes;
 import javax.enterprise.inject.IllegalProductException;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.InjectionPoint;
@@ -48,7 +47,6 @@
 import org.jboss.weld.util.Beans;
 import org.jboss.weld.util.Names;
 import org.jboss.weld.util.Reflections;
-import org.jboss.weld.util.collections.Arrays2;
 
 /**
  * The implicit producer bean
@@ -90,24 +88,13 @@
    @Override
    protected void initTypes()
    {
-      if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
+      if (getType().isArray() || getType().isPrimitive())
       {
-         types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
-      }
-      else if (getType().isArray() || getType().isPrimitive())
-      {
          Set<Type> types = new HashSet<Type>();
          types.add(getType());
          types.add(Object.class);
          super.types = types;
       }
-      else if (getType().isInterface())
-      {
-         Set<Type> types = new HashSet<Type>();
-         types.add(Object.class);
-         types.addAll(getAnnotatedItem().getTypeClosure());
-         super.types = types;
-      }
       else
       {
          super.initTypes();

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -22,7 +22,10 @@
 import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
+import java.util.Map;
 import java.util.Set;
 
 import javassist.util.proxy.ProxyFactory;
@@ -32,8 +35,8 @@
 import javax.enterprise.context.ApplicationScoped;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Observes;
-import javax.enterprise.inject.BeanTypes;
 import javax.enterprise.inject.CreationException;
+import javax.enterprise.inject.Typed;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.InjectionTarget;
 import javax.interceptor.Interceptor;
@@ -59,7 +62,6 @@
 import org.jboss.weld.resources.ClassTransformer;
 import org.jboss.weld.util.Beans;
 import org.jboss.weld.util.Proxies;
-import org.jboss.weld.util.collections.Arrays2;
 
 /**
  * An enterprise bean representation
@@ -190,19 +192,19 @@
    @Override
    protected void initTypes()
    {
-      if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
+      Map<Class<?>, Type> types = new LinkedHashMap<Class<?>, Type>();
+      for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
       {
-         types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
+         types.put(businessInterfaceDescriptor.getInterface(), businessInterfaceDescriptor.getInterface());
       }
+      if (getAnnotatedItem().isAnnotationPresent(Typed.class))
+      {
+         super.types = getTypedTypes(types, getAnnotatedItem().getJavaClass(), getAnnotatedItem().getAnnotation(Typed.class));
+      }
       else
       {
-         Set<Type> types = new LinkedHashSet<Type>();
-         types.add(Object.class);
-         for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
-         {
-            types.add(businessInterfaceDescriptor.getInterface());
-         }
-         super.types = types;
+         types.put(Object.class, Object.class);
+         super.types = new HashSet<Type>(types.values());
       }
    }
 

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -138,5 +138,10 @@
    {
       return "Proxy pool with " + pool.size() + " proxies";
    }
+   
+   public void clear()
+   {
+      this.pool.clear();
+   }
 
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -42,7 +42,7 @@
 import org.jboss.weld.bean.ee.EEResourceProducerField;
 import org.jboss.weld.bean.ee.PersistenceContextProducerField;
 import org.jboss.weld.bootstrap.events.ProcessBeanImpl;
-import org.jboss.weld.bootstrap.events.ProcessInjectionTargetImpl;
+import org.jboss.weld.bootstrap.events.ProcessBeanInjectionTarget;
 import org.jboss.weld.bootstrap.events.ProcessManagedBeanImpl;
 import org.jboss.weld.bootstrap.events.ProcessObserverMethodImpl;
 import org.jboss.weld.bootstrap.events.ProcessProducerFieldImpl;
@@ -111,7 +111,7 @@
             }
             else if (bean instanceof AbstractClassBean<?>)
             {
-               ProcessInjectionTargetImpl.fire(manager, (AbstractClassBean<?>) bean);
+               ProcessBeanInjectionTarget.fire(manager, (AbstractClassBean<?>) bean);
             }
             if (bean instanceof ManagedBean<?>)
             {

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -79,6 +79,7 @@
    public BeanDeployer addClass(AnnotatedType<?> clazz)
    {
       ClassTransformer classTransformer = Container.instance().deploymentServices().get(ClassTransformer.class);
+      // TODO Discover any @New injection points, and store as newClasses
       classes.add(classTransformer.loadClass(clazz));
       return this;
    }
@@ -112,6 +113,7 @@
             createSimpleBean(clazz);
          }
       }
+      // TODO Iterate over newClasses and add a new bean for each
       for (InternalEjbDescriptor<?> ejbDescriptor : getEnvironment().getEjbDescriptors())
       {
          createEnterpriseBean(ejbDescriptor);

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -128,6 +128,8 @@
       log.debug("Enabled interceptor types for "  + beanManager + ": " + beanManager.getEnabledInterceptorClasses());
    }
    
+   // TODO Move class stuff into startContainer phase
+   // TODO read EJB descriptors after reading classes
    public void deployBeans(Environment environment)
    {
       for (ExtensionBean bean : extensionBeanDeployerEnvironment.getBeans())

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -268,6 +268,7 @@
          // Add the Deployment BeanManager Bean to the Deployment BeanManager
          deploymentManager.addBean(new ManagerBean(deploymentManager));
          
+         // TODO keep a list of new bdas, add them all in, and deploy beans for them, then merge into existing
          BeforeBeanDiscoveryImpl.fire(deploymentManager, deployment, beanDeployments, extensionDeployerEnvironment);
       }
       return this;
@@ -277,6 +278,7 @@
    {
       synchronized (this)
       {
+         // TODO keep a list of new bdas, add them all in, and deploy beans for them, then merge into existing
          for (Entry<BeanDeploymentArchive, BeanDeployment> entry : beanDeployments.entrySet())
          {
             entry.getValue().deployBeans(environment);
@@ -302,6 +304,7 @@
 
    public Bootstrap endInitialization()
    {
+      // TODO rebuild the manager accessibility graph if the bdas have changed
       synchronized (this)
       {
          // Register the managers so external requests can handle them

Added: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java	                        (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,51 @@
+package org.jboss.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+
+public abstract class AbstractProcessInjectionTarget<T> extends AbstractDefinitionContainerEvent
+{
+
+   public static <X> void fire(BeanManagerImpl beanManager, AbstractClassBean<X> bean)
+   {
+      new ProcessBeanInjectionTarget<X>(beanManager, bean) {}.fire();
+   }
+   
+   public static <X> InjectionTarget<X> fire(BeanManagerImpl beanManager, AnnotatedType<X> annotatedType, InjectionTarget<X> injectionTarget)
+   {
+      ProcessSimpleInjectionTarget<X> processSimpleInjectionTarget = new ProcessSimpleInjectionTarget<X>(beanManager, annotatedType, injectionTarget) {};
+      processSimpleInjectionTarget.fire();
+      return processSimpleInjectionTarget.getInjectionTarget();
+   }
+
+   protected final AnnotatedType<T> annotatedType;
+
+   public AbstractProcessInjectionTarget(BeanManagerImpl beanManager, AnnotatedType<T> annotatedType)
+   {
+      super(beanManager, ProcessInjectionTarget.class, new Type[] {annotatedType.getBaseType() });
+      this.annotatedType = annotatedType;
+   }
+
+   public void addDefinitionError(Throwable t)
+   {
+      getErrors().add(t);
+   }
+
+   public List<Throwable> getDefinitionErrors()
+   {
+      return super.getErrors();
+   }
+
+   public AnnotatedType<T> getAnnotatedType()
+   {
+      return annotatedType;
+   }
+
+}
\ No newline at end of file


Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Copied: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java (from rev 4164, core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java	                        (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,31 @@
+package org.jboss.weld.bootstrap.events;
+
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+
+
+public class ProcessBeanInjectionTarget<T> extends AbstractProcessInjectionTarget<T> implements ProcessInjectionTarget<T>
+{
+   
+   private final AbstractClassBean<T> classBean;
+
+   public ProcessBeanInjectionTarget(BeanManagerImpl beanManager, AbstractClassBean<T> bean)
+   {
+      super(beanManager, bean.getAnnotatedItem());
+      this.classBean = bean;
+   }
+
+   public InjectionTarget<T> getInjectionTarget()
+   {
+      return classBean.getInjectionTarget();
+   }
+
+   public void setInjectionTarget(InjectionTarget<T> injectionTarget)
+   {
+      classBean.setInjectionTarget(injectionTarget);
+   }
+
+}


Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Deleted: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -1,57 +0,0 @@
-package org.jboss.weld.bootstrap.events;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.bean.AbstractClassBean;
-
-
-public class ProcessInjectionTargetImpl<T> extends AbstractDefinitionContainerEvent implements ProcessInjectionTarget<T>
-{
-   
-   public static <X> void fire(BeanManagerImpl beanManager, AbstractClassBean<X> bean)
-   {
-      new ProcessInjectionTargetImpl<X>(beanManager, bean.getAnnotatedItem(), bean) {}.fire();
-   }
-   
-   private final AnnotatedType<T> annotatedType;
-   private AbstractClassBean<T> classBean;
-
-   public ProcessInjectionTargetImpl(BeanManagerImpl beanManager, AnnotatedType<T> annotatedType, AbstractClassBean<T> bean)
-   {
-      super(beanManager, ProcessInjectionTarget.class, new Type[] { bean.getAnnotatedItem().getBaseType() });
-      this.classBean = bean;
-      this.annotatedType = annotatedType;
-   }
-
-   public void addDefinitionError(Throwable t)
-   {
-      getErrors().add(t);
-   }
-   
-   public List<Throwable> getDefinitionErrors()
-   {
-      return super.getErrors();
-   }
-
-   public AnnotatedType<T> getAnnotatedType()
-   {
-      return annotatedType;
-   }
-
-   public InjectionTarget<T> getInjectionTarget()
-   {
-      return classBean.getInjectionTarget();
-   }
-
-   public void setInjectionTarget(InjectionTarget<T> injectionTarget)
-   {
-      classBean.setInjectionTarget(injectionTarget);
-   }
-
-}

Added: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java	                        (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -0,0 +1,30 @@
+package org.jboss.weld.bootstrap.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.jboss.weld.BeanManagerImpl;
+
+
+public class ProcessSimpleInjectionTarget<T> extends AbstractProcessInjectionTarget<T> implements ProcessInjectionTarget<T>
+{
+   
+   private InjectionTarget<T> injectionTarget;
+
+   public ProcessSimpleInjectionTarget(BeanManagerImpl beanManager, AnnotatedType<T> annotatedType, InjectionTarget<T> injectionTarget)
+   {
+      super(beanManager, annotatedType);
+   }
+
+   public InjectionTarget<T> getInjectionTarget()
+   {
+      return injectionTarget;
+   }
+
+   public void setInjectionTarget(InjectionTarget<T> injectionTarget)
+   {
+      this.injectionTarget = injectionTarget;
+   }
+
+}


Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSimpleInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:eol-style
   + native

Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractMapContext.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -75,7 +75,7 @@
       }
       if (getBeanStore() == null)
       {
-         throw new IllegalStateException("No bean store available for " + toString());
+         return null;
       }
       if (contextual == null)
       {

Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/AbstractThreadLocalMapContext.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -63,6 +63,13 @@
    }
    
    @Override
+   public void destroy()
+   {
+      super.destroy();
+      this.beanStore.remove();
+   }
+   
+   @Override
    public void cleanup()
    {
       super.cleanup();

Modified: core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ejb/EjbDescriptors.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -150,6 +150,10 @@
       return ejbs.values().iterator();
    }
    
-   public void cleanup() {}
+   public void cleanup() 
+   {
+      this.ejbClasses.clear();
+      this.ejbs.clear();
+   }
 
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/el/Namespace.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -123,5 +123,10 @@
    {
       return "Namespace(" + ( name==null ? "Root" : name ) + ')';
    }
+   
+   public void clear()
+   {
+      
+   }
 
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -18,6 +18,7 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
+import java.util.Map;
 import java.util.Set;
 
 /**
@@ -45,6 +46,11 @@
    {
       return delegate().getMetaAnnotationsAsArray(metaAnnotationType);
    }
+   
+   public Map<Class<?>, Type> getTypeClosureAsMap()
+   {
+      return delegate().getTypeClosureAsMap();
+   }
 
    @Deprecated
    public Set<Annotation> getQualifiers()

Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -20,6 +20,7 @@
 import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import javax.enterprise.context.NormalScope;
@@ -52,6 +53,8 @@
     *         are no matches.
     */
    public Set<Annotation> getMetaAnnotations(Class<? extends Annotation> metaAnnotationType);
+   
+   public Map<Class<?>, Type> getTypeClosureAsMap();
 
    /**
     * Gets all annotations which are declared on this annotated item with the

Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -21,12 +21,14 @@
 import java.lang.reflect.Type;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import org.jboss.weld.introspector.AnnotationStore;
 import org.jboss.weld.introspector.WeldAnnotated;
 import org.jboss.weld.util.Proxies;
 import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.Reflections.HierarchyDiscovery;
 import org.jboss.weld.util.collections.Arrays2;
 
 /**
@@ -59,7 +61,8 @@
    private final Class<T> rawType;
    private final Type[] actualTypeArguments; 
    private final Type type;
-   private final Set<Type> flattenedTypes;
+   private final Map<Class<?>, Type> typeClosureAsMap;
+   private final Set<Type> typeClosureAsSet;
    private final Set<Type> interfaceOnlyFlattenedTypes;
    private final boolean proxyable;
    private final boolean _parameterizedType;
@@ -87,13 +90,15 @@
          this.actualTypeArguments = new Type[0];
       }
       this._parameterizedType = Reflections.isParameterizedType(rawType);
-      this.flattenedTypes = new Reflections.HierarchyDiscovery(type).getFlattenedTypes();
+      HierarchyDiscovery discovery = new Reflections.HierarchyDiscovery(type);
       this.interfaceOnlyFlattenedTypes = new HashSet<Type>();
       for (Type t : rawType.getGenericInterfaces())
       {
-         interfaceOnlyFlattenedTypes.addAll(new Reflections.HierarchyDiscovery(t).getFlattenedTypes());
+         interfaceOnlyFlattenedTypes.addAll(new Reflections.HierarchyDiscovery(t).getTypeClosureAsSet());
       }
-      this.proxyable = Proxies.isTypesProxyable(flattenedTypes);
+      this.typeClosureAsSet = discovery.getTypeClosureAsSet();
+      this.typeClosureAsMap = discovery.getTypeClosureAsMap();
+      this.proxyable = Proxies.isTypesProxyable(typeClosureAsSet);
    }
 
    public AbstractWeldAnnotated(AnnotationStore annotatedItemHelper)
@@ -103,7 +108,8 @@
       this.type = null;
       this.actualTypeArguments = new Type[0];
       this._parameterizedType = false;
-      this.flattenedTypes = null;
+      this.typeClosureAsMap = null;
+      this.typeClosureAsSet = null;
       this.interfaceOnlyFlattenedTypes = null;
       this.proxyable = false;
    }
@@ -263,7 +269,12 @@
 
    public Set<Type> getTypeClosure()
    {
-      return Collections.unmodifiableSet(flattenedTypes);
+      return typeClosureAsSet;
    }
+   
+   public Map<Class<?>, Type> getTypeClosureAsMap()
+   {
+      return typeClosureAsMap;
+   }
 
 }
\ No newline at end of file

Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/TypeStore.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -65,6 +65,9 @@
       this.extraAnnotations.get(annotationType).addAll(annotations);
    }
    
-   public void cleanup() {}
+   public void cleanup() 
+   {
+      this.extraAnnotations.clear();
+   }
 
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/metadata/cache/MetaAnnotationStore.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -132,9 +132,10 @@
    
    public void cleanup() 
    {
-      bindingTypes.clear();
-      scopes.clear();
-      stereotypes.clear();
+      this.bindingTypes.clear();
+      this.scopes.clear();
+      this.stereotypes.clear();
+      this.interceptorBindings.clear();
    }
 
    public <T extends Annotation> InterceptorBindingModel getInterceptorBindingModel(final Class<T> interceptorBinding)

Modified: core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resources/ClassTransformer.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -35,7 +35,6 @@
    private final ConcurrentCache<Class<?>, WeldClass<?>> classes;
    private final ConcurrentCache<AnnotatedType<?>, WeldClass<?>> annotatedTypes;
    private final ConcurrentCache<Class<?>, WeldAnnotation<?>> annotations;
-   private final ClassTransformer transformer = this;
    private final TypeStore typeStore;
 
    /**
@@ -51,6 +50,7 @@
 
    public <T> WeldClass<T> loadClass(final Class<T> clazz)
    {
+      final ClassTransformer transformer = this;
       return classes.putIfAbsent(clazz, new Callable<WeldClass<T>>()
       {
 
@@ -64,6 +64,7 @@
    
    public <T> WeldClass<T> loadClass(final AnnotatedType<T> clazz)
    {
+      final ClassTransformer transformer = this;
       return annotatedTypes.putIfAbsent(clazz, new Callable<WeldClass<T>>()
       {
 
@@ -77,8 +78,10 @@
 
    public <T extends Annotation> WeldAnnotation<T> loadAnnotation(final Class<T> clazz)
    {
+      final ClassTransformer transformer = this;
       return annotations.putIfAbsent(clazz, new Callable<WeldAnnotation<T>>()
       {
+         
          public WeldAnnotation<T> call() throws Exception
          {
             return WeldAnnotationImpl.of(clazz, transformer);
@@ -94,9 +97,9 @@
    
    public void cleanup() 
    {
-      annotatedTypes.clear();
-      annotations.clear();
-      classes.clear();
+      this.annotatedTypes.clear();
+      this.annotations.clear();
+      this.classes.clear();
    }
 
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -33,7 +33,9 @@
 import java.lang.reflect.WildcardType;
 import java.security.AccessControlException;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
 import javax.inject.Qualifier;
@@ -63,31 +65,51 @@
 
       private final Type type;
 
-      private Set<Type> types;
+      private Map<Class<?>, Type> typeMap;
+      private Set<Type> typeSet;
 
       public HierarchyDiscovery(Type type)
       {
          this.type = type;
       }
 
-      protected void add(Type type)
+      protected void add(Class<?> clazz, Type type)
       {
-         types.add(type);
+         typeSet.add(type);
+         if (clazz != null)
+         {
+            typeMap.put(clazz, type);
+         }
       }
 
-      public Set<Type> getFlattenedTypes()
+      public Set<Type> getTypeClosureAsSet()
       {
-         if (types == null)
+         if (typeSet == null)
          {
-            this.types = new HashSet<Type>();
-            discoverTypes(type);
+            init();
          }
-         return types;
+         return typeSet;
       }
+      
+      public Map<Class<?>, Type> getTypeClosureAsMap()
+      {
+         if (typeMap == null)
+         {
+            init();
+         }
+         return typeMap;
+      }
+      
+      private void init()
+      {
+         this.typeSet = new HashSet<Type>();
+         this.typeMap = new HashMap<Class<?>, Type>();
+         discoverTypes(type);
+      }
 
       public Type getResolvedType()
       {
-         if (type instanceof Class)
+         if (type instanceof Class<?>)
          {
             Class<?> clazz = (Class<?>) type;
             return resolveType(clazz);
@@ -99,23 +121,25 @@
       {
          if (type != null)
          {
-            if (type instanceof Class)
+            if (type instanceof Class<?>)
             {
                Class<?> clazz = (Class<?>) type;
-               add(resolveType(clazz));
+               add(clazz, resolveType(clazz));
                discoverFromClass(clazz);
             }
             else
             {
+               Class<?> clazz = null;
                if (type instanceof ParameterizedType)
                {
                   Type rawType = ((ParameterizedType) type).getRawType();
-                  if (rawType instanceof Class)
+                  if (rawType instanceof Class<?>)
                   {
                      discoverFromClass((Class<?>) rawType);
+                     clazz = (Class<?>) rawType;
                   }
                }
-               add(type);
+               add(clazz, type);
             }
          }
       }
@@ -464,12 +488,6 @@
       return false;
    }
 
-   public static Set<Type> createTypeClosure(Class<?> rawType, Type[] actualTypeArguments)
-   {
-      Type type = new ParameterizedTypeImpl(rawType, actualTypeArguments, rawType.getDeclaringClass());
-      return new HierarchyDiscovery(type).getFlattenedTypes();
-   }
-
    /**
     * Invokes a method and wraps exceptions
     * 

Modified: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java	2009-10-18 12:44:56 UTC (rev 4178)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java	2009-10-18 12:47:27 UTC (rev 4179)
@@ -10,8 +10,8 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
-import javax.enterprise.inject.BeanTypes;
 import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Typed;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -59,7 +59,7 @@
     * 
     * @return
     */
-   @Produces @BeanTypes(DriversSeat.class)
+   @Produces @Typed(DriversSeat.class)
    public DriversSeat produceDriversSeat()
    {
       return driversSeat.newInstance().produce().inject().get();
@@ -89,7 +89,7 @@
    /**
     * Producer method for bean with default qualifiers and type SpareTire only
     */
-   @Produces @BeanTypes(SpareTire.class)
+   @Produces @Typed(SpareTire.class)
    public SpareTire produceSpareTire()
    {
       return spareTire.newInstance().produce().inject().get();



More information about the weld-commits mailing list