You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stephen Kestle (JIRA)" <ji...@apache.org> on 2008/03/28 03:36:24 UTC

[jira] Created: (LANG-420) Rename ObjectUtils.toString() to asString().

Rename ObjectUtils.toString() to asString().
--------------------------------------------

                 Key: LANG-420
                 URL: https://issues.apache.org/jira/browse/LANG-420
             Project: Commons Lang
          Issue Type: Improvement
    Affects Versions: 2.3
            Reporter: Stephen Kestle
            Priority: Trivial


With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.

For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  

It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()

Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603517#action_12603517 ] 

Sebb commented on LANG-420:
---------------------------

If one just wants to allow shorthand method calling, surely one could just add wrapper methods with the new names?

The old names could be left for backwards compatibility.


> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>             Fix For: LangTwo 1.0
>
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-420:
-------------------------------

         Fix Version/s: LangTwo 1.0
    Remaining Estimate:     (was: 0.5h)
     Original Estimate:     (was: 0.5h)

Assigning to LangTwo; seems unlikely we'd want to adjust this for 3.0.

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>             Fix For: LangTwo 1.0
>
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752009#action_12752009 ] 

Henri Yandell commented on LANG-420:
------------------------------------

Options seem to be:

a) Users use the full name. 
b) Come up with a generic way to rename clashes. Having an _equals(...), _hashCode(...) etc.
c) Fix just this one to asString.

My vote is on a) as I don't see this as a critical enough feature to warrant all that overloading. 

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>             Fix For: 3.0
>
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bourg reopened LANG-420:
---------------------------------


Reopening, this issue exists with static imports. For example with the following code :

{code:java}
import static org.apache.commons.lang.ObjectUtils.*;

public class Test {
    {
        toString(null, "");
    }
}
{code}

The compiler complains that toString() in java.lang.Object cannot be applied to (<nulltype>,java.lang.String).


> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603776#action_12603776 ] 

Henri Yandell commented on LANG-420:
------------------------------------

Or it could be reported as a bug to Sun. 

I'm not a fan of the static importing feature, so I definitely don't have the itch to go rename things. I guess if we make _equals() methods or some such, a standard 'get around the problem' approach instead of trying to rename every method, then it might be pretty easy.

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>             Fix For: LangTwo 1.0
>
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-420.
------------------------------

    Resolution: Won't Fix

Resolving again as WONTFIX.

I definitely don't see a need to rename the method from toString(). It could be argued that there could be an alias method of asString() to provide a workaround, but I don't see why ObjectUtils.toString is such a terrible workaround.

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>             Fix For: 3.0
>
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-420.
------------------------------

    Resolution: Invalid

Closing as it doesn't seem like we have this bug. If someone can indicate that the bug does exist, please reopen.

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595890#action_12595890 ] 

Henri Yandell commented on LANG-420:
------------------------------------

I think this should be WONTFIX as there is no ObjectUtils.toString().

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742776#action_12742776 ] 

Henri Yandell commented on LANG-420:
------------------------------------

Looks intentional. I'm guessing this is "A static-import-on-demand declaration never causes any other declaration to be shadowed." in 7.5.4 of the JLS:

http://java.sun.com/docs/books/jls/third_edition/html/packages.html#94114

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>             Fix For: 3.0
>
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12583554#action_12583554 ] 

Henri Yandell commented on LANG-420:
------------------------------------

Even if it's toString(Object)? That still clashes with the toString() on Object?

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603486#action_12603486 ] 

Henri Yandell commented on LANG-420:
------------------------------------

Yep, I can confirm. Also will be a problem in ArrayUtils, BooleanUtils, ReflectionToStringBuilder, CharUtils. 

equals(..) will be a problem in ObjectUtils and StringUtils. 

hashCode(..) will be a problem in ArrayUtils and ObjectUtils.

getClass(..) will be a problem in ClassUtils.

clone(..) will be a problem in ArrayUtils and SerializationUtils.

Work around - use the full invocation, ie: ObjectUtils.toString(...). I'm not sure we'll want to go renaming all of the above.

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>             Fix For: LangTwo 1.0
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-420) Rename ObjectUtils.toString() to asString().

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582885#action_12582885 ] 

Paul Benedict commented on LANG-420:
------------------------------------

Good point. Without the qualifier, I rather call it (i.e.) 'nullSafeToString' to make its purpose clear.,

> Rename ObjectUtils.toString() to asString().
> --------------------------------------------
>
>                 Key: LANG-420
>                 URL: https://issues.apache.org/jira/browse/LANG-420
>             Project: Commons Lang
>          Issue Type: Improvement
>    Affects Versions: 2.3
>            Reporter: Stephen Kestle
>            Priority: Trivial
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> With Java 5 static method inlining, methods do not require class qualifying *unless* the class already has the method.
> For this reason, ObjectUtlis.toString() cannot be inlined to toString(), as Object has a toString() method.  
> It would be nice for it to have a name that could be statically imported, such as asString.  This would follow the naming convention of Arrays.asList()
> Note that this DOES NOT need a java 5 version of lang.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.