diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-09-27 22:00:15 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-09-28 16:45:25 +0200 |
commit | 017616408177f8359255e72729f18e2015881761 (patch) | |
tree | ea913f75295c7aa84a28270807b74427b4dbc357 /sonar-core | |
parent | 351e7858621b01e3d783ebaff54ed4358941e0de (diff) | |
download | sonarqube-017616408177f8359255e72729f18e2015881761.tar.gz sonarqube-017616408177f8359255e72729f18e2015881761.zip |
Decrease usage of Guava in PluginInfo
to stop dealing with hell of conflicting Guava versions when
using PluginInfo
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java b/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java index 5312c6f41b8..d2e0a3dcec2 100644 --- a/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java +++ b/sonar-core/src/main/java/org/sonar/core/platform/PluginInfo.java @@ -20,10 +20,7 @@ package org.sonar.core.platform; import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Function; import com.google.common.base.Joiner; -import com.google.common.base.MoreObjects; -import com.google.common.base.Preconditions; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; import java.io.File; @@ -32,7 +29,6 @@ import java.util.HashSet; import java.util.Set; import java.util.regex.Pattern; import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.commons.lang.StringUtils; import org.sonar.api.utils.MessageException; @@ -40,6 +36,8 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.updatecenter.common.PluginManifest; import org.sonar.updatecenter.common.Version; +import static java.util.Objects.requireNonNull; + public class PluginInfo implements Comparable<PluginInfo> { private static final Joiner SLASH_JOINER = Joiner.on(" / ").skipNulls(); @@ -144,7 +142,7 @@ public class PluginInfo implements Comparable<PluginInfo> { private final Set<RequiredPlugin> requiredPlugins = new HashSet<>(); public PluginInfo(String key) { - Preconditions.checkNotNull(key, "Plugin key is missing from manifest"); + requireNonNull(key, "Plugin key is missing from manifest"); this.key = key; this.name = key; } @@ -160,7 +158,7 @@ public class PluginInfo implements Comparable<PluginInfo> { } public File getNonNullJarFile() { - Preconditions.checkNotNull(jarFile); + requireNonNull(jarFile); return jarFile; } @@ -251,7 +249,7 @@ public class PluginInfo implements Comparable<PluginInfo> { } public PluginInfo setName(@Nullable String name) { - this.name = MoreObjects.firstNonNull(name, this.key); + this.name = (name != null ? name : this.key); return this; } @@ -438,17 +436,4 @@ public class PluginInfo implements Comparable<PluginInfo> { } return info; } - - private enum JarToPluginInfo implements Function<File, PluginInfo> { - INSTANCE; - - @Override - public PluginInfo apply(@Nonnull File jarFile) { - return create(jarFile); - } - } - - public static Function<File, PluginInfo> jarToPluginInfo() { - return JarToPluginInfo.INSTANCE; - } } |