Hi,
as part of JDO-817 "Check Compiler warnings" I was looking into the
warnings of the api submodule. I started with "raw use of parameterized
class", so replacing the use of Set by something like Set<String>.
There is one case where I need some feedback. In javax.jdo.identity
there is a class SingleFieldIdentity which is the abstract base class
for single field identity classes such as IntIdentity, LongIdentity,
etc. Today the abstract base class implements Comparable without
implementing method compareTo which is done in the subclasses. The
implements clause is using the raw type Comparable.
I would like to fix this and move the implements clause to the concrete
subclasses, e.g.:
public class IntIdentity extends SingleFieldIdentity implements
Comparable<IntIdentity>
public class LongIdentity extends SingleFieldIdentity implements Comparable<LongIdentity>
This way we can use the concrete subclass as class parameter for
Comparable.
Then the signature of the compare method takes an instance of the
concrete subclass as an argument instead of Object, such that we do not
need the instanceof check anymore:
public int compareTo(LongIdentity o) {
instead of
public int compareTo(Object o) {
if (oinstanceof LongIdentity) {
The TCK succeeds with this change, but we would need to change the
SignatureTest (runonce.conf), because of the change of the implements
clause of SingleFieldIdentity and its subclasses.
What do you think? Is this an API change that is OK?
Regards Michael