aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1768068 - in /aries/trunk/blueprint/blueprint-core/src: main/java/org/apache/aries/blueprint/container/AggregateConverter.java test/java/org/apache/aries/blueprint/container/AggregateConverterTest.java
Date Fri, 04 Nov 2016 16:49:59 GMT
Author: gnodet
Date: Fri Nov  4 16:49:59 2016
New Revision: 1768068

URL: http://svn.apache.org/viewvc?rev=1768068&view=rev
Log:
[ARIES-960] Make sure X.class is assignable to Class<X>

Modified:
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AggregateConverter.java
    aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/AggregateConverterTest.java

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AggregateConverter.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AggregateConverter.java?rev=1768068&r1=1768067&r2=1768068&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AggregateConverter.java
(original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/AggregateConverter.java
Fri Nov  4 16:49:59 2016
@@ -455,7 +455,15 @@ public class AggregateConverter implemen
         if (target.size() == 0) {
             return unwrap(target.getRawClass()).isAssignableFrom(unwrap(source.getClass()));
         } else {
-            return isTypeAssignable(new GenericType(source.getClass()), target);
+            return isTypeAssignable(getType(source), target);
+        }
+    }
+
+    private static ReifiedType getType(Object source) {
+        if (source instanceof Class) {
+            return new GenericType(Class.class, new GenericType((Class) source));
+        } else {
+            return new GenericType(source.getClass());
         }
     }
 

Modified: aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/AggregateConverterTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/AggregateConverterTest.java?rev=1768068&r1=1768067&r2=1768068&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/AggregateConverterTest.java
(original)
+++ aries/trunk/blueprint/blueprint-core/src/test/java/org/apache/aries/blueprint/container/AggregateConverterTest.java
Fri Nov  4 16:49:59 2016
@@ -149,6 +149,8 @@ public class AggregateConverterTest exte
         assertEquals(this, service.convert(this, AggregateConverterTest.class));
         assertEquals(AggregateConverterTest.class, service.convert(this.getClass().getName(),
Class.class));
         assertEquals(int[].class, service.convert("int[]", Class.class));
+        assertEquals(RegionIterable.class, service.convert(RegionIterable.class.getName(),
new GenericType(Class.class, new GenericType(RegionIterable.class))));
+        assertTrue(AggregateConverter.isAssignable(RegionIterable.class, new GenericType(Class.class,
new GenericType(RegionIterable.class))));
     }
 
     public void testConvertArray() throws Exception {



Mime
View raw message