commons-issues mailing list archives

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


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:
>             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

View raw message