Silenced lint warnings in ContributedLibrary

Comparing strings with `==` operator triggers a lint4j warning.
This refactoring avoids the use of `thisVersion == otherVersion`.
This commit is contained in:
Cristian Maglie 2016-09-29 19:54:51 +02:00
parent 0def10443f
commit 53e456936d
1 changed files with 6 additions and 3 deletions

View File

@ -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();