openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r754548 - in /incubator/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/util/ test/java/org/apache/w...
Date Sat, 14 Mar 2009 23:28:02 GMT
Author: gerdogdu
Date: Sat Mar 14 23:28:00 2009
New Revision: 754548

URL: http://svn.apache.org/viewvc?rev=754548&view=rev
Log:
Updating for TCK tests.

Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java?rev=754548&r1=754547&r2=754548&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
Sat Mar 14 23:28:00 2009
@@ -19,6 +19,8 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 
 import javax.context.CreationalContext;
 import javax.context.Dependent;
@@ -112,6 +114,23 @@
 
     }
     
+    public Type[] getActualTypeArguments()
+    {
+        Type type = producerField.getGenericType();
+        if (type instanceof ParameterizedType)
+        {
+            ParameterizedType pType = (ParameterizedType) type;
+            return pType.getActualTypeArguments();
+        }
+
+        else
+        {
+            return new Type[0];
+        }
+
+    }
+    
+    
     @SuppressWarnings("unchecked")
     protected <K> void destroyBean(Bean<?> bean, Object instance)
     {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=754548&r1=754547&r2=754548&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
Sat Mar 14 23:28:00 2009
@@ -102,16 +102,9 @@
             }
         }
 
-        if (!found && (component instanceof IComponentHasParent))
-        {
-            IComponentHasParent child = (IComponentHasParent) component;
-            component.setType(child.getParent().getType());
-            found = true;
-        }
-
         if (!found)
         {
-            // Look inherited meta-data deplyment type
+            // Look inherited meta-data deployment type
             IBeanInheritedMetaData metadata = component.getInheritedMetaData();
             if (metadata != null)
             {
@@ -129,17 +122,29 @@
             // Look stereotype
             Annotation result = WebBeansUtil.getMaxPrecedenceSteroTypeDeploymentType(component);
 
-            // Default @Production
             if (result == null)
             {
-                component.setType(new ProductionLiteral());
-
+                //From parent
+                if (!found && (component instanceof IComponentHasParent))
+                {
+                    IComponentHasParent child = (IComponentHasParent) component;
+                    component.setType(child.getParent().getType());
+                }
+                
+                else
+                {
+                    component.setType(new ProductionLiteral());
+                    found = true;    
+                }
+                
             }
             else
             {
                 component.setType(result);
+                found = true;
             }
         }
+                
 
         return component.getDeploymentType();
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=754548&r1=754547&r2=754548&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
Sat Mar 14 23:28:00 2009
@@ -15,6 +15,7 @@
 
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=754548&r1=754547&r2=754548&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Sat Mar 14 23:28:00 2009
@@ -29,6 +29,7 @@
 import org.apache.webbeans.component.InstanceComponentImpl;
 import org.apache.webbeans.component.ObservableComponentImpl;
 import org.apache.webbeans.component.ProducerComponentImpl;
+import org.apache.webbeans.component.ProducerFieldComponent;
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
@@ -253,8 +254,18 @@
                                 {
                                     results.add((Bean<T>) component);
                                     break;
-                                }
+                                }                                                       
        
+                            }
+                            else if(component instanceof ProducerFieldComponent)
+                            {
+                                ProducerFieldComponent<?> pf = (ProducerFieldComponent<?>)component;
+                                actualArgs = pf.getActualTypeArguments();
                                 
+                                if (Arrays.equals(actualArgs, actualTypeArguments))
+                                {
+                                    results.add((Bean<T>) component);
+                                    break;
+                                }
                                 
                             }
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=754548&r1=754547&r2=754548&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Sat Mar 14 23:28:00 2009
@@ -1249,11 +1249,14 @@
             {
                 AbstractComponent<?> candidate = (AbstractComponent<?>)candidates;
                 
-                if(candidate.getReturnType().equals(superClass))
+                if(!(candidate instanceof NewComponentImpl))
                 {
-                    superBean = candidates;
-                    break;
-                }
+                    if(candidate.getReturnType().equals(superClass))
+                    {
+                        superBean = candidates;
+                        break;
+                    }                    
+                }                
             }
                         
             if (superBean != null)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java?rev=754548&r1=754547&r2=754548&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/specializes/SpecializationComponentTest.java
Sat Mar 14 23:28:00 2009
@@ -46,6 +46,8 @@
     @Test
     public void testMockService()
     {
+        clear();
+        
         ContextFactory.initRequestContext(null);
         
         Bean<MockSpecializesService> bean1 = defineSimpleWebBean(MockSpecializesService.class);



Mime
View raw message