[jboss-cvs] JBossAS SVN: r81545 - in projects/jboss-reflect/branches/Branch_2_0/src: main/java/org/jboss/reflect/plugins and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 25 08:30:24 EST 2008
Author: alesj
Date: 2008-11-25 08:30:23 -0500 (Tue, 25 Nov 2008)
New Revision: 81545
Added:
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/support/BeanInfoCache.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java
Removed:
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java
Modified:
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/NumberInfo.java
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java
projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/TypeInfo.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/ContainerAllTestSuite.java
projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/test/BeanInfoCacheTestCase.java
Log:
Port fixes to branch.
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/beans/info/plugins/AbstractBeanInfoFactory.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -55,7 +55,7 @@
public class AbstractBeanInfoFactory implements BeanInfoFactory
{
/** The cache */
- protected Map<ClassInfo, Map<BeanAccessMode, BeanInfo>> cache = new WeakHashMap<ClassInfo, Map<BeanAccessMode, BeanInfo>>();
+ protected Map<ClassLoader, Map<ClassInfo, Map<BeanAccessMode, BeanInfo>>> cache = new WeakHashMap<ClassLoader, Map<ClassInfo, Map<BeanAccessMode, BeanInfo>>>();
protected static boolean isGetter(MethodInfo minfo)
{
@@ -133,13 +133,19 @@
synchronized (cache)
{
+ ClassLoader cl = classAdapter.getClassLoader();
ClassInfo classInfo = classAdapter.getClassInfo();
- Map<BeanAccessMode, BeanInfo> modeMap = cache.get(classInfo);
- if (modeMap != null)
+ Map<ClassInfo, Map<BeanAccessMode, BeanInfo>> classInfoMap = cache.get(cl);
+ Map<BeanAccessMode, BeanInfo> modeMap = null;
+ if (classInfoMap != null)
{
- BeanInfo info = modeMap.get(accessMode);
- if (info != null)
- return info;
+ modeMap = classInfoMap.get(classInfo);
+ if (modeMap != null)
+ {
+ BeanInfo info = modeMap.get(accessMode);
+ if (info != null)
+ return info;
+ }
}
Set<ConstructorInfo> constructors = getConstructors(classInfo);
@@ -152,10 +158,15 @@
Set<EventInfo> events = getEvents(classInfo);
BeanInfo result = createBeanInfo(classAdapter, accessMode, properties, constructors, methods, events);
+ if (classInfoMap == null)
+ {
+ classInfoMap = new WeakHashMap<ClassInfo, Map<BeanAccessMode, BeanInfo>>();
+ cache.put(cl, classInfoMap);
+ }
if (modeMap == null)
{
modeMap = new WeakValueHashMap<BeanAccessMode, BeanInfo>();
- cache.put(classInfo, modeMap);
+ classInfoMap.put(classInfo, modeMap);
}
modeMap.put(accessMode, result);
return result;
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/ClassInfoImpl.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -539,12 +539,17 @@
public boolean isAssignableFrom(TypeInfo info)
{
if (info == null)
- {
throw new NullPointerException("Parameter info cannot be null!");
- }
+
return getType().isAssignableFrom(info.getType());
}
+ @SuppressWarnings("deprecation")
+ public boolean isInstance(Object object)
+ {
+ return getType().isInstance(object);
+ }
+
public TypeInfo[] getActualTypeArguments()
{
return null;
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/introspection/ParameterizedClassInfo.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -32,7 +32,7 @@
/**
* ParameterizedClassInfo.
- *
+ *
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
@@ -40,28 +40,28 @@
{
/** The serialVersionUID */
private static final long serialVersionUID = 2;
-
+
/** The factory */
protected transient IntrospectionTypeInfoFactoryImpl factory;
-
+
/** The parameterized type */
transient ParameterizedType parameterizedType;
-
+
/** The owner type */
private TypeInfo ownerType = ClassInfoImpl.UNKNOWN_TYPE;
-
+
/** 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.
*
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfo.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -380,12 +380,17 @@
public boolean isAssignableFrom(TypeInfo info)
{
if (info == null)
- {
throw new NullPointerException("Parameter info cannot be null!");
- }
+
return getType().isAssignableFrom(info.getType());
}
+ @SuppressWarnings("deprecation")
+ public boolean isInstance(Object object)
+ {
+ return getType().isInstance(object);
+ }
+
public TypeInfoFactory getTypeInfoFactory()
{
return factory;
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/DelegateClassInfo.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -290,6 +290,11 @@
return delegate.isAssignableFrom(info);
}
+ public boolean isInstance(Object object)
+ {
+ return delegate.isInstance(object);
+ }
+
public TypeInfo[] getActualTypeArguments()
{
return delegate.getActualTypeArguments();
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/NumberInfo.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/NumberInfo.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/NumberInfo.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -335,12 +335,13 @@
return this;
}
- public String toShortString()
+ public void toShortString(JBossStringBuilder buffer)
{
- return name;
+ buffer.append(name);
}
- public void toShortString(JBossStringBuilder buffer)
+ @Override
+ protected void toString(JBossStringBuilder buffer)
{
buffer.append(name);
}
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/PrimitiveInfo.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -268,13 +268,33 @@
@SuppressWarnings({"unchecked", "deprecation"})
public boolean isAssignableFrom(TypeInfo info)
{
+ if (info == null)
+ throw new NullPointerException("Parameter info cannot be null!");
+
if (info == this)
return true;
+ return canProgress(info.getType());
+ }
+
+ @SuppressWarnings("deprecation")
+ public boolean isInstance(Object object)
+ {
+ return object != null && canProgress(object.getClass());
+ }
+
+ /**
+ * Can we progress class param to this type info.
+ *
+ * @param clazz the class to progress
+ * @return true if we can progress, false otherwise
+ */
+ protected boolean canProgress(Class<?> clazz)
+ {
try
{
ProgressionConvertor pc = ProgressionConvertorFactory.getInstance().getConvertor();
- return pc.canProgress(getType(), info.getType());
+ return pc.canProgress(getType(), clazz);
}
catch (Throwable throwable)
{
Modified: projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/TypeInfo.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/TypeInfo.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/main/java/org/jboss/reflect/spi/TypeInfo.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -144,7 +144,7 @@
/**
* Mostly using
* @see java.lang.Class#isAssignableFrom
- * NumberInfo tests for progression
+ * PrimitiveInfo tests for progression
*
* @param info type info
* @return the boolean value indicating whether objects of the
@@ -155,6 +155,16 @@
boolean isAssignableFrom(TypeInfo info);
/**
+ * Is object instance of this type info.
+ * @see Class#isInstance(Object)
+ * PrimitiveInfo tests for progression
+ *
+ * @param object the object to check
+ * @return true if <code>object</code> is an instance of this class
+ */
+ boolean isInstance(Object object);
+
+ /**
* Get the TypeInfoFactory that created this type info
*
* @return type info factory
Modified: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/ContainerAllTestSuite.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/ContainerAllTestSuite.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/ContainerAllTestSuite.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -27,6 +27,7 @@
import org.jboss.test.beaninfo.test.BeanInfoTestSuite;
import org.jboss.test.classinfo.test.ClassInfoTestSuite;
import org.jboss.test.joinpoint.test.JoinpointTestSuite;
+import org.jboss.test.typeinfo.test.TypeInfoTestSuite;
/**
* All Test Suite.
@@ -45,6 +46,7 @@
{
TestSuite suite = new TestSuite("All Tests");
+ suite.addTest(TypeInfoTestSuite.suite());
suite.addTest(ClassInfoTestSuite.suite());
suite.addTest(JoinpointTestSuite.suite());
suite.addTest(BeanInfoTestSuite.suite());
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/support/BeanInfoCache.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/beaninfo/support/BeanInfoCache.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/support/BeanInfoCache.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/support/BeanInfoCache.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,31 @@
+/*
+* 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.beaninfo.support;
+
+/**
+ * BeanInfoCache.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BeanInfoCache
+{
+}
\ No newline at end of file
Modified: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/test/BeanInfoCacheTestCase.java
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/test/BeanInfoCacheTestCase.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/beaninfo/test/BeanInfoCacheTestCase.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -23,11 +23,14 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.net.URL;
+import java.net.URLClassLoader;
import java.util.List;
import java.util.Set;
import junit.framework.Test;
import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.config.spi.Configuration;
import org.jboss.reflect.spi.ClassInfo;
import org.jboss.reflect.spi.TypeInfo;
import org.jboss.test.beaninfo.support.BeanInfoAnnotation;
@@ -64,6 +67,31 @@
assertBeanInfoCaching("", BeanInfoEmpty.class);
}
+ public void testClassLoaderCaching() throws Throwable
+ {
+ String className = BeanInfoEmpty.class.getName();
+ Class<?> clazz = Class.forName(className);
+ URL url1 = clazz.getProtectionDomain().getCodeSource().getLocation();
+ URL[] urls = {url1};
+ ClassLoader cl1 = new URLClassLoader(urls, null);
+
+ clazz = Class.forName(ClassInfo.class.getName());
+ URL url2 = clazz.getProtectionDomain().getCodeSource().getLocation();
+ urls = new URL[]{url1, url2};
+ ClassLoader cl2 = new URLClassLoader(urls, null);
+
+ Configuration configuration = getConfiguration();
+
+ ClassInfo ci1 = configuration.getClassInfo(className, cl1);
+ ClassInfo ci2 = configuration.getClassInfo(className, cl2);
+ assertEquals(ci1, ci2);
+
+ className = "org.jboss.test.beaninfo.support.BeanInfoCache";
+ BeanInfo bi1 = configuration.getBeanInfo(className, cl1);
+ BeanInfo bi2 = configuration.getBeanInfo(className, cl2);
+ assertFalse(bi1.equals(bi2));
+ }
+
private void assertBeanInfoCaching(String string, Class<?> clazz) throws Exception
{
Type type = getType(string, clazz);
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo)
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support)
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.support;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class GenericIntegerImpl implements GenericInterface<Integer>
-{
-}
\ No newline at end of file
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericIntegerImpl.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class GenericIntegerImpl implements GenericInterface<Integer>
+{
+}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.support;
-
-/**
- * @param <T> generic type
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface GenericInterface<T>
-{
-}
\ No newline at end of file
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericInterface.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.support;
+
+/**
+ * @param <T> generic type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface GenericInterface<T>
+{
+}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.support;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class GenericStringImpl implements GenericInterface<String>
-{
-}
\ No newline at end of file
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/GenericStringImpl.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class GenericStringImpl implements GenericInterface<String>
+{
+}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.support;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class TestImpl implements TestInterface
-{
-}
\ No newline at end of file
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestImpl.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TestImpl implements TestInterface
+{
+}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.support;
-
-/**
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface TestInterface
-{
-}
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/support/TestInterface.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.support;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface TestInterface
+{
+}
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test)
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,137 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.test;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Date;
-
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.reflect.spi.TypeInfoFactory;
-import org.jboss.test.ContainerTest;
-import org.jboss.test.typeinfo.support.GenericInterface;
-import org.jboss.test.typeinfo.support.TestImpl;
-import org.jboss.test.typeinfo.support.TestInterface;
-import org.jboss.test.typeinfo.support.GenericStringImpl;
-import org.jboss.test.typeinfo.support.GenericIntegerImpl;
-
-/**
- * Type info test.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class AbstractTypeInfoTest extends ContainerTest
-{
- protected AbstractTypeInfoTest(String name)
- {
- super(name);
- }
-
- protected abstract TypeInfoFactory getTypeInfoFactory();
-
- // TODO - remove this after JBMICROCONT-129 is done
- protected abstract boolean isTypeSupported();
-
- protected TypeInfo getTypeInfo(Type type) throws Exception
- {
- return getTypeInfoFactory().getTypeInfo(type);
- }
-
- public void testIsAssignableFrom() throws Throwable
- {
- TypeInfo first = getTypeInfo(int.class);
- TypeInfo second = getTypeInfo(double.class);
-
- assertIsAssignableFrom(first, second, true);
- second = getTypeInfo(Date.class);
- assertIsAssignableFrom(first, second, false);
-
- first = getTypeInfo(TestInterface.class);
- assertIsAssignableFrom(first, second, false);
-
- second = getTypeInfo(TestInterface.class);
- assertIsAssignableFrom(first, second, true);
- second = getTypeInfo(TestImpl.class);
- assertIsAssignableFrom(first, second, true);
-
- if (isTypeSupported())
- {
- first = getTypeInfo(getType("getGenericStringInterface"));
- second = getTypeInfo(GenericStringImpl.class);
- assertIsAssignableFrom(first, second, true);
-
- second = getTypeInfo(GenericIntegerImpl.class);
- // TODO - better impl could return false?
- assertIsAssignableFrom(first, second, true);
- }
- }
-
- public void testIsInstance() throws Throwable
- {
- TypeInfo first = getTypeInfo(int.class);
- Object second = 123d;
-
- assertIsInstance(first, second, true);
- second = (byte)123;
- assertIsInstance(first, second, true);
- second = new Date();
- assertIsInstance(first, second, false);
-
- first = getTypeInfo(TestInterface.class);
- assertIsInstance(first, second, false);
-
- second = new TestImpl();
- assertIsInstance(first, second, true);
-
- if (isTypeSupported())
- {
- first = getTypeInfo(getType("getGenericStringInterface"));
- second = new GenericStringImpl();
- assertIsInstance(first, second, true);
-
- second = new GenericIntegerImpl();
- // TODO - better impl could return false?
- assertIsInstance(first, second, true);
- }
- }
-
- protected void assertIsAssignableFrom(TypeInfo first, TypeInfo second, boolean expected) throws Throwable
- {
- assertEquals(expected, first.isAssignableFrom(second));
- }
-
- protected void assertIsInstance(TypeInfo typeInfo, Object object, boolean expected) throws Throwable
- {
- assertEquals(expected, typeInfo.isInstance(object));
- }
-
- protected Type getType(String methodName, Class<?>... parameters) throws Exception
- {
- Method method = getClass().getMethod(methodName, parameters);
- return method.getGenericReturnType();
- }
-
- public GenericInterface<String> getGenericStringInterface()
- {
- return null;
- }
-}
\ No newline at end of file
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/AbstractTypeInfoTest.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.test;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Date;
+
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.reflect.spi.TypeInfoFactory;
+import org.jboss.test.ContainerTest;
+import org.jboss.test.typeinfo.support.GenericInterface;
+import org.jboss.test.typeinfo.support.TestImpl;
+import org.jboss.test.typeinfo.support.TestInterface;
+import org.jboss.test.typeinfo.support.GenericStringImpl;
+import org.jboss.test.typeinfo.support.GenericIntegerImpl;
+
+/**
+ * Type info test.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractTypeInfoTest extends ContainerTest
+{
+ protected AbstractTypeInfoTest(String name)
+ {
+ super(name);
+ }
+
+ protected abstract TypeInfoFactory getTypeInfoFactory();
+
+ // TODO - remove this after JBMICROCONT-129 is done
+ protected abstract boolean isTypeSupported();
+
+ protected TypeInfo getTypeInfo(Type type) throws Exception
+ {
+ return getTypeInfoFactory().getTypeInfo(type);
+ }
+
+ public void testIsAssignableFrom() throws Throwable
+ {
+ TypeInfo first = getTypeInfo(int.class);
+ TypeInfo second = getTypeInfo(double.class);
+
+ assertIsAssignableFrom(first, second, true);
+ second = getTypeInfo(Date.class);
+ assertIsAssignableFrom(first, second, false);
+
+ first = getTypeInfo(TestInterface.class);
+ assertIsAssignableFrom(first, second, false);
+
+ second = getTypeInfo(TestInterface.class);
+ assertIsAssignableFrom(first, second, true);
+ second = getTypeInfo(TestImpl.class);
+ assertIsAssignableFrom(first, second, true);
+
+ if (isTypeSupported())
+ {
+ first = getTypeInfo(getType("getGenericStringInterface"));
+ second = getTypeInfo(GenericStringImpl.class);
+ assertIsAssignableFrom(first, second, true);
+
+ second = getTypeInfo(GenericIntegerImpl.class);
+ // TODO - better impl could return false?
+ assertIsAssignableFrom(first, second, true);
+ }
+ }
+
+ public void testIsInstance() throws Throwable
+ {
+ TypeInfo first = getTypeInfo(int.class);
+ Object second = 123d;
+
+ assertIsInstance(first, second, true);
+ second = (byte)123;
+ assertIsInstance(first, second, true);
+ second = new Date();
+ assertIsInstance(first, second, false);
+
+ first = getTypeInfo(TestInterface.class);
+ assertIsInstance(first, second, false);
+
+ second = new TestImpl();
+ assertIsInstance(first, second, true);
+
+ if (isTypeSupported())
+ {
+ first = getTypeInfo(getType("getGenericStringInterface"));
+ second = new GenericStringImpl();
+ assertIsInstance(first, second, true);
+
+ second = new GenericIntegerImpl();
+ // TODO - better impl could return false?
+ assertIsInstance(first, second, true);
+ }
+ }
+
+ protected void assertIsAssignableFrom(TypeInfo first, TypeInfo second, boolean expected) throws Throwable
+ {
+ assertEquals(expected, first.isAssignableFrom(second));
+ }
+
+ protected void assertIsInstance(TypeInfo typeInfo, Object object, boolean expected) throws Throwable
+ {
+ assertEquals(expected, typeInfo.isInstance(object));
+ }
+
+ protected Type getType(String methodName, Class<?>... parameters) throws Exception
+ {
+ Method method = getClass().getMethod(methodName, parameters);
+ return method.getGenericReturnType();
+ }
+
+ public GenericInterface<String> getGenericStringInterface()
+ {
+ return null;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.test;
-
-import junit.framework.Test;
-import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory;
-import org.jboss.reflect.spi.TypeInfoFactory;
-
-/**
- * Introspection test info tests.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class IntrospectionTypeInfoTestCase extends AbstractTypeInfoTest
-{
- private TypeInfoFactory factory = new IntrospectionTypeInfoFactory();
-
- public IntrospectionTypeInfoTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(IntrospectionTypeInfoTestCase.class);
- }
-
- protected TypeInfoFactory getTypeInfoFactory()
- {
- return factory;
- }
-
- protected boolean isTypeSupported()
- {
- return true;
- }
-}
\ No newline at end of file
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/IntrospectionTypeInfoTestCase.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.test;
+
+import junit.framework.Test;
+import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory;
+import org.jboss.reflect.spi.TypeInfoFactory;
+
+/**
+ * Introspection test info tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class IntrospectionTypeInfoTestCase extends AbstractTypeInfoTest
+{
+ private TypeInfoFactory factory = new IntrospectionTypeInfoFactory();
+
+ public IntrospectionTypeInfoTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(IntrospectionTypeInfoTestCase.class);
+ }
+
+ protected TypeInfoFactory getTypeInfoFactory()
+ {
+ return factory;
+ }
+
+ protected boolean isTypeSupported()
+ {
+ return true;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.test;
-
-import junit.framework.Test;
-import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
-import org.jboss.reflect.spi.TypeInfoFactory;
-
-/**
- * Javassist type info tests.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class JavassistTypeInfoTestCase extends AbstractTypeInfoTest
-{
- private TypeInfoFactory factory = new JavassistTypeInfoFactory();
-
- public JavassistTypeInfoTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(JavassistTypeInfoTestCase.class);
- }
-
- protected TypeInfoFactory getTypeInfoFactory()
- {
- return factory;
- }
-
- protected boolean isTypeSupported()
- {
- return false;
- }
-}
\ No newline at end of file
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/JavassistTypeInfoTestCase.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.test;
+
+import junit.framework.Test;
+import org.jboss.reflect.plugins.javassist.JavassistTypeInfoFactory;
+import org.jboss.reflect.spi.TypeInfoFactory;
+
+/**
+ * Javassist type info tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class JavassistTypeInfoTestCase extends AbstractTypeInfoTest
+{
+ private TypeInfoFactory factory = new JavassistTypeInfoFactory();
+
+ public JavassistTypeInfoTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(JavassistTypeInfoTestCase.class);
+ }
+
+ protected TypeInfoFactory getTypeInfoFactory()
+ {
+ return factory;
+ }
+
+ protected boolean isTypeSupported()
+ {
+ return false;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java
===================================================================
--- projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java 2008-11-25 13:20:12 UTC (rev 81544)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.typeinfo.test;
-
-import junit.framework.TestSuite;
-import junit.framework.Test;
-import junit.textui.TestRunner;
-
-/**
- * TypeInfo test suite.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class TypeInfoTestSuite extends TestSuite
-{
- public static void main(String[] args)
- {
- TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("TypeInfo Tests");
-
- suite.addTest(IntrospectionTypeInfoTestCase.suite());
- suite.addTest(JavassistTypeInfoTestCase.suite());
-
- return suite;
- }
-}
Copied: projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java (from rev 81544, projects/jboss-reflect/trunk/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java)
===================================================================
--- projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java (rev 0)
+++ projects/jboss-reflect/branches/Branch_2_0/src/test/java/org/jboss/test/typeinfo/test/TypeInfoTestSuite.java 2008-11-25 13:30:23 UTC (rev 81545)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.typeinfo.test;
+
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import junit.textui.TestRunner;
+
+/**
+ * TypeInfo test suite.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TypeInfoTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("TypeInfo Tests");
+
+ suite.addTest(IntrospectionTypeInfoTestCase.suite());
+ suite.addTest(JavassistTypeInfoTestCase.suite());
+
+ return suite;
+ }
+}
More information about the jboss-cvs-commits
mailing list