Menu

Character not a primitive type ?

Help
2007-06-18
2013-04-25
  • Bruno Marchesson

    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

     

Log in to post a comment.