commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomasz Blachowicz (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-298) ClassUtils.getShortClassName and ClassUtils.getPackageName and class of array
Date Mon, 27 Nov 2006 23:17:22 GMT
    [ http://issues.apache.org/jira/browse/LANG-298?page=comments#action_12453737 ] 
            
Tomasz Blachowicz commented on LANG-298:
----------------------------------------

I'm really sorry I've submitted this issue without description. Here you can find detailed
explanation of the problem I've came across recently.

When you use ClassUtils.getShortClassName method for class of array you get unresonable result.
For instance:
ClassUtils.getShortClassName(java.lang.Object[].class) returns Object;
ClassUtils.getShortClassName(int[].class) returns [I

Respectively, when use classUtils.getPackageName for class of array it also fails.
For instance:
ClassUtils.getPackageName(java.lang.Object[].class) returns [Ljava.lang
ClassUtils.getPackageName(int[].class) returns empty string

In my opinion both methods should transform class name into canonical one before extracting
short name or package name. In JavaSE 1.5 there is a method Class.getCanonicalName() but commons-lang
should be < 1.5 compilant co there is a need to implement a custom mechanism to convert
spring representation of class names from JVM to canonical name.

I think the results for above examples should look like that:
ClassUtils.getShortClassName(java.lang.Object[].class) should return Object[]
ClassUtils.getShortClassName(int[].class) should return int[]
ClassUtils.getPackageName(java.lang.Object[].class) should return java.lang
ClassUtils.getPackageName(int[].class) should return empty string /it's OK/

> ClassUtils.getShortClassName and ClassUtils.getPackageName and class of array
> -----------------------------------------------------------------------------
>
>                 Key: LANG-298
>                 URL: http://issues.apache.org/jira/browse/LANG-298
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 2.2
>            Reporter: Tomasz Blachowicz
>


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message