DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=39538>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39538 ------- Additional Comments From [EMAIL PROTECTED] 2006-05-22 21:49 ------- (In reply to comment #4) > The project was done without good technical knowledge of Java 1.5 parametized > classes. > THE TYPICAL ERROR: > class Set<E> { > void add(E d) {...} // that's wrong!!! > } > - the method add should read > void add(<? extends E> d) {...} // so any subclass of E is acceptable. I am sorry to disappoint you, but the code above is not wrong. add(E) will accept any subclass of actual type argument. The example below is fully legitimate: Set<Number> set = new HashSet<Number>(); set.add(new Double(0)); Please have a look, how Set<E> interface is defined in the JDK. As for the wildcards (? extends/super E), they are mostly needed, when you have generic objects being passed into/returned from methods. Remember that you cannot pass object, which is declared as Set<Double>, to a function that accepts a Set<Number> as an argument, but you can do it if the argument type is declared as Set<? extends Number>. Without any aim to offend you, I would strongly recommend you revisiting the tutorial you mentioned. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]