I got an error (IllegalArgumentException) when trying to clone an object with a 'char' attribute.
I looked the source, and it looks loke the Characted class is not considered as a primitive type in the following ClassUtils :
public static boolean immutable(Class c) {
if (c == null)
return false;
return c == String.class
|| c.isPrimitive()
|| c.isEnum()
|| Number.class.isAssignableFrom(c) && isJavaPackage(c)
|| Boolean.class == c
;
}
I modified the test by adding a comparison to java.lang.Character, and the clone call do not throw exception anymore.
Can you confirm my understand of the problem is right ? Can you add the correction in the next release ?
Regards
Bruno
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Hanson,
I got an error (IllegalArgumentException) when trying to clone an object with a 'char' attribute.
I looked the source, and it looks loke the Characted class is not considered as a primitive type in the following ClassUtils :
public static boolean immutable(Class c) {
if (c == null)
return false;
return c == String.class
|| c.isPrimitive()
|| c.isEnum()
|| Number.class.isAssignableFrom(c) && isJavaPackage(c)
|| Boolean.class == c
;
}
I modified the test by adding a comparison to java.lang.Character, and the clone call do not throw exception anymore.
Can you confirm my understand of the problem is right ? Can you add the correction in the next release ?
Regards
Bruno
Thanks for reporting this. I've added both Character and Byte for checking for immutability:
http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib/src/net/sf/beanlib/utils/ClassUtils.java?r1=133&r2=204