openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r915422 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/inject/ main/java/org/apache/webbeans/...
Date Tue, 23 Feb 2010 16:43:59 GMT
Author: gerdogdu
Date: Tue Feb 23 16:43:59 2010
New Revision: 915422

URL: http://svn.apache.org/viewvc?rev=915422&view=rev
Log:
API type update for generic types.

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java
  (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java
  (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/tests/ApiTypeTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
Tue Feb 23 16:43:59 2010
@@ -23,22 +23,23 @@
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.util.TypeLiteral;
+import javax.inject.Provider;
 
 import org.apache.webbeans.inject.instance.InstanceFactory;
 
-public class InstanceBean<T> extends AbstractOwbBean<Instance<T>>
+public class InstanceBean<T> extends AbstractOwbBean<Provider<T>>
 {
     public static ThreadLocal<InjectionPoint> local = new ThreadLocal<InjectionPoint>();
     
     @SuppressWarnings("serial")
     public InstanceBean()
     {
-        super(WebBeansType.INSTANCE, new TypeLiteral<Instance<T>>(){}.getRawType());
       
+        super(WebBeansType.INSTANCE, new TypeLiteral<Provider<T>>(){}.getRawType());
       
     }
     
          
     @Override
-    protected Instance<T> createInstance(CreationalContext<Instance<T>>
creationalContext)
+    protected Provider<T> createInstance(CreationalContext<Provider<T>>
creationalContext)
     {
         try
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Tue Feb 23 16:43:59 2010
@@ -349,9 +349,10 @@
         if (classIndex != null)
         {
             for(Class<?> implClass : classIndex)
-            {
+            {               
                 if (ManagedBeanConfigurator.isManagedBean(implClass))
                 {
+                    ManagedBeanConfigurator.checkManagedBeanCondition(implClass);
                     defineManagedBean(implClass);
                 }
                 else if(this.discoverEjb)
@@ -359,8 +360,7 @@
                     if(EJBWebBeansConfigurator.isSessionBean(implClass))
                     {
                         logger.info(OWBLogConst.INFO_0010, new Object[]{implClass.getName()});
-                        defineEnterpriseWebBean(implClass);
-                        
+                        defineEnterpriseWebBean(implClass);                        
                     }
                 }
             }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
Tue Feb 23 16:43:59 2010
@@ -1074,7 +1074,7 @@
     public static <T> void defineSerializable(AbstractOwbBean<T> component)
     {
         Asserts.assertNotNull(component, "component parameter can not be null");
-        if (ClassUtil.isAssignable(Serializable.class, component.getReturnType()))
+        if (ClassUtil.isClassAssignable(Serializable.class, component.getReturnType()))
         {
             component.setSerializable(true);
         }

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java?rev=915422&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
Tue Feb 23 16:43:59 2010
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.webbeans.config;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+public class OwbParametrizedTypeImpl implements ParameterizedType
+{
+    private Class<?> clazz;
+    
+    public OwbParametrizedTypeImpl(Class<?> clazz)
+    {
+        this.clazz = clazz;
+    }
+    
+    @Override
+    public Type[] getActualTypeArguments()
+    {
+        return clazz.getTypeParameters();
+    }
+
+    @Override
+    public Type getOwnerType()
+    {
+        return null;
+    }
+
+    @Override
+    public Type getRawType()
+    {
+        return this.clazz;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((clazz == null) ? 0 : clazz.hashCode());
+        return result;
+    }
+
+    /* (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        OwbParametrizedTypeImpl other = (OwbParametrizedTypeImpl) obj;
+        if (clazz == null)
+        {
+            if (other.clazz != null)
+                return false;
+        }
+        else if (!clazz.equals(other.clazz))
+            return false;
+        return true;
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OwbParametrizedTypeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Tue Feb 23 16:43:59 2010
@@ -19,6 +19,7 @@
 package org.apache.webbeans.container;
 
 import java.io.InputStream;
+import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -98,8 +99,10 @@
  * @see BeanManager 
  */
 @SuppressWarnings("unchecked")
-public class BeanManagerImpl implements BeanManager, Referenceable
+public class BeanManagerImpl implements BeanManager, Referenceable, Serializable
 {
+    private static final long serialVersionUID = 1L;
+
     /**Holds the context with key scope*/
     private static Map<Class<? extends Annotation>, List<Context>> contextMap
= new ConcurrentHashMap<Class<? extends Annotation>, List<Context>>();
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
Tue Feb 23 16:43:59 2010
@@ -20,9 +20,9 @@
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Event;
-import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Provider;
 
 import org.apache.webbeans.component.EventBean;
 import org.apache.webbeans.component.InjectionPointBean;
@@ -125,7 +125,7 @@
             ParameterizedType pt = (ParameterizedType) type;            
             Class<?> clazz = (Class<?>) pt.getRawType();
             
-            if(clazz.isAssignableFrom(Instance.class))
+            if(Provider.class.isAssignableFrom(clazz))
             {
                 return true;
             }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
Tue Feb 23 16:43:59 2010
@@ -41,8 +41,11 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.enterprise.event.Event;
 import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Provider;
 
+import org.apache.webbeans.config.OwbParametrizedTypeImpl;
 import org.apache.webbeans.exception.WebBeansException;
 
 /**
@@ -791,7 +794,7 @@
             ParameterizedType ptBean = (ParameterizedType)beanType;
             Class<?> clazzBeanType = (Class<?>)ptBean.getRawType();
             Class<?> clazzReqType = (Class<?>)requiredType;
-            if(isAssignable(clazzReqType, clazzBeanType ))
+            if(isClassAssignable(clazzReqType, clazzBeanType ))
             {
                 Type[]  beanTypeArgs = ptBean.getActualTypeArguments();               
                 for(Type actual : beanTypeArgs)
@@ -833,11 +836,15 @@
             ParameterizedType ptReq = (ParameterizedType)requiredType;
             Class<?> clazzReqType = (Class<?>)ptReq.getRawType();
             
-            if(isAssignable(clazzReqType, clazzBeanType))
+            if(Provider.class.isAssignableFrom(clazzReqType) ||
+                    Event.class.isAssignableFrom(clazzReqType))
             {
-                return true;
+                if(isClassAssignable(clazzReqType, clazzBeanType))
+                {
+                    return true;
+                }    
             }
-            
+                        
             return false;
         }
         else
@@ -875,7 +882,7 @@
             ParameterizedType ptEvent = (ParameterizedType)eventType;
             Class<?> eventClazz = (Class<?>)ptEvent.getRawType();
             
-            if(isAssignable(clazzBeanType, eventClazz))
+            if(isClassAssignable(clazzBeanType, eventClazz))
             {
                 return true;
             }
@@ -884,7 +891,7 @@
         }
         else if(observerType instanceof Class && eventType instanceof Class)
         {
-            return isAssignable((Class<?>)observerType, (Class<?>) eventType);
+            return isClassAssignable((Class<?>)observerType, (Class<?>) eventType);
         }
         
         return false;
@@ -899,7 +906,7 @@
      * @param rhs right hand side class
      * @return true if rhs is assignable to lhs
      */
-    public static boolean isAssignable(Class<?> lhs, Class<?> rhs)
+    public static boolean isClassAssignable(Class<?> lhs, Class<?> rhs)
     {
         Asserts.assertNotNull(lhs, "lhs parameter can not be null");
         Asserts.assertNotNull(rhs, "rhs parameter can not be null");
@@ -935,7 +942,7 @@
         Class<?> beanRawType = (Class<?>) beanType.getRawType();
         Class<?> requiredRawType = (Class<?>) requiredType.getRawType();
 
-        if (ClassUtil.isAssignable(requiredRawType,beanRawType))
+        if (ClassUtil.isClassAssignable(requiredRawType,beanRawType))
         {
             //Bean api type actual type arguments
             Type[] beanTypeArgs = beanType.getActualTypeArguments();
@@ -987,7 +994,7 @@
             }      
             else if((beanTypeArg instanceof Class) && (requiredTypeArg instanceof
Class))
             {
-                if(isAssignable(beanTypeArg, requiredTypeArg))
+                if(isClassAssignable((Class<?>)requiredTypeArg,(Class<?>)beanTypeArg))
                 {
                     return true;
                 }
@@ -1560,11 +1567,16 @@
     {
         Class<?> raw = getClazz(clazz);
         
-        if (raw == null) {
+        if (raw == null) 
+        {
             return null;
         }
         
         set.add(clazz);
+        if(ClassUtil.isDefinitionConstainsTypeVariables(raw))
+        {
+            set.add(new OwbParametrizedTypeImpl(raw));
+        }
 
         Type sc = raw.getGenericSuperclass();
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Tue Feb 23 16:43:59 2010
@@ -319,7 +319,7 @@
         Asserts.nullCheckForClass(clazz, "Class is null");
         
         int modifier = clazz.getModifiers();
-
+        
         if (!ClassUtil.isStatic(modifier) && ClassUtil.isInnerClazz(clazz))
             throw new WebBeansConfigurationException("Bean implementation class : " + clazz.getName()
+ " can not be non-static inner class");
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
Tue Feb 23 16:43:59 2010
@@ -952,7 +952,7 @@
                 {
                     Class<?> xmlType = typeList.get(j);
 
-                    if (ClassUtil.isAssignable(parameterType, xmlType))
+                    if (ClassUtil.isClassAssignable(parameterType, xmlType))
                     {
                         if (!ok)
                         {
@@ -1089,7 +1089,7 @@
             else
             {
                 Class<?> directChildType = XMLUtil.getElementJavaType(directChild);
-                if (!ClassUtil.isAssignable(field.getType(), directChildType))
+                if (!ClassUtil.isClassAssignable(field.getType(), directChildType))
                 {
                     throw new WebBeansConfigurationException(createConfigurationFailedMessage()
+ "Declared field type is not assignable to class field type");
                 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/tests/ApiTypeTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/tests/ApiTypeTest.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/tests/ApiTypeTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/apiTypes/tests/ApiTypeTest.java
Tue Feb 23 16:43:59 2010
@@ -43,7 +43,7 @@
         DefinitionUtil.defineApiTypes(bean, ApiTypeBean.class);
         
         Set<Type> type = bean.getTypes();
-        Assert.assertEquals(5, type.size());
+        Assert.assertEquals(7, type.size());
     }
 
 }

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java?rev=915422&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java
Tue Feb 23 16:43:59 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.webbeans.newtests.injection.typeliteral;
+
+class Pencil<T>
+{
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Pencil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java?rev=915422&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
Tue Feb 23 16:43:59 2010
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.webbeans.newtests.injection.typeliteral;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.TypeLiteral;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.InjectionPointMetaDataOwner;
+import org.apache.webbeans.newtests.injection.injectionpoint.beans.LoggerInjectedBean;
+import org.junit.Test;
+
+public class TypeLiteralTest extends AbstractUnitTest
+{
+    @SuppressWarnings("serial")
+    @Test
+    public void testDependentProducerMethodInjectionPoint()
+    {
+        Collection<URL> beanXmls = new ArrayList<URL>();
+        
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(Pencil.class);
+        beanClasses.add(XXPencil.class);
+        beanClasses.add(YYPencil.class);
+        
+        startContainer(beanClasses, beanXmls);    
+                
+        Set<Bean<?>> bean = getBeanManager().getBeans(new TypeLiteral<Pencil<Ypencil>>(){}.getType(),
new Annotation[0]);
+        System.out.println(bean.size());
+        
+        shutDownContainer();
+
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/TypeLiteralTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java?rev=915422&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java
Tue Feb 23 16:43:59 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.webbeans.newtests.injection.typeliteral;
+
+public class XXPencil extends Pencil<Xpencil>
+{
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/XXPencil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java?rev=915422&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java
Tue Feb 23 16:43:59 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.webbeans.newtests.injection.typeliteral;
+
+public interface Xpencil
+{
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Xpencil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java?rev=915422&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java
Tue Feb 23 16:43:59 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.webbeans.newtests.injection.typeliteral;
+
+public class YYPencil extends Pencil<Ypencil>
+{
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/YYPencil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java?rev=915422&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java
Tue Feb 23 16:43:59 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.webbeans.newtests.injection.typeliteral;
+
+public interface Ypencil extends Xpencil
+{
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/typeliteral/Ypencil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/clazz/ClazzTest.java
Tue Feb 23 16:43:59 2010
@@ -30,7 +30,7 @@
         Set<Type> set = new HashSet<Type>();
         ClassUtil.setTypeHierarchy(set, Student.class);
 
-        Assert.assertEquals(5, set.size());
+        Assert.assertEquals(8, set.size());
 
     }
 
@@ -41,7 +41,7 @@
 
         ClassUtil.setTypeHierarchy(set, Student2.class);
 
-        Assert.assertEquals(4, set.size());
+        Assert.assertEquals(6, set.size());
 
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java?rev=915422&r1=915421&r2=915422&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/TypedComponentTest.java
Tue Feb 23 16:43:59 2010
@@ -53,7 +53,6 @@
         defineManagedBean(TypedComponent.class);
         List<AbstractOwbBean<?>> list = getComponents();
 
-        @SuppressWarnings("unused")
         Set<Bean<?>> beans= getManager().resolveByType(TypedComponentTest.class.getDeclaredField("s").getType(),
new Default()
         {
 
@@ -65,7 +64,7 @@
 
         });
 
-        Assert.assertTrue(beans.size() == 0 ? true : false);
+        Assert.assertTrue(beans.size() == 1 ? true : false);
     }
 
 }



Mime
View raw message