*/
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;
private Issue getIssueOnLine(final Integer line, final String repoKey, final String ruleKey, List<Issue> issues) {
return Iterables.find(issues, new Predicate<Issue>() {
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);
}
});
}
*/
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;
}
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);
}
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;
return false;
}
MetricImpl metric = (MetricImpl) o;
- return Objects.equal(key, metric.key);
+ return Objects.equals(key, metric.key);
}
@Override
*/
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 {
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");
}
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");
}
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;
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;
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());
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());
}
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);
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);
}
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;
}
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;
}
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());
}
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());
}
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());
}
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);
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);
}
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);
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());
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());
*/
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;
String changeAuthor = notification.getFieldValue("changeAuthor");
String assignee = notification.getFieldValue("assignee");
- if (!Objects.equal(changeAuthor, assignee)) {
+ if (!Objects.equals(changeAuthor, assignee)) {
addUserToContextIfSubscribed(context, assignee, subscribedRecipients);
}
}
*/
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;
@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<String, NotificationChannel> subscribedRecipients = notifications.findNotificationSubscribers(this, projectKey);
for (Map.Entry<String, Collection<NotificationChannel>> 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);
}
*/
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;
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);
*/
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;
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;
}
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());
*/
package org.sonar.db.dashboard;
-import com.google.common.base.Objects;
+import java.util.Objects;
public final class ActiveDashboardDto {
private Long id;
*/
package org.sonar.db.loadedtemplate;
-import com.google.common.base.Objects;
+import java.util.Objects;
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
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;
}
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
*/
package org.sonar.duplications.detector.suffixtree;
-import com.google.common.base.Objects;
+import java.util.Objects;
/**
* Provides algorithm to construct suffix tree.
// 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);
*/
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 {
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++;
*/
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;
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
}
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;
}
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;
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;
@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));
}
}