[jboss-cvs] JBossAS SVN: r63860 - in projects/aop/trunk/aop/src: test/org/jboss/test/aop/unit/assignability and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 6 02:02:42 EDT 2007
Author: flavia.rainone at jboss.com
Date: 2007-07-06 02:02:42 -0400 (Fri, 06 Jul 2007)
New Revision: 63860
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java
projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/ParameterizedTypeFromParamTypeTest.java
Log:
[JBAOP-420] More scenarios plus bug fixed
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java 2007-07-06 05:46:23 UTC (rev 63859)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/advice/annotation/assignability/Algorithm.java 2007-07-06 06:02:42 UTC (rev 63860)
@@ -120,6 +120,10 @@
{
throw new RuntimeException("This comparison should never happen");
}
+ if (type instanceof TypeVariable)
+ {
+ return false;
+ }
else
{
return isAssignable((GenericArrayType) type, fromType,
Modified: projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/ParameterizedTypeFromParamTypeTest.java
===================================================================
--- projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/ParameterizedTypeFromParamTypeTest.java 2007-07-06 05:46:23 UTC (rev 63859)
+++ projects/aop/trunk/aop/src/test/org/jboss/test/aop/unit/assignability/ParameterizedTypeFromParamTypeTest.java 2007-07-06 06:02:42 UTC (rev 63860)
@@ -2236,4 +2236,96 @@
assertFalse(algorithm.isAssignable(called.getGenericParameterTypes()[0],
caller.getGenericParameterTypes()[0], hierarchy));
}
+
+ // Scenario 142
+
+ void caller142(ArrayList<List> arg)
+ {
+ called142(arg);
+ }
+
+ void called142(ArrayList<? super List> arg) {}
+
+ public void test142() throws Exception
+ {
+ Method caller = this.getClass().getDeclaredMethod("caller142", new Class[]{ArrayList.class});
+ Method called = this.getClass().getDeclaredMethod("called142", new Class[]{ArrayList.class});
+ assertTrue(algorithm.isAssignable(called.getGenericParameterTypes()[0],
+ caller.getGenericParameterTypes()[0], hierarchy));
+ }
+
+ // Scenario 143
+
+ void caller143(ArrayList<Collection> arg)
+ {
+ called142(arg);
+ }
+
+ public void test143() throws Exception
+ {
+ Method caller = this.getClass().getDeclaredMethod("caller143", new Class[]{ArrayList.class});
+ Method called = this.getClass().getDeclaredMethod("called142", new Class[]{ArrayList.class});
+ assertTrue(algorithm.isAssignable(called.getGenericParameterTypes()[0],
+ caller.getGenericParameterTypes()[0], hierarchy));
+ }
+
+ // Scenario 144
+
+ void caller144(ArrayList<ArrayList> arg)
+ {
+ //called142(arg);
+ }
+
+ public void test144() throws Exception
+ {
+ Method caller = this.getClass().getDeclaredMethod("caller144", new Class[]{ArrayList.class});
+ Method called = this.getClass().getDeclaredMethod("called142", new Class[]{ArrayList.class});
+ assertFalse(algorithm.isAssignable(called.getGenericParameterTypes()[0],
+ caller.getGenericParameterTypes()[0], hierarchy));
+ }
+
+ // Scenario 145
+
+ <A extends List>void caller145(ArrayList<A> arg)
+ {
+ //called142(arg);
+ }
+
+ public void test145() throws Exception
+ {
+ Method caller = this.getClass().getDeclaredMethod("caller145", new Class[]{ArrayList.class});
+ Method called = this.getClass().getDeclaredMethod("called142", new Class[]{ArrayList.class});
+ assertFalse(algorithm.isAssignable(called.getGenericParameterTypes()[0],
+ caller.getGenericParameterTypes()[0], hierarchy));
+ }
+
+ // Scenario 146
+
+ <A extends Collection>void caller146(ArrayList<A> arg)
+ {
+ //called142(arg);
+ }
+
+ public void test146() throws Exception
+ {
+ Method caller = this.getClass().getDeclaredMethod("caller146", new Class[]{ArrayList.class});
+ Method called = this.getClass().getDeclaredMethod("called142", new Class[]{ArrayList.class});
+ assertFalse(algorithm.isAssignable(called.getGenericParameterTypes()[0],
+ caller.getGenericParameterTypes()[0], hierarchy));
+ }
+
+ // Scenario 147
+
+ <A extends ArrayList>void caller147(ArrayList<ArrayList> arg)
+ {
+ //called142(arg);
+ }
+
+ public void test147() throws Exception
+ {
+ Method caller = this.getClass().getDeclaredMethod("caller147", new Class[]{ArrayList.class});
+ Method called = this.getClass().getDeclaredMethod("called142", new Class[]{ArrayList.class});
+ assertFalse(algorithm.isAssignable(called.getGenericParameterTypes()[0],
+ caller.getGenericParameterTypes()[0], hierarchy));
+ }
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list