You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "tbw777 (via GitHub)" <gi...@apache.org> on 2023/01/30 11:35:33 UTC

[GitHub] [netbeans] tbw777 commented on a diff in pull request #5379: Proposal to change `==` comparing constants with `equals`

tbw777 commented on code in PR #5379:
URL: https://github.com/apache/netbeans/pull/5379#discussion_r1090508851


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ModuleDependency.java:
##########
@@ -146,7 +146,7 @@ public int compareTo(ModuleDependency other) {
         if (result != 0) { return result; }
         
         // do not force resolution of SPEC_VERSION_LAZY for comparisons, unnecessary
-        if (specVersion != SPEC_VERSION_LAZY || other.specVersion != SPEC_VERSION_LAZY) {
+        if (!SPEC_VERSION_LAZY.equals(specVersion) || !SPEC_VERSION_LAZY.equals(other.specVersion)) {

Review Comment:
   specVersion is variable, not a compile time constant, therefore code its correct



##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ModuleDependency.java:
##########
@@ -146,7 +146,7 @@ public int compareTo(ModuleDependency other) {
         if (result != 0) { return result; }
         
         // do not force resolution of SPEC_VERSION_LAZY for comparisons, unnecessary
-        if (specVersion != SPEC_VERSION_LAZY || other.specVersion != SPEC_VERSION_LAZY) {
+        if (!SPEC_VERSION_LAZY.equals(specVersion) || !SPEC_VERSION_LAZY.equals(other.specVersion)) {

Review Comment:
   specVersion is variable, not a compile time constant, therefore fixing code its correct



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists