Update Guava to 19.0-rc1
Release 19 includes several bug fixes and API updates [1]. - Remove "unchecked" warning suppressions that are no longer necessary. - Replace calls to deprecated Futures.transform() with new Futures.transformAsync(). - Use CharMatcher's static factory methods instead of constants that will later be deprecated. [1] https://github.com/google/guava/wiki/Release19 Change-Id: I512ddc6ccf7ebaac0c16557d3b0d62ee1394de37
This commit is contained in:
@@ -14,8 +14,6 @@
|
||||
|
||||
package com.google.gerrit.server.change;
|
||||
|
||||
import static com.google.common.base.CharMatcher.WHITESPACE;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.ChangeHooks;
|
||||
@@ -45,7 +43,8 @@ import java.util.regex.Pattern;
|
||||
|
||||
@Singleton
|
||||
public class HashtagsUtil {
|
||||
private static final CharMatcher LEADER = WHITESPACE.or(CharMatcher.is('#'));
|
||||
private static final CharMatcher LEADER =
|
||||
CharMatcher.whitespace().or(CharMatcher.is('#'));
|
||||
private static final String PATTERN = "(?:\\s|\\A)#[\\p{L}[0-9]-_]+";
|
||||
|
||||
private final ChangeUpdate.Factory updateFactory;
|
||||
@@ -69,7 +68,7 @@ public class HashtagsUtil {
|
||||
|
||||
public static String cleanupHashtag(String hashtag) {
|
||||
hashtag = LEADER.trimLeadingFrom(hashtag);
|
||||
hashtag = WHITESPACE.trimTrailingFrom(hashtag);
|
||||
hashtag = CharMatcher.whitespace().trimTrailingFrom(hashtag);
|
||||
return hashtag;
|
||||
}
|
||||
|
||||
|
@@ -80,7 +80,7 @@ public class ListCapabilities implements RestReadView<ConfigResource> {
|
||||
}
|
||||
|
||||
private static boolean isPluginNameSane(String pluginName) {
|
||||
return CharMatcher.JAVA_LETTER_OR_DIGIT
|
||||
return CharMatcher.javaLetterOrDigit()
|
||||
.or(CharMatcher.is('-'))
|
||||
.matchesAllOf(pluginName);
|
||||
}
|
||||
|
@@ -635,7 +635,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
|
||||
|
||||
private static LabelValue parseLabelValue(String src) {
|
||||
List<String> parts = ImmutableList.copyOf(
|
||||
Splitter.on(CharMatcher.WHITESPACE).omitEmptyStrings().limit(2)
|
||||
Splitter.on(CharMatcher.whitespace()).omitEmptyStrings().limit(2)
|
||||
.split(src));
|
||||
if (parts.isEmpty()) {
|
||||
throw new IllegalArgumentException("empty value");
|
||||
|
@@ -69,7 +69,7 @@ public class ReindexAfterUpdate implements GitReferenceUpdatedListener {
|
||||
|
||||
@Override
|
||||
public void onGitReferenceUpdated(final Event event) {
|
||||
Futures.transform(
|
||||
Futures.transformAsync(
|
||||
executor.submit(new GetChanges(event)),
|
||||
new AsyncFunction<List<Change>, List<Void>>() {
|
||||
@Override
|
||||
|
@@ -213,7 +213,7 @@ public class SiteIndexer {
|
||||
}
|
||||
|
||||
try {
|
||||
mpm.waitFor(Futures.transform(Futures.successfulAsList(futures),
|
||||
mpm.waitFor(Futures.transformAsync(Futures.successfulAsList(futures),
|
||||
new AsyncFunction<List<?>, Void>() {
|
||||
@Override
|
||||
public ListenableFuture<Void> apply(List<?> input) {
|
||||
|
@@ -318,7 +318,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
||||
}
|
||||
|
||||
private static boolean isValidParameterName(String name) {
|
||||
return CharMatcher.JAVA_LETTER_OR_DIGIT
|
||||
return CharMatcher.javaLetterOrDigit()
|
||||
.or(CharMatcher.is('-'))
|
||||
.matchesAllOf(name) && !name.startsWith("-");
|
||||
}
|
||||
|
Reference in New Issue
Block a user