diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2010-07-08 09:46:32 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2010-07-08 09:46:32 +0000 |
commit | e409a23fb5dffd67c843e99ef97467ff4a42c211 (patch) | |
tree | 87798868f0dd7d81224f953e7ed04825fcd89974 | |
parent | 6b14fe163cca31a245721daaf1bc1f630a90258a (diff) | |
download | javassist-e409a23fb5dffd67c843e99ef97467ff4a42c211.tar.gz javassist-e409a23fb5dffd67c843e99ef97467ff4a42c211.zip |
fixed JASSIST-118
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@551 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
-rw-r--r-- | src/main/javassist/CtArray.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/javassist/CtArray.java b/src/main/javassist/CtArray.java index 92ca85e9..42fe6093 100644 --- a/src/main/javassist/CtArray.java +++ b/src/main/javassist/CtArray.java @@ -48,9 +48,14 @@ final class CtArray extends CtClass { } 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 @@ final class CtArray extends CtClass { 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()); } |