[jboss-cvs] javassist SVN: r551 - trunk/src/main/javassist.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 8 05:46:32 EDT 2010
Author: chiba
Date: 2010-07-08 05:46:32 -0400 (Thu, 08 Jul 2010)
New Revision: 551
Modified:
trunk/src/main/javassist/CtArray.java
Log:
fixed JASSIST-118
Modified: trunk/src/main/javassist/CtArray.java
===================================================================
--- trunk/src/main/javassist/CtArray.java 2010-06-17 14:22:24 UTC (rev 550)
+++ trunk/src/main/javassist/CtArray.java 2010-07-08 09:46:32 UTC (rev 551)
@@ -48,9 +48,14 @@
}
public CtClass[] getInterfaces() throws NotFoundException {
- if (interfaces == null)
- interfaces = new CtClass[] {
- pool.get("java.lang.Cloneable"), pool.get("java.io.Serializable") };
+ if (interfaces == null) {
+ Class[] intfs = Object[].class.getInterfaces();
+ // java.lang.Cloneable and java.io.Serializable.
+ // If the JVM is CLDC, intfs is empty.
+ interfaces = new CtClass[intfs.length];
+ for (int i = 0; i < intfs.length; i++)
+ interfaces[i] = pool.get(intfs[i].getName());
+ }
return interfaces;
}
@@ -60,11 +65,14 @@
return true;
String cname = clazz.getName();
- if (cname.equals(javaLangObject)
- || cname.equals("java.lang.Cloneable")
- || cname.equals("java.io.Serializable"))
+ if (cname.equals(javaLangObject))
return true;
+ CtClass[] intfs = getInterfaces();
+ for (int i = 0; i < intfs.length; i++)
+ if (intfs[i].subtypeOf(clazz))
+ return true;
+
return clazz.isArray()
&& getComponentType().subtypeOf(clazz.getComponentType());
}
More information about the jboss-cvs-commits
mailing list