[ https://issues.apache.org/jira/browse/LANG-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13862772#comment-13862772 ]
Matt Benson commented on LANG-819: ---------------------------------- What have I said to lead you to conclude that I misunderstand type bounds? It almost seems (and I hope I'm wrong) that I understand them in such a fundamental way that I cannot be easily talked into doing something that makes _perfect_ sense in the general case, but feels totally useless in this specific one. Your example is all well and good _for non-{{final}} types_, but {{Set<? extends Foo>}} is IMHO a red herring. {{EnumSet.allOf(Foo.class)}} returns {{EnumSet<Foo>}}, _not_ {{EnumSet<? extends Foo>}}; therefore the entire example is contrived. If for some reason you were using a {{Set}} of whatever element type that you didn't already _know_ was {{enum}} you'd never _pass_ that {{Set}} to {{EnumUtils#generateBitVector()}} without first somehow checking that, at which point you'd have to cast the {{Set}} anyway to call the bit vector method. I comprehend that you are saying the {{? extends E}} idiom makes the compiler disallow the modification of a {{Collection}} (an {{Iterable}} can't be modified without casting to {{Collection}} anyway) and I can make the logical leap that _because of this_ it may be a visual shorthand for "read-only," yet I _still_ stubbornly refuse to be bullied by this fact when you have not: * explained your (lacking clarification, striking me as rude and condescending) assertion that I "misunderstand type bounds" * provided a realistic example of code that suffers because of the current parameter specification * explained how [this comment|https://issues.apache.org/jira/browse/LANG-819?focusedCommentId=13452659&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13452659] is germane to the discussion Regards, Matt > 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 > > 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)