diff --git a/android/guava/src/com/google/common/base/AbstractIterator.java b/android/guava/src/com/google/common/base/AbstractIterator.java index 853dfcdc8201..aaeb5f0d8d57 100644 --- a/android/guava/src/com/google/common/base/AbstractIterator.java +++ b/android/guava/src/com/google/common/base/AbstractIterator.java @@ -43,8 +43,8 @@ private enum State { protected abstract T computeNext(); - @NullableDecl @CanIgnoreReturnValue + @NullableDecl protected final T endOfData() { state = State.DONE; return null; diff --git a/android/guava/src/com/google/common/base/Converter.java b/android/guava/src/com/google/common/base/Converter.java index ad145cbafd74..4d30791ac98a 100644 --- a/android/guava/src/com/google/common/base/Converter.java +++ b/android/guava/src/com/google/common/base/Converter.java @@ -164,8 +164,8 @@ protected Converter() { * * @return the converted value; is null if and only if {@code a} is null */ - @NullableDecl @CanIgnoreReturnValue + @NullableDecl public final B convert(@NullableDecl A a) { return correctedDoForward(a); } @@ -386,8 +386,8 @@ public String toString() { */ @Deprecated @Override - @NullableDecl @CanIgnoreReturnValue + @NullableDecl public final B apply(@NullableDecl A a) { return convert(a); } diff --git a/android/guava/src/com/google/common/base/Defaults.java b/android/guava/src/com/google/common/base/Defaults.java index 787810c26632..00adbdefa12f 100644 --- a/android/guava/src/com/google/common/base/Defaults.java +++ b/android/guava/src/com/google/common/base/Defaults.java @@ -37,8 +37,8 @@ private Defaults() {} * false} for {@code boolean} and {@code '\0'} for {@code char}. For non-primitive types and * {@code void}, {@code null} is returned. */ - @NullableDecl @SuppressWarnings("unchecked") + @NullableDecl public static T defaultValue(Class type) { checkNotNull(type); if (type == boolean.class) { diff --git a/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java b/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java index a90458a50211..40dfd462b81c 100644 --- a/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java +++ b/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java @@ -241,8 +241,8 @@ static class SystemLoader implements FinalizerLoader { // finding Finalizer on the system class path even if it is there. @VisibleForTesting static boolean disabled; - @NullableDecl @Override + @NullableDecl public Class loadFinalizer() { if (disabled) { return null; @@ -279,8 +279,8 @@ static class DecoupledLoader implements FinalizerLoader { + "loader. To support reclaiming this class loader, either resolve the underlying " + "issue, or move Guava to your system class path."; - @NullableDecl @Override + @NullableDecl public Class loadFinalizer() { try { /* diff --git a/android/guava/src/com/google/common/collect/ImmutableEntry.java b/android/guava/src/com/google/common/collect/ImmutableEntry.java index 806ecb7cdd79..cc869b31aa21 100644 --- a/android/guava/src/com/google/common/collect/ImmutableEntry.java +++ b/android/guava/src/com/google/common/collect/ImmutableEntry.java @@ -31,14 +31,14 @@ class ImmutableEntry extends AbstractMapEntry implements Serializabl this.value = value; } - @NullableDecl @Override + @NullableDecl public final K getKey() { return key; } - @NullableDecl @Override + @NullableDecl public final V getValue() { return value; } diff --git a/android/guava/src/com/google/common/collect/ImmutableSet.java b/android/guava/src/com/google/common/collect/ImmutableSet.java index 9f7cb855487b..9be1c36cdfdf 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSet.java @@ -338,7 +338,7 @@ public int hashCode() { @Override public abstract UnmodifiableIterator iterator(); - @LazyInit @NullableDecl @RetainedWith private transient ImmutableList asList; + @LazyInit @RetainedWith @NullableDecl private transient ImmutableList asList; @Override public ImmutableList asList() { diff --git a/android/guava/src/com/google/common/primitives/Doubles.java b/android/guava/src/com/google/common/primitives/Doubles.java index e99206032d0f..c81bc9b01f24 100644 --- a/android/guava/src/com/google/common/primitives/Doubles.java +++ b/android/guava/src/com/google/common/primitives/Doubles.java @@ -675,8 +675,8 @@ private static Pattern fpPattern() { * @since 14.0 */ @Beta - @NullableDecl @GwtIncompatible // regular expressions + @NullableDecl public static Double tryParse(String string) { if (FLOATING_POINT_PATTERN.matcher(string).matches()) { // TODO(lowasser): could be potentially optimized, but only with diff --git a/android/guava/src/com/google/common/primitives/Floats.java b/android/guava/src/com/google/common/primitives/Floats.java index c35f32efe81a..fc75aef50bab 100644 --- a/android/guava/src/com/google/common/primitives/Floats.java +++ b/android/guava/src/com/google/common/primitives/Floats.java @@ -649,8 +649,8 @@ float[] toFloatArray() { * @since 14.0 */ @Beta - @NullableDecl @GwtIncompatible // regular expressions + @NullableDecl public static Float tryParse(String string) { if (Doubles.FLOATING_POINT_PATTERN.matcher(string).matches()) { // TODO(lowasser): could be potentially optimized, but only with diff --git a/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java index d3541b6ac8dd..3b88c9ccde11 100644 --- a/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java @@ -41,28 +41,28 @@ public final class MutableTypeToInstanceMap extends ForwardingMap, B> backingMap = Maps.newHashMap(); - @NullableDecl @Override + @NullableDecl public T getInstance(Class type) { return trustedGet(TypeToken.of(type)); } - @NullableDecl @Override + @NullableDecl public T getInstance(TypeToken type) { return trustedGet(type.rejectTypeVariables()); } - @NullableDecl @Override @CanIgnoreReturnValue + @NullableDecl public T putInstance(Class type, @NullableDecl T value) { return trustedPut(TypeToken.of(type), value); } - @NullableDecl @Override @CanIgnoreReturnValue + @NullableDecl public T putInstance(TypeToken type, @NullableDecl T value) { return trustedPut(type.rejectTypeVariables(), value); } diff --git a/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java index 91e0e3addb95..7dc0ffd742d4 100644 --- a/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java @@ -70,8 +70,8 @@ public interface TypeToInstanceMap extends Map, B> { * @return the value previously associated with this class (possibly {@code null}), or {@code * null} if there was no previous entry. */ - @NullableDecl @CanIgnoreReturnValue + @NullableDecl T putInstance(Class type, @NullableDecl T value); /** @@ -81,7 +81,7 @@ public interface TypeToInstanceMap extends Map, B> { * @return the value previously associated with this type (possibly {@code null}), or {@code null} * if there was no previous entry. */ - @NullableDecl @CanIgnoreReturnValue + @NullableDecl T putInstance(TypeToken type, @NullableDecl T value); } diff --git a/android/guava/src/com/google/common/reflect/TypeToken.java b/android/guava/src/com/google/common/reflect/TypeToken.java index 698777c83831..73bec0b5d3e7 100644 --- a/android/guava/src/com/google/common/reflect/TypeToken.java +++ b/android/guava/src/com/google/common/reflect/TypeToken.java @@ -1310,8 +1310,8 @@ Iterable> getInterfaces(TypeToken type) { return type.getGenericInterfaces(); } - @NullableDecl @Override + @NullableDecl TypeToken getSuperclass(TypeToken type) { return type.getGenericSuperclass(); } @@ -1329,8 +1329,8 @@ Iterable> getInterfaces(Class type) { return Arrays.asList(type.getInterfaces()); } - @NullableDecl @Override + @NullableDecl Class getSuperclass(Class type) { return type.getSuperclass(); } diff --git a/android/guava/src/com/google/common/reflect/Types.java b/android/guava/src/com/google/common/reflect/Types.java index 6dd022529d3a..dd74ae8d9f4c 100644 --- a/android/guava/src/com/google/common/reflect/Types.java +++ b/android/guava/src/com/google/common/reflect/Types.java @@ -105,15 +105,15 @@ static ParameterizedType newParameterizedType(Class rawType, Type... argument /** Decides what owner type to use for constructing {@link ParameterizedType} from a raw class. */ private enum ClassOwnership { OWNED_BY_ENCLOSING_CLASS { - @NullableDecl @Override + @NullableDecl Class getOwnerType(Class rawType) { return rawType.getEnclosingClass(); } }, LOCAL_CLASS_HAS_NO_OWNER { - @NullableDecl @Override + @NullableDecl Class getOwnerType(Class rawType) { if (rawType.isLocalClass()) { return null; diff --git a/guava/src/com/google/common/base/Absent.java b/guava/src/com/google/common/base/Absent.java index af35c2eeb960..4223b39e6c24 100644 --- a/guava/src/com/google/common/base/Absent.java +++ b/guava/src/com/google/common/base/Absent.java @@ -61,8 +61,7 @@ public T or(Supplier supplier) { } @Override - @Nullable - public T orNull() { + public @Nullable T orNull() { return null; } diff --git a/guava/src/com/google/common/base/AbstractIterator.java b/guava/src/com/google/common/base/AbstractIterator.java index d49dc17fe9ba..7b12a3e71565 100644 --- a/guava/src/com/google/common/base/AbstractIterator.java +++ b/guava/src/com/google/common/base/AbstractIterator.java @@ -39,13 +39,12 @@ private enum State { FAILED, } - @Nullable private T next; + private @Nullable T next; protected abstract T computeNext(); - @Nullable @CanIgnoreReturnValue - protected final T endOfData() { + protected final @Nullable T endOfData() { state = State.DONE; return null; } diff --git a/guava/src/com/google/common/base/Converter.java b/guava/src/com/google/common/base/Converter.java index 57cdcccc8cab..ffec3f8b4fb4 100644 --- a/guava/src/com/google/common/base/Converter.java +++ b/guava/src/com/google/common/base/Converter.java @@ -164,9 +164,8 @@ protected Converter() { * * @return the converted value; is null if and only if {@code a} is null */ - @Nullable @CanIgnoreReturnValue - public final B convert(@Nullable A a) { + public final @Nullable B convert(@Nullable A a) { return correctedDoForward(a); } @@ -386,9 +385,8 @@ public String toString() { */ @Deprecated @Override - @Nullable @CanIgnoreReturnValue - public final B apply(@Nullable A a) { + public final @Nullable B apply(@Nullable A a) { return convert(a); } diff --git a/guava/src/com/google/common/base/Defaults.java b/guava/src/com/google/common/base/Defaults.java index 9f787feb29ae..92958c15c7d4 100644 --- a/guava/src/com/google/common/base/Defaults.java +++ b/guava/src/com/google/common/base/Defaults.java @@ -37,9 +37,8 @@ private Defaults() {} * false} for {@code boolean} and {@code '\0'} for {@code char}. For non-primitive types and * {@code void}, {@code null} is returned. */ - @Nullable @SuppressWarnings("unchecked") - public static T defaultValue(Class type) { + public static @Nullable T defaultValue(Class type) { checkNotNull(type); if (type == boolean.class) { return (T) Boolean.FALSE; diff --git a/guava/src/com/google/common/base/Equivalence.java b/guava/src/com/google/common/base/Equivalence.java index c5c315a8c966..b4ac005708af 100644 --- a/guava/src/com/google/common/base/Equivalence.java +++ b/guava/src/com/google/common/base/Equivalence.java @@ -184,7 +184,7 @@ public final Wrapper wrap(@Nullable S reference) { */ public static final class Wrapper implements Serializable { private final Equivalence equivalence; - @Nullable private final T reference; + private final @Nullable T reference; private Wrapper(Equivalence equivalence, @Nullable T reference) { this.equivalence = checkNotNull(equivalence); @@ -192,8 +192,7 @@ private Wrapper(Equivalence equivalence, @Nullable T reference) { } /** Returns the (possibly null) reference wrapped by this instance. */ - @Nullable - public T get() { + public @Nullable T get() { return reference; } @@ -272,7 +271,7 @@ public final Predicate equivalentTo(@Nullable T target) { private static final class EquivalentToPredicate implements Predicate, Serializable { private final Equivalence equivalence; - @Nullable private final T target; + private final @Nullable T target; EquivalentToPredicate(Equivalence equivalence, @Nullable T target) { this.equivalence = checkNotNull(equivalence); diff --git a/guava/src/com/google/common/base/FinalizableReferenceQueue.java b/guava/src/com/google/common/base/FinalizableReferenceQueue.java index 29cfea0e6f8d..3fe706f10974 100644 --- a/guava/src/com/google/common/base/FinalizableReferenceQueue.java +++ b/guava/src/com/google/common/base/FinalizableReferenceQueue.java @@ -241,9 +241,8 @@ static class SystemLoader implements FinalizerLoader { // finding Finalizer on the system class path even if it is there. @VisibleForTesting static boolean disabled; - @Nullable @Override - public Class loadFinalizer() { + public @Nullable Class loadFinalizer() { if (disabled) { return null; } @@ -279,9 +278,8 @@ static class DecoupledLoader implements FinalizerLoader { + "loader. To support reclaiming this class loader, either resolve the underlying " + "issue, or move Guava to your system class path."; - @Nullable @Override - public Class loadFinalizer() { + public @Nullable Class loadFinalizer() { try { /* * We use URLClassLoader because it's the only concrete class loader implementation in the diff --git a/guava/src/com/google/common/base/Functions.java b/guava/src/com/google/common/base/Functions.java index 496fcff86bcc..af6ac5ed133c 100644 --- a/guava/src/com/google/common/base/Functions.java +++ b/guava/src/com/google/common/base/Functions.java @@ -88,8 +88,7 @@ private enum IdentityFunction implements Function { INSTANCE; @Override - @Nullable - public Object apply(@Nullable Object o) { + public @Nullable Object apply(@Nullable Object o) { return o; } @@ -171,7 +170,7 @@ public String toString() { private static class ForMapWithDefault implements Function, Serializable { final Map map; - @Nullable final V defaultValue; + final @Nullable V defaultValue; ForMapWithDefault(Map map, @Nullable V defaultValue) { this.map = checkNotNull(map); @@ -320,7 +319,7 @@ public static Function constant(@Nullable E value) { } private static class ConstantFunction implements Function, Serializable { - @Nullable private final E value; + private final @Nullable E value; public ConstantFunction(@Nullable E value) { this.value = value; diff --git a/guava/src/com/google/common/base/Optional.java b/guava/src/com/google/common/base/Optional.java index af4405075aa4..fe36bb963b74 100644 --- a/guava/src/com/google/common/base/Optional.java +++ b/guava/src/com/google/common/base/Optional.java @@ -120,8 +120,8 @@ public static Optional fromNullable(@Nullable T nullableReference) { * * @since 21.0 */ - @Nullable - public static Optional fromJavaUtil(java.util.@Nullable Optional javaUtilOptional) { + public static @Nullable Optional fromJavaUtil( + java.util.@Nullable Optional javaUtilOptional) { return (javaUtilOptional == null) ? null : fromNullable(javaUtilOptional.orElse(null)); } @@ -246,8 +246,7 @@ public java.util.Optional toJavaUtil() { *

Comparison to {@code java.util.Optional}: this method is equivalent to Java 8's * {@code Optional.orElse(null)}. */ - @Nullable - public abstract T orNull(); + public abstract @Nullable T orNull(); /** * Returns an immutable singleton {@link Set} whose only element is the contained instance if it diff --git a/guava/src/com/google/common/base/StandardSystemProperty.java b/guava/src/com/google/common/base/StandardSystemProperty.java index d0674cbbc4b9..7a7b11502fb1 100644 --- a/guava/src/com/google/common/base/StandardSystemProperty.java +++ b/guava/src/com/google/common/base/StandardSystemProperty.java @@ -125,8 +125,7 @@ public String key() { * Returns the current value for this system property by delegating to {@link * System#getProperty(String)}. */ - @Nullable - public String value() { + public @Nullable String value() { return System.getProperty(key); } diff --git a/guava/src/com/google/common/base/Strings.java b/guava/src/com/google/common/base/Strings.java index d3207b5f2836..20d82488bcc7 100644 --- a/guava/src/com/google/common/base/Strings.java +++ b/guava/src/com/google/common/base/Strings.java @@ -47,8 +47,7 @@ public static String nullToEmpty(@Nullable String string) { * @param string the string to test and possibly return * @return {@code string} itself if it is nonempty; {@code null} if it is empty or null */ - @Nullable - public static String emptyToNull(@Nullable String string) { + public static @Nullable String emptyToNull(@Nullable String string) { return Platform.emptyToNull(string); } diff --git a/guava/src/com/google/common/base/Suppliers.java b/guava/src/com/google/common/base/Suppliers.java index 6c4fc745958b..b602c880e34d 100644 --- a/guava/src/com/google/common/base/Suppliers.java +++ b/guava/src/com/google/common/base/Suppliers.java @@ -113,7 +113,7 @@ static class MemoizingSupplier implements Supplier, Serializable { transient volatile boolean initialized; // "value" does not need to be volatile; visibility piggy-backs // on volatile read of "initialized". - @Nullable transient T value; + transient @Nullable T value; MemoizingSupplier(Supplier delegate) { this.delegate = Preconditions.checkNotNull(delegate); @@ -214,7 +214,7 @@ public static Supplier memoizeWithExpiration( static class ExpiringMemoizingSupplier implements Supplier, Serializable { final Supplier delegate; final long durationNanos; - @Nullable transient volatile T value; + transient volatile @Nullable T value; // The special value 0 means "not yet initialized". transient volatile long expirationNanos; @@ -266,7 +266,7 @@ public static Supplier ofInstance(@Nullable T instance) { } private static class SupplierOfInstance implements Supplier, Serializable { - @Nullable final T instance; + final @Nullable T instance; SupplierOfInstance(@Nullable T instance) { this.instance = instance; diff --git a/guava/src/com/google/common/base/Throwables.java b/guava/src/com/google/common/base/Throwables.java index c8ace433700f..54152388b071 100644 --- a/guava/src/com/google/common/base/Throwables.java +++ b/guava/src/com/google/common/base/Throwables.java @@ -448,32 +448,30 @@ private static Object invokeAccessibleNonThrowingMethod( /** Access to some fancy internal JVM internals. */ @GwtIncompatible // java.lang.reflect - @Nullable - private static final Object jla = getJLA(); + private static final @Nullable Object jla = getJLA(); /** * The "getStackTraceElementMethod" method, only available on some JDKs so we use reflection to * find it when available. When this is null, use the slow way. */ @GwtIncompatible // java.lang.reflect - @Nullable - private static final Method getStackTraceElementMethod = (jla == null) ? null : getGetMethod(); + private static final @Nullable Method getStackTraceElementMethod = + (jla == null) ? null : getGetMethod(); /** * The "getStackTraceDepth" method, only available on some JDKs so we use reflection to find it * when available. When this is null, use the slow way. */ @GwtIncompatible // java.lang.reflect - @Nullable - private static final Method getStackTraceDepthMethod = (jla == null) ? null : getSizeMethod(); + private static final @Nullable Method getStackTraceDepthMethod = + (jla == null) ? null : getSizeMethod(); /** * Returns the JavaLangAccess class that is present in all Sun JDKs. It is not whitelisted for * AppEngine, and not present in non-Sun JDKs. */ @GwtIncompatible // java.lang.reflect - @Nullable - private static Object getJLA() { + private static @Nullable Object getJLA() { try { /* * We load sun.misc.* classes using reflection since Android doesn't support these classes and @@ -498,8 +496,7 @@ private static Object getJLA() { * method cannot be found (it is only to be found in fairly recent JDKs). */ @GwtIncompatible // java.lang.reflect - @Nullable - private static Method getGetMethod() { + private static @Nullable Method getGetMethod() { return getJlaMethod("getStackTraceElement", Throwable.class, int.class); } @@ -513,8 +510,7 @@ private static Method getGetMethod() { * UnsupportedOperationException. */ @GwtIncompatible // java.lang.reflect - @Nullable - private static Method getSizeMethod() { + private static @Nullable Method getSizeMethod() { try { Method getStackTraceDepth = getJlaMethod("getStackTraceDepth", Throwable.class); if (getStackTraceDepth == null) { @@ -528,8 +524,8 @@ private static Method getSizeMethod() { } @GwtIncompatible // java.lang.reflect - @Nullable - private static Method getJlaMethod(String name, Class... parameterTypes) throws ThreadDeath { + private static @Nullable Method getJlaMethod(String name, Class... parameterTypes) + throws ThreadDeath { try { return Class.forName(JAVA_LANG_ACCESS_CLASSNAME, false, null).getMethod(name, parameterTypes); } catch (ThreadDeath death) { diff --git a/guava/src/com/google/common/base/internal/Finalizer.java b/guava/src/com/google/common/base/internal/Finalizer.java index 3b928d49686f..75d0d72f6ec4 100644 --- a/guava/src/com/google/common/base/internal/Finalizer.java +++ b/guava/src/com/google/common/base/internal/Finalizer.java @@ -116,11 +116,10 @@ public static void startFinalizer( // By preference, we will use the Thread constructor that has an `inheritThreadLocals` parameter. // But before Java 9, our only way not to inherit ThreadLocals is to zap them after the thread // is created, by accessing a private field. - @Nullable - private static final Constructor bigThreadConstructor = getBigThreadConstructor(); + private static final @Nullable Constructor bigThreadConstructor = + getBigThreadConstructor(); - @Nullable - private static final Field inheritableThreadLocals = + private static final @Nullable Field inheritableThreadLocals = (bigThreadConstructor == null) ? getInheritableThreadLocalsField() : null; /** Constructs a new finalizer thread. */ @@ -192,8 +191,7 @@ private boolean cleanUp(Reference reference) { } /** Looks up FinalizableReference.finalizeReferent() method. */ - @Nullable - private Method getFinalizeReferentMethod() { + private @Nullable Method getFinalizeReferentMethod() { Class finalizableReferenceClass = finalizableReferenceClassReference.get(); if (finalizableReferenceClass == null) { /* @@ -211,8 +209,7 @@ private Method getFinalizeReferentMethod() { } } - @Nullable - private static Field getInheritableThreadLocalsField() { + private static @Nullable Field getInheritableThreadLocalsField() { try { Field inheritableThreadLocals = Thread.class.getDeclaredField("inheritableThreadLocals"); inheritableThreadLocals.setAccessible(true); @@ -226,8 +223,7 @@ private static Field getInheritableThreadLocalsField() { } } - @Nullable - private static Constructor getBigThreadConstructor() { + private static @Nullable Constructor getBigThreadConstructor() { try { return Thread.class.getConstructor( ThreadGroup.class, Runnable.class, String.class, long.class, boolean.class); diff --git a/guava/src/com/google/common/cache/CacheBuilderSpec.java b/guava/src/com/google/common/cache/CacheBuilderSpec.java index 39d94c817dc2..f332c90f864e 100644 --- a/guava/src/com/google/common/cache/CacheBuilderSpec.java +++ b/guava/src/com/google/common/cache/CacheBuilderSpec.java @@ -278,8 +278,7 @@ public boolean equals(@Nullable Object obj) { * Converts an expiration duration/unit pair into a single Long for hashing and equality. Uses * nanos to match CacheBuilder implementation. */ - @Nullable - private static Long durationInNanos(long duration, @Nullable TimeUnit unit) { + private static @Nullable Long durationInNanos(long duration, @Nullable TimeUnit unit) { return (unit == null) ? null : unit.toNanos(duration); } diff --git a/guava/src/com/google/common/cache/ForwardingCache.java b/guava/src/com/google/common/cache/ForwardingCache.java index fa4f1a428da5..81dbf7acefa4 100644 --- a/guava/src/com/google/common/cache/ForwardingCache.java +++ b/guava/src/com/google/common/cache/ForwardingCache.java @@ -43,8 +43,7 @@ protected ForwardingCache() {} /** @since 11.0 */ @Override - @Nullable - public V getIfPresent(Object key) { + public @Nullable V getIfPresent(Object key) { return delegate().getIfPresent(key); } diff --git a/guava/src/com/google/common/cache/LocalCache.java b/guava/src/com/google/common/cache/LocalCache.java index f27e157a2cef..54472a0a7845 100644 --- a/guava/src/com/google/common/cache/LocalCache.java +++ b/guava/src/com/google/common/cache/LocalCache.java @@ -230,7 +230,7 @@ class LocalCache extends AbstractMap implements ConcurrentMap final StatsCounter globalStatsCounter; /** The default cache loader to use on loading operations. */ - @Nullable final CacheLoader defaultLoader; + final @Nullable CacheLoader defaultLoader; /** * Creates a new, empty map with the specified strategy, initial capacity and concurrency level. @@ -953,7 +953,7 @@ public K getKey() { // The code below is exactly the same for each entry type. final int hash; - @Nullable final ReferenceEntry next; + final @Nullable ReferenceEntry next; volatile ValueReference valueReference = unset(); @Override @@ -1240,7 +1240,7 @@ public void setPreviousInWriteQueue(ReferenceEntry previous) { // The code below is exactly the same for each entry type. final int hash; - @Nullable final ReferenceEntry next; + final @Nullable ReferenceEntry next; volatile ValueReference valueReference = unset(); @Override @@ -1893,13 +1893,13 @@ static class Segment extends ReentrantLock { * The key reference queue contains entries whose keys have been garbage collected, and which * need to be cleaned up internally. */ - @Nullable final ReferenceQueue keyReferenceQueue; + final @Nullable ReferenceQueue keyReferenceQueue; /** * The value reference queue contains value references whose values have been garbage collected, * and which need to be cleaned up internally. */ - @Nullable final ReferenceQueue valueReferenceQueue; + final @Nullable ReferenceQueue valueReferenceQueue; /** * The recency queue is used to record which entries were accessed for updating the access @@ -3932,8 +3932,7 @@ public int size() { } @Override - @Nullable - public V get(@Nullable Object key) { + public @Nullable V get(@Nullable Object key) { if (key == null) { return null; } @@ -3946,8 +3945,7 @@ V get(K key, CacheLoader loader) throws ExecutionException { return segmentFor(hash).get(key, hash, loader); } - @Nullable - public V getIfPresent(Object key) { + public @Nullable V getIfPresent(Object key) { int hash = hash(checkNotNull(key)); V value = segmentFor(hash).get(key, hash); if (value == null) { @@ -3960,8 +3958,7 @@ public V getIfPresent(Object key) { // Only becomes available in Java 8 when it's on the interface. // @Override - @Nullable - public V getOrDefault(@Nullable Object key, @Nullable V defaultValue) { + public @Nullable V getOrDefault(@Nullable Object key, @Nullable V defaultValue) { V result = get(key); return (result != null) ? result : defaultValue; } @@ -4693,7 +4690,7 @@ static class ManualSerializationProxy extends ForwardingCache final Weigher weigher; final int concurrencyLevel; final RemovalListener removalListener; - @Nullable final Ticker ticker; + final @Nullable Ticker ticker; final CacheLoader loader; @MonotonicNonNullDecl transient Cache delegate; @@ -4857,8 +4854,7 @@ private LocalManualCache(LocalCache localCache) { // Cache methods @Override - @Nullable - public V getIfPresent(Object key) { + public @Nullable V getIfPresent(Object key) { return localCache.getIfPresent(key); } diff --git a/guava/src/com/google/common/collect/AbstractIterator.java b/guava/src/com/google/common/collect/AbstractIterator.java index c514bd063a01..ff009c528ddc 100644 --- a/guava/src/com/google/common/collect/AbstractIterator.java +++ b/guava/src/com/google/common/collect/AbstractIterator.java @@ -81,7 +81,7 @@ private enum State { FAILED, } - @Nullable private T next; + private @Nullable T next; /** * Returns the next element. Note: the implementation must call {@link #endOfData()} when diff --git a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java index 036cbd94b224..335102f19fcc 100644 --- a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java +++ b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java @@ -324,10 +324,10 @@ final List wrapList(@Nullable K key, List list, @Nullable WrappedCollectio */ @WeakOuter class WrappedCollection extends AbstractCollection { - @Nullable final K key; + final @Nullable K key; Collection delegate; - @Nullable final WrappedCollection ancestor; - @Nullable final Collection ancestorDelegate; + final @Nullable WrappedCollection ancestor; + final @Nullable Collection ancestorDelegate; WrappedCollection( @Nullable K key, Collection delegate, @Nullable WrappedCollection ancestor) { diff --git a/guava/src/com/google/common/collect/AbstractNavigableMap.java b/guava/src/com/google/common/collect/AbstractNavigableMap.java index 7004b7211fbf..b0200d7245b0 100644 --- a/guava/src/com/google/common/collect/AbstractNavigableMap.java +++ b/guava/src/com/google/common/collect/AbstractNavigableMap.java @@ -36,30 +36,25 @@ abstract class AbstractNavigableMap extends IteratorBasedAbstractMap implements NavigableMap { @Override - @Nullable - public abstract V get(@Nullable Object key); + public abstract @Nullable V get(@Nullable Object key); @Override - @Nullable - public Entry firstEntry() { + public @Nullable Entry firstEntry() { return Iterators.getNext(entryIterator(), null); } @Override - @Nullable - public Entry lastEntry() { + public @Nullable Entry lastEntry() { return Iterators.getNext(descendingEntryIterator(), null); } @Override - @Nullable - public Entry pollFirstEntry() { + public @Nullable Entry pollFirstEntry() { return Iterators.pollNext(entryIterator()); } @Override - @Nullable - public Entry pollLastEntry() { + public @Nullable Entry pollLastEntry() { return Iterators.pollNext(descendingEntryIterator()); } @@ -84,26 +79,22 @@ public K lastKey() { } @Override - @Nullable - public Entry lowerEntry(K key) { + public @Nullable Entry lowerEntry(K key) { return headMap(key, false).lastEntry(); } @Override - @Nullable - public Entry floorEntry(K key) { + public @Nullable Entry floorEntry(K key) { return headMap(key, true).lastEntry(); } @Override - @Nullable - public Entry ceilingEntry(K key) { + public @Nullable Entry ceilingEntry(K key) { return tailMap(key, true).firstEntry(); } @Override - @Nullable - public Entry higherEntry(K key) { + public @Nullable Entry higherEntry(K key) { return tailMap(key, false).firstEntry(); } diff --git a/guava/src/com/google/common/collect/AbstractSequentialIterator.java b/guava/src/com/google/common/collect/AbstractSequentialIterator.java index 05f561d68502..35a48641970f 100644 --- a/guava/src/com/google/common/collect/AbstractSequentialIterator.java +++ b/guava/src/com/google/common/collect/AbstractSequentialIterator.java @@ -41,7 +41,7 @@ */ @GwtCompatible public abstract class AbstractSequentialIterator extends UnmodifiableIterator { - @Nullable private T nextOrNull; + private @Nullable T nextOrNull; /** * Creates a new iterator with the given first element, or, if {@code firstOrNull} is null, diff --git a/guava/src/com/google/common/collect/ArrayTable.java b/guava/src/com/google/common/collect/ArrayTable.java index 1a40c21cf909..0c873cc77ef4 100644 --- a/guava/src/com/google/common/collect/ArrayTable.java +++ b/guava/src/com/google/common/collect/ArrayTable.java @@ -190,11 +190,9 @@ K getKey(int index) { abstract String getKeyRole(); - @Nullable - abstract V getValue(int index); + abstract @Nullable V getValue(int index); - @Nullable - abstract V setValue(int index, V newValue); + abstract @Nullable V setValue(int index, V newValue); @Override public int size() { diff --git a/guava/src/com/google/common/collect/CollectSpliterators.java b/guava/src/com/google/common/collect/CollectSpliterators.java index f697a8d23e07..dcb5b46cc3f6 100644 --- a/guava/src/com/google/common/collect/CollectSpliterators.java +++ b/guava/src/com/google/common/collect/CollectSpliterators.java @@ -65,8 +65,7 @@ public void forEachRemaining(Consumer action) { } @Override - @Nullable - public Spliterator trySplit() { + public @Nullable Spliterator trySplit() { Spliterator.OfInt split = delegate.trySplit(); return (split == null) ? null : new WithCharacteristics(split); } diff --git a/guava/src/com/google/common/collect/CompactHashMap.java b/guava/src/com/google/common/collect/CompactHashMap.java index ad8f54e02523..96fdfaba6151 100644 --- a/guava/src/com/google/common/collect/CompactHashMap.java +++ b/guava/src/com/google/common/collect/CompactHashMap.java @@ -236,8 +236,7 @@ void accessEntry(int index) { @CanIgnoreReturnValue @Override - @Nullable - public V put(@Nullable K key, @Nullable V value) { + public @Nullable V put(@Nullable K key, @Nullable V value) { long[] entries = this.entries; Object[] keys = this.keys; Object[] values = this.values; @@ -373,13 +372,11 @@ public V get(@Nullable Object key) { @CanIgnoreReturnValue @Override - @Nullable - public V remove(@Nullable Object key) { + public @Nullable V remove(@Nullable Object key) { return remove(key, smearedHash(key)); } - @Nullable - private V remove(@Nullable Object key, int hash) { + private @Nullable V remove(@Nullable Object key, int hash) { int tableIndex = hash & hashTableMask(); int next = table[tableIndex]; if (next == UNSET) { // empty bucket @@ -664,7 +661,7 @@ Entry getOutput(int entry) { } final class MapEntry extends AbstractMapEntry { - @Nullable private final K key; + private final @Nullable K key; private int lastKnownIndex; diff --git a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java index ab49e9aa97ef..3aaa76e3da3f 100644 --- a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java +++ b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java @@ -522,7 +522,7 @@ protected Entry computeNext() { }; return new ForwardingIterator>() { - @Nullable private Entry last; + private @Nullable Entry last; @Override protected Iterator> delegate() { diff --git a/guava/src/com/google/common/collect/Cut.java b/guava/src/com/google/common/collect/Cut.java index 3a12b2473a76..8f6cd818f738 100644 --- a/guava/src/com/google/common/collect/Cut.java +++ b/guava/src/com/google/common/collect/Cut.java @@ -33,7 +33,7 @@ */ @GwtCompatible abstract class Cut implements Comparable>, Serializable { - @Nullable final C endpoint; + final @Nullable C endpoint; Cut(@Nullable C endpoint) { this.endpoint = endpoint; diff --git a/guava/src/com/google/common/collect/DenseImmutableTable.java b/guava/src/com/google/common/collect/DenseImmutableTable.java index 2e2688a99a81..af7cd5f94a7a 100644 --- a/guava/src/com/google/common/collect/DenseImmutableTable.java +++ b/guava/src/com/google/common/collect/DenseImmutableTable.java @@ -101,8 +101,7 @@ K getKey(int index) { return keyToIndex().keySet().asList().get(index); } - @Nullable - abstract V getValue(int keyIndex); + abstract @Nullable V getValue(int keyIndex); @Override ImmutableSet createKeySet() { diff --git a/guava/src/com/google/common/collect/GeneralRange.java b/guava/src/com/google/common/collect/GeneralRange.java index 697769ace6e6..29248a38a784 100644 --- a/guava/src/com/google/common/collect/GeneralRange.java +++ b/guava/src/com/google/common/collect/GeneralRange.java @@ -92,10 +92,10 @@ static GeneralRange range( private final Comparator comparator; private final boolean hasLowerBound; - @Nullable private final T lowerEndpoint; + private final @Nullable T lowerEndpoint; private final BoundType lowerBoundType; private final boolean hasUpperBound; - @Nullable private final T upperEndpoint; + private final @Nullable T upperEndpoint; private final BoundType upperBoundType; private GeneralRange( diff --git a/guava/src/com/google/common/collect/HashBiMap.java b/guava/src/com/google/common/collect/HashBiMap.java index c1c4bf6046c1..af6091d84a3c 100644 --- a/guava/src/com/google/common/collect/HashBiMap.java +++ b/guava/src/com/google/common/collect/HashBiMap.java @@ -105,8 +105,8 @@ private static final class BiEntry extends ImmutableEntry { private transient BiEntry[] hashTableKToV; private transient BiEntry[] hashTableVToK; - @Nullable private transient BiEntry firstInKeyInsertionOrder; - @Nullable private transient BiEntry lastInKeyInsertionOrder; + private transient @Nullable BiEntry firstInKeyInsertionOrder; + private transient @Nullable BiEntry lastInKeyInsertionOrder; private transient int size; private transient int mask; private transient int modCount; @@ -249,9 +249,8 @@ public boolean containsValue(@Nullable Object value) { return seekByValue(value, smearedHash(value)) != null; } - @Nullable @Override - public V get(@Nullable Object key) { + public @Nullable V get(@Nullable Object key) { return Maps.valueOrNull(seekByKey(key, smearedHash(key))); } @@ -301,8 +300,7 @@ public V forcePut(@Nullable K key, @Nullable V value) { return put(key, value, true); } - @Nullable - private K putInverse(@Nullable V value, @Nullable K key, boolean force) { + private @Nullable K putInverse(@Nullable V value, @Nullable K key, boolean force) { int valueHash = smearedHash(value); int keyHash = smearedHash(key); diff --git a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java index b775baa23c3f..8a108b34d1f7 100644 --- a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java +++ b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java @@ -169,8 +169,7 @@ protected Map, B> delegate() { @Override @SuppressWarnings("unchecked") // value could not get in if not a T - @Nullable - public T getInstance(Class type) { + public @Nullable T getInstance(Class type) { return (T) delegate.get(checkNotNull(type)); } diff --git a/guava/src/com/google/common/collect/ImmutableEntry.java b/guava/src/com/google/common/collect/ImmutableEntry.java index 5122e08019bf..0f435e97069a 100644 --- a/guava/src/com/google/common/collect/ImmutableEntry.java +++ b/guava/src/com/google/common/collect/ImmutableEntry.java @@ -23,23 +23,21 @@ /** @see com.google.common.collect.Maps#immutableEntry(Object, Object) */ @GwtCompatible(serializable = true) class ImmutableEntry extends AbstractMapEntry implements Serializable { - @Nullable final K key; - @Nullable final V value; + final @Nullable K key; + final @Nullable V value; ImmutableEntry(@Nullable K key, @Nullable V value) { this.key = key; this.value = value; } - @Nullable @Override - public final K getKey() { + public final @Nullable K getKey() { return key; } - @Nullable @Override - public final V getValue() { + public final @Nullable V getValue() { return value; } diff --git a/guava/src/com/google/common/collect/ImmutableMapEntry.java b/guava/src/com/google/common/collect/ImmutableMapEntry.java index 8d5eb84ad971..d03d4fa0ea81 100644 --- a/guava/src/com/google/common/collect/ImmutableMapEntry.java +++ b/guava/src/com/google/common/collect/ImmutableMapEntry.java @@ -80,8 +80,7 @@ static class NonTerminalImmutableMapEntry extends ImmutableMapEntry } @Override - @Nullable - final ImmutableMapEntry getNextInKeyBucket() { + final @Nullable ImmutableMapEntry getNextInKeyBucket() { return nextInKeyBucket; } diff --git a/guava/src/com/google/common/collect/ImmutableRangeMap.java b/guava/src/com/google/common/collect/ImmutableRangeMap.java index 9d758d9a4357..5ebf0f4e4e5d 100644 --- a/guava/src/com/google/common/collect/ImmutableRangeMap.java +++ b/guava/src/com/google/common/collect/ImmutableRangeMap.java @@ -169,8 +169,7 @@ public ImmutableRangeMap build() { } @Override - @Nullable - public V get(K key) { + public @Nullable V get(K key) { int index = SortedLists.binarySearch( ranges, @@ -187,8 +186,7 @@ public V get(K key) { } @Override - @Nullable - public Entry, V> getEntry(K key) { + public @Nullable Entry, V> getEntry(K key) { int index = SortedLists.binarySearch( ranges, diff --git a/guava/src/com/google/common/collect/ImmutableSet.java b/guava/src/com/google/common/collect/ImmutableSet.java index 9af82851ca13..56a78f95414c 100644 --- a/guava/src/com/google/common/collect/ImmutableSet.java +++ b/guava/src/com/google/common/collect/ImmutableSet.java @@ -302,7 +302,7 @@ public int hashCode() { @Override public abstract UnmodifiableIterator iterator(); - @LazyInit @Nullable @RetainedWith private transient ImmutableList asList; + @LazyInit @RetainedWith private transient @Nullable ImmutableList asList; @Override public ImmutableList asList() { diff --git a/guava/src/com/google/common/collect/Iterables.java b/guava/src/com/google/common/collect/Iterables.java index 2f000b6e6ffc..5313b49e9111 100644 --- a/guava/src/com/google/common/collect/Iterables.java +++ b/guava/src/com/google/common/collect/Iterables.java @@ -199,8 +199,8 @@ public static boolean removeIf(Iterable removeFrom, Predicate } /** Removes and returns the first matching element, or returns {@code null} if there is none. */ - @Nullable - static T removeFirstMatching(Iterable removeFrom, Predicate predicate) { + static @Nullable T removeFirstMatching( + Iterable removeFrom, Predicate predicate) { checkNotNull(predicate); Iterator iterator = removeFrom.iterator(); while (iterator.hasNext()) { @@ -263,8 +263,8 @@ public static T getOnlyElement(Iterable iterable) { * * @throws IllegalArgumentException if the iterator contains multiple elements */ - @Nullable - public static T getOnlyElement(Iterable iterable, @Nullable T defaultValue) { + public static @Nullable T getOnlyElement( + Iterable iterable, @Nullable T defaultValue) { return Iterators.getOnlyElement(iterable.iterator(), defaultValue); } @@ -641,8 +641,7 @@ public static T find(Iterable iterable, Predicate predicate) { * * @since 7.0 */ - @Nullable - public static T find( + public static @Nullable T find( Iterable iterable, Predicate predicate, @Nullable T defaultValue) { return Iterators.find(iterable.iterator(), predicate, defaultValue); } @@ -745,8 +744,8 @@ public static T get(Iterable iterable, int position) { * @throws IndexOutOfBoundsException if {@code position} is negative * @since 4.0 */ - @Nullable - public static T get(Iterable iterable, int position, @Nullable T defaultValue) { + public static @Nullable T get( + Iterable iterable, int position, @Nullable T defaultValue) { checkNotNull(iterable); Iterators.checkNonnegative(position); if (iterable instanceof List) { @@ -776,8 +775,7 @@ public static T get(Iterable iterable, int position, @Nullable * @return the first element of {@code iterable} or the default value * @since 7.0 */ - @Nullable - public static T getFirst(Iterable iterable, @Nullable T defaultValue) { + public static @Nullable T getFirst(Iterable iterable, @Nullable T defaultValue) { return Iterators.getNext(iterable.iterator(), defaultValue); } @@ -814,8 +812,7 @@ public static T getLast(Iterable iterable) { * @return the last element of {@code iterable} or the default value * @since 3.0 */ - @Nullable - public static T getLast(Iterable iterable, @Nullable T defaultValue) { + public static @Nullable T getLast(Iterable iterable, @Nullable T defaultValue) { if (iterable instanceof Collection) { Collection c = Collections2.cast(iterable); if (c.isEmpty()) { diff --git a/guava/src/com/google/common/collect/Iterators.java b/guava/src/com/google/common/collect/Iterators.java index 9bbaeec1983e..f8cc4628e1ed 100644 --- a/guava/src/com/google/common/collect/Iterators.java +++ b/guava/src/com/google/common/collect/Iterators.java @@ -324,8 +324,8 @@ public static T getOnlyElement(Iterator iterator) { * iterator is unspecified. */ @CanIgnoreReturnValue // TODO(kak): Consider removing this? - @Nullable - public static T getOnlyElement(Iterator iterator, @Nullable T defaultValue) { + public static @Nullable T getOnlyElement( + Iterator iterator, @Nullable T defaultValue) { return iterator.hasNext() ? getOnlyElement(iterator) : defaultValue; } @@ -707,8 +707,7 @@ public static T find(Iterator iterator, Predicate predicate) { * * @since 7.0 */ - @Nullable - public static T find( + public static @Nullable T find( Iterator iterator, Predicate predicate, @Nullable T defaultValue) { checkNotNull(iterator); checkNotNull(predicate); @@ -823,8 +822,8 @@ public static T get(Iterator iterator, int position) { * @throws IndexOutOfBoundsException if {@code position} is negative * @since 4.0 */ - @Nullable - public static T get(Iterator iterator, int position, @Nullable T defaultValue) { + public static @Nullable T get( + Iterator iterator, int position, @Nullable T defaultValue) { checkNonnegative(position); advance(iterator, position); return getNext(iterator, defaultValue); @@ -844,8 +843,7 @@ static void checkNonnegative(int position) { * @return the next element of {@code iterator} or the default value * @since 7.0 */ - @Nullable - public static T getNext(Iterator iterator, @Nullable T defaultValue) { + public static @Nullable T getNext(Iterator iterator, @Nullable T defaultValue) { return iterator.hasNext() ? iterator.next() : defaultValue; } @@ -872,8 +870,7 @@ public static T getLast(Iterator iterator) { * @return the last element of {@code iterator} * @since 3.0 */ - @Nullable - public static T getLast(Iterator iterator, @Nullable T defaultValue) { + public static @Nullable T getLast(Iterator iterator, @Nullable T defaultValue) { return iterator.hasNext() ? getLast(iterator) : defaultValue; } @@ -970,8 +967,7 @@ public String toString() { * Deletes and returns the next value from the iterator, or returns {@code null} if there is no * such value. */ - @Nullable - static T pollNext(Iterator iterator) { + static @Nullable T pollNext(Iterator iterator) { if (iterator.hasNext()) { T result = iterator.next(); iterator.remove(); @@ -1051,7 +1047,7 @@ protected T get(int index) { * *

The {@link Iterable} equivalent of this method is {@link Collections#singleton}. */ - public static UnmodifiableIterator singletonIterator(@Nullable final T value) { + public static UnmodifiableIterator singletonIterator(final @Nullable T value) { return new UnmodifiableIterator() { boolean done; @@ -1119,7 +1115,7 @@ private static class PeekingImpl implements PeekingIterator { private final Iterator iterator; private boolean hasPeeked; - @Nullable private E peekedElement; + private @Nullable E peekedElement; public PeekingImpl(Iterator iterator) { this.iterator = checkNotNull(iterator); @@ -1288,7 +1284,7 @@ public T next() { private static class ConcatenatedIterator implements Iterator { /* The last iterator to return an element. Calls to remove() go to this iterator. */ - @Nullable private Iterator toRemove; + private @Nullable Iterator toRemove; /* The iterator currently returning elements. */ private Iterator iterator; @@ -1303,7 +1299,7 @@ private static class ConcatenatedIterator implements Iterator { private Iterator> topMetaIterator; // Only becomes nonnull if we encounter nested concatenations. - @Nullable private Deque>> metaIterators; + private @Nullable Deque>> metaIterators; ConcatenatedIterator(Iterator> metaIterator) { iterator = emptyIterator(); @@ -1311,8 +1307,7 @@ private static class ConcatenatedIterator implements Iterator { } // Returns a nonempty meta-iterator or, if all meta-iterators are empty, null. - @Nullable - private Iterator> getTopMetaIterator() { + private @Nullable Iterator> getTopMetaIterator() { while (topMetaIterator == null || !topMetaIterator.hasNext()) { if (metaIterators != null && !metaIterators.isEmpty()) { topMetaIterator = metaIterators.removeFirst(); diff --git a/guava/src/com/google/common/collect/LinkedListMultimap.java b/guava/src/com/google/common/collect/LinkedListMultimap.java index 18489fc5d93d..821c84a6e618 100644 --- a/guava/src/com/google/common/collect/LinkedListMultimap.java +++ b/guava/src/com/google/common/collect/LinkedListMultimap.java @@ -106,7 +106,7 @@ public class LinkedListMultimap extends AbstractMultimap */ private static final class Node extends AbstractMapEntry { - @Nullable final K key; + final @Nullable K key; @Nullable V value; @Nullable Node next; // the next node (with any key) @Nullable Node previous; // the previous node (with any key) @@ -150,8 +150,8 @@ private static class KeyList { } } - @Nullable private transient Node head; // the head for all keys - @Nullable private transient Node tail; // the tail for all keys + private transient @Nullable Node head; // the head for all keys + private transient @Nullable Node tail; // the tail for all keys private transient Map> keyToKeyList; private transient int size; @@ -454,7 +454,7 @@ public void remove() { /** A {@code ListIterator} over values for a specified key. */ private class ValueForKeyIterator implements ListIterator { - @Nullable final Object key; + final @Nullable Object key; int nextIndex; @Nullable Node next; @Nullable Node current; diff --git a/guava/src/com/google/common/collect/Lists.java b/guava/src/com/google/common/collect/Lists.java index a5256a6ddbe4..4f895325069d 100644 --- a/guava/src/com/google/common/collect/Lists.java +++ b/guava/src/com/google/common/collect/Lists.java @@ -314,7 +314,7 @@ public static List asList(@Nullable E first, @Nullable E second, E[] rest /** @see Lists#asList(Object, Object[]) */ private static class OnePlusArrayList extends AbstractList implements Serializable, RandomAccess { - @Nullable final E first; + final @Nullable E first; final E[] rest; OnePlusArrayList(@Nullable E first, E[] rest) { @@ -340,8 +340,8 @@ public E get(int index) { /** @see Lists#asList(Object, Object, Object[]) */ private static class TwoPlusArrayList extends AbstractList implements Serializable, RandomAccess { - @Nullable final E first; - @Nullable final E second; + final @Nullable E first; + final @Nullable E second; final E[] rest; TwoPlusArrayList(@Nullable E first, @Nullable E second, E[] rest) { diff --git a/guava/src/com/google/common/collect/MapMakerInternalMap.java b/guava/src/com/google/common/collect/MapMakerInternalMap.java index 54ead3944277..899190443b91 100644 --- a/guava/src/com/google/common/collect/MapMakerInternalMap.java +++ b/guava/src/com/google/common/collect/MapMakerInternalMap.java @@ -340,7 +340,7 @@ abstract static class AbstractStrongKeyEntry { final K key; final int hash; - @Nullable final E next; + final @Nullable E next; AbstractStrongKeyEntry(K key, int hash, @Nullable E next) { this.key = key; @@ -390,15 +390,14 @@ WeakValueReference unsetWeakValueReference() { static final class StrongKeyStrongValueEntry extends AbstractStrongKeyEntry> implements StrongValueEntry> { - @Nullable private volatile V value = null; + private volatile @Nullable V value = null; StrongKeyStrongValueEntry(K key, int hash, @Nullable StrongKeyStrongValueEntry next) { super(key, hash, next); } @Override - @Nullable - public V getValue() { + public @Nullable V getValue() { return value; } @@ -647,7 +646,7 @@ public StrongKeyDummyValueEntry newEntry( abstract static class AbstractWeakKeyEntry> extends WeakReference implements InternalEntry { final int hash; - @Nullable final E next; + final @Nullable E next; AbstractWeakKeyEntry(ReferenceQueue queue, K key, int hash, @Nullable E next) { super(key, queue); @@ -755,7 +754,7 @@ public WeakKeyDummyValueEntry newEntry( static final class WeakKeyStrongValueEntry extends AbstractWeakKeyEntry> implements StrongValueEntry> { - @Nullable private volatile V value = null; + private volatile @Nullable V value = null; WeakKeyStrongValueEntry( ReferenceQueue queue, K key, int hash, @Nullable WeakKeyStrongValueEntry next) { @@ -763,8 +762,7 @@ static final class WeakKeyStrongValueEntry } @Override - @Nullable - public V getValue() { + public @Nullable V getValue() { return value; } diff --git a/guava/src/com/google/common/collect/Maps.java b/guava/src/com/google/common/collect/Maps.java index 2c36408b3eb1..5921019c90d0 100644 --- a/guava/src/com/google/common/collect/Maps.java +++ b/guava/src/com/google/common/collect/Maps.java @@ -92,15 +92,13 @@ private Maps() {} private enum EntryFunction implements Function, Object> { KEY { @Override - @Nullable - public Object apply(Entry entry) { + public @Nullable Object apply(Entry entry) { return entry.getKey(); } }, VALUE { @Override - @Nullable - public Object apply(Entry entry) { + public @Nullable Object apply(Entry entry) { return entry.getValue(); } }; @@ -695,8 +693,8 @@ public String toString() { } static class ValueDifferenceImpl implements MapDifference.ValueDifference { - @Nullable private final V left; - @Nullable private final V right; + private final @Nullable V left; + private final @Nullable V right; static ValueDifference create(@Nullable V left, @Nullable V right) { return new ValueDifferenceImpl(left, right); @@ -1051,14 +1049,12 @@ public Comparator comparator() { } @Override - @Nullable - public V get(@Nullable Object key) { + public @Nullable V get(@Nullable Object key) { return getOrDefault(key, null); } @Override - @Nullable - public V getOrDefault(@Nullable Object key, @Nullable V defaultValue) { + public @Nullable V getOrDefault(@Nullable Object key, @Nullable V defaultValue) { if (Collections2.safeContains(set, key)) { @SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it K k = (K) key; @@ -2030,16 +2026,14 @@ public boolean containsKey(Object key) { } @Override - @Nullable - public V2 get(@Nullable Object key) { + public @Nullable V2 get(@Nullable Object key) { return getOrDefault(key, null); } // safe as long as the user followed the Warning in the javadoc @SuppressWarnings("unchecked") @Override - @Nullable - public V2 getOrDefault(@Nullable Object key, @Nullable V2 defaultValue) { + public @Nullable V2 getOrDefault(@Nullable Object key, @Nullable V2 defaultValue) { V1 value = fromMap.get(key); return (value != null || fromMap.containsKey(key)) ? transformer.transformEntry((K) key, value) @@ -2249,8 +2243,7 @@ public NavigableMap tailMap(K fromKey, boolean inclusive) { return transformEntries(fromMap().tailMap(fromKey, inclusive), transformer); } - @Nullable - private Entry transformEntry(@Nullable Entry entry) { + private @Nullable Entry transformEntry(@Nullable Entry entry) { return (entry == null) ? null : Maps.transformEntry(transformer, entry); } @@ -3128,8 +3121,7 @@ public boolean isEmpty() { } @Override - @Nullable - public V get(@Nullable Object key) { + public @Nullable V get(@Nullable Object key) { return filteredDelegate.get(key); } @@ -3284,8 +3276,8 @@ public static NavigableMap unmodifiableNavigableMap( } } - @Nullable - private static Entry unmodifiableOrNull(@Nullable Entry entry) { + private static @Nullable Entry unmodifiableOrNull( + @Nullable Entry entry) { return (entry == null) ? null : Maps.unmodifiableEntry(entry); } @@ -3744,13 +3736,11 @@ public void clear() { } } - @Nullable - static K keyOrNull(@Nullable Entry entry) { + static @Nullable K keyOrNull(@Nullable Entry entry) { return (entry == null) ? null : entry.getKey(); } - @Nullable - static V valueOrNull(@Nullable Entry entry) { + static @Nullable V valueOrNull(@Nullable Entry entry) { return (entry == null) ? null : entry.getValue(); } diff --git a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java index fd871e9ce993..3907fb703eca 100644 --- a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java +++ b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java @@ -754,7 +754,7 @@ private class QueueIterator implements Iterator { // either of them, up to the same multiplicity as the queue. @MonotonicNonNullDecl private Queue forgetMeNot; @MonotonicNonNullDecl private List skipMe; - @Nullable private E lastFromForgetMeNot; + private @Nullable E lastFromForgetMeNot; private boolean canRemove; @Override diff --git a/guava/src/com/google/common/collect/Multisets.java b/guava/src/com/google/common/collect/Multisets.java index b04e9669f23f..d90b4efc6fd9 100644 --- a/guava/src/com/google/common/collect/Multisets.java +++ b/guava/src/com/google/common/collect/Multisets.java @@ -246,7 +246,7 @@ public static Multiset.Entry immutableEntry(@Nullable E e, int n) { } static class ImmutableEntry extends AbstractEntry implements Serializable { - @Nullable private final E element; + private final @Nullable E element; private final int count; ImmutableEntry(@Nullable E element, int count) { @@ -256,8 +256,7 @@ static class ImmutableEntry extends AbstractEntry implements Serializable } @Override - @Nullable - public final E getElement() { + public final @Nullable E getElement() { return element; } diff --git a/guava/src/com/google/common/collect/RegularImmutableBiMap.java b/guava/src/com/google/common/collect/RegularImmutableBiMap.java index 27c2bdb7a1e6..e04088444313 100644 --- a/guava/src/com/google/common/collect/RegularImmutableBiMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableBiMap.java @@ -135,8 +135,7 @@ private static int checkNoConflictInValueBucket( } @Override - @Nullable - public V get(@Nullable Object key) { + public @Nullable V get(@Nullable Object key) { return (keyTable == null) ? null : RegularImmutableMap.get(key, keyTable, mask); } diff --git a/guava/src/com/google/common/collect/RegularImmutableMap.java b/guava/src/com/google/common/collect/RegularImmutableMap.java index 0c050c651ae5..d8f1fff6bbd4 100644 --- a/guava/src/com/google/common/collect/RegularImmutableMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableMap.java @@ -155,8 +155,8 @@ public V get(@Nullable Object key) { return get(key, table, mask); } - @Nullable - static V get(@Nullable Object key, ImmutableMapEntry @Nullable [] keyTable, int mask) { + static @Nullable V get( + @Nullable Object key, ImmutableMapEntry @Nullable [] keyTable, int mask) { if (key == null || keyTable == null) { return null; } diff --git a/guava/src/com/google/common/collect/RegularImmutableTable.java b/guava/src/com/google/common/collect/RegularImmutableTable.java index 935b74605d61..6f37987e2ed7 100644 --- a/guava/src/com/google/common/collect/RegularImmutableTable.java +++ b/guava/src/com/google/common/collect/RegularImmutableTable.java @@ -96,8 +96,8 @@ boolean isPartialView() { static RegularImmutableTable forCells( List> cells, - @Nullable final Comparator rowComparator, - @Nullable final Comparator columnComparator) { + final @Nullable Comparator rowComparator, + final @Nullable Comparator columnComparator) { checkNotNull(cells); if (rowComparator != null || columnComparator != null) { /* diff --git a/guava/src/com/google/common/collect/Sets.java b/guava/src/com/google/common/collect/Sets.java index 125ad5f7c0ff..93e255257f45 100644 --- a/guava/src/com/google/common/collect/Sets.java +++ b/guava/src/com/google/common/collect/Sets.java @@ -1208,14 +1208,12 @@ NavigableSet unfiltered() { } @Override - @Nullable - public E lower(E e) { + public @Nullable E lower(E e) { return Iterators.find(unfiltered().headSet(e, false).descendingIterator(), predicate, null); } @Override - @Nullable - public E floor(E e) { + public @Nullable E floor(E e) { return Iterators.find(unfiltered().headSet(e, true).descendingIterator(), predicate, null); } diff --git a/guava/src/com/google/common/collect/Tables.java b/guava/src/com/google/common/collect/Tables.java index db91616f7c57..fc913ec79745 100644 --- a/guava/src/com/google/common/collect/Tables.java +++ b/guava/src/com/google/common/collect/Tables.java @@ -151,9 +151,9 @@ public static Cell immutableCell( } static final class ImmutableCell extends AbstractCell implements Serializable { - @Nullable private final R rowKey; - @Nullable private final C columnKey; - @Nullable private final V value; + private final @Nullable R rowKey; + private final @Nullable C columnKey; + private final @Nullable V value; ImmutableCell(@Nullable R rowKey, @Nullable C columnKey, @Nullable V value) { this.rowKey = rowKey; diff --git a/guava/src/com/google/common/collect/TopKSelector.java b/guava/src/com/google/common/collect/TopKSelector.java index 2f173ed4dd8d..8d9e0e4686c6 100644 --- a/guava/src/com/google/common/collect/TopKSelector.java +++ b/guava/src/com/google/common/collect/TopKSelector.java @@ -110,7 +110,7 @@ public static TopKSelector greatest(int k, Comparator comparat * The largest of the lowest k elements we've seen so far relative to this comparator. If * bufferSize ≥ k, then we can ignore any elements greater than this value. */ - @Nullable private T threshold; + private @Nullable T threshold; private TopKSelector(Comparator comparator, int k) { this.comparator = checkNotNull(comparator, "comparator"); diff --git a/guava/src/com/google/common/collect/TreeBasedTable.java b/guava/src/com/google/common/collect/TreeBasedTable.java index 2993b6654442..615d31ba8692 100644 --- a/guava/src/com/google/common/collect/TreeBasedTable.java +++ b/guava/src/com/google/common/collect/TreeBasedTable.java @@ -169,8 +169,8 @@ public SortedMap row(R rowKey) { } private class TreeRow extends Row implements SortedMap { - @Nullable final C lowerBound; - @Nullable final C upperBound; + final @Nullable C lowerBound; + final @Nullable C upperBound; TreeRow(R rowKey) { this(rowKey, null, null); @@ -243,7 +243,7 @@ public C lastKey() { return backingRowMap().lastKey(); } - @Nullable transient SortedMap wholeRow; + transient @Nullable SortedMap wholeRow; /* * If the row was previously empty, we check if there's a new row here every diff --git a/guava/src/com/google/common/collect/TreeMultiset.java b/guava/src/com/google/common/collect/TreeMultiset.java index c9d31e2239f4..da3a63cc034d 100644 --- a/guava/src/com/google/common/collect/TreeMultiset.java +++ b/guava/src/com/google/common/collect/TreeMultiset.java @@ -380,8 +380,7 @@ public int getCount() { } /** Returns the first node in the tree that is in range. */ - @Nullable - private AvlNode firstNode() { + private @Nullable AvlNode firstNode() { AvlNode root = rootReference.get(); if (root == null) { return null; @@ -403,8 +402,7 @@ && comparator().compare(endpoint, node.getElement()) == 0) { return (node == header || !range.contains(node.getElement())) ? null : node; } - @Nullable - private AvlNode lastNode() { + private @Nullable AvlNode lastNode() { AvlNode root = rootReference.get(); if (root == null) { return null; @@ -547,10 +545,9 @@ public SortedMultiset tailMultiset(@Nullable E lowerBound, BoundType boundTyp } private static final class Reference { - @Nullable private T value; + private @Nullable T value; - @Nullable - public T get() { + public @Nullable T get() { return value; } @@ -567,7 +564,7 @@ void clear() { } private static final class AvlNode { - @Nullable private final E elem; + private final @Nullable E elem; // elemCount is 0 iff this node has been deleted. private int elemCount; @@ -575,10 +572,10 @@ private static final class AvlNode { private int distinctElements; private long totalCount; private int height; - @Nullable private AvlNode left; - @Nullable private AvlNode right; - @Nullable private AvlNode pred; - @Nullable private AvlNode succ; + private @Nullable AvlNode left; + private @Nullable AvlNode right; + private @Nullable AvlNode pred; + private @Nullable AvlNode succ; AvlNode(@Nullable E elem, int elemCount) { checkArgument(elemCount > 0); @@ -946,8 +943,7 @@ private static int height(@Nullable AvlNode node) { return (node == null) ? 0 : node.height; } - @Nullable - private AvlNode ceiling(Comparator comparator, E e) { + private @Nullable AvlNode ceiling(Comparator comparator, E e) { int cmp = comparator.compare(e, elem); if (cmp < 0) { return (left == null) ? this : MoreObjects.firstNonNull(left.ceiling(comparator, e), this); @@ -958,8 +954,7 @@ private AvlNode ceiling(Comparator comparator, E e) { } } - @Nullable - private AvlNode floor(Comparator comparator, E e) { + private @Nullable AvlNode floor(Comparator comparator, E e) { int cmp = comparator.compare(e, elem); if (cmp > 0) { return (right == null) ? this : MoreObjects.firstNonNull(right.floor(comparator, e), this); diff --git a/guava/src/com/google/common/collect/TreeRangeMap.java b/guava/src/com/google/common/collect/TreeRangeMap.java index 07b66fe4f6f5..72f6d369b828 100644 --- a/guava/src/com/google/common/collect/TreeRangeMap.java +++ b/guava/src/com/google/common/collect/TreeRangeMap.java @@ -100,15 +100,13 @@ Cut getUpperBound() { } @Override - @Nullable - public V get(K key) { + public @Nullable V get(K key) { Entry, V> entry = getEntry(key); return (entry == null) ? null : entry.getValue(); } @Override - @Nullable - public Entry, V> getEntry(K key) { + public @Nullable Entry, V> getEntry(K key) { Entry, RangeMapEntry> mapEntry = entriesByLowerBound.floorEntry(Cut.belowValue(key)); if (mapEntry != null && mapEntry.getValue().contains(key)) { @@ -305,14 +303,12 @@ private RangeMap emptySubRangeMap() { private static final RangeMap EMPTY_SUB_RANGE_MAP = new RangeMap() { @Override - @Nullable - public Object get(Comparable key) { + public @Nullable Object get(Comparable key) { return null; } @Override - @Nullable - public Entry getEntry(Comparable key) { + public @Nullable Entry getEntry(Comparable key) { return null; } @@ -377,14 +373,12 @@ private class SubRangeMap implements RangeMap { } @Override - @Nullable - public V get(K key) { + public @Nullable V get(K key) { return subRange.contains(key) ? TreeRangeMap.this.get(key) : null; } @Override - @Nullable - public Entry, V> getEntry(K key) { + public @Nullable Entry, V> getEntry(K key) { if (subRange.contains(key)) { Entry, V> entry = TreeRangeMap.this.getEntry(key); if (entry != null) { diff --git a/guava/src/com/google/common/collect/TreeRangeSet.java b/guava/src/com/google/common/collect/TreeRangeSet.java index 0d3fb130c6b5..7ae13d9a9c0c 100644 --- a/guava/src/com/google/common/collect/TreeRangeSet.java +++ b/guava/src/com/google/common/collect/TreeRangeSet.java @@ -119,8 +119,7 @@ public boolean equals(@Nullable Object o) { } @Override - @Nullable - public Range rangeContaining(C value) { + public @Nullable Range rangeContaining(C value) { checkNotNull(value); Entry, Range> floorEntry = rangesByLowerBound.floorEntry(Cut.belowValue(value)); if (floorEntry != null && floorEntry.getValue().contains(value)) { @@ -153,8 +152,7 @@ public boolean encloses(Range range) { return floorEntry != null && floorEntry.getValue().encloses(range); } - @Nullable - private Range rangeEnclosing(Range range) { + private @Nullable Range rangeEnclosing(Range range) { checkNotNull(range); Entry, Range> floorEntry = rangesByLowerBound.floorEntry(range.lowerBound); return (floorEntry != null && floorEntry.getValue().encloses(range)) @@ -625,8 +623,7 @@ public int size() { } @Override - @Nullable - public Range get(Object key) { + public @Nullable Range get(Object key) { if (key instanceof Cut) { try { @SuppressWarnings("unchecked") @@ -743,8 +740,7 @@ public boolean containsKey(@Nullable Object key) { } @Override - @Nullable - public Range get(@Nullable Object key) { + public @Nullable Range get(@Nullable Object key) { if (key instanceof Cut) { try { @SuppressWarnings("unchecked") // we catch CCE's @@ -881,8 +877,7 @@ public boolean encloses(Range range) { } @Override - @Nullable - public Range rangeContaining(C value) { + public @Nullable Range rangeContaining(C value) { if (!restriction.contains(value)) { return null; } diff --git a/guava/src/com/google/common/graph/AbstractNetwork.java b/guava/src/com/google/common/graph/AbstractNetwork.java index 085a60006ff7..fd11ec26dc4f 100644 --- a/guava/src/com/google/common/graph/AbstractNetwork.java +++ b/guava/src/com/google/common/graph/AbstractNetwork.java @@ -192,8 +192,7 @@ public Optional edgeConnecting(N nodeU, N nodeV) { } @Override - @Nullable - public E edgeConnectingOrNull(N nodeU, N nodeV) { + public @Nullable E edgeConnectingOrNull(N nodeU, N nodeV) { return edgeConnecting(nodeU, nodeV).orElse(null); } diff --git a/guava/src/com/google/common/graph/ConfigurableValueGraph.java b/guava/src/com/google/common/graph/ConfigurableValueGraph.java index 25f5e49f0569..c8120a080c05 100644 --- a/guava/src/com/google/common/graph/ConfigurableValueGraph.java +++ b/guava/src/com/google/common/graph/ConfigurableValueGraph.java @@ -123,8 +123,7 @@ public boolean hasEdgeConnecting(N nodeU, N nodeV) { } @Override - @Nullable - public V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) { + public @Nullable V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) { checkNotNull(nodeU); checkNotNull(nodeV); GraphConnections connectionsU = nodeConnections.get(nodeU); diff --git a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java index 583c6139c867..4a560aefbd1f 100644 --- a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java @@ -139,8 +139,7 @@ public void addOutEdge(E edge, N node) { } } - @Nullable - private static T getReference(@Nullable Reference reference) { + private static @Nullable T getReference(@Nullable Reference reference) { return (reference == null) ? null : reference.get(); } } diff --git a/guava/src/com/google/common/graph/EdgesConnecting.java b/guava/src/com/google/common/graph/EdgesConnecting.java index bfdbd011b3a5..1c4673544238 100644 --- a/guava/src/com/google/common/graph/EdgesConnecting.java +++ b/guava/src/com/google/common/graph/EdgesConnecting.java @@ -63,8 +63,7 @@ public boolean contains(@Nullable Object edge) { return (connectingEdge != null && connectingEdge.equals(edge)); } - @Nullable - private E getConnectingEdge() { + private @Nullable E getConnectingEdge() { return nodeToOutEdge.get(targetNode); } } diff --git a/guava/src/com/google/common/graph/ElementOrder.java b/guava/src/com/google/common/graph/ElementOrder.java index cf8f932bd587..54fe18674b90 100644 --- a/guava/src/com/google/common/graph/ElementOrder.java +++ b/guava/src/com/google/common/graph/ElementOrder.java @@ -50,8 +50,7 @@ public final class ElementOrder { private final Type type; @SuppressWarnings("Immutable") // Hopefully the comparator provided is immutable! - @Nullable - private final Comparator comparator; + private final @Nullable Comparator comparator; /** * The type of ordering that this object specifies. diff --git a/guava/src/com/google/common/graph/ForwardingValueGraph.java b/guava/src/com/google/common/graph/ForwardingValueGraph.java index f998023a8d49..6f16282502ef 100644 --- a/guava/src/com/google/common/graph/ForwardingValueGraph.java +++ b/guava/src/com/google/common/graph/ForwardingValueGraph.java @@ -101,8 +101,7 @@ public Optional edgeValue(N nodeU, N nodeV) { } @Override - @Nullable - public V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) { + public @Nullable V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) { return delegate().edgeValueOrDefault(nodeU, nodeV, defaultValue); } } diff --git a/guava/src/com/google/common/graph/Graphs.java b/guava/src/com/google/common/graph/Graphs.java index 69e9c7f20646..aea23ad45bfa 100644 --- a/guava/src/com/google/common/graph/Graphs.java +++ b/guava/src/com/google/common/graph/Graphs.java @@ -344,8 +344,7 @@ public Optional edgeValue(N nodeU, N nodeV) { } @Override - @Nullable - public V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) { + public @Nullable V edgeValueOrDefault(N nodeU, N nodeV, @Nullable V defaultValue) { return delegate().edgeValueOrDefault(nodeV, nodeU, defaultValue); // transpose } } diff --git a/guava/src/com/google/common/graph/MapIteratorCache.java b/guava/src/com/google/common/graph/MapIteratorCache.java index 0777c402d74d..ca4b3019d2bf 100644 --- a/guava/src/com/google/common/graph/MapIteratorCache.java +++ b/guava/src/com/google/common/graph/MapIteratorCache.java @@ -47,7 +47,7 @@ class MapIteratorCache { // Per JDK: "the behavior of a map entry is undefined if the backing map has been modified after // the entry was returned by the iterator, except through the setValue operation on the map entry" // As such, this field must be cleared before every map mutation. - @Nullable private transient Entry entrySetCache; + private transient @Nullable Entry entrySetCache; MapIteratorCache(Map backingMap) { this.backingMap = checkNotNull(backingMap); diff --git a/guava/src/com/google/common/graph/MapRetrievalCache.java b/guava/src/com/google/common/graph/MapRetrievalCache.java index 625867bfc29e..ee774a598020 100644 --- a/guava/src/com/google/common/graph/MapRetrievalCache.java +++ b/guava/src/com/google/common/graph/MapRetrievalCache.java @@ -26,8 +26,8 @@ * @author James Sexton */ class MapRetrievalCache extends MapIteratorCache { - @Nullable private transient CacheEntry cacheEntry1; - @Nullable private transient CacheEntry cacheEntry2; + private transient @Nullable CacheEntry cacheEntry1; + private transient @Nullable CacheEntry cacheEntry2; MapRetrievalCache(Map backingMap) { super(backingMap); diff --git a/guava/src/com/google/common/graph/Traverser.java b/guava/src/com/google/common/graph/Traverser.java index 00331ad52a8e..745f72bbc744 100644 --- a/guava/src/com/google/common/graph/Traverser.java +++ b/guava/src/com/google/common/graph/Traverser.java @@ -471,7 +471,7 @@ NodeAndSuccessors withSuccessors(N node) { /** A simple tuple of a node and a partially iterated {@link Iterator} of its successors. */ private final class NodeAndSuccessors { - @Nullable final N node; + final @Nullable N node; final Iterator successorIterator; NodeAndSuccessors(@Nullable N node, Iterable successors) { @@ -644,7 +644,7 @@ NodeAndChildren withChildren(N node) { /** A simple tuple of a node and a partially iterated {@link Iterator} of its children. */ private final class NodeAndChildren { - @Nullable final N node; + final @Nullable N node; final Iterator childIterator; NodeAndChildren(@Nullable N node, Iterable children) { diff --git a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java index 83f4306fc580..a96a59593e39 100644 --- a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java @@ -115,8 +115,7 @@ public void addOutEdge(E edge, N node) { } } - @Nullable - private static T getReference(@Nullable Reference reference) { + private static @Nullable T getReference(@Nullable Reference reference) { return (reference == null) ? null : reference.get(); } } diff --git a/guava/src/com/google/common/io/BaseEncoding.java b/guava/src/com/google/common/io/BaseEncoding.java index 8b8d029d4232..849a90a0e4bb 100644 --- a/guava/src/com/google/common/io/BaseEncoding.java +++ b/guava/src/com/google/common/io/BaseEncoding.java @@ -567,7 +567,7 @@ static class StandardBaseEncoding extends BaseEncoding { // TODO(lowasser): provide a useful toString final Alphabet alphabet; - @Nullable final Character paddingChar; + final @Nullable Character paddingChar; StandardBaseEncoding(String name, String alphabetChars, @Nullable Character paddingChar) { this(new Alphabet(name, alphabetChars.toCharArray()), paddingChar); diff --git a/guava/src/com/google/common/io/CharSource.java b/guava/src/com/google/common/io/CharSource.java index 5213fbc398f3..ac3df0c87cc1 100644 --- a/guava/src/com/google/common/io/CharSource.java +++ b/guava/src/com/google/common/io/CharSource.java @@ -295,8 +295,7 @@ public String read() throws IOException { * * @throws IOException if an I/O error occurs while reading from this source */ - @Nullable - public String readFirstLine() throws IOException { + public @Nullable String readFirstLine() throws IOException { Closer closer = Closer.create(); try { BufferedReader reader = closer.register(openBufferedStream()); diff --git a/guava/src/com/google/common/io/FileBackedOutputStream.java b/guava/src/com/google/common/io/FileBackedOutputStream.java index 0f10a0c29a51..27e3feb5724d 100644 --- a/guava/src/com/google/common/io/FileBackedOutputStream.java +++ b/guava/src/com/google/common/io/FileBackedOutputStream.java @@ -46,7 +46,7 @@ public final class FileBackedOutputStream extends OutputStream { private OutputStream out; private MemoryOutput memory; - @Nullable private File file; + private @Nullable File file; /** ByteArrayOutputStream that exposes its internals. */ private static class MemoryOutput extends ByteArrayOutputStream { diff --git a/guava/src/com/google/common/io/LineReader.java b/guava/src/com/google/common/io/LineReader.java index c4b8e25abfc4..1ccb4d12b8b9 100644 --- a/guava/src/com/google/common/io/LineReader.java +++ b/guava/src/com/google/common/io/LineReader.java @@ -39,7 +39,7 @@ @GwtIncompatible public final class LineReader { private final Readable readable; - @Nullable private final Reader reader; + private final @Nullable Reader reader; private final CharBuffer cbuf = createBuffer(); private final char[] buf = cbuf.array(); diff --git a/guava/src/com/google/common/io/MoreFiles.java b/guava/src/com/google/common/io/MoreFiles.java index e8c87cd90c6a..e4d842d7ad20 100644 --- a/guava/src/com/google/common/io/MoreFiles.java +++ b/guava/src/com/google/common/io/MoreFiles.java @@ -611,8 +611,7 @@ public static void deleteDirectoryContents(Path path, RecursiveDeleteOption... o * Secure recursive delete using {@code SecureDirectoryStream}. Returns a collection of exceptions * that occurred or null if no exceptions were thrown. */ - @Nullable - private static Collection deleteRecursivelySecure( + private static @Nullable Collection deleteRecursivelySecure( SecureDirectoryStream dir, Path path) { Collection exceptions = null; try { @@ -640,8 +639,7 @@ private static Collection deleteRecursivelySecure( * Secure method for deleting the contents of a directory using {@code SecureDirectoryStream}. * Returns a collection of exceptions that occurred or null if no exceptions were thrown. */ - @Nullable - private static Collection deleteDirectoryContentsSecure( + private static @Nullable Collection deleteDirectoryContentsSecure( SecureDirectoryStream dir) { Collection exceptions = null; try { @@ -659,8 +657,7 @@ private static Collection deleteDirectoryContentsSecure( * Insecure recursive delete for file systems that don't support {@code SecureDirectoryStream}. * Returns a collection of exceptions that occurred or null if no exceptions were thrown. */ - @Nullable - private static Collection deleteRecursivelyInsecure(Path path) { + private static @Nullable Collection deleteRecursivelyInsecure(Path path) { Collection exceptions = null; try { if (Files.isDirectory(path, NOFOLLOW_LINKS)) { @@ -686,8 +683,7 @@ private static Collection deleteRecursivelyInsecure(Path path) { * support {@code SecureDirectoryStream}. Returns a collection of exceptions that occurred or null * if no exceptions were thrown. */ - @Nullable - private static Collection deleteDirectoryContentsInsecure( + private static @Nullable Collection deleteDirectoryContentsInsecure( DirectoryStream dir) { Collection exceptions = null; try { @@ -706,8 +702,7 @@ private static Collection deleteDirectoryContentsInsecure( * path, this is simple. Otherwise, we need to do some trickier things. Returns null if the path * is a root or is the empty path. */ - @Nullable - private static Path getParentPath(Path path) { + private static @Nullable Path getParentPath(Path path) { Path parent = path.getParent(); // Paths that have a parent: @@ -766,8 +761,7 @@ private static Collection addException( * null, the other collection is returned. Otherwise, the elements of {@code other} are added to * {@code exceptions} and {@code exceptions} is returned. */ - @Nullable - private static Collection concat( + private static @Nullable Collection concat( @Nullable Collection exceptions, @Nullable Collection other) { if (exceptions == null) { return other; diff --git a/guava/src/com/google/common/io/MultiInputStream.java b/guava/src/com/google/common/io/MultiInputStream.java index d1ec9095ccb8..71a97d37d401 100644 --- a/guava/src/com/google/common/io/MultiInputStream.java +++ b/guava/src/com/google/common/io/MultiInputStream.java @@ -33,7 +33,7 @@ final class MultiInputStream extends InputStream { private Iterator it; - @Nullable private InputStream in; + private @Nullable InputStream in; /** * Creates a new instance. diff --git a/guava/src/com/google/common/io/MultiReader.java b/guava/src/com/google/common/io/MultiReader.java index 0c2aee068469..135f32e4a097 100644 --- a/guava/src/com/google/common/io/MultiReader.java +++ b/guava/src/com/google/common/io/MultiReader.java @@ -30,7 +30,7 @@ @GwtIncompatible class MultiReader extends Reader { private final Iterator it; - @Nullable private Reader current; + private @Nullable Reader current; MultiReader(Iterator readers) throws IOException { this.it = readers; diff --git a/guava/src/com/google/common/primitives/Doubles.java b/guava/src/com/google/common/primitives/Doubles.java index 7df81fe7ff1f..a5d5922de082 100644 --- a/guava/src/com/google/common/primitives/Doubles.java +++ b/guava/src/com/google/common/primitives/Doubles.java @@ -682,9 +682,8 @@ private static Pattern fpPattern() { * @since 14.0 */ @Beta - @Nullable @GwtIncompatible // regular expressions - public static Double tryParse(String string) { + public static @Nullable Double tryParse(String string) { if (FLOATING_POINT_PATTERN.matcher(string).matches()) { // TODO(lowasser): could be potentially optimized, but only with // extensive testing diff --git a/guava/src/com/google/common/primitives/Floats.java b/guava/src/com/google/common/primitives/Floats.java index 701b5767613f..826dede629a6 100644 --- a/guava/src/com/google/common/primitives/Floats.java +++ b/guava/src/com/google/common/primitives/Floats.java @@ -649,9 +649,8 @@ float[] toFloatArray() { * @since 14.0 */ @Beta - @Nullable @GwtIncompatible // regular expressions - public static Float tryParse(String string) { + public static @Nullable Float tryParse(String string) { if (Doubles.FLOATING_POINT_PATTERN.matcher(string).matches()) { // TODO(lowasser): could be potentially optimized, but only with // extensive testing diff --git a/guava/src/com/google/common/primitives/Ints.java b/guava/src/com/google/common/primitives/Ints.java index 2b4ced08d87a..ae4111aa0674 100644 --- a/guava/src/com/google/common/primitives/Ints.java +++ b/guava/src/com/google/common/primitives/Ints.java @@ -707,8 +707,7 @@ int[] toIntArray() { * @since 11.0 */ @Beta - @Nullable - public static Integer tryParse(String string) { + public static @Nullable Integer tryParse(String string) { return tryParse(string, 10); } @@ -732,8 +731,7 @@ public static Integer tryParse(String string) { * @since 19.0 */ @Beta - @Nullable - public static Integer tryParse(String string, int radix) { + public static @Nullable Integer tryParse(String string, int radix) { Long result = Longs.tryParse(string, radix); if (result == null || result.longValue() != result.intValue()) { return null; diff --git a/guava/src/com/google/common/primitives/Longs.java b/guava/src/com/google/common/primitives/Longs.java index 5e0ce239c28e..830543fa1283 100644 --- a/guava/src/com/google/common/primitives/Longs.java +++ b/guava/src/com/google/common/primitives/Longs.java @@ -362,8 +362,7 @@ static int digit(char c) { * @since 14.0 */ @Beta - @Nullable - public static Long tryParse(String string) { + public static @Nullable Long tryParse(String string) { return tryParse(string, 10); } @@ -387,8 +386,7 @@ public static Long tryParse(String string) { * @since 19.0 */ @Beta - @Nullable - public static Long tryParse(String string, int radix) { + public static @Nullable Long tryParse(String string, int radix) { if (checkNotNull(string).isEmpty()) { return null; } diff --git a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java index 90c00d9e1d9e..c7fe512a59bd 100644 --- a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java @@ -41,29 +41,25 @@ public final class MutableTypeToInstanceMap extends ForwardingMap, B> backingMap = Maps.newHashMap(); - @Nullable @Override - public T getInstance(Class type) { + public @Nullable T getInstance(Class type) { return trustedGet(TypeToken.of(type)); } - @Nullable @Override - public T getInstance(TypeToken type) { + public @Nullable T getInstance(TypeToken type) { return trustedGet(type.rejectTypeVariables()); } - @Nullable @Override @CanIgnoreReturnValue - public T putInstance(Class type, @Nullable T value) { + public @Nullable T putInstance(Class type, @Nullable T value) { return trustedPut(TypeToken.of(type), value); } - @Nullable @Override @CanIgnoreReturnValue - public T putInstance(TypeToken type, @Nullable T value) { + public @Nullable T putInstance(TypeToken type, @Nullable T value) { return trustedPut(type.rejectTypeVariables(), value); } @@ -103,14 +99,12 @@ protected Map, B> delegate() { } @SuppressWarnings("unchecked") // value could not get in if not a T - @Nullable - private T trustedPut(TypeToken type, @Nullable T value) { + private @Nullable T trustedPut(TypeToken type, @Nullable T value) { return (T) backingMap.put(type, value); } @SuppressWarnings("unchecked") // value could not get in if not a T - @Nullable - private T trustedGet(TypeToken type) { + private @Nullable T trustedGet(TypeToken type) { return (T) backingMap.get(type); } diff --git a/guava/src/com/google/common/reflect/Parameter.java b/guava/src/com/google/common/reflect/Parameter.java index 313449608093..7dafd46d8a21 100644 --- a/guava/src/com/google/common/reflect/Parameter.java +++ b/guava/src/com/google/common/reflect/Parameter.java @@ -68,8 +68,7 @@ public boolean isAnnotationPresent(Class annotationType) { } @Override - @Nullable - public A getAnnotation(Class annotationType) { + public @Nullable A getAnnotation(Class annotationType) { checkNotNull(annotationType); for (Annotation annotation : annotations) { if (annotationType.isInstance(annotation)) { @@ -99,8 +98,7 @@ public Annotation[] getDeclaredAnnotations() { /** @since 18.0 */ // @Override on JDK8 - @Nullable - public A getDeclaredAnnotation(Class annotationType) { + public @Nullable A getDeclaredAnnotation(Class annotationType) { checkNotNull(annotationType); return FluentIterable.from(annotations).filter(annotationType).first().orNull(); } diff --git a/guava/src/com/google/common/reflect/TypeToInstanceMap.java b/guava/src/com/google/common/reflect/TypeToInstanceMap.java index 667c326b8f84..d4097c61ef65 100644 --- a/guava/src/com/google/common/reflect/TypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/TypeToInstanceMap.java @@ -49,16 +49,14 @@ public interface TypeToInstanceMap extends Map, B> { *

{@code getInstance(Foo.class)} is equivalent to {@code * getInstance(TypeToken.of(Foo.class))}. */ - @Nullable - T getInstance(Class type); + @Nullable T getInstance(Class type); /** * Returns the value the specified type is mapped to, or {@code null} if no entry for this type is * present. This will only return a value that was bound to this specific type, not a value that * may have been bound to a subtype. */ - @Nullable - T getInstance(TypeToken type); + @Nullable T getInstance(TypeToken type); /** * Maps the specified class to the specified value. Does not associate this value with any @@ -70,9 +68,8 @@ public interface TypeToInstanceMap extends Map, B> { * @return the value previously associated with this class (possibly {@code null}), or {@code * null} if there was no previous entry. */ - @Nullable @CanIgnoreReturnValue - T putInstance(Class type, @Nullable T value); + @Nullable T putInstance(Class type, @Nullable T value); /** * Maps the specified type to the specified value. Does not associate this value with any @@ -81,7 +78,6 @@ public interface TypeToInstanceMap extends Map, B> { * @return the value previously associated with this type (possibly {@code null}), or {@code null} * if there was no previous entry. */ - @Nullable @CanIgnoreReturnValue - T putInstance(TypeToken type, @Nullable T value); + @Nullable T putInstance(TypeToken type, @Nullable T value); } diff --git a/guava/src/com/google/common/reflect/TypeToken.java b/guava/src/com/google/common/reflect/TypeToken.java index fecf435597c5..8776b75eb189 100644 --- a/guava/src/com/google/common/reflect/TypeToken.java +++ b/guava/src/com/google/common/reflect/TypeToken.java @@ -289,8 +289,7 @@ private TypeToken resolveSupertype(Type type) { * if the bound is a class or extends from a class. This means that the returned type could be a * type variable too. */ - @Nullable - final TypeToken getGenericSuperclass() { + final @Nullable TypeToken getGenericSuperclass() { if (runtimeType instanceof TypeVariable) { // First bound is always the super class, if one exists. return boundAsSuperclass(((TypeVariable) runtimeType).getBounds()[0]); @@ -308,8 +307,7 @@ final TypeToken getGenericSuperclass() { return superToken; } - @Nullable - private TypeToken boundAsSuperclass(Type bound) { + private @Nullable TypeToken boundAsSuperclass(Type bound) { TypeToken token = of(bound); if (token.getRawType().isInterface()) { return null; @@ -561,8 +559,7 @@ public final TypeToken unwrap() { * Returns the array component type if this type represents an array ({@code int[]}, {@code T[]}, * {@code []>} etc.), or else {@code null} is returned. */ - @Nullable - public final TypeToken getComponentType() { + public final @Nullable TypeToken getComponentType() { Type componentType = Types.getComponentType(runtimeType); if (componentType == null) { return null; @@ -1133,8 +1130,7 @@ private boolean isOwnedBySubtypeOf(Type supertype) { * Returns the owner type of a {@link ParameterizedType} or enclosing class of a {@link Class}, or * null otherwise. */ - @Nullable - private Type getOwnerTypeIfPresent() { + private @Nullable Type getOwnerTypeIfPresent() { if (runtimeType instanceof ParameterizedType) { return ((ParameterizedType) runtimeType).getOwnerType(); } else if (runtimeType instanceof Class) { @@ -1310,8 +1306,8 @@ Iterable> getInterfaces(TypeToken type) { return type.getGenericInterfaces(); } - @Nullable @Override + @Nullable TypeToken getSuperclass(TypeToken type) { return type.getGenericSuperclass(); } @@ -1329,8 +1325,8 @@ Iterable> getInterfaces(Class type) { return Arrays.asList(type.getInterfaces()); } - @Nullable @Override + @Nullable Class getSuperclass(Class type) { return type.getSuperclass(); } @@ -1412,8 +1408,7 @@ public int compare(K left, K right) { abstract Iterable getInterfaces(K type); - @Nullable - abstract K getSuperclass(K type); + abstract @Nullable K getSuperclass(K type); private static class ForwardingTypeCollector extends TypeCollector { diff --git a/guava/src/com/google/common/reflect/Types.java b/guava/src/com/google/common/reflect/Types.java index 9ebe797e8748..5babaa06dd2d 100644 --- a/guava/src/com/google/common/reflect/Types.java +++ b/guava/src/com/google/common/reflect/Types.java @@ -105,15 +105,15 @@ static ParameterizedType newParameterizedType(Class rawType, Type... argument /** Decides what owner type to use for constructing {@link ParameterizedType} from a raw class. */ private enum ClassOwnership { OWNED_BY_ENCLOSING_CLASS { - @Nullable @Override + @Nullable Class getOwnerType(Class rawType) { return rawType.getEnclosingClass(); } }, LOCAL_CLASS_HAS_NO_OWNER { - @Nullable @Override + @Nullable Class getOwnerType(Class rawType) { if (rawType.isLocalClass()) { return null; @@ -123,8 +123,7 @@ Class getOwnerType(Class rawType) { } }; - @Nullable - abstract Class getOwnerType(Class rawType); + abstract @Nullable Class getOwnerType(Class rawType); static final ClassOwnership JVM_BEHAVIOR = detectJvmBehavior(); @@ -172,8 +171,7 @@ static String toString(Type type) { return (type instanceof Class) ? ((Class) type).getName() : type.toString(); } - @Nullable - static Type getComponentType(Type type) { + static @Nullable Type getComponentType(Type type) { checkNotNull(type); final AtomicReference result = new AtomicReference<>(); new TypeVisitor() { @@ -204,8 +202,7 @@ void visitClass(Class t) { * Returns {@code ? extends X} if any of {@code bounds} is a subtype of {@code X[]}; or null * otherwise. */ - @Nullable - private static Type subtypeOfComponentType(Type[] bounds) { + private static @Nullable Type subtypeOfComponentType(Type[] bounds) { for (Type bound : bounds) { Type componentType = getComponentType(bound); if (componentType != null) { @@ -260,7 +257,7 @@ public boolean equals(Object obj) { private static final class ParameterizedTypeImpl implements ParameterizedType, Serializable { - @Nullable private final Type ownerType; + private final @Nullable Type ownerType; private final ImmutableList argumentsList; private final Class rawType; diff --git a/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java b/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java index eb99d37c50a7..c5c979a8c1a4 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java @@ -141,8 +141,7 @@ protected String pendingToString() { /** Template method for subtypes to actually run the fallback. */ @ForOverride - @Nullable - abstract T doFallback(F fallback, X throwable) throws Exception; + abstract @Nullable T doFallback(F fallback, X throwable) throws Exception; /** Template method for subtypes to actually set the result. */ @ForOverride diff --git a/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/guava/src/com/google/common/util/concurrent/AbstractFuture.java index 5dd45120ed45..83dc58fe0f07 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractFuture.java @@ -170,8 +170,8 @@ public final boolean cancel(boolean mayInterruptIfRunning) { private static final class Waiter { static final Waiter TOMBSTONE = new Waiter(false /* ignored param */); - @Nullable volatile Thread thread; - @Nullable volatile Waiter next; + volatile @Nullable Thread thread; + volatile @Nullable Waiter next; /** * Constructor for the TOMBSTONE, avoids use of ATOMIC_HELPER in case this class is loaded @@ -293,7 +293,7 @@ private static final class Cancellation { } final boolean wasInterrupted; - @Nullable final Throwable cause; + final @Nullable Throwable cause; Cancellation(boolean wasInterrupted, @Nullable Throwable cause) { this.wasInterrupted = wasInterrupted; @@ -341,13 +341,13 @@ public void run() { * argument. * */ - @Nullable private volatile Object value; + private volatile @Nullable Object value; /** All listeners. */ - @Nullable private volatile Listener listeners; + private volatile @Nullable Listener listeners; /** All waiting threads. */ - @Nullable private volatile Waiter waiters; + private volatile @Nullable Waiter waiters; /** Constructor for use by subclasses. */ protected AbstractFuture() {} @@ -978,8 +978,7 @@ public String toString() { * @return null if an explanation cannot be provided because the future is done. * @since 23.0 */ - @Nullable - protected String pendingToString() { + protected @Nullable String pendingToString() { Object localValue = value; if (localValue instanceof SetFuture) { return "setFuture=[" + userObjectToString(((SetFuture) localValue).future) + "]"; diff --git a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java index 82cac8e50c11..492de8db466a 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java @@ -466,8 +466,7 @@ private class ReschedulableCallable extends ForwardingFuture implements Ca /** The future that represents the next execution of this task. */ @GuardedBy("lock") - @Nullable - private Future currentFuture; + private @Nullable Future currentFuture; ReschedulableCallable( AbstractService service, ScheduledExecutorService executor, Runnable runnable) { diff --git a/guava/src/com/google/common/util/concurrent/AbstractService.java b/guava/src/com/google/common/util/concurrent/AbstractService.java index 375a677ae082..f08a994d0b4d 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractService.java @@ -551,7 +551,7 @@ private static final class StateSnapshot { * The exception that caused this service to fail. This will be {@code null} unless the service * has failed. */ - @Nullable final Throwable failure; + final @Nullable Throwable failure; StateSnapshot(State internalState) { this(internalState, false, null); diff --git a/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java b/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java index a4fbc504bd22..e6691500d7f8 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java @@ -162,8 +162,7 @@ public final void run() { /** Template method for subtypes to actually run the transform. */ @ForOverride - @Nullable - abstract T doTransform(F function, @Nullable I result) throws Exception; + abstract @Nullable T doTransform(F function, @Nullable I result) throws Exception; /** Template method for subtypes to actually set the result. */ @ForOverride diff --git a/guava/src/com/google/common/util/concurrent/AggregateFuture.java b/guava/src/com/google/common/util/concurrent/AggregateFuture.java index b514de84ec26..b6dd425d6251 100644 --- a/guava/src/com/google/common/util/concurrent/AggregateFuture.java +++ b/guava/src/com/google/common/util/concurrent/AggregateFuture.java @@ -44,7 +44,7 @@ abstract class AggregateFuture extends AbstractFuture.TrustedFu * In certain circumstances, this field might theoretically not be visible to an afterDone() call * triggered by cancel(). For details, see the comments on the fields of TimeoutFuture. */ - @Nullable private RunningState runningState; + private @Nullable RunningState runningState; @Override protected final void afterDone() { diff --git a/guava/src/com/google/common/util/concurrent/Callables.java b/guava/src/com/google/common/util/concurrent/Callables.java index 505a9abc0250..e470afa1ab54 100644 --- a/guava/src/com/google/common/util/concurrent/Callables.java +++ b/guava/src/com/google/common/util/concurrent/Callables.java @@ -34,7 +34,7 @@ public final class Callables { private Callables() {} /** Creates a {@code Callable} which immediately returns a preset value each time it is called. */ - public static Callable returning(@Nullable final T value) { + public static Callable returning(final @Nullable T value) { return new Callable() { @Override public T call() { diff --git a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java index 3802715cbcf9..67d247867166 100644 --- a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java +++ b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java @@ -674,8 +674,7 @@ void checkAcquiredLock(Policy policy, LockGraphNode acquiredLock) { * @return If a path was found, a chained {@link ExampleStackTrace} illustrating the path to the * {@code lock}, or {@code null} if no path was found. */ - @Nullable - private ExampleStackTrace findPathTo(LockGraphNode node, Set seen) { + private @Nullable ExampleStackTrace findPathTo(LockGraphNode node, Set seen) { if (!seen.add(this)) { return null; // Already traversed this node. } diff --git a/guava/src/com/google/common/util/concurrent/ExecutionList.java b/guava/src/com/google/common/util/concurrent/ExecutionList.java index f813a637417c..1ff609b78c98 100644 --- a/guava/src/com/google/common/util/concurrent/ExecutionList.java +++ b/guava/src/com/google/common/util/concurrent/ExecutionList.java @@ -49,8 +49,7 @@ public final class ExecutionList { * RunnableExecutorPair#next} field. */ @GuardedBy("this") - @Nullable - private RunnableExecutorPair runnables; + private @Nullable RunnableExecutorPair runnables; @GuardedBy("this") private boolean executed; diff --git a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java index 33fc7316e35c..fce85469a61c 100644 --- a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java +++ b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java @@ -257,8 +257,7 @@ public Boolean apply(Constructor input) { }) .reverse(); - @Nullable - private static X newFromConstructor(Constructor constructor, Throwable cause) { + private static @Nullable X newFromConstructor(Constructor constructor, Throwable cause) { Class[] paramTypes = constructor.getParameterTypes(); Object[] params = new Object[paramTypes.length]; for (int i = 0; i < paramTypes.length; i++) { diff --git a/guava/src/com/google/common/util/concurrent/ImmediateFuture.java b/guava/src/com/google/common/util/concurrent/ImmediateFuture.java index 590360e5478c..dce2f7e3a7c3 100644 --- a/guava/src/com/google/common/util/concurrent/ImmediateFuture.java +++ b/guava/src/com/google/common/util/concurrent/ImmediateFuture.java @@ -73,7 +73,7 @@ public boolean isDone() { static class ImmediateSuccessfulFuture extends ImmediateFuture { static final ImmediateSuccessfulFuture NULL = new ImmediateSuccessfulFuture<>(null); - @Nullable private final V value; + private final @Nullable V value; ImmediateSuccessfulFuture(@Nullable V value) { this.value = value; @@ -95,7 +95,7 @@ public String toString() { @GwtIncompatible // TODO static class ImmediateSuccessfulCheckedFuture extends ImmediateFuture implements CheckedFuture { - @Nullable private final V value; + private final @Nullable V value; ImmediateSuccessfulCheckedFuture(@Nullable V value) { this.value = value; diff --git a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java index be23be9de78a..8c6189a29ae2 100644 --- a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java +++ b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java @@ -70,8 +70,8 @@ static ListenableFuture create( * write-barriers). */ - @Nullable private ListenableFuture delegateRef; - @Nullable private Future timer; + private @Nullable ListenableFuture delegateRef; + private @Nullable Future timer; private TimeoutFuture(ListenableFuture delegate) { this.delegateRef = Preconditions.checkNotNull(delegate);