RFR: 8274168: Avoid String.compareTo == 0 to check String equality in java.management
Chris Plummer
cjplummer at openjdk.java.net
Thu Sep 23 04:28:51 UTC 2021
On Thu, 23 Sep 2021 02:52:11 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> I agree with Chris on this.
>> Fix in the other file looks okay to me.
>
> I look at it this way, the code should really (IMHO) have been written as:
>
> int res = sval1.compareTo(sval2);
> switch(relOp) {
> case Query.GT: return res > 0;
> case ...
> }
>
> and so the use of equals() instead would never have arisen. :)
Yep, that works for me.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5640
More information about the serviceability-dev
mailing list