Skip to content

Commit bc95e00

Browse files
author
Vincent Potucek
committed
Merge branch 'master' into fix-RemoveUnusedPrivateMethods
2 parents a0d1502 + 8d0b1e4 commit bc95e00

File tree

23 files changed

+102
-261
lines changed

23 files changed

+102
-261
lines changed

android/guava-bom/pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@
6161
<artifactId>central-publishing-maven-plugin</artifactId>
6262
<version>0.8.0</version>
6363
<extensions>true</extensions>
64-
<configuration>
65-
<publishingServerId>central</publishingServerId>
66-
</configuration>
6764
</plugin>
6865
</plugins>
6966
</build>

android/guava-tests/test/com/google/common/base/StringsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ public void testLenientFormat() {
213213
assertEquals("5 + 6 = 11", Strings.lenientFormat("5 + %s = 11", 6));
214214
assertEquals("5 + 6 = 11", Strings.lenientFormat("5 + 6 = %s", 11));
215215
assertEquals("5 + 6 = 11", Strings.lenientFormat("%s + %s = %s", 5, 6, 11));
216+
assertEquals(
217+
"5 + 6 = 11", Strings.lenientFormat("%s + %s = %s", (Object[]) new Integer[] {5, 6, 11}));
216218
assertEquals("null [null, null]", Strings.lenientFormat("%s", null, null, null));
217219
assertEquals("null [5, 6]", Strings.lenientFormat(null, 5, 6));
218220
assertEquals("null", Strings.lenientFormat("%s", (Object) null));

android/guava/src/com/google/common/base/NullnessCasts.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ final class NullnessCasts {
4444
* doesn't work: Because nullness analyses typically infer the nullness of local variables,
4545
* there's no way to assign a {@code @Nullable T} to a field {@code T foo;} and instruct the
4646
* analysis that that means "plain {@code T}" rather than the inferred type {@code @Nullable T}.
47-
* (Even if supported added {@code @NonNull}, that would not help, since the problem case
48-
* addressed by this method is the case in which {@code T} has parametric nullness -- and thus its
49-
* value may be legitimately {@code null}.)
47+
* (And even if annotations on local variables were permitted as an optional hint, no annotation
48+
* would be the right tool for the job here: {@code @Nullable} is the annotation that we're trying
49+
* to get rid of, and {@code @NonNull} would be wrong for our use case for the same reason as
50+
* {@code requireNonNull}: Our use case is the one in which {@code T} has parametric nullness—and
51+
* thus its value may be legitimately {@code null}.)
5052
*/
5153
@ParametricNullness
5254
@SuppressWarnings("nullness")

android/guava/src/com/google/common/base/Strings.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,6 @@ public static String lenientFormat(
263263

264264
if (args == null) {
265265
args = new Object[] {"(Object[])null"};
266-
} else {
267-
for (int i = 0; i < args.length; i++) {
268-
args[i] = lenientToString(args[i]);
269-
}
270266
}
271267

272268
// start substituting the arguments into the '%s' placeholders
@@ -279,18 +275,18 @@ public static String lenientFormat(
279275
break;
280276
}
281277
builder.append(template, templateStart, placeholderStart);
282-
builder.append(args[i++]);
278+
builder.append(lenientToString(args[i++]));
283279
templateStart = placeholderStart + 2;
284280
}
285281
builder.append(template, templateStart, template.length());
286282

287-
// if we run out of placeholders, append the extra args in square braces
283+
// if we run out of placeholders, append the extra args in square brackets
288284
if (i < args.length) {
289-
builder.append(" [");
290-
builder.append(args[i++]);
291-
while (i < args.length) {
292-
builder.append(", ");
293-
builder.append(args[i++]);
285+
String prefix = " [";
286+
for (; i < args.length; i++) {
287+
builder.append(prefix);
288+
builder.append(lenientToString(args[i]));
289+
prefix = ", ";
294290
}
295291
builder.append(']');
296292
}

android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ public NavigableSet<V> tailSet(@ParametricNullness V fromElement, boolean inclus
758758

759759
/** List decorator that stays in sync with the multimap values for a key. */
760760
@WeakOuter
761-
class WrappedList extends WrappedCollection implements List<V> {
761+
private class WrappedList extends WrappedCollection implements List<V> {
762762
WrappedList(@ParametricNullness K key, List<V> delegate, @Nullable WrappedCollection ancestor) {
763763
super(key, delegate, ancestor);
764764
}

android/guava/src/com/google/common/collect/ArrayTable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,11 @@
8989
* @author Jared Levy
9090
* @since 10.0
9191
*/
92+
// We explicitly list `implements Table<...>` so that its `@Nullable V` appears in Javadoc.
93+
@SuppressWarnings("RedundancyRemover")
9294
@GwtCompatible
9395
public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
94-
implements Serializable {
96+
implements Table<R, C, @Nullable V>, Serializable {
9597

9698
/**
9799
* Creates an {@code ArrayTable} filled with {@code null}.

android/guava/src/com/google/common/collect/NullnessCasts.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ final class NullnessCasts {
4444
* doesn't work: Because nullness analyses typically infer the nullness of local variables,
4545
* there's no way to assign a {@code @Nullable T} to a field {@code T foo;} and instruct the
4646
* analysis that that means "plain {@code T}" rather than the inferred type {@code @Nullable T}.
47-
* (Even if supported added {@code @NonNull}, that would not help, since the problem case
48-
* addressed by this method is the case in which {@code T} has parametric nullness -- and thus its
49-
* value may be legitimately {@code null}.)
47+
* (And even if annotations on local variables were permitted as an optional hint, no annotation
48+
* would be the right tool for the job here: {@code @Nullable} is the annotation that we're trying
49+
* to get rid of, and {@code @NonNull} would be wrong for our use case for the same reason as
50+
* {@code requireNonNull}: Our use case is the one in which {@code T} has parametric nullness—and
51+
* thus its value may be legitimately {@code null}.)
5052
*/
5153
@ParametricNullness
5254
@SuppressWarnings("nullness")

android/guava/src/com/google/common/math/LongMath.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,10 @@ public static long gcd(long a, long b) {
534534
* Returns the sum of {@code a} and {@code b}, provided it does not overflow.
535535
*
536536
* <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use {@link
537-
* Math#addExact(long, long)} instead.
537+
* Math#addExact(long, long)} instead. Note that if both arguments are {@code int} values, writing
538+
* {@code Math.addExact(a, b)} will call the {@link Math#addExact(int, int)} overload, not {@link
539+
* Math#addExact(long, long)}. Also note that adding two {@code int} values can <b>never</b>
540+
* overflow a {@code long}, so you can just write {@code (long) a + b}.
538541
*
539542
* @throws ArithmeticException if {@code a + b} overflows in signed {@code long} arithmetic
540543
*/
@@ -547,7 +550,11 @@ public static long checkedAdd(long a, long b) {
547550
* Returns the difference of {@code a} and {@code b}, provided it does not overflow.
548551
*
549552
* <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use {@link
550-
* Math#subtractExact(long, long)} instead.
553+
* Math#subtractExact(long, long)} instead. Note that if both arguments are {@code int} values,
554+
* writing {@code Math.subtractExact(a, b)} will call the {@link Math#subtractExact(int, int)}
555+
* overload, not {@link Math#subtractExact(long, long)}. Also note that subtracting two {@code
556+
* int} values can <b>never</b> overflow a {@code long}, so you can just write {@code (long) a -
557+
* b}.
551558
*
552559
* @throws ArithmeticException if {@code a - b} overflows in signed {@code long} arithmetic
553560
*/
@@ -560,7 +567,11 @@ public static long checkedSubtract(long a, long b) {
560567
* Returns the product of {@code a} and {@code b}, provided it does not overflow.
561568
*
562569
* <p><b>Note:</b> this method is now unnecessary and should be treated as deprecated; use {@link
563-
* Math#multiplyExact(long, long)} instead.
570+
* Math#multiplyExact(long, long)} instead. Note that if both arguments are {@code int} values,
571+
* writing {@code Math.multiplyExact(a, b)} will call the {@link Math#multiplyExact(int, int)}
572+
* overload, not {@link Math#multiplyExact(long, long)}. Also note that multiplying two {@code
573+
* int} values can <b>never</b> overflow a {@code long}, so you can just write {@code (long) a *
574+
* b}.
564575
*
565576
* @throws ArithmeticException if {@code a * b} overflows in signed {@code long} arithmetic
566577
*/

android/guava/src/com/google/common/util/concurrent/NullnessCasts.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ final class NullnessCasts {
4444
* doesn't work: Because nullness analyses typically infer the nullness of local variables,
4545
* there's no way to assign a {@code @Nullable T} to a field {@code T foo;} and instruct the
4646
* analysis that that means "plain {@code T}" rather than the inferred type {@code @Nullable T}.
47-
* (Even if supported added {@code @NonNull}, that would not help, since the problem case
48-
* addressed by this method is the case in which {@code T} has parametric nullness -- and thus its
49-
* value may be legitimately {@code null}.)
47+
* (And even if annotations on local variables were permitted as an optional hint, no annotation
48+
* would be the right tool for the job here: {@code @Nullable} is the annotation that we're trying
49+
* to get rid of, and {@code @NonNull} would be wrong for our use case for the same reason as
50+
* {@code requireNonNull}: Our use case is the one in which {@code T} has parametric nullness—and
51+
* thus its value may be legitimately {@code null}.)
5052
*/
5153
@SuppressWarnings("nullness")
5254
@ParametricNullness

android/guava/src/com/google/thirdparty/publicsuffix/PublicSuffixPatterns.java

Lines changed: 9 additions & 9 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)