[jboss-cvs] JBossAS SVN: r64354 - in projects/microcontainer/trunk/container/src: main/org/jboss/reflect/plugins/introspection and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 30 17:06:50 EDT 2007
Author: adrian at jboss.org
Date: 2007-07-30 17:06:50 -0400 (Mon, 30 Jul 2007)
New Revision: 64354
Added:
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollection.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionAndChangesParameter.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWay.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionNotGeneric.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMap.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapAndChangesParameters.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWay.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapNotGeneric.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollection.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionNotGeneric.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMap.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMapNotGeneric.java
Modified:
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoHelper.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoImpl.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/ClassInfo.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/DelegateClassInfo.java
projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java
projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java
Log:
Add support for getComponentType() for a collection and
getKey/ValueType for a map.
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoHelper.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoHelper.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoHelper.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -116,6 +116,30 @@
TypeInfo getOwnerType(ParameterizedClassInfo classInfo);
/**
+ * Get the component type for a collection
+ *
+ * @param classInfo the class info
+ * @return the component type or null if not a collection
+ */
+ TypeInfo getComponentType(ClassInfo classInfo);
+
+ /**
+ * Get the key type for a map
+ *
+ * @param classInfo the class info
+ * @return the key type or null if not a map
+ */
+ TypeInfo getKeyType(ClassInfo classInfo);
+
+ /**
+ * Get the value type for a map
+ *
+ * @param classInfo the class info
+ * @return the value type or null if not a map
+ */
+ TypeInfo getValueType(ClassInfo classInfo);
+
+ /**
* Get the package for class
*
* @param classInfo the class info
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoImpl.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoImpl.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ClassInfoImpl.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -107,6 +107,15 @@
/** The package info */
protected PackageInfo packageInfo;
+ /** The component type */
+ private transient TypeInfo componentType = ClassInfoImpl.UNKNOWN_TYPE;
+
+ /** The key type */
+ private transient TypeInfo keyType = ClassInfoImpl.UNKNOWN_TYPE;
+
+ /** The key type */
+ private transient TypeInfo valueType = ClassInfoImpl.UNKNOWN_TYPE;
+
/** The class info helper */
protected transient ClassInfoHelper classInfoHelper;
@@ -541,6 +550,27 @@
return this;
}
+ public TypeInfo getComponentType()
+ {
+ if (componentType == UNKNOWN_TYPE)
+ componentType = classInfoHelper.getComponentType(this);
+ return componentType;
+ }
+
+ public TypeInfo getKeyType()
+ {
+ if (keyType == UNKNOWN_TYPE)
+ keyType = classInfoHelper.getKeyType(this);
+ return keyType;
+ }
+
+ public TypeInfo getValueType()
+ {
+ if (valueType == UNKNOWN_TYPE)
+ valueType = classInfoHelper.getValueType(this);
+ return valueType;
+ }
+
public PackageInfo getPackage()
{
if (packageInfo == null)
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -28,8 +28,11 @@
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.Collection;
+import java.util.Map;
import org.jboss.reflect.plugins.AnnotationAttributeImpl;
import org.jboss.reflect.plugins.AnnotationHelper;
@@ -520,4 +523,129 @@
return getTypeInfo(owner);
}
+
+ public TypeInfo getComponentType(ClassInfo classInfo)
+ {
+ if (classInfo.isCollection() == false)
+ return null;
+
+ Type type = classInfo.getType();
+ if (classInfo instanceof ParameterizedClassInfo)
+ type = ((ParameterizedClassInfo) classInfo).parameterizedType;
+
+ Type result = locateActualType(Collection.class, 0, classInfo.getType(), type);
+ if (result instanceof TypeVariable)
+ {
+ TypeVariable typeVariable = (TypeVariable) result;
+ result = typeVariable.getBounds()[0];
+ }
+ return getTypeInfo(result);
+ }
+
+ public TypeInfo getKeyType(ClassInfo classInfo)
+ {
+ if (classInfo.isMap() == false)
+ return null;
+
+ Type type = classInfo.getType();
+ if (classInfo instanceof ParameterizedClassInfo)
+ type = ((ParameterizedClassInfo) classInfo).parameterizedType;
+
+ Type result = locateActualType(Map.class, 0, classInfo.getType(), type);
+ if (result instanceof TypeVariable)
+ {
+ TypeVariable typeVariable = (TypeVariable) result;
+ result = typeVariable.getBounds()[0];
+ }
+ return getTypeInfo(result);
+ }
+
+ public TypeInfo getValueType(ClassInfo classInfo)
+ {
+ if (classInfo.isMap() == false)
+ return null;
+
+ Type type = classInfo.getType();
+ if (classInfo instanceof ParameterizedClassInfo)
+ type = ((ParameterizedClassInfo) classInfo).parameterizedType;
+
+ Type result = locateActualType(Map.class, 1, classInfo.getType(), type);
+ if (result instanceof TypeVariable)
+ {
+ TypeVariable typeVariable = (TypeVariable) result;
+ result = typeVariable.getBounds()[0];
+ }
+ return getTypeInfo(result);
+ }
+
+ protected static Type locateActualType(Class reference, int parameter, Class clazz, Type type)
+ {
+ if (reference.equals(clazz))
+ {
+ if (type instanceof Class)
+ {
+ Class typeClass = (Class) type;
+ Type result = typeClass.getTypeParameters()[parameter];
+ return result;
+ }
+ else
+ {
+ ParameterizedType parameterized = (ParameterizedType) type;
+ Type result = parameterized.getActualTypeArguments()[parameter];
+ return result;
+ }
+ }
+
+ Type[] interfaces = clazz.getGenericInterfaces();
+ for (Type intf : interfaces)
+ {
+ Type result = null;
+ if (intf instanceof Class)
+ {
+ Class interfaceClass = (Class) intf;
+ result = locateActualType(reference, parameter, interfaceClass, intf);
+ if (result instanceof TypeVariable)
+ result = getParameter(clazz, type, (TypeVariable) result);
+ }
+ else if (intf instanceof ParameterizedType)
+ {
+ ParameterizedType interfaceType = (ParameterizedType) intf;
+ Class interfaceClass = (Class) interfaceType.getRawType();
+ result = locateActualType(reference, parameter, interfaceClass, intf);
+ if (result instanceof TypeVariable)
+ result = getParameter(clazz, type, (TypeVariable) result);
+ }
+ else
+ throw new IllegalStateException("Unexpected type " + intf.getClass());
+ if (result != null)
+ return result;
+ }
+
+ Class superClass = clazz.getSuperclass();
+ Type genericSuperClass = clazz.getGenericSuperclass();
+ Type result = locateActualType(reference, parameter, superClass, genericSuperClass);
+ if (result instanceof TypeVariable)
+ result = getParameter(clazz, type, (TypeVariable) result);
+ return result;
+ }
+
+ private static Type getParameter(Class clazz, Type type, TypeVariable variable)
+ {
+ TypeVariable[] variables = clazz.getTypeParameters();
+ for (int i = 0; i < variables.length; ++i)
+ {
+ if (variables[i].getName().equals(variable.getName()))
+ {
+ if (type instanceof ParameterizedType)
+ {
+ ParameterizedType parameterized = (ParameterizedType) type;
+ Type result = parameterized.getActualTypeArguments()[i];
+ return result;
+ }
+ return variable;
+ }
+ }
+ // Not generic
+ return Object.class;
+ }
}
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -53,6 +53,15 @@
/** The type arguments */
private TypeInfo[] typeArguments = ClassInfoImpl.UNKNOWN_TYPES;
+ /** The component type */
+ private transient TypeInfo componentType = ClassInfoImpl.UNKNOWN_TYPE;
+
+ /** The key type */
+ private transient TypeInfo keyType = ClassInfoImpl.UNKNOWN_TYPE;
+
+ /** The key type */
+ private transient TypeInfo valueType = ClassInfoImpl.UNKNOWN_TYPE;
+
/**
* Create a new ParameterizedClassInfo.
*
@@ -96,6 +105,30 @@
}
@Override
+ public TypeInfo getComponentType()
+ {
+ if (componentType == ClassInfoImpl.UNKNOWN_TYPE)
+ componentType = factory.getComponentType(this);
+ return componentType;
+ }
+
+ @Override
+ public TypeInfo getKeyType()
+ {
+ if (keyType == ClassInfoImpl.UNKNOWN_TYPE);
+ keyType = factory.getKeyType(this);
+ return keyType;
+ }
+
+ @Override
+ public TypeInfo getValueType()
+ {
+ if (valueType == ClassInfoImpl.UNKNOWN_TYPE)
+ valueType = factory.getValueType(this);
+ return valueType;
+ }
+
+ @Override
public void toShortString(JBossStringBuilder buffer)
{
buffer.append(parameterizedType);
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -619,6 +619,21 @@
return this;
}
+ public TypeInfo getComponentType()
+ {
+ return null;
+ }
+
+ public TypeInfo getKeyType()
+ {
+ return null;
+ }
+
+ public TypeInfo getValueType()
+ {
+ return null;
+ }
+
public PackageInfo getPackage()
{
if (packageInfo == null)
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/ClassInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/ClassInfo.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/ClassInfo.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -137,6 +137,27 @@
* @return the owner type
*/
TypeInfo getOwnerType();
+
+ /**
+ * Get the component type if it is a collection or an array
+ *
+ * @return the component type
+ */
+ TypeInfo getComponentType();
+
+ /**
+ * Get the key type if it is a map
+ *
+ * @return the key type
+ */
+ TypeInfo getKeyType();
+
+ /**
+ * Get the value type if it is a map
+ *
+ * @return the value type
+ */
+ TypeInfo getValueType();
/**
* Get the package
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/DelegateClassInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/DelegateClassInfo.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/DelegateClassInfo.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -295,6 +295,21 @@
return delegate.getRawType();
}
+ public TypeInfo getComponentType()
+ {
+ return delegate.getComponentType();
+ }
+
+ public TypeInfo getKeyType()
+ {
+ return delegate.getKeyType();
+ }
+
+ public TypeInfo getValueType()
+ {
+ return delegate.getValueType();
+ }
+
public PackageInfo getPackage()
{
return delegate.getPackage();
Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -298,6 +298,21 @@
return delegate;
}
+ public TypeInfo getComponentType()
+ {
+ return delegate.getComponentType();
+ }
+
+ public TypeInfo getKeyType()
+ {
+ return delegate.getKeyType();
+ }
+
+ public TypeInfo getValueType()
+ {
+ return delegate.getValueType();
+ }
+
public PackageInfo getPackage()
{
return delegate.getPackage();
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollection.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollection.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollection.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.AbstractCollection;
+import java.util.Iterator;
+
+/**
+ * ClassInfoGenericExtendsCollection
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsCollection extends AbstractCollection<Short>
+{
+ public Iterator<Short> iterator()
+ {
+ return null;
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionAndChangesParameter.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionAndChangesParameter.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionAndChangesParameter.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.AbstractCollection;
+import java.util.Iterator;
+
+/**
+ * ClassInfoGenericExtendsCollectionAndChangesParameter.
+ *
+ * @param <T> the changed parameter name
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsCollectionAndChangesParameter<T> extends AbstractCollection<T>
+{
+ public Iterator<T> iterator()
+ {
+ return null;
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWay.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWay.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWay.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+/**
+ * ClassInfoGenericExtendsCollectionInComplicatedWay.
+ *
+ * @param <A>
+ * @param <B>
+ * @param <C> the collection type
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsCollectionInComplicatedWay<A, B, C> extends ClassInfoGenericExtendsCollectionAndChangesParameter<C>
+{
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+/**
+ * ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType extends ClassInfoGenericExtendsCollectionInComplicatedWay<String, Integer, Double>
+{
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionNotGeneric.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionNotGeneric.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsCollectionNotGeneric.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.AbstractCollection;
+import java.util.Iterator;
+
+/**
+ * ClassInfoGenericExtendsCollection
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsCollectionNotGeneric extends AbstractCollection
+{
+ public Iterator iterator()
+ {
+ return null;
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMap.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMap.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMap.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.AbstractMap;
+import java.util.Set;
+
+/**
+ * ClassInfoGenericExtendsCollection
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsMap extends AbstractMap<Short, Double>
+{
+ public Set<java.util.Map.Entry<Short, Double>> entrySet()
+ {
+ return null;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapAndChangesParameters.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapAndChangesParameters.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapAndChangesParameters.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.AbstractMap;
+import java.util.Set;
+
+/**
+ * ClassInfoGenericExtendsCollectionAndChangesParameter.
+ *
+ * @param <A> the changed parameter name
+ * @param <B> the changed parameter name
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsMapAndChangesParameters<A, B> extends AbstractMap<A, B>
+{
+ public Set<java.util.Map.Entry<A, B>> entrySet()
+ {
+ return null;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWay.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWay.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWay.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+/**
+ * ClassInfoGenericExtendsCollectionInComplicatedWay.
+ *
+ * @param <A>
+ * @param <B>
+ * @param <C> the key type
+ * @param <D> the value type
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsMapInComplicatedWay<A, B, C, D> extends ClassInfoGenericExtendsMapAndChangesParameters<C, D>
+{
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+/**
+ * ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType extends ClassInfoGenericExtendsMapInComplicatedWay<String, Integer, Double, Short>
+{
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapNotGeneric.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapNotGeneric.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericExtendsMapNotGeneric.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.AbstractMap;
+import java.util.Set;
+
+/**
+ * ClassInfoGenericExtendsCollection
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericExtendsMapNotGeneric extends AbstractMap
+{
+ public Set entrySet()
+ {
+ return null;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollection.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollection.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollection.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,98 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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 java.util.Iterator;
+
+/**
+ * ClassInfoGenericImplementsCollection.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericImplementsCollection implements Collection<Long>
+{
+ public boolean add(Long o)
+ {
+ return false;
+ }
+
+ public boolean addAll(Collection<? extends Long> c)
+ {
+ return false;
+ }
+
+ public void clear()
+ {
+ }
+
+ public boolean contains(Object o)
+ {
+ return false;
+ }
+
+ public boolean containsAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public Iterator<Long> iterator()
+ {
+ return null;
+ }
+
+ public boolean remove(Object o)
+ {
+ return false;
+ }
+
+ public boolean removeAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public boolean retainAll(Collection<?> c)
+ {
+ return false;
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+
+ public Object[] toArray()
+ {
+ return null;
+ }
+
+ public <T> T[] toArray(T[] a)
+ {
+ return null;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionNotGeneric.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionNotGeneric.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsCollectionNotGeneric.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,103 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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 aObject 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 java.util.Iterator;
+
+/**
+ * ClassInfoGenericImplementsCollection.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericImplementsCollectionNotGeneric implements Collection
+{
+ public boolean add(Object o)
+ {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean addAll(Collection c)
+ {
+ return false;
+ }
+
+ public void clear()
+ {
+ }
+
+ public boolean contains(Object o)
+ {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean containsAll(Collection c)
+ {
+ return false;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public Iterator<Object> iterator()
+ {
+ return null;
+ }
+
+ public boolean remove(Object o)
+ {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean removeAll(Collection c)
+ {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean retainAll(Collection c)
+ {
+ return false;
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+
+ public Object[] toArray()
+ {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] toArray(Object[] a)
+ {
+ return null;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMap.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMap.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMap.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,93 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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 java.util.Map;
+import java.util.Set;
+
+/**
+ * ClassInfoGenericImplementsCollection.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericImplementsMap implements Map<Long, Integer>
+{
+ public void clear()
+ {
+ }
+
+ public boolean containsKey(Object key)
+ {
+ return false;
+ }
+
+ public boolean containsValue(Object value)
+ {
+ return false;
+ }
+
+ public Set<java.util.Map.Entry<Long, Integer>> entrySet()
+ {
+ return null;
+ }
+
+ public Integer get(Object key)
+ {
+ return null;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public Set<Long> keySet()
+ {
+ return null;
+ }
+
+ public Integer put(Long key, Integer value)
+ {
+ return null;
+ }
+
+ public void putAll(Map<? extends Long, ? extends Integer> t)
+ {
+ }
+
+ public Integer remove(Object key)
+ {
+ return null;
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+
+ public Collection<Integer> values()
+ {
+ return null;
+ }
+}
Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMapNotGeneric.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMapNotGeneric.java (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/support/ClassInfoGenericImplementsMapNotGeneric.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -0,0 +1,93 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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 java.util.Map;
+import java.util.Set;
+
+/**
+ * ClassInfoGenericImplementsCollection.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInfoGenericImplementsMapNotGeneric implements Map
+{
+ public void clear()
+ {
+ }
+
+ public boolean containsKey(Object key)
+ {
+ return false;
+ }
+
+ public boolean containsValue(Object value)
+ {
+ return false;
+ }
+
+ public Set entrySet()
+ {
+ return null;
+ }
+
+ public Object get(Object key)
+ {
+ return null;
+ }
+
+ public boolean isEmpty()
+ {
+ return false;
+ }
+
+ public Set keySet()
+ {
+ return null;
+ }
+
+ public Integer put(Object key, Object value)
+ {
+ return null;
+ }
+
+ public void putAll(Map t)
+ {
+ }
+
+ public Object remove(Object key)
+ {
+ return null;
+ }
+
+ public int size()
+ {
+ return 0;
+ }
+
+ public Collection values()
+ {
+ return null;
+ }
+}
Modified: projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java 2007-07-30 17:04:11 UTC (rev 64353)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/classinfo/test/ClassInfoGenericClassTest.java 2007-07-30 21:06:50 UTC (rev 64354)
@@ -21,8 +21,13 @@
*/
package org.jboss.test.classinfo.test;
+import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Map;
import org.jboss.reflect.plugins.ClassInfoImpl;
import org.jboss.reflect.spi.ClassInfo;
@@ -32,7 +37,21 @@
import org.jboss.test.classinfo.support.ClassInfoEmptyClass;
import org.jboss.test.classinfo.support.ClassInfoGenericClass;
import org.jboss.test.classinfo.support.ClassInfoGenericConstructorsClass;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollection;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionAndChangesParameter;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionInComplicatedWay;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsCollectionNotGeneric;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMap;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapAndChangesParameters;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapInComplicatedWay;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType;
+import org.jboss.test.classinfo.support.ClassInfoGenericExtendsMapNotGeneric;
import org.jboss.test.classinfo.support.ClassInfoGenericFieldsClass;
+import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollection;
+import org.jboss.test.classinfo.support.ClassInfoGenericImplementsCollectionNotGeneric;
+import org.jboss.test.classinfo.support.ClassInfoGenericImplementsMap;
+import org.jboss.test.classinfo.support.ClassInfoGenericImplementsMapNotGeneric;
import org.jboss.test.classinfo.support.ClassInfoGenericInterface;
import org.jboss.test.classinfo.support.ClassInfoGenericMethodsClass;
import org.jboss.test.classinfo.support.ClassInfoGenericSuperClassEmptyClass;
@@ -130,6 +149,185 @@
testGenericClass(ClassInfoGenericFieldsClass.class);
}
+ public void testComponentTypeNotGeneric() throws Throwable
+ {
+ assertComponentType(Collection.class, Object.class);
+ }
+
+ public void testComponentTypeImplementsCollectionNotGeneric() throws Throwable
+ {
+ assertComponentType(ClassInfoGenericImplementsCollectionNotGeneric.class, Object.class);
+ }
+
+ public void testComponentTypeExtendsCollectionNotGeneric() throws Throwable
+ {
+ assertComponentType(ClassInfoGenericExtendsCollectionNotGeneric.class, Object.class);
+ }
+
+ public static Collection<Boolean> signatureCollectionBoolean()
+ {
+ return null;
+ }
+
+ public void testComponentTypeCollectionBoolean() throws Throwable
+ {
+ assertComponentType("signatureCollectionBoolean", Boolean.class);
+ }
+
+ public void testComponentTypeImplementsCollection() throws Throwable
+ {
+ assertComponentType(ClassInfoGenericImplementsCollection.class, Long.class);
+ }
+
+ public void testComponentTypeExtendsCollection() throws Throwable
+ {
+ assertComponentType(ClassInfoGenericExtendsCollection.class, Short.class);
+ }
+
+ public void testComponentTypeExtendsCollectionAndChangesParameter() throws Throwable
+ {
+ assertComponentType(ClassInfoGenericExtendsCollectionAndChangesParameter.class, Object.class);
+ }
+
+ public static ClassInfoGenericExtendsCollectionAndChangesParameter<Float> signatureChangesParameter()
+ {
+ return null;
+ }
+
+ public void testComponentTypeExtendsCollectionAndChangesParameterExplicit() throws Throwable
+ {
+ assertComponentType("signatureChangesParameter", Float.class);
+ }
+
+ public void testComponentTypeExtendsCollectionInAComplicatedWay() throws Throwable
+ {
+ assertComponentType(ClassInfoGenericExtendsCollectionInComplicatedWay.class, Object.class);
+ }
+
+ public static ClassInfoGenericExtendsCollectionInComplicatedWay<String, Float, Date> signatureComplicatedWay()
+ {
+ return null;
+ }
+
+ public void testComponentTypeExtendsCollectionInAComplicatedWayExplicit() throws Throwable
+ {
+ assertComponentType("signatureComplicatedWay", Date.class);
+ }
+
+ public void testComponentTypeExtendsCollectionInAComplicatedWayWithSpecificType() throws Throwable
+ {
+ assertComponentType(ClassInfoGenericExtendsCollectionInComplicatedWayWIthSpecificType.class, Double.class);
+ }
+
+ public void testKeyValueTypeNotGeneric() throws Throwable
+ {
+ assertKeyValueType(Map.class, Object.class, Object.class);
+ }
+
+ public void testKeyValueTypeImplementsMapNotGeneric() throws Throwable
+ {
+ assertKeyValueType(ClassInfoGenericImplementsMapNotGeneric.class, Object.class, Object.class);
+ }
+
+ public void testKeyValueTypeExtendsMapNotGeneric() throws Throwable
+ {
+ assertKeyValueType(ClassInfoGenericExtendsMapNotGeneric.class, Object.class, Object.class);
+ }
+
+ public static Map<Boolean, Date> signatureMapBooleanDate()
+ {
+ return null;
+ }
+
+ public void testKeyValueTypeMapBooleanDate() throws Throwable
+ {
+ assertKeyValueType("signatureMapBooleanDate", Boolean.class, Date.class);
+ }
+
+ public void testKeyValueTypeImplementsMap() throws Throwable
+ {
+ assertKeyValueType(ClassInfoGenericImplementsMap.class, Long.class, Integer.class);
+ }
+
+ public void testKeyValueTypeExtendsMap() throws Throwable
+ {
+ assertKeyValueType(ClassInfoGenericExtendsMap.class, Short.class, Double.class);
+ }
+
+ public void testKeyValueTypeExtendsMapAndChangesParameters() throws Throwable
+ {
+ assertKeyValueType(ClassInfoGenericExtendsMapAndChangesParameters.class, Object.class, Object.class);
+ }
+
+ public static ClassInfoGenericExtendsMapAndChangesParameters<Float, Double> signatureMapChangesParameter()
+ {
+ return null;
+ }
+
+ public void testKeyValueTypeExtendsMapAndChangesParameterExplicit() throws Throwable
+ {
+ assertKeyValueType("signatureMapChangesParameter", Float.class, Double.class);
+ }
+
+ public void testKeyValueTypeExtendsMapInAComplicatedWay() throws Throwable
+ {
+ assertKeyValueType(ClassInfoGenericExtendsMapInComplicatedWay.class, Object.class, Object.class);
+ }
+
+ public static ClassInfoGenericExtendsMapInComplicatedWay<String, Float, Date, StringBuffer> signatureMapComplicatedWay()
+ {
+ return null;
+ }
+
+ public void testComponentTypeExtendsMapInAComplicatedWayExplicit() throws Throwable
+ {
+ assertKeyValueType("signatureMapComplicatedWay", Date.class, StringBuffer.class);
+ }
+
+ public void testComponentTypeExtendsMapInAComplicatedWayWithSpecificType() throws Throwable
+ {
+ assertKeyValueType(ClassInfoGenericExtendsMapInComplicatedWayWIthSpecificType.class, Double.class, Short.class);
+ }
+
+ private void assertComponentType(String methodName, Class expected) throws Exception
+ {
+ Method method = ClassInfoGenericClassTest.class.getMethod(methodName, null);
+ Type type = method.getGenericReturnType();
+ assertComponentType(type, expected);
+ }
+
+ private void assertComponentType(Type type, Class expected) throws Exception
+ {
+ TypeInfoFactory factory = getTypeInfoFactory();
+ TypeInfo typeInfo = factory.getTypeInfo(type);
+ ClassInfo classInfo = assertInstanceOf(typeInfo, ClassInfo.class);
+ assertTrue(classInfo.isCollection());
+
+ TypeInfo expectedInfo = factory.getTypeInfo(expected);
+ assertEquals(expectedInfo, classInfo.getComponentType());
+ }
+
+ private void assertKeyValueType(String methodName, Class keyExpected, Class valueExpected) throws Exception
+ {
+ Method method = ClassInfoGenericClassTest.class.getMethod(methodName, null);
+ Type type = method.getGenericReturnType();
+ assertKeyValueType(type, keyExpected, valueExpected);
+ }
+
+ private void assertKeyValueType(Type type, Class keyExpected, Class valueExpected) throws Exception
+ {
+ TypeInfoFactory factory = getTypeInfoFactory();
+ TypeInfo typeInfo = factory.getTypeInfo(type);
+ ClassInfo classInfo = assertInstanceOf(typeInfo, ClassInfo.class);
+ assertTrue(classInfo.isMap());
+
+ TypeInfo expectedInfo = factory.getTypeInfo(keyExpected);
+ assertEquals(expectedInfo, classInfo.getKeyType());
+
+ expectedInfo = factory.getTypeInfo(valueExpected);
+ assertEquals(expectedInfo, classInfo.getValueType());
+ }
+
private void testGenericClass(Class clazz) throws Throwable
{
ClassInfoImpl expected = new ClassInfoImpl(clazz.getName(), Modifier.PUBLIC);
More information about the jboss-cvs-commits
mailing list