1) The compareTo() that uses a registry to do comparison
will only work when the specific version being tested uses the registry.
VersionImpl.compareTo(OSGiVersion) -> registry
OSGiVersion.comapreTo(VersionImpl) does not
The way I said to fix the problem was to pass the Comparator (really
a registry of comparators) into the VersionRange check.
2) The equals() doesn't work as expected.
| public boolean equals(Object object)
| {
| if (object == this)
| return true;
|
| if (object instanceof VersionImpl == false)
| return false;
|
| VersionImpl other = (VersionImpl)object;
| return (major == other.major) && (minor == other.minor) &&
(micro == other.micro) && qualifier.equals(other.qualifier);
| }
|
VersionImpl ours = VersionImpl.parse("1.0.0");
OSGiVersion osgi = OSGiVersion.parse("1.0.0");
ours.equals(osgi) == false and vice versa
This one is a lot harder to fix. e.g. We can't override the equals() calls
if versions (or composites thereof) are used as keys in maps.
Even if we fix the above code to something like:
| Version other = (Version)object;
| return registry.equals(this, other);
|
it won't work the other way around. Also for HashMaps/Sets, etc.
the hashCodes will likely disagree, so they are broken.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124882#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...