*/
package org.sonar.ce.app;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
import javax.annotation.CheckForNull;
// if none stops, the test will fail with timeout
}
- Exception exception = Objects.firstNonNull(waitingThread1.getException(), waitingThread2.getException());
+ Exception exception = MoreObjects.firstNonNull(waitingThread1.getException(), waitingThread2.getException());
assertThat(exception)
.isInstanceOf(IllegalStateException.class)
.hasMessage("There can't be more than one thread waiting for the Compute Engine to stop");
*/
package org.sonar.ce.queue;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("componentUuid", componentUuid)
.add("uuid", uuid)
.add("type", type)
*/
package org.sonar.ce.settings;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.Maps;
import java.util.Date;
import java.util.List;
}
private ServerSettings currentDelegate() {
- return Objects.firstNonNull(threadLocalDelegate.get(), defaultDelegate);
+ return MoreObjects.firstNonNull(threadLocalDelegate.get(), defaultDelegate);
}
private Settings currentSettings() {
*/
package org.sonar.server.computation.issue;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import javax.annotation.CheckForNull;
import org.sonar.api.server.debt.DebtRemediationFunction;
Duration debt = Duration.create(0);
String gapMultiplier =fn.gapMultiplier();
if (fn.type().usesGapMultiplier() && !Strings.isNullOrEmpty(gapMultiplier)) {
- int effortToFixValue = Objects.firstNonNull(issue.effortToFix(), 1).intValue();
+ int effortToFixValue = MoreObjects.firstNonNull(issue.effortToFix(), 1).intValue();
// TODO convert to Duration directly in Rule#remediationFunction -> better performance + error handling
debt = durations.decode(gapMultiplier).multiply(effortToFixValue);
}
*/
package org.sonar.server.computation.issue;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import java.util.HashMap;
private boolean isEmpty = true;
void add(int periodIndex, long newEffort) {
- double previous = Objects.firstNonNull(sums[periodIndex - 1], 0d);
+ double previous = MoreObjects.firstNonNull(sums[periodIndex - 1], 0d);
sums[periodIndex - 1] = previous + newEffort;
isEmpty = false;
}
package org.sonar.server.computation.issue;
import com.google.common.base.Function;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
public long calculate(DefaultIssue issue, Collection<IssueChangeDto> debtChangelog, Period period) {
if (issue.creationDate().getTime() > period.getSnapshotDate() + 1000L) {
- return Objects.firstNonNull(issue.effortInMinutes(), 0L);
+ return MoreObjects.firstNonNull(issue.effortInMinutes(), 0L);
}
return calculateFromChangelog(issue, debtChangelog, period.getSnapshotDate());
}
*/
package org.sonar.server.computation.issue;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.util.Set;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("id", id)
.add("key", key)
.add("name", name)
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return com.google.common.base.MoreObjects.toStringHelper(this)
.add("valueType", valueType)
.add("developer", developer)
.add("value", value)
*/
package org.sonar.server.computation.measure;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.util.Arrays;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("1", variations[0])
.add("2", variations[1])
.add("3", variations[2])
*/
package org.sonar.server.computation.measure;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("status", status)
.add("text", text)
.toString();
*/
package org.sonar.server.computation.metric;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
this.name = checkNotNull(name);
this.type = checkNotNull(type);
if (type.getValueType() == Measure.ValueType.DOUBLE) {
- this.decimalScale = Objects.firstNonNull(decimalScale, org.sonar.api.measures.Metric.DEFAULT_DECIMAL_SCALE);
+ this.decimalScale = MoreObjects.firstNonNull(decimalScale, org.sonar.api.measures.Metric.DEFAULT_DECIMAL_SCALE);
} else {
this.decimalScale = decimalScale;
}
@Override
public String toString() {
- return com.google.common.base.Objects.toStringHelper(this)
+ return com.google.common.base.MoreObjects.toStringHelper(this)
.add("id", id)
.add("key", key)
.add("name", name)
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
-import static com.google.common.base.Objects.toStringHelper;
+import static com.google.common.base.MoreObjects.toStringHelper;
import static java.util.Objects.hash;
import static java.util.Objects.requireNonNull;
*/
package org.sonar.server.computation.qualitygate;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("metric", metric)
.add("period", period)
.add("operator", operator)
*/
package org.sonar.server.computation.qualitygate;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("level", level)
.add("value", value)
.toString();
*/
package org.sonar.server.computation.qualityprofile;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.util.Date;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("key", qpKey)
.add("name", qpName)
.add("language", languageKey)
*/
package org.sonar.server.exceptions;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.util.List;
import org.sonar.api.utils.ValidationMessages;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("errors", errors)
.toString();
}
*/
package org.sonar.server.exceptions;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.i18n.I18n;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("messages", messages)
.toString();
}
*/
package org.sonar.server.exceptions;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import org.apache.commons.lang.StringUtils;
import javax.annotation.CheckForNull;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("key", key)
.add("params", params != null ? Arrays.toString(params) : null)
.toString();
*/
package org.sonar.server.issue.ws;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import org.sonar.api.server.ws.Request;
import org.sonar.api.server.ws.Response;
import org.sonar.api.server.ws.WebService;
@Override
public void handle(Request request, Response response) throws Exception {
String key = request.mandatoryParam("key");
- List<String> tags = Objects.firstNonNull(request.paramAsStrings("tags"), Collections.<String>emptyList());
+ List<String> tags = MoreObjects.firstNonNull(request.paramAsStrings("tags"), Collections.<String>emptyList());
Collection<String> resultTags = service.setTags(key, tags);
JsonWriter json = response.newJsonWriter().beginObject().name("tags").beginArray();
for (String tag : resultTags) {
*/
package org.sonar.server.qualityprofile;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.sonar.db.qualityprofile.ActiveRuleKey;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("type", type)
.add("key", key)
.add("severity", severity)
*/
package org.sonar.server.source.ws;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.io.Resources;
import java.util.Date;
userSession.checkComponentUuidPermission(UserRole.CODEVIEWER, file.projectUuid());
int from = request.mandatoryParamAsInt(PARAM_FROM);
- int to = Objects.firstNonNull(request.paramAsInt(PARAM_TO), Integer.MAX_VALUE);
+ int to = MoreObjects.firstNonNull(request.paramAsInt(PARAM_TO), Integer.MAX_VALUE);
Optional<Iterable<DbFileSources.Line>> lines = sourceService.getLines(dbSession, file.uuid(), from, to);
if (!lines.isPresent()) {
*/
package org.sonar.server.user;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Sets;
}
protected T setLocale(@Nullable Locale l) {
- this.locale = Objects.firstNonNull(l, Locale.ENGLISH);
+ this.locale = MoreObjects.firstNonNull(l, Locale.ENGLISH);
return clazz.cast(this);
}
*/
package org.sonar.server.user;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
private static final ThreadLocal<UserSession> THREAD_LOCAL = new ThreadLocal<>();
public UserSession get() {
- return Objects.firstNonNull(THREAD_LOCAL.get(), AnonymousUserSession.INSTANCE);
+ return MoreObjects.firstNonNull(THREAD_LOCAL.get(), AnonymousUserSession.INSTANCE);
}
public void set(UserSession session) {
*/
package org.sonar.core.issue;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import java.util.Map;
DefaultIssue issue = new DefaultIssue();
String key = Uuids.create();
issue.setKey(key);
- issue.setType(Objects.firstNonNull(type, RuleType.CODE_SMELL));
+ issue.setType(MoreObjects.firstNonNull(type, RuleType.CODE_SMELL));
issue.setComponentKey(componentKey);
issue.setProjectKey(projectKey);
issue.setRuleKey(ruleKey);
*/
package org.sonar.core.issue.tracking;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import java.util.Collection;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("rawToBase", rawToBase)
.add("baseToRaw", baseToRaw)
.add("raws", raws)
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Ordering;
}
public PluginInfo setName(@Nullable String name) {
- this.name = Objects.firstNonNull(name, this.key);
+ this.name = MoreObjects.firstNonNull(name, this.key);
return this;
}
*/
package org.sonar.db.ce;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("uuid", uuid)
.add("taskType", taskType)
.add("componentUuid", componentUuid)
*/
package org.sonar.db.ce;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("uuid", uuid)
.add("taskType", taskType)
.add("componentUuid", componentUuid)
package org.sonar.db.issue;
import com.google.common.base.Joiner;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableSet;
issue.setChecksum(checksum);
issue.setSeverity(severity);
issue.setAssignee(assignee);
- issue.setAttributes(KeyValueFormat.parse(Objects.firstNonNull(issueAttributes, "")));
+ issue.setAttributes(KeyValueFormat.parse(MoreObjects.firstNonNull(issueAttributes, "")));
issue.setComponentKey(componentKey);
issue.setComponentUuid(componentUuid);
issue.setModuleUuid(moduleUuid);
*/
package org.sonar.db.measure;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.nio.charset.StandardCharsets;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("id", id)
.add("value", value)
.add("textValue", textValue)
*/
package org.sonar.db.property;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
public class PropertyDto {
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.addValue(this.key)
.addValue(this.value)
.addValue(this.resourceId)
*/
package org.sonar.api.config;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import org.sonar.api.CoreProperties;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.ce.ComputeEngineSide;
}
private String get(String key, String defaultValue) {
- return Objects.firstNonNull(settings.getString(key), defaultValue);
+ return MoreObjects.firstNonNull(settings.getString(key), defaultValue);
}
}
*/
package org.sonar.api.security;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
/**
* This class is not intended to be subclassed by clients.
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("name", name)
.add("email", email)
.add("userId", userId)
*/
package org.sonar.api.server.debt.internal;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
@Override
public String toString() {
- return Objects.toStringHelper(DebtRemediationFunction.class)
+ return MoreObjects.toStringHelper(DebtRemediationFunction.class)
.add("type", type)
.add("gap multiplier", gapMultiplier)
.add("base effort", baseEffort)
*/
package org.sonar.api.server.rule;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("key", key)
.add("language", language)
.toString();
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("language", language)
.add("key", key)
.toString();
*/
package org.sonar.api.web;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import org.sonar.api.task.TaskExtension;
import org.sonar.colorizer.Tokenizer;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("lang", languageKey)
.toString();
}
*/
package org.sonar.batch;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableMap;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("map", map)
.toString();
}
*/
package org.sonar.batch.rule;
-import com.google.common.base.Objects;
+import com.google.common.base.MoreObjects;
import java.util.Date;
@Override
public String toString() {
- return Objects.toStringHelper(this)
+ return MoreObjects.toStringHelper(this)
.add("key", key)
.add("name", name)
.add("language", language)