[jboss-cvs] JBossAS SVN: r103822 - in projects/jboss-reflect/trunk/src: test/java/org/jboss/test/classinfo/support and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 12 08:02:07 EDT 2010


Author: kabir.khan at jboss.com
Date: 2010-04-12 08:02:07 -0400 (Mon, 12 Apr 2010)
New Revision: 103822

Added:
   projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionIndirectlyWithBoundedWildcardHierarchy.java
Modified:
   projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistHelper.java
   projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java
Log:
[JBREFLECT-5] Pop interfaces from hierarchy if they don't lead us where we want

Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistHelper.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistHelper.java	2010-04-12 11:43:06 UTC (rev 103821)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistHelper.java	2010-04-12 12:02:07 UTC (rev 103822)
@@ -322,12 +322,12 @@
       if (search == null)
          throw new IllegalArgumentException("Null search");
    
+      if (hierarchy != null)
+         hierarchy.push(current);
+      
       if (current == null)
          return false;
    
-      if (hierarchy != null)
-         hierarchy.push(current);
-      
       if (current.equals(search))
          return true;
       
@@ -339,6 +339,8 @@
             boolean result = determineHierarchy(hierarchy, interfaces[i], search);
             if (result)
                return true;
+            if (hierarchy != null)
+               hierarchy.pop();
          }
       }
       

Added: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionIndirectlyWithBoundedWildcardHierarchy.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionIndirectlyWithBoundedWildcardHierarchy.java	                        (rev 0)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionIndirectlyWithBoundedWildcardHierarchy.java	2010-04-12 12:02:07 UTC (rev 103822)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.classinfo.support;
+
+import java.util.Collection;
+
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.reflect.spi.TypeInfo;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericImplementsCollectionIndirectlyWithBoundedWildcardHierarchy
+{
+   public static abstract class Base<T extends TypeInfo> implements Collection<T>
+   {
+      
+   }
+   
+   public static abstract class Child extends Base<ClassInfo> implements Additional, Additional2 
+   {
+      
+   }
+   
+   public @interface Additional
+   {
+      
+   }
+   
+   public @interface Additional2
+   {
+      
+   }
+   
+}

Modified: projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java	2010-04-12 11:43:06 UTC (rev 103821)
+++ projects/jboss-reflect/trunk/src/test/java/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java	2010-04-12 12:02:07 UTC (rev 103822)
@@ -58,6 +58,7 @@
 import org.jboss.test.classinfo.support.ClassInfoGenericFieldsClass;
 import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollection;
 import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollectionComplex;
+import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollectionIndirectlyWithBoundedWildcardHierarchy;
 import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollectionNotGeneric;
 import org.jboss.test.classinfo.support.ClassInfoGenericImplementsMap;
 import org.jboss.test.classinfo.support.ClassInfoGenericImplementsMapComplex;
@@ -261,6 +262,11 @@
       assertComponentType(ClassInfoGenericExtendsCollectionNotGeneric.class, Object.class);
    }
    
+   public void testComponentTypeImplementsCollectionIndirectlyWithBoundedWildcard() throws Throwable
+   {
+      assertComponentType(ClassInfoGenericImplementsCollectionIndirectlyWithBoundedWildcardHierarchy.Child.class, ClassInfo.class);
+   }
+
    public static byte[] signaturePrimitiveArrayType() 
    {
       return null;




More information about the jboss-cvs-commits mailing list