[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] ServiceReference.compareTo(Object)

2009/4/24 åéãçä <okano-shinichi@xxxxxxxxx>:
> Hi all !
>
> I am using Equinox 3.4.2, and I thik I found a bug.
>
> The Javadoc of "org.osgi.framework.ServiceReference.compareTo(Object)"
> says the following:
>
> Â ÂThis ServiceReference is less than the specified ServiceReference if
> Â Âit has a lower service ranking and greater if it has a higher
> Â Âservice ranking. Otherwise, if this ServiceReference and the
> Â Âspecified ServiceReference have the same service ranking, this
> Â ÂServiceReference is less than the specified ServiceReference if it
> Â Âhas a higher service id and greater if it has a lower service id.
>
> But,
> org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl.compareTo(Object)
> (version=3.4.3.R34x_v20081215-1030) is implemented the following.
>
> Â Âif (this.getRanking() != other.getRanking())
> Â Â Â Âreturn this.getRanking() > other.getRanking() ? -1 : 1;
> Â Âreturn this.getId() == other.getId() ? 0 : this.getId() > other.getId() ? 1 : -1;
>
> I think the following is correct.
>
> Â Âif (this.getRanking() != other.getRanking())
>
> Â Â Â Âreturn this.getRanking() > other.getRanking() ? 1 : -1; Â// Â<--
>
> Â Âreturn this.getId() == other.getId() ? 0 : this.getId() > other.getId() ? -1 : 1; Â// <<-
>
>
> I'm sorry if I have a mistake, or if it had already been discussed.

Looks reasonable. Why not open a bug at bugs.eclipse.org?

Alex