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 Tue, 11 Sep 2012 02:34:07 GMT


Shevek commented on LANG-819:

Note also that you can capture a ? token by creating a separate method

<T> void foo(A<T> a, B<T> b) { }

and call this with an A<?> and a B<?> (from different sources, e.g. a Map<Class<?>,
A<?>> without a type warning - there's no way to parameterize that in Java, so one
then can't call value.method(key) as the ?s won't match, even though everyone knows that ClassToInstanceMap,
or Provider, or any other type-safe factory pattern causes it to be the case.
> EnumUtils.generateBitVector needs a "? extends"
> -----------------------------------------------
>                 Key: LANG-819
>                 URL:
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.0.1
>            Reporter: Shevek
>            Priority: Minor
>     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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message