[jboss-cvs] JBossAS SVN: r104795 - projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri May 14 07:47:37 EDT 2010
Author: kabir.khan at jboss.com
Date: 2010-05-14 07:47:37 -0400 (Fri, 14 May 2010)
New Revision: 104795
Modified:
projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
Log:
[JBREFLECT-5] Clean up duplicate code
Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java 2010-05-14 11:34:12 UTC (rev 104794)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java 2010-05-14 11:47:37 UTC (rev 104795)
@@ -164,51 +164,8 @@
@SuppressWarnings("unchecked")
protected TypeInfo instantiate(Class clazz)
{
- try
- {
- CtClass ctClass = getCtClass(clazz.getName(), clazz.getClassLoader());
-
- if (clazz.isArray())
- {
- TypeInfo componentType = getTypeInfo(clazz.getComponentType());
- return new JavassistArrayInfoImpl(this, ctClass, clazz, componentType);
- }
-
- if (ctClass.isAnnotation())
- {
- JavassistAnnotationInfo result = new JavassistAnnotationInfo(this, ctClass, clazz);
- CtMethod[] methods = ctClass.getDeclaredMethods();
- AnnotationAttributeImpl[] atttributes = new AnnotationAttributeImpl[methods.length];
- for (int i = 0 ; i < methods.length ; i++)
- {
- atttributes[i] = new AnnotationAttributeImpl(methods[i].getName(), getTypeInfo(methods[i].getReturnType()), null);
- }
- result.setAttributes(atttributes);
- return result;
-
- }
- else if (ctClass.isEnum())
- {
- JavassistEnumInfo enumInfo = new JavassistEnumInfo(this, ctClass, clazz);
- CtField[] fields = ctClass.getFields();
- EnumConstantInfoImpl[] constants = new EnumConstantInfoImpl[fields.length];
- int i = 0;
- for (CtField field : fields)
- {
- AnnotationValue[] annotations = getAnnotations(field);
- constants[i++] = new EnumConstantInfoImpl(field.getName(), enumInfo, annotations);
- }
- enumInfo.setEnumConstants(constants);
- return enumInfo;
- }
-
-
- return new JavassistTypeInfo(this, ctClass, clazz);
- }
- catch (NotFoundException e)
- {
- throw new RuntimeException(e);
- }
+ CtClass ctClass = getCtClass(clazz.getName(), clazz.getClassLoader());
+ return instantiate(ctClass, clazz);
}
protected TypeInfo instantiate(CtClass ctClass, Class<?> clazz)
@@ -679,7 +636,7 @@
if (result != null)
{
CtClass clazz = getCtClass(result, false);
- if (clazz != null)
+ if (clazz != null && clazz.isModified())
{
//Only do this check if it is a Javassist implementation. delegateToIntrospectionImplementation()
//loads up Reflect implementations in some cases
More information about the jboss-cvs-commits
mailing list