openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1590655 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: container/InjectionResolver.java util/GenericsUtil.java
Date Mon, 28 Apr 2014 14:29:22 GMT
Author: arne
Date: Mon Apr 28 14:29:22 2014
New Revision: 1590655

URL: http://svn.apache.org/r1590655
Log:
OWB-948: Fixed @New handling

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1590655&r1=1590654&r2=1590655&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Mon Apr 28 14:29:22 2014
@@ -802,9 +802,19 @@ public class InjectionResolver
             }
         }
 
-        if (result.isEmpty() && annotations.length == 1 && New.class.equals(annotations[0].annotationType())
&& Class.class.isInstance(type))
+        if (result.isEmpty() && annotations.length == 1 && New.class.equals(annotations[0].annotationType()))
         { // happen in TCKs, shouldn't be the case in real apps
-            result.add(webBeansContext.getWebBeansUtil().createNewComponent(Class.class.cast(type)));
+            New newQualifier = (New)annotations[0];
+            Class<?> beanClass;
+            if (newQualifier.value() != New.class)
+            {
+                beanClass = newQualifier.value(); 
+            }
+            else
+            {
+                beanClass = GenericsUtil.getRawType(type);
+            }
+            result.add(webBeansContext.getWebBeansUtil().createNewComponent(beanClass));
         }
 
         return result;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java?rev=1590655&r1=1590654&r2=1590655&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/GenericsUtil.java
Mon Apr 28 14:29:22 2014
@@ -728,7 +728,11 @@ public final class GenericsUtil
         else // if (declaringClass.isAssignableFrom(actualClass))
         { 
             Type genericSuperclass = getGenericSuperclass(actualClass, declaringClass);
-            if (genericSuperclass instanceof Class)
+            if (genericSuperclass == null)
+            {
+                return variable;
+            }
+            else if (genericSuperclass instanceof Class)
             {
                 // special handling for type erasure
                 Class<?> superclass = (Class<?>)genericSuperclass;



Mime
View raw message