[ 
http://www.stripesframework.org/jira/browse/STS-584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11433#action_11433
 ] 

Taras Puchko commented on STS-584:
----------------------------------

Sorry, I misunderstood the meaning of CollectionUtil.asList(Object) - I thought 
it's like java.util.Arrays.singletonList(Object). 
But nevertheless I suggest to merge CollectionUtil.asList(Iterable) into 
CollectionUtil.asList(Object) or to rename CollectionUtil.asList(Object) to 
CollectionUtil.primitiveArrayAsList(Object).

> CollectionUtil.asList(Object) should be named distinctly from 
> CollectionUtil.asList(Iterable<T>)
> ------------------------------------------------------------------------------------------------
>
>                 Key: STS-584
>                 URL: http://www.stripesframework.org/jira/browse/STS-584
>             Project: Stripes
>          Issue Type: Improvement
>    Affects Versions: Release 1.5
>            Reporter: Taras Puchko
>            Priority: Minor
>
> Class net.sourceforge.stripes.util.CollectionUtil has an overloaded method 
> asList that doesn't comply with Joshua Bloch's recommendations for method 
> overloading: 
> http://www.informit.com/content/images/0201310058/samplechapter/blochch6.pdf
> For instance, we have two consecutive lines of code in class 
> net.sourceforge.stripes.tag.InputOptionsCollectionTag where the casting seems 
> unnecessary but it changes the semantics of the method:
>         else if (in instanceof Iterable) this.collection = 
> CollectionUtil.asList((Iterable) in);
>         else if (in.getClass().isArray()) this.collection = 
> CollectionUtil.asList(in);
> On the contrary if we have Iterable it = ... we need to use casting to Object 
> in order to make a list of a single Iterable.
> Such methods with different semantics are incompatible with Retrotranslator 
> which replaces Iterable with Object so both methods have identical signature 
> and one of them gets removed.

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

        

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to