I looked at a few of the collections15 files in CVS.
It did not take me much time to spot some obvious
errors. The most common error is to simply replace
the class parameter symbol ('E') everywhere and that's
wrong. Some more thought has to be given to it. I
refer you to the document generics-tutorial.pdf found
on Sun website. This document must be read carefully
before understanding and making corrections to the
collections15 sources.
COMMON ERROR: If you have a container, say Bag<E> and
you use it to hold class or interface Shape like this
Bag<Shape>. Then you should be able to add Triangle,
Circle and Rectagle to it because each is a subclass
of of Shape. So it is not enough to simply put the E
symbol everywhere in the sourcecode. The add method
of Bag<E> should read like this:
class Bag<E> .... {
void add(<? extends E> e) { ... }
}
This way, any class that extends E can be put into the
Bag. The document mentioned above explains it in
further detail.
Every current collection15 sourcecode should be
reviewed in light of this
Logged In: YES
user_id=958687
Just took over the project. It's a project that still have
a long way to go. I would appreciated if you can metion
that few files you have spotted that we can start to work
on. Thanks!