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:32:08 GMT


Shevek commented on LANG-819:

Officially: etc etc etc

>From Google:
etc etc etc - the internet is filthy with this stuff.

See also the javadocs for guice, guava, and other competing libraries - they're maintained
by a group of people who are highly formally trained and very aware of type semantics, and
they tend to get this stuff very much correct.

Basically, people NEED to use ? extends and ? super wherever appropriate, especially in things
like transformer and predicate libraries and implementations, otherwise the only way to usefully
use polymorphism is to have hard casts, which defeats the entire purpose of using generics.
Serializer libraries tend to be notoriously badly written, and defeat the purpose of their
own attempted type safety.

Commons should be audited for this kind of thing overall.
> 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