From 53e456936d9c9dfff05700b4ed5a65bb38c2c6e0 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 29 Sep 2016 19:54:51 +0200 Subject: [PATCH] Silenced lint warnings in ContributedLibrary Comparing strings with `==` operator triggers a lint4j warning. This refactoring avoids the use of `thisVersion == otherVersion`. --- .../contributions/libraries/ContributedLibrary.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java b/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java index a766b0d7e..d44c5ac06 100644 --- a/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java +++ b/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java @@ -137,10 +137,13 @@ public abstract class ContributedLibrary extends DownloadableContribution { String thisVersion = getParsedVersion(); String otherVersion = ((ContributedLibrary) obj).getParsedVersion(); - // Important: for legacy libs, versions are null. Two legacy libs must + boolean versionEquals = (thisVersion != null && otherVersion != null + && thisVersion.equals(otherVersion)); + + // Important: for legacy libs, versions are null. Two legacy libs must // always pass this test. - boolean versionEquals = thisVersion == otherVersion || - (thisVersion != null && otherVersion != null && thisVersion.equals(otherVersion)); + if (thisVersion == null && otherVersion == null) + versionEquals = true; String thisName = getName(); String otherName = ((ContributedLibrary) obj).getName();