commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shevek (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-819) EnumUtils.generateBitVector needs a "? extends"
Date Fri, 10 Jan 2014 22:24:53 GMT

    [ https://issues.apache.org/jira/browse/LANG-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13868404#comment-13868404
] 

Shevek commented on LANG-819:
-----------------------------

Oh, to answer the last question, to use transform() without upcasting, I might have to wrap
Iterable in Iterable. I don't know. One of the other tricks that works is defining a method
whose only purpose is to do type capture. I don't really like that, but it's the only way
Java lets you have a type (non-first-class) in lexical scope.

> EnumUtils.generateBitVector needs a "? extends"
> -----------------------------------------------
>
>                 Key: LANG-819
>                 URL: https://issues.apache.org/jira/browse/LANG-819
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.0.1
>            Reporter: Shevek
>            Priority: Minor
>             Fix For: 3.3
>
>
>     public static <E extends Enum<E>> long generateBitVector(Class<E>
enumClass, Iterable<E> values) {
> Should be Iterable<? extends E>.
> This is because although no subclasses of E can exist, the "? extends" is a common idiom
for marking the collection as readonly, or not "owned" by the current object.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message