From 9e291cdec361a9d49adf6da953913f0ce676f9b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Tue, 24 May 2016 12:48:25 +0200 Subject: [PATCH] remove use of Guava's Objects.equal --- .../test/java/it/issue/IssueTrackingTest.java | 6 ++-- .../user/RailsExternalAuthenticationTest.java | 4 +-- .../server/computation/metric/MetricImpl.java | 4 +-- .../server/issue/IssueCommentService.java | 19 ++++++------ .../org/sonar/server/issue/IssueUpdater.java | 30 +++++++++---------- ...hangesOnMyIssueNotificationDispatcher.java | 4 +-- .../DoNotFixNotificationDispatcher.java | 6 ++-- .../sonar/server/user/DefaultUserService.java | 4 +-- .../org/sonar/core/issue/DefaultIssue.java | 4 +-- .../db/dashboard/ActiveDashboardDto.java | 2 +- .../db/loadedtemplate/LoadedTemplateDto.java | 4 +-- .../org/sonar/db/property/PropertyDto.java | 12 ++++---- .../detector/suffixtree/SuffixTree.java | 4 +-- .../detector/suffixtree/StringSuffixTree.java | 5 ++-- .../sonar/api/resources/InputFileUtils.java | 7 ++--- .../sonar/api/resources/ResourceTypes.java | 4 +-- 16 files changed, 58 insertions(+), 61 deletions(-) diff --git a/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java b/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java index f7c368b48f0..abbfd01c8f7 100644 --- a/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java +++ b/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java @@ -19,13 +19,13 @@ */ package it.issue; -import com.google.common.base.Objects; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.sonar.orchestrator.locator.FileLocation; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.Objects; import org.junit.Before; import org.junit.Test; import org.sonar.wsclient.issue.Issue; @@ -162,8 +162,8 @@ public class IssueTrackingTest extends AbstractIssueTest { private Issue getIssueOnLine(final Integer line, final String repoKey, final String ruleKey, List issues) { return Iterables.find(issues, new Predicate() { public boolean apply(Issue issue) { - return Objects.equal(issue.line(), line) && - Objects.equal(issue.ruleKey(), repoKey + ":" + ruleKey); + return Objects.equals(issue.line(), line) && + Objects.equals(issue.ruleKey(), repoKey + ":" + ruleKey); } }); } diff --git a/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java b/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java index fd7280fef4d..6ce7c2ec88f 100644 --- a/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java @@ -19,12 +19,12 @@ */ package it.user; -import com.google.common.base.Objects; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.selenium.Selenese; import java.util.Map; +import java.util.Objects; import org.apache.commons.lang.RandomStringUtils; import org.junit.After; import org.junit.Before; @@ -401,7 +401,7 @@ public class RailsExternalAuthenticationTest { } try { String value = wsClient.find(new UserPropertyQuery("auth")).getValue(); - if (!Objects.equal(value, expectedValue)) { + if (!Objects.equals(value, expectedValue)) { // exceptional case - update+retrieval were successful, but value doesn't match throw new IllegalStateException("Expected " + expectedValue + " , but got " + value); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/metric/MetricImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/metric/MetricImpl.java index b4d55aa1bd8..38e1aeafe29 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/metric/MetricImpl.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/metric/MetricImpl.java @@ -20,7 +20,7 @@ package org.sonar.server.computation.metric; import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; +import java.util.Objects; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; @@ -107,7 +107,7 @@ public final class MetricImpl implements Metric { return false; } MetricImpl metric = (MetricImpl) o; - return Objects.equal(key, metric.key); + return Objects.equals(key, metric.key); } @Override diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java index 6fb50b2a36f..8893f23e2b5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueCommentService.java @@ -19,27 +19,26 @@ */ package org.sonar.server.issue; -import com.google.common.base.Objects; import com.google.common.base.Strings; +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Objects; import org.apache.commons.lang.StringUtils; import org.sonar.api.issue.IssueComment; +import org.sonar.api.utils.System2; import org.sonar.core.issue.DefaultIssue; import org.sonar.core.issue.DefaultIssueComment; import org.sonar.core.issue.IssueChangeContext; -import org.sonar.api.utils.System2; -import org.sonar.db.issue.IssueChangeDto; -import org.sonar.db.DbSession; import org.sonar.db.DbClient; +import org.sonar.db.DbSession; +import org.sonar.db.issue.IssueChangeDto; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.exceptions.UnauthorizedException; import org.sonar.server.user.UserSession; -import java.util.Collection; -import java.util.Date; -import java.util.List; - import static com.google.common.collect.Lists.newArrayList; public class IssueCommentService { @@ -111,7 +110,7 @@ public class IssueCommentService { if (comment == null) { throw new NotFoundException("Comment not found: " + commentKey); } - if (Strings.isNullOrEmpty(comment.userLogin()) || !Objects.equal(comment.userLogin(), userSession.getLogin())) { + if (Strings.isNullOrEmpty(comment.userLogin()) || !Objects.equals(comment.userLogin(), userSession.getLogin())) { throw new ForbiddenException("You can only delete your own comments"); } @@ -130,7 +129,7 @@ public class IssueCommentService { if (comment == null) { throw new NotFoundException("Comment not found: " + commentKey); } - if (Strings.isNullOrEmpty(comment.userLogin()) || !Objects.equal(comment.userLogin(), userSession.getLogin())) { + if (Strings.isNullOrEmpty(comment.userLogin()) || !Objects.equals(comment.userLogin(), userSession.getLogin())) { throw new ForbiddenException("You can only edit your own comments"); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java index a769c0dc358..d268f0da78a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/IssueUpdater.java @@ -21,7 +21,6 @@ package org.sonar.server.issue; import com.google.common.base.Function; import com.google.common.base.Joiner; -import com.google.common.base.Objects; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.Sets; @@ -29,6 +28,7 @@ import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.Locale; +import java.util.Objects; import java.util.Set; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; @@ -71,7 +71,7 @@ public class IssueUpdater { private static final Joiner CHANGELOG_TAG_JOINER = Joiner.on(" ").skipNulls(); public boolean setType(DefaultIssue issue, RuleType type, IssueChangeContext context) { - if (!Objects.equal(type, issue.type())) { + if (!Objects.equals(type, issue.type())) { issue.setFieldChange(context, TYPE, issue.type(), type); issue.setType(type); issue.setUpdateDate(context.date()); @@ -85,7 +85,7 @@ public class IssueUpdater { if (issue.manualSeverity()) { throw new IllegalStateException("Severity can't be changed"); } - if (!Objects.equal(severity, issue.severity())) { + if (!Objects.equals(severity, issue.severity())) { issue.setFieldChange(context, SEVERITY, issue.severity(), severity); issue.setSeverity(severity); issue.setUpdateDate(context.date()); @@ -102,7 +102,7 @@ public class IssueUpdater { } public boolean setManualSeverity(DefaultIssue issue, String severity, IssueChangeContext context) { - if (!issue.manualSeverity() || !Objects.equal(severity, issue.severity())) { + if (!issue.manualSeverity() || !Objects.equals(severity, issue.severity())) { issue.setFieldChange(context, SEVERITY, issue.severity(), severity); issue.setSeverity(severity); issue.setManualSeverity(true); @@ -119,7 +119,7 @@ public class IssueUpdater { if (user != null) { sanitizedAssignee = StringUtils.defaultIfBlank(user.login(), null); } - if (!Objects.equal(sanitizedAssignee, issue.assignee())) { + if (!Objects.equals(sanitizedAssignee, issue.assignee())) { String newAssigneeName = user != null ? user.name() : null; issue.setFieldChange(context, ASSIGNEE, UNUSED, newAssigneeName); issue.setAssignee(sanitizedAssignee); @@ -148,7 +148,7 @@ public class IssueUpdater { } public boolean setLine(DefaultIssue issue, @Nullable Integer line) { - if (!Objects.equal(line, issue.line())) { + if (!Objects.equals(line, issue.line())) { issue.setLine(line); issue.setChanged(true); return true; @@ -163,7 +163,7 @@ public class IssueUpdater { } public boolean setLocations(DefaultIssue issue, @Nullable Object locations) { - if (!Objects.equal(locations, issue.getLocations())) { + if (!Objects.equals(locations, issue.getLocations())) { issue.setLocations(locations); issue.setChanged(true); return true; @@ -179,7 +179,7 @@ public class IssueUpdater { } public boolean setResolution(DefaultIssue issue, @Nullable String resolution, IssueChangeContext context) { - if (!Objects.equal(resolution, issue.resolution())) { + if (!Objects.equals(resolution, issue.resolution())) { issue.setFieldChange(context, RESOLUTION, issue.resolution(), resolution); issue.setResolution(resolution); issue.setUpdateDate(context.date()); @@ -191,7 +191,7 @@ public class IssueUpdater { } public boolean setStatus(DefaultIssue issue, String status, IssueChangeContext context) { - if (!Objects.equal(status, issue.status())) { + if (!Objects.equals(status, issue.status())) { issue.setFieldChange(context, STATUS, issue.status(), status); issue.setStatus(status); issue.setUpdateDate(context.date()); @@ -203,7 +203,7 @@ public class IssueUpdater { } public boolean setAuthorLogin(DefaultIssue issue, @Nullable String authorLogin, IssueChangeContext context) { - if (!Objects.equal(authorLogin, issue.authorLogin())) { + if (!Objects.equals(authorLogin, issue.authorLogin())) { issue.setFieldChange(context, AUTHOR, issue.authorLogin(), authorLogin); issue.setAuthorLogin(authorLogin); issue.setUpdateDate(context.date()); @@ -231,7 +231,7 @@ public class IssueUpdater { } public boolean setMessage(DefaultIssue issue, @Nullable String s, IssueChangeContext context) { - if (!Objects.equal(s, issue.message())) { + if (!Objects.equals(s, issue.message())) { issue.setMessage(s); issue.setUpdateDate(context.date()); issue.setChanged(true); @@ -254,7 +254,7 @@ public class IssueUpdater { public void setCloseDate(DefaultIssue issue, @Nullable Date d, IssueChangeContext context) { Date dateWithoutMilliseconds = d == null ? null : DateUtils.truncate(d, Calendar.SECOND); - if (!Objects.equal(dateWithoutMilliseconds, issue.closeDate())) { + if (!Objects.equals(dateWithoutMilliseconds, issue.closeDate())) { issue.setCloseDate(d); issue.setUpdateDate(context.date()); issue.setChanged(true); @@ -262,7 +262,7 @@ public class IssueUpdater { } public boolean setGap(DefaultIssue issue, @Nullable Double d, IssueChangeContext context) { - if (!Objects.equal(d, issue.gap())) { + if (!Objects.equals(d, issue.gap())) { issue.setGap(d); issue.setUpdateDate(context.date()); issue.setChanged(true); @@ -281,7 +281,7 @@ public class IssueUpdater { public boolean setEffort(DefaultIssue issue, @Nullable Duration value, IssueChangeContext context) { Duration oldValue = issue.effort(); - if (!Objects.equal(value, oldValue)) { + if (!Objects.equals(value, oldValue)) { issue.setEffort(value != null ? value : null); issue.setFieldChange(context, TECHNICAL_DEBT, oldValue != null ? oldValue.toMinutes() : null, value != null ? value.toMinutes() : null); issue.setUpdateDate(context.date()); @@ -299,7 +299,7 @@ public class IssueUpdater { public boolean setAttribute(DefaultIssue issue, String key, @Nullable String value, IssueChangeContext context) { String oldValue = issue.attribute(key); - if (!Objects.equal(oldValue, value)) { + if (!Objects.equals(oldValue, value)) { issue.setFieldChange(context, key, oldValue, value); issue.setAttribute(key, value); issue.setUpdateDate(context.date()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcher.java b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcher.java index 69789360368..20238f00528 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcher.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/ChangesOnMyIssueNotificationDispatcher.java @@ -19,9 +19,9 @@ */ package org.sonar.server.issue.notification; -import com.google.common.base.Objects; import com.google.common.collect.Multimap; import java.util.Collection; +import java.util.Objects; import javax.annotation.Nullable; import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.NotificationChannel; @@ -66,7 +66,7 @@ public class ChangesOnMyIssueNotificationDispatcher extends NotificationDispatch String changeAuthor = notification.getFieldValue("changeAuthor"); String assignee = notification.getFieldValue("assignee"); - if (!Objects.equal(changeAuthor, assignee)) { + if (!Objects.equals(changeAuthor, assignee)) { addUserToContextIfSubscribed(context, assignee, subscribedRecipients); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcher.java b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcher.java index 69fca8eef51..1622611b7d9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcher.java +++ b/server/sonar-server/src/main/java/org/sonar/server/issue/notification/DoNotFixNotificationDispatcher.java @@ -19,10 +19,10 @@ */ package org.sonar.server.issue.notification; -import com.google.common.base.Objects; import com.google.common.collect.Multimap; import java.util.Collection; import java.util.Map; +import java.util.Objects; import org.sonar.api.issue.Issue; import org.sonar.api.notifications.Notification; import org.sonar.api.notifications.NotificationChannel; @@ -58,7 +58,7 @@ public class DoNotFixNotificationDispatcher extends NotificationDispatcher { @Override public void dispatch(Notification notification, Context context) { String newResolution = notification.getFieldValue("new.resolution"); - if (Objects.equal(newResolution, Issue.RESOLUTION_FALSE_POSITIVE) || Objects.equal(newResolution, Issue.RESOLUTION_WONT_FIX)) { + if (Objects.equals(newResolution, Issue.RESOLUTION_FALSE_POSITIVE) || Objects.equals(newResolution, Issue.RESOLUTION_WONT_FIX)) { String author = notification.getFieldValue("changeAuthor"); String projectKey = notification.getFieldValue("projectKey"); Multimap subscribedRecipients = notifications.findNotificationSubscribers(this, projectKey); @@ -70,7 +70,7 @@ public class DoNotFixNotificationDispatcher extends NotificationDispatcher { for (Map.Entry> channelsByRecipients : subscribedRecipients.asMap().entrySet()) { String login = channelsByRecipients.getKey(); // Do not notify the person that resolved the issue - if (!Objects.equal(author, login)) { + if (!Objects.equals(author, login)) { for (NotificationChannel channel : channelsByRecipients.getValue()) { context.addUser(login, channel); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/DefaultUserService.java b/server/sonar-server/src/main/java/org/sonar/server/user/DefaultUserService.java index 9152ebf0e0c..983ca9f00bf 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/DefaultUserService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/DefaultUserService.java @@ -19,10 +19,10 @@ */ package org.sonar.server.user; -import com.google.common.base.Objects; import com.google.common.base.Strings; import java.util.List; import java.util.Map; +import java.util.Objects; import javax.annotation.CheckForNull; import org.apache.commons.lang.StringUtils; import org.sonar.api.user.RubyUserService; @@ -101,7 +101,7 @@ public class DefaultUserService implements RubyUserService { throw new BadRequestException("Login is missing"); } userSession.checkPermission(GlobalPermissions.SYSTEM_ADMIN); - if (Objects.equal(userSession.getLogin(), login)) { + if (Objects.equals(userSession.getLogin(), login)) { throw new BadRequestException("Self-deactivation is not possible"); } userUpdater.deactivateUserByLogin(login); diff --git a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java index e8885be59ba..12b5f9ae573 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/DefaultIssue.java @@ -19,7 +19,6 @@ */ package org.sonar.core.issue; -import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; @@ -35,6 +34,7 @@ import java.util.Date; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -509,7 +509,7 @@ public class DefaultIssue implements Issue, Trackable, org.sonar.api.ce.measure. } public DefaultIssue setFieldChange(IssueChangeContext context, String field, @Nullable Serializable oldValue, @Nullable Serializable newValue) { - if (!Objects.equal(oldValue, newValue)) { + if (!Objects.equals(oldValue, newValue)) { if (currentChange == null) { currentChange = new FieldDiffs(); currentChange.setUserLogin(context.login()); diff --git a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java index 3a7a2c501d4..6db7d489c61 100644 --- a/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java +++ b/sonar-db/src/main/java/org/sonar/db/dashboard/ActiveDashboardDto.java @@ -19,7 +19,7 @@ */ package org.sonar.db.dashboard; -import com.google.common.base.Objects; +import java.util.Objects; public final class ActiveDashboardDto { private Long id; diff --git a/sonar-db/src/main/java/org/sonar/db/loadedtemplate/LoadedTemplateDto.java b/sonar-db/src/main/java/org/sonar/db/loadedtemplate/LoadedTemplateDto.java index de311db7524..69c82404deb 100644 --- a/sonar-db/src/main/java/org/sonar/db/loadedtemplate/LoadedTemplateDto.java +++ b/sonar-db/src/main/java/org/sonar/db/loadedtemplate/LoadedTemplateDto.java @@ -19,7 +19,7 @@ */ package org.sonar.db.loadedtemplate; -import com.google.common.base.Objects; +import java.util.Objects; public final class LoadedTemplateDto { @@ -79,7 +79,7 @@ public final class LoadedTemplateDto { return false; } LoadedTemplateDto other = (LoadedTemplateDto) o; - return Objects.equal(id, other.id) && Objects.equal(key, other.key) && Objects.equal(type, other.type); + return Objects.equals(id, other.id) && Objects.equals(key, other.key) && Objects.equals(type, other.type); } @Override diff --git a/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java b/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java index 3f0bfb6d589..a9f9a5f118d 100644 --- a/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java +++ b/sonar-db/src/main/java/org/sonar/db/property/PropertyDto.java @@ -20,7 +20,7 @@ package org.sonar.db.property; import com.google.common.base.MoreObjects; -import com.google.common.base.Objects; +import java.util.Objects; public class PropertyDto { private Long id; @@ -84,15 +84,15 @@ public class PropertyDto { } final PropertyDto other = (PropertyDto) obj; - return Objects.equal(this.key, other.key) - && Objects.equal(this.value, other.value) - && Objects.equal(this.userId, other.userId) - && Objects.equal(this.resourceId, other.resourceId); + return Objects.equals(this.key, other.key) + && Objects.equals(this.value, other.value) + && Objects.equals(this.userId, other.userId) + && Objects.equals(this.resourceId, other.resourceId); } @Override public int hashCode() { - return Objects.hashCode(this.key, this.value, this.resourceId, this.userId); + return Objects.hash(this.key, this.value, this.resourceId, this.userId); } @Override diff --git a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java index fc0975dd87d..9d97443a8bc 100644 --- a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java +++ b/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/SuffixTree.java @@ -19,7 +19,7 @@ */ package org.sonar.duplications.detector.suffixtree; -import com.google.common.base.Objects; +import java.util.Objects; /** * Provides algorithm to construct suffix tree. @@ -80,7 +80,7 @@ public final class SuffixTree { // implicit node, a little more complicated edge = active.getOriginNode().findEdge(symbolAt(active.getBeginIndex())); int span = active.getSpan(); - if (Objects.equal(symbolAt(edge.getBeginIndex() + span + 1), symbolAt(endIndex))) { + if (Objects.equals(symbolAt(edge.getBeginIndex() + span + 1), symbolAt(endIndex))) { break; } parentNode = edge.splitEdge(active); diff --git a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java index b18954a87d2..38f01553b3d 100644 --- a/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java +++ b/sonar-duplications/src/test/java/org/sonar/duplications/detector/suffixtree/StringSuffixTree.java @@ -19,9 +19,8 @@ */ package org.sonar.duplications.detector.suffixtree; -import com.google.common.base.Objects; - import java.util.LinkedList; +import java.util.Objects; import java.util.Queue; public class StringSuffixTree { @@ -113,7 +112,7 @@ public class StringSuffixTree { if (i == str.length()) { break; } - if (!Objects.equal(tree.symbolAt(j), str.symbolAt(i))) { + if (!Objects.equals(tree.symbolAt(j), str.symbolAt(i))) { return -1; } i++; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java index 183c157f226..cf5ed30c2c5 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/InputFileUtils.java @@ -19,10 +19,7 @@ */ package org.sonar.api.resources; -import com.google.common.base.Objects; import com.google.common.collect.Lists; -import org.apache.commons.lang.StringUtils; - import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -31,6 +28,8 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Objects; +import org.apache.commons.lang.StringUtils; /** * @since 2.8 @@ -152,7 +151,7 @@ public final class InputFileUtils { } if (o instanceof DefaultInputFile) { DefaultInputFile that = (DefaultInputFile) o; - return Objects.equal(basedir, that.basedir) && Objects.equal(relativePath, that.relativePath); + return Objects.equals(basedir, that.basedir) && Objects.equals(relativePath, that.relativePath); } return false; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java index c8e3cccd3fc..7f9c384c0b7 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceTypes.java @@ -21,7 +21,6 @@ package org.sonar.api.resources; import com.google.common.annotations.Beta; import com.google.common.base.Function; -import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; @@ -36,6 +35,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Objects; import javax.annotation.Nullable; import org.sonar.api.ce.ComputeEngineSide; import org.sonar.api.server.ServerSide; @@ -156,7 +156,7 @@ public class ResourceTypes { @Override public boolean apply(@Nullable ResourceType input) { - return input != null && Objects.equal(propertyValue, input.getStringProperty(propertyKey)); + return input != null && Objects.equals(propertyValue, input.getStringProperty(propertyKey)); } } -- 2.39.5