diff --git a/android/guava-testlib/pom.xml b/android/guava-testlib/pom.xml index 1963a08fcc65..0ea97ee3a89e 100644 --- a/android/guava-testlib/pom.xml +++ b/android/guava-testlib/pom.xml @@ -14,6 +14,10 @@ unit testing - particularly to assist the tests for Guava itself. + + org.jspecify + jspecify + com.google.code.findbugs jsr305 diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java index f281cd83414b..33a3a83746b8 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -32,7 +33,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractCollectionTester extends AbstractContainerTester, E> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java index 56163a6f6740..92e6f5a1ec94 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractContainerTester extends AbstractTester> { protected SampleElements samples; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java index 36ea3614d5d0..417e67dc2c2e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java @@ -34,6 +34,7 @@ import java.util.NoSuchElementException; import java.util.Set; import java.util.Stack; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractIteratorTester> { private Stimulus[] stimuli; private final Iterator elementsToInsert; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java index f85b01fbbc7e..fc8cbdd9c545 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java @@ -26,6 +26,7 @@ import java.util.ListIterator; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -43,7 +44,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMapTester extends AbstractContainerTester, Entry> { protected Map getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java index 5ffe110e7dbe..4ae6fc9f87a6 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author George van den Driessche */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractTester extends TestCase { private G subjectGenerator; private String suiteName; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java index 6312a67bc66a..b13345794c57 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java @@ -33,6 +33,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class DerivedCollectionGenerators { public static class MapEntrySetGenerator implements TestSetGenerator>, DerivedGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/ElementTypesAreNonnullByDefault.java b/android/guava-testlib/src/com/google/common/collect/testing/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 80379ccb8c69..000000000000 --- a/android/guava-testlib/src/com/google/common/collect/testing/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.common.collect.testing; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import com.google.common.annotations.GwtCompatible; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierDefault; - -/** - * Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this - * unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to - * "undo" it as best we can. - */ -@GwtCompatible -@Retention(RUNTIME) -@Target(TYPE) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java index a9e7ac04d84a..360793345a0a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java @@ -44,10 +44,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class Helpers { // Clone of Objects.equal static boolean equal(@Nullable Object a, @Nullable Object b) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java b/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java index 7bc6548bcab2..ac9e70cac1dc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java index 01409884607a..fcd39baeac99 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collections; import java.util.Iterator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -85,7 +86,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class IteratorTester extends AbstractIteratorTester> { /** diff --git a/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java index a781d0ab0266..3a9404e66772 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class ListIteratorTester extends AbstractIteratorTester> { protected ListIteratorTester( diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java b/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java index 8c3fdeadccb1..38864047f9e8 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java @@ -33,6 +33,7 @@ import java.util.Map.Entry; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -48,7 +49,7 @@ // check the order if so. // TODO: Refactor to share code with SetTestBuilder etc. @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class MapInterfaceTest extends TestCase { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java b/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java index 67b7cdb485e4..d09b8afc4f03 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.Iterator; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MinimalCollection extends AbstractCollection { // TODO: expose allow nulls parameter? diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java b/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java index 971e69a2436b..b78a5ce21597 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Set; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MinimalSet extends MinimalCollection implements Set { @SuppressWarnings("unchecked") // empty Object[] as E[] diff --git a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java index faeee278d0d9..7625463adf75 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class OneSizeGenerator implements OneSizeTestContainerGenerator { private final TestContainerGenerator generator; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java index 9cb5a87e79e6..72fbf0224eac 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.features.CollectionSize; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface OneSizeTestContainerGenerator extends TestSubjectGenerator, TestContainerGenerator { TestContainerGenerator getInnerGenerator(); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java b/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java index 9f32428f8732..6e0431b1319e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java b/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java index e1606a19d977..153d68467712 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SampleElements implements Iterable { // TODO: rename e3, e4 => missing1, missing2 private final E e0; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java index 8f04c980bac4..45804ef22a7d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java @@ -42,6 +42,7 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -50,7 +51,7 @@ * @since 33.4.0 (but since 21.0 in the JRE flavor) */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("Java7ApiChecker") @IgnoreJRERequirement // Users will use this only if they're already using Spliterator. public final class SpliteratorTester { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java index 07b465bb889a..acf6ec52e5ab 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Chars; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Generates {@code List} instances for test suites. @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestCharacterListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java index 63c35be86abc..5f336be4ce95 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,6 +27,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestCollectionGenerator extends TestContainerGenerator, E> {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java index b26a6a5832f9..836f4bf971e7 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Colliders; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * A generator using sample elements whose hash codes all collide badly. @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestCollidingSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java index c6792bfdf519..08d2e31f43a5 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java @@ -20,6 +20,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestContainerGenerator { /** Returns the sample elements that this generate populates its container with. */ SampleElements samples(); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java index b4b97c601339..a6f1c610faf1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with enum maps. @@ -30,7 +31,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumMapGenerator implements TestMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java index 307fc1533fab..2ddd283db418 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.SampleElements.Enums; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * An abstract TestSetGenerator for generating sets containing enum values. @@ -29,7 +30,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java index 633329c1e626..b8e8b595d846 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Ints; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Create integer sets for collection tests. @@ -27,7 +28,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestIntegerSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java index 73b44b616f1d..576e870c3ebe 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Create integer sets for testing collections that are sorted by natural ordering. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestIntegerSortedSetGenerator extends TestIntegerSetGenerator { @Override protected abstract SortedSet create(Integer[] elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java index 34117f898874..886bb105bb74 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestListGenerator extends TestCollectionGenerator { @Override List create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java index 57376d4987e1..eb62f12b5d8c 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Jesse Wilson */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestMapEntrySetGenerator< K extends @Nullable Object, V extends @Nullable Object> implements TestSetGenerator> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java index efc85fc5563b..86b79469b1f1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMapGenerator extends TestContainerGenerator, Map.Entry> { K[] createKeyArray(int length); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java index c5b093b1880d..e0aebf66919d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Queue; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestQueueGenerator extends TestCollectionGenerator { @Override Queue create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java index 2ed582aa7a36..83fd9075de46 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSetGenerator extends TestCollectionGenerator { @Override Set create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java index 107a8e76cea7..ae462fe31f00 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSortedMapGenerator extends TestMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java index 10abd8b4d171..dc9e94222006 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSortedSetGenerator extends TestSetGenerator { @Override SortedSet create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java index 081e9eaddd26..c637c223dafc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * String creation for testing arbitrary collections. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringCollectionGenerator implements TestCollectionGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java index fe1de2eb2450..9b2bddec9305 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * TODO: javadoc. @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java index 0900629a55c8..2edf70fff26d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with maps of strings. @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringMapGenerator implements TestMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java index 1102c3456bd0..1d2d3f4af55a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; import java.util.Queue; +import org.jspecify.annotations.NullMarked; /** * Create queue of strings for tests. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringQueueGenerator implements TestQueueGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java index 2949e4aca819..d8a517f6c991 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Create string sets for collection tests. @@ -27,7 +28,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java index 8a8f758290d6..7f2738c2236f 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with sorted maps of strings. @@ -30,7 +31,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSortedMapGenerator extends TestStringMapGenerator implements TestSortedMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java index e83dd74ac1c5..d83fc9d4ab73 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Create string sets for testing collections that are sorted by natural ordering. @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSortedSetGenerator extends TestStringSetGenerator implements TestSortedSetGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java index 431e7e8103d7..978fa683d8c8 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java @@ -17,6 +17,7 @@ package com.google.common.collect.testing; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSubjectGenerator { T createTestSubject(); } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java index d4d772b81e1d..94719ef52a0a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Unhashables; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Creates collections containing unhashable sample elements, to be tested. @@ -27,7 +28,7 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestUnhashableCollectionGenerator> implements TestCollectionGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java index 99d4aa4c7039..553fbb8f5423 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -34,7 +35,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractBiMapTester extends AbstractMapTester { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java index 32749e4e21a3..5134c913e0e0 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ListMultimap; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -32,7 +33,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractListMultimapTester extends AbstractMultimapTester> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java index a48e4940662f..5ffeefccbfb1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java @@ -28,6 +28,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMultimapTester< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends AbstractContainerTester> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java index bacd16155b88..634a1a424c03 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java @@ -25,6 +25,7 @@ import com.google.common.collect.Maps; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Generators of various {@link com.google.common.collect.BiMap}s and derived collections. @@ -33,7 +34,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class BiMapGenerators { public static class ImmutableBiMapGenerator extends TestStringBiMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java index 3dbb5cd9e89c..11eb5d910ca1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -42,7 +43,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class DerivedGoogleCollectionGenerators { public static class MapGenerator implements TestMapGenerator, DerivedGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/ElementTypesAreNonnullByDefault.java b/android/guava-testlib/src/com/google/common/collect/testing/google/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index c666efdcbff8..000000000000 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.common.collect.testing.google; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import com.google.common.annotations.GwtCompatible; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierDefault; - -/** - * Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this - * unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to - * "undo" it as best we can. - */ -@GwtCompatible -@Retention(RUNTIME) -@Target(TYPE) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java index e5dd65c4b6d1..fe7229ff8159 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java @@ -30,6 +30,7 @@ import com.google.common.primitives.Chars; import java.util.Collections; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Common generators of different types of lists. @@ -37,7 +38,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ListGenerators { private ListGenerators() {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java index 12e31fbd383b..afea133492f0 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -47,7 +48,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ListMultimapAsMapTester extends AbstractListMultimapTester { public void testAsMapValuesImplementList() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java index c42680043e7d..4be8dc317908 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Generators of different types of map and related collections, such as keys, entries and values. @@ -47,7 +48,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapGenerators { public static class ImmutableMapGenerator extends TestStringMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java index a5d80d9d9de5..95fd02dd767c 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -39,7 +40,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapEqualsTester extends AbstractMultimapTester> { public void testEqualsTrue() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java index 0d04d181123d..6cf7607f2fa9 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java @@ -37,6 +37,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -49,7 +50,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapPutTester extends AbstractMultimapTester> { @MapFeature.Require(absent = SUPPORTS_PUT) diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java index b3bc461a932c..950290116e84 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java @@ -28,6 +28,7 @@ import com.google.common.collect.testing.features.MapFeature; import java.util.Collection; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapSizeTester extends AbstractMultimapTester> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java index 50c3d367c59a..970d5139ffac 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java @@ -29,6 +29,7 @@ import java.lang.reflect.Method; import java.util.Iterator; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetIteratorTester extends AbstractMultisetTester { @CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, KNOWN_ORDER}) public void testRemovingIteratorKnownOrder() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java b/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java index a9704ce4739b..a4a37259a178 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java index 908b733338be..137a3bc432ed 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java @@ -53,6 +53,7 @@ import java.util.List; import java.util.Set; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Generators of different types of sets and derived collections from sets. @@ -62,7 +63,7 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetGenerators { public static class ImmutableSetCopyOfGenerator extends TestStringSetGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java index 456d566a0bfd..961dc4f24f56 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -47,7 +48,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class SetMultimapAsMapTester extends AbstractMultimapTester> { public void testAsMapValuesImplementSet() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java index 49b73296018c..d82fd9ab6bd0 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Generators of sorted maps and derived collections. @@ -42,7 +43,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedMapGenerators { public static class ImmutableSortedMapGenerator extends TestStringSortedMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java index 5194e50c603a..4f6edeb87e2c 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.testing.TestContainerGenerator; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -28,7 +29,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestBiMapGenerator extends TestContainerGenerator, Entry> { K[] createKeyArray(int length); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java index 96e56e38b6ae..7c699cce29dd 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java @@ -24,6 +24,7 @@ import com.google.common.collect.testing.SampleElements; import com.google.common.collect.testing.SampleElements.Enums; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * An abstract {@code TestMultisetGenerator} for generating multisets containing enum values. @@ -31,7 +32,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java index 6a71573f11b6..35df19804775 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ListMultimap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,6 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestListMultimapGenerator extends TestMultimapGenerator> {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java index 79c6874bffbb..8f473def24ba 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.TestContainerGenerator; import java.util.Collection; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMultimapGenerator< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends TestContainerGenerator> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java index 272313253dea..63a02bf0561b 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Multiset; import com.google.common.collect.testing.TestCollectionGenerator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMultisetGenerator extends TestCollectionGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java index 1f59dd0beecb..ee56438dac48 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java @@ -23,6 +23,7 @@ import com.google.common.collect.testing.SampleElements; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestBiMapGenerator} for use with bimaps of strings. @@ -33,7 +34,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringBiMapGenerator implements TestBiMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java index 8c9140ed44d8..790fe46b1dfe 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * A skeleton generator for a {@code ListMultimap} implementation. @@ -32,7 +33,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringListMultimapGenerator implements TestListMultimapGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java index b7b2558d9919..8bdef2293382 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.collect.testing.SampleElements; import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Create multisets of strings for tests. @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java index e03cd52d01ea..414860e414c5 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * A skeleton generator for a {@code SetMultimap} implementation. @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSetMultimapGenerator implements TestSetMultimapGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java b/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java index f03e6a586560..f118ecf7ac2b 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Robert Konigsberg */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableCollectionTests { public static void assertMapEntryIsUnmodifiable(Entry entry) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java index 002831ef3c13..8b52204b620b 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.AbstractCollectionTester; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java index 8bcb6b62e000..d7621fd7494d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java @@ -40,6 +40,7 @@ import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -53,7 +54,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class CollectionIteratorTester extends AbstractCollectionTester { public void testIterator() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java index 9e40e4128247..78395adbc801 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java @@ -29,6 +29,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Map.Entry; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapPutIfAbsentTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java index 21dd73bf0d93..2d5b1014e0c8 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java @@ -27,6 +27,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -39,7 +40,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapRemoveTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java index 50e39d13201a..7cd1ba6693bb 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java @@ -27,6 +27,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapReplaceEntryTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java index 4b55fef8def3..f65d5fb326d0 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java @@ -28,6 +28,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -41,7 +42,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapReplaceTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ElementTypesAreNonnullByDefault.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 6d5d26c79493..000000000000 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.common.collect.testing.testers; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import com.google.common.annotations.GwtCompatible; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierDefault; - -/** - * Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this - * unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to - * "undo" it as best we can. - */ -@GwtCompatible -@Retention(RUNTIME) -@Target(TYPE) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java index 42976bcb76f8..cab1041e5953 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java index 3cdbc3737132..21c6ae24279a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java @@ -39,6 +39,7 @@ import java.util.ListIterator; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -53,7 +54,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ListListIteratorTester extends AbstractListTester { @CollectionFeature.Require(absent = SUPPORTS_REMOVE) @ListFeature.Require(absent = {SUPPORTS_SET, SUPPORTS_ADD_WITH_INDEX}) diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java index 5d1722173f10..38c5c5c61a75 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -54,7 +55,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MapPutAllTester extends AbstractMapTester { private List> containsNullKey; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java index b014de3146e4..a9dc1191dfc2 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java index a8cda429574a..6e94a3ad886a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedSetNavigationTester extends AbstractSetTester { private SortedSet sortedSet; diff --git a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java index 565f5d1f74d4..8ee0cd94f6ea 100644 --- a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -145,6 +145,7 @@ import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -171,7 +172,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ArbitraryInstances { private static final Ordering BY_FIELD_NAME = diff --git a/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java b/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java index a4f3b45e7582..9b7b6f6a3358 100644 --- a/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java +++ b/android/guava-testlib/src/com/google/common/testing/ClassSanityTester.java @@ -53,6 +53,7 @@ import javax.annotation.CheckForNull; import junit.framework.Assert; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullUnmarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -81,6 +82,8 @@ */ @GwtIncompatible @J2ktIncompatible +@NullUnmarked +@SuppressWarnings("nullness") public final class ClassSanityTester { private static final Ordering> BY_METHOD_NAME = diff --git a/android/guava-testlib/src/com/google/common/testing/ClusterException.java b/android/guava-testlib/src/com/google/common/testing/ClusterException.java index 2b8d4eb77e72..47232e8dd63b 100644 --- a/android/guava-testlib/src/com/google/common/testing/ClusterException.java +++ b/android/guava-testlib/src/com/google/common/testing/ClusterException.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import org.jspecify.annotations.NullMarked; /** * An {@link ClusterException} is a data structure that allows for some code to "throw multiple @@ -59,7 +60,7 @@ * @author Luiz-Otavio Zorzella */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class ClusterException extends RuntimeException { final Collection exceptions; diff --git a/android/guava-testlib/src/com/google/common/testing/DummyProxy.java b/android/guava-testlib/src/com/google/common/testing/DummyProxy.java index 3494a66bb2c0..4515963f4613 100644 --- a/android/guava-testlib/src/com/google/common/testing/DummyProxy.java +++ b/android/guava-testlib/src/com/google/common/testing/DummyProxy.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class DummyProxy { /** diff --git a/android/guava-testlib/src/com/google/common/testing/ElementTypesAreNonnullByDefault.java b/android/guava-testlib/src/com/google/common/testing/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 1362176b5a12..000000000000 --- a/android/guava-testlib/src/com/google/common/testing/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.common.testing; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import com.google.common.annotations.GwtCompatible; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierDefault; - -/** - * Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this - * unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to - * "undo" it as best we can. - */ -@GwtCompatible -@Retention(RUNTIME) -@Target(TYPE) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java index 5f02dba84855..9d311d3fa360 100644 --- a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -27,6 +27,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.ArrayList; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -76,7 +77,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EqualsTester { private static final int REPETITIONS = 3; diff --git a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java index ec34752c57ab..bf16785bc5f1 100644 --- a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -27,6 +27,7 @@ import com.google.common.testing.RelationshipTester.ItemReporter; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Tester for {@link Equivalence} relationships between groups of objects. @@ -50,7 +51,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EquivalenceTester { private static final int REPETITIONS = 3; diff --git a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java index ffa0e87aff50..66ae972ca4d9 100644 --- a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -28,6 +28,7 @@ import java.time.Duration; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import org.jspecify.annotations.NullMarked; /** * A Ticker whose value can be advanced programmatically in test. @@ -40,7 +41,7 @@ * @author Jige Yu * @since 10.0 */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible public class FakeTicker extends Ticker { diff --git a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java index 0d38191f5ede..ca57703d9fc5 100644 --- a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -36,6 +36,7 @@ import java.lang.reflect.Modifier; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -57,7 +58,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ForwardingWrapperTester { private boolean testsEquals = false; diff --git a/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java b/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java index 0386d875bc1d..c2fe57baf5a3 100644 --- a/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java +++ b/android/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java @@ -121,6 +121,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullUnmarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -130,6 +131,8 @@ */ @GwtIncompatible @J2ktIncompatible +@NullUnmarked +@SuppressWarnings("nullness") class FreshValueGenerator { private static final ImmutableMap, Method> GENERATORS; diff --git a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java index fb0facf24fd8..c883dd7916ce 100644 --- a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -30,6 +30,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeoutException; +import org.jspecify.annotations.NullMarked; /** * Testing utilities relating to garbage collection finalization. @@ -107,7 +108,7 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // gc -@ElementTypesAreNonnullByDefault +@NullMarked public final class GcFinalization { private GcFinalization() {} diff --git a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java index 31d1938a5d54..ba140359d1f8 100644 --- a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -46,6 +46,7 @@ import java.util.List; import java.util.concurrent.ConcurrentMap; import junit.framework.Assert; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -67,7 +68,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class NullPointerTester { private final ClassToInstanceMap defaults = MutableClassToInstanceMap.create(); diff --git a/android/guava-testlib/src/com/google/common/testing/Platform.java b/android/guava-testlib/src/com/google/common/testing/Platform.java index 9726d2de0eb1..0352b5aa9ee5 100644 --- a/android/guava-testlib/src/com/google/common/testing/Platform.java +++ b/android/guava-testlib/src/com/google/common/testing/Platform.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import org.jspecify.annotations.NullMarked; /** * Methods factored out so that they can be emulated differently in GWT. @@ -32,7 +33,7 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class Platform { /** Serializes and deserializes the specified object. */ @SuppressWarnings("unchecked") diff --git a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java index d1caedd4e8d1..fdfa23242daf 100644 --- a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -25,6 +25,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link EqualsTester} and {@link EquivalenceTester} that tests for @@ -33,7 +34,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class RelationshipTester { static class ItemReporter { diff --git a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java index c2f8cc169b0b..7be2f47586e3 100644 --- a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -20,6 +20,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import junit.framework.Assert; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Tests serialization and deserialization of an object, optionally asserting that the resulting @@ -33,7 +34,7 @@ * @since 10.0 */ @GwtCompatible // but no-op! -@ElementTypesAreNonnullByDefault +@NullMarked public final class SerializableTester { private SerializableTester() {} diff --git a/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java b/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java index 10d9dc04ecd4..1790499ca801 100644 --- a/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * Simple utility for when you want to create a {@link TearDown} that may throw an exception but @@ -30,7 +31,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class SloppyTearDown implements TearDown { private static final Logger logger = Logger.getLogger(SloppyTearDown.class.getName()); diff --git a/android/guava-testlib/src/com/google/common/testing/TearDown.java b/android/guava-testlib/src/com/google/common/testing/TearDown.java index 45aebe2a2448..dbd04e2090ca 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDown.java @@ -17,6 +17,7 @@ package com.google.common.testing; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; /** * An object that can perform a {@link #tearDown} operation. @@ -25,7 +26,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TearDown { /** * Performs a single tear-down operation. See test-libraries-for-java's {@code diff --git a/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java b/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java index ec4319bab550..ed514d2d4b1b 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.DoNotMock; +import org.jspecify.annotations.NullMarked; /** * Any object which can accept registrations of {@link TearDown} instances. @@ -27,7 +28,7 @@ */ @DoNotMock("Implement with a lambda") @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TearDownAccepter { /** * Registers a TearDown implementor which will be run after the test proper. diff --git a/android/guava-testlib/src/com/google/common/testing/TearDownStack.java b/android/guava-testlib/src/com/google/common/testing/TearDownStack.java index b16869865907..f0c8dbd2ede8 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownStack.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownStack.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * A {@code TearDownStack} contains a stack of {@link TearDown} instances. @@ -37,7 +38,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TearDownStack implements TearDownAccepter { private static final Logger logger = Logger.getLogger(TearDownStack.class.getName()); diff --git a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java index aba2131935bb..ec01f81b5f81 100644 --- a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.logging.Handler; import java.util.logging.LogRecord; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -53,7 +54,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TestLogHandler extends Handler { private final Object lock = new Object(); diff --git a/android/guava-testlib/src/com/google/common/testing/package-info.java b/android/guava-testlib/src/com/google/common/testing/package-info.java index 3c0849ffca63..ee913c788291 100644 --- a/android/guava-testlib/src/com/google/common/testing/package-info.java +++ b/android/guava-testlib/src/com/google/common/testing/package-info.java @@ -19,5 +19,5 @@ * href="https://github.com/google/guava">Guava library. */ @com.google.errorprone.annotations.CheckReturnValue -@javax.annotation.ParametersAreNonnullByDefault +@org.jspecify.annotations.NullMarked package com.google.common.testing; diff --git a/android/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java b/android/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java index ca07ffae0fbd..05ff429bbdf5 100644 --- a/android/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/pom.xml b/android/guava-tests/pom.xml index 12cf5de79bda..58ee4d19732e 100644 --- a/android/guava-tests/pom.xml +++ b/android/guava-tests/pom.xml @@ -21,6 +21,10 @@ ${project.version} test + + org.jspecify + jspecify + com.google.code.findbugs jsr305 diff --git a/android/guava-tests/test/com/google/common/base/CharMatcherTest.java b/android/guava-tests/test/com/google/common/base/CharMatcherTest.java index 67e83a7fb030..1d47a3dc8a85 100644 --- a/android/guava-tests/test/com/google/common/base/CharMatcherTest.java +++ b/android/guava-tests/test/com/google/common/base/CharMatcherTest.java @@ -37,6 +37,7 @@ import java.util.Set; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link CharMatcher}. @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class CharMatcherTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/base/EquivalenceTest.java b/android/guava-tests/test/com/google/common/base/EquivalenceTest.java index 9bc96b0d24e7..8b5db3ab2ae2 100644 --- a/android/guava-tests/test/com/google/common/base/EquivalenceTest.java +++ b/android/guava-tests/test/com/google/common/base/EquivalenceTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.NullPointerTester; import com.google.common.testing.SerializableTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * * @author Jige Yu */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class EquivalenceTest extends TestCase { public void testPairwiseEquivalent() { diff --git a/android/guava-tests/test/com/google/common/base/FunctionsTest.java b/android/guava-tests/test/com/google/common/base/FunctionsTest.java index 1241200daafa..54380fe53d3b 100644 --- a/android/guava-tests/test/com/google/common/base/FunctionsTest.java +++ b/android/guava-tests/test/com/google/common/base/FunctionsTest.java @@ -30,6 +30,7 @@ import java.io.Serializable; import java.util.Map; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ * @author Vlad Patryshev */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class FunctionsTest extends TestCase { public void testIdentity_same() { diff --git a/android/guava-tests/test/com/google/common/base/JoinerTest.java b/android/guava-tests/test/com/google/common/base/JoinerTest.java index c02127e9d55d..5d427dd7a5d6 100644 --- a/android/guava-tests/test/com/google/common/base/JoinerTest.java +++ b/android/guava-tests/test/com/google/common/base/JoinerTest.java @@ -36,6 +36,7 @@ import java.util.Map.Entry; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class JoinerTest extends TestCase { private static final Joiner J = Joiner.on("-"); diff --git a/android/guava-tests/test/com/google/common/base/OptionalTest.java b/android/guava-tests/test/com/google/common/base/OptionalTest.java index ec197f5c2b82..3c6e2e9f072b 100644 --- a/android/guava-tests/test/com/google/common/base/OptionalTest.java +++ b/android/guava-tests/test/com/google/common/base/OptionalTest.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * * @author Kurt Alfred Kluever */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public final class OptionalTest extends TestCase { @SuppressWarnings("NullOptional") diff --git a/android/guava-tests/test/com/google/common/base/PreconditionsTest.java b/android/guava-tests/test/com/google/common/base/PreconditionsTest.java index 71845c8e5892..10ee1296bd13 100644 --- a/android/guava-tests/test/com/google/common/base/PreconditionsTest.java +++ b/android/guava-tests/test/com/google/common/base/PreconditionsTest.java @@ -39,6 +39,7 @@ import java.util.List; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -47,7 +48,7 @@ * @author Kevin Bourrillion * @author Jared Levy */ -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("LenientFormatStringValidation") // Intentional for testing @GwtCompatible(emulated = true) public class PreconditionsTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/base/PredicatesTest.java b/android/guava-tests/test/com/google/common/base/PredicatesTest.java index f1918c6d8c42..6fc9660f4bd7 100644 --- a/android/guava-tests/test/com/google/common/base/PredicatesTest.java +++ b/android/guava-tests/test/com/google/common/base/PredicatesTest.java @@ -38,6 +38,7 @@ import java.util.regex.Pattern; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class PredicatesTest extends TestCase { private static final Predicate<@Nullable Integer> TRUE = Predicates.alwaysTrue(); diff --git a/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java index e8f98fdd542e..2315bae34bc6 100644 --- a/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java @@ -33,11 +33,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/base/SplitterTest.java b/android/guava-tests/test/com/google/common/base/SplitterTest.java index 71a37a5f08e0..d5b5a9aeb373 100644 --- a/android/guava-tests/test/com/google/common/base/SplitterTest.java +++ b/android/guava-tests/test/com/google/common/base/SplitterTest.java @@ -31,11 +31,12 @@ import java.util.Map; import java.util.regex.Pattern; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author Julien Silland */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SplitterTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/base/StringsTest.java b/android/guava-tests/test/com/google/common/base/StringsTest.java index 494f321c208d..79fd2651cd24 100644 --- a/android/guava-tests/test/com/google/common/base/StringsTest.java +++ b/android/guava-tests/test/com/google/common/base/StringsTest.java @@ -24,13 +24,14 @@ import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.NullPointerTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link Strings}. * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class StringsTest extends TestCase { public void testNullToEmpty() { diff --git a/android/guava-tests/test/com/google/common/base/SuppliersTest.java b/android/guava-tests/test/com/google/common/base/SuppliersTest.java index 9a1150a0fc02..5971816134e7 100644 --- a/android/guava-tests/test/com/google/common/base/SuppliersTest.java +++ b/android/guava-tests/test/com/google/common/base/SuppliersTest.java @@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @author Laurence Gonsalves * @author Harry Heymann */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SuppliersTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java index 0fa5fdbdb7b4..c496603719d7 100644 --- a/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java @@ -33,11 +33,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java b/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java index 9dfa3fde21f6..21c7b8bde46c 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java @@ -24,10 +24,11 @@ import java.util.Map; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractFilteredMapTest extends TestCase { private static final Predicate<@Nullable String> NOT_LENGTH_3 = input -> input == null || input.length() != 3; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java b/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java index b0cb64e5faab..9a6615fa449d 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractImmutableSetTest extends TestCase { protected abstract > Set of(); diff --git a/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java index 45f877a17ecf..6f1b6f7e8c6b 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests {@link ImmutableTable} @@ -27,7 +28,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractImmutableTableTest extends TestCase { abstract Iterable> getTestInstances(); diff --git a/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java b/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java index 1b6d6656483e..c935a962b9fe 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractIteratorTest extends TestCase { public void testDefaultBehaviorOfNextAndHasNext() { diff --git a/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java b/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java index a0f25ca5c29a..80c9526665f4 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -29,7 +30,7 @@ * @author Mike Bostock */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractMapEntryTest extends TestCase { private static final @Nullable String NK = null; private static final @Nullable Integer NV = null; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java index 1a86566d0cfc..6808c3cf13fa 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ * @author Isaac Shum */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractMapsTransformValuesTest extends MapInterfaceTest { public AbstractMapsTransformValuesTest() { super(false, true, false, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java index 84b920902557..682f16d54d5a 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an arbitrary multimap with {@link MapInterfaceTest}. @@ -30,7 +31,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMultimapAsMapImplementsMapTest extends MapInterfaceTest> { diff --git a/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java b/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java index b1f64347ee53..e93736a6b89f 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java @@ -28,11 +28,12 @@ import java.util.NoSuchElementException; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Tests for {@link AbstractSequentialIterator}. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractSequentialIteratorTest extends TestCase { @GwtIncompatible // Too slow public void testDoublerExhaustive() { diff --git a/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java b/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java index 5eada001250c..2d6a94d28e67 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.EqualsTester; import com.google.common.testing.NullPointerTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractTableReadTest extends TestCase { protected Table table; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java b/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java index 264bb06f0a80..4f479f49d9be 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java @@ -22,6 +22,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractTableTest extends AbstractTableReadTest { diff --git a/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java b/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java index bc18b493baa4..37f513ae3b29 100644 --- a/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java @@ -35,6 +35,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code ArrayListMultimap}. @@ -42,7 +43,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayListMultimapTest extends TestCase { @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java b/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java index 9755891f9d62..a0399d3cf49f 100644 --- a/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java @@ -31,6 +31,7 @@ import com.google.common.testing.SerializableTester; import java.util.Arrays; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayTableTest extends AbstractTableTest<@Nullable Character> { @Override diff --git a/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java b/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java index 44815e122dfa..16c98c5cae61 100644 --- a/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java +++ b/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java @@ -27,10 +27,11 @@ import java.util.stream.IntStream; import java.util.stream.LongStream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** Tests for {@code CollectSpliterators}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class CollectSpliteratorsTest extends TestCase { public void testMap() { SpliteratorTester.of( diff --git a/android/guava-tests/test/com/google/common/collect/Collections2Test.java b/android/guava-tests/test/com/google/common/collect/Collections2Test.java index b14550a4719d..69adcaeb6fe5 100644 --- a/android/guava-tests/test/com/google/common/collect/Collections2Test.java +++ b/android/guava-tests/test/com/google/common/collect/Collections2Test.java @@ -40,6 +40,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class Collections2Test extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java b/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java index 963f22ada1f0..8710c49fafed 100644 --- a/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java +++ b/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java @@ -36,6 +36,7 @@ import java.util.Comparator; import java.util.Optional; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ComparatorsTest extends TestCase { public void testLexicographical() { Comparator comparator = Ordering.natural(); diff --git a/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java b/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java index c599a02aa3e7..1f3e422b6077 100644 --- a/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java +++ b/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link ComparisonChain}. @@ -28,7 +29,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ComparisonChainTest extends TestCase { private static final DontCompareMe DONT_COMPARE_ME = new DontCompareMe(); diff --git a/android/guava-tests/test/com/google/common/collect/CountTest.java b/android/guava-tests/test/com/google/common/collect/CountTest.java index a6f6019b7901..86323cc8f728 100644 --- a/android/guava-tests/test/com/google/common/collect/CountTest.java +++ b/android/guava-tests/test/com/google/common/collect/CountTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code Count}. @@ -23,7 +24,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class CountTest extends TestCase { public void testGet() { assertEquals(20, new Count(20).get()); diff --git a/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java index 1c928638a96e..163688c867bc 100644 --- a/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.testing.EqualsTester; +import org.jspecify.annotations.NullMarked; /** * Tests {@link EmptyImmutableTable} @@ -26,7 +27,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EmptyImmutableTableTest extends AbstractImmutableTableTest { private static final ImmutableTable INSTANCE = ImmutableTable.of(); diff --git a/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java b/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java index 31eab3bc14db..4f5cea264617 100644 --- a/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java @@ -42,6 +42,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code EnumBiMap}. @@ -51,7 +52,7 @@ */ @J2ktIncompatible // EnumBimap @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EnumBiMapTest extends TestCase { private enum Currency { DOLLAR, diff --git a/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java b/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java index 7ba7923aed5c..1d8cdd383907 100644 --- a/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java +++ b/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link EvictingQueue}. @@ -34,7 +35,7 @@ * @author Kurt Alfred Kluever */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EvictingQueueTest extends TestCase { public void testCreateWithNegativeSize() throws Exception { diff --git a/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java b/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java index 652a23045e50..78d4e958ccc3 100644 --- a/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java @@ -17,9 +17,10 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredBiMapTest extends AbstractFilteredMapTest { @Override BiMap createUnfiltered() { diff --git a/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java b/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java index 049e28645723..70e561443e70 100644 --- a/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredMapTest extends AbstractFilteredMapTest { @Override Map createUnfiltered() { diff --git a/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java b/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java index c4015cb72701..7fb754300d59 100644 --- a/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredSortedMapTest extends AbstractFilteredMapTest { @Override SortedMap createUnfiltered() { diff --git a/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java index 3cabcda48d17..b09fc124a98d 100644 --- a/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for a {@link Multimaps#forMap} multimap with {@link @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ForMapMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { public ForMapMultimapAsMapImplementsMapTest() { diff --git a/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java index b021a0de47f0..a2f6c8739265 100644 --- a/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.SortedMapInterfaceTest; import java.util.SortedMap; import java.util.TreeMap; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link ForwardingSortedMap} using {@link MapInterfaceTest}. @@ -29,7 +30,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ForwardingSortedMapImplementsMapTest extends SortedMapInterfaceTest { private static class SimpleForwardingSortedMap extends ForwardingSortedMap { diff --git a/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java b/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java index e85aa2787640..b9dbffcd501c 100644 --- a/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java +++ b/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class GeneralRangeTest extends TestCase { private static final Ordering<@Nullable Integer> ORDERING = Ordering.natural().nullsFirst(); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java index dc77b8cac28c..16657ccc4799 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableColumnMapTest extends ColumnMapTests { public HashBasedTableColumnMapTest() { super(false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java index 48d0d4785122..238c04bba9d6 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableColumnTest extends ColumnTests { public HashBasedTableColumnTest() { super(false, true, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java index e007fe077b2f..923ffe197faa 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableRowMapTest extends RowMapTests { public HashBasedTableRowMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java index 265e2983d0e1..1b6f4a44a97f 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableRowTest extends RowTests { public HashBasedTableRowTest() { super(false, true, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java index d5ed5751ad52..a6a23beaaf30 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.NullPointerTester; import com.google.common.testing.SerializableTester; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableTest extends AbstractTableTest { @Override diff --git a/android/guava-tests/test/com/google/common/collect/HashBiMapTest.java b/android/guava-tests/test/com/google/common/collect/HashBiMapTest.java index 32988d42bd3d..988c028bf9ae 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBiMapTest.java @@ -34,6 +34,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link HashBiMap}. @@ -41,7 +42,7 @@ * @author Mike Bostock */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBiMapTest extends TestCase { public static final class HashBiMapGenerator extends TestStringBiMapGenerator { diff --git a/android/guava-tests/test/com/google/common/collect/HashMultimapTest.java b/android/guava-tests/test/com/google/common/collect/HashMultimapTest.java index 0fa8ac353c9a..e4decb57c2c8 100644 --- a/android/guava-tests/test/com/google/common/collect/HashMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashMultimapTest.java @@ -30,6 +30,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link HashMultimap}. @@ -37,7 +38,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashMultimapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java b/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java index f2d56cda9a17..294a75bf88a4 100644 --- a/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java @@ -31,6 +31,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link HashMultiset}. @@ -39,7 +40,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/HashingTest.java b/android/guava-tests/test/com/google/common/collect/HashingTest.java index c68d2c2bd731..07162702e118 100644 --- a/android/guava-tests/test/com/google/common/collect/HashingTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashingTest.java @@ -18,10 +18,11 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** Tests for {@code Hashing}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashingTest extends TestCase { public void testSmear() { assertEquals(1459320713, smear(754102528)); diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java index 34d186439883..6e3803df599f 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java @@ -44,6 +44,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -52,7 +53,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableBiMapTest extends TestCase { // TODO: Reduce duplication of ImmutableMapTest code diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java index d02b2429bb65..ebedb004b7fc 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java @@ -35,6 +35,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code ImmutableEnumMap}. @@ -42,7 +43,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableEnumMapTest extends TestCase { public static class ImmutableEnumMapGenerator extends TestEnumMapGenerator { @Override diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java index 1f3c9aefec14..f0185f21f513 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java @@ -42,6 +42,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -50,7 +51,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableListMultimapTest extends TestCase { public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator { @Override diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableListTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableListTest.java index bc45424d78ea..31c41cb3f188 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableListTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableListTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -62,7 +63,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableListTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java index 620b53c134c6..9a65525d7ea0 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java @@ -61,6 +61,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -71,7 +72,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java index f216745044e3..0d7889408235 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an {@link ImmutableMultimap} with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java index d1219082014a..7d8860a873dd 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java @@ -32,6 +32,7 @@ import com.google.common.testing.NullPointerTester; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultimapTest extends TestCase { @SuppressWarnings("JUnitIncompatibleType") diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java index 8744b4d8d5a3..444984805457 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java @@ -49,6 +49,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -57,7 +58,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java index 317644e1421d..f8dfc39a2990 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an {@link ImmutableSetMultimap} with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Mike Ward */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java index 898f41bde878..adc61af16972 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java @@ -41,6 +41,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Mike Ward */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetMultimapTest extends TestCase { private static final class ImmutableSetMultimapGenerator extends TestStringSetMultimapGenerator { @Override diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSetTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSetTest.java index ddde4bfacd1a..8df4e5facca0 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSetTest.java @@ -42,6 +42,7 @@ import java.util.Set; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link ImmutableSet}. @@ -51,7 +52,7 @@ * @author Nick Kralevich */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java index cb3402ade3b5..c9321c40be6a 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java @@ -50,6 +50,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -61,7 +62,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedMapTest extends TestCase { // TODO: Avoid duplicating code in ImmutableMapTest diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java index 0d0303c763a2..78cba2570d2b 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java @@ -55,6 +55,7 @@ import java.util.TreeSet; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link ImmutableSortedSet}. @@ -62,7 +63,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java index 8fb5dfa63593..aef92ea1bc75 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.SerializableTester; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableTableTest extends AbstractTableReadTest { @Override protected Table create(@Nullable Object... data) { diff --git a/android/guava-tests/test/com/google/common/collect/IterablesTest.java b/android/guava-tests/test/com/google/common/collect/IterablesTest.java index 78e2ef710673..ccca7a71067f 100644 --- a/android/guava-tests/test/com/google/common/collect/IterablesTest.java +++ b/android/guava-tests/test/com/google/common/collect/IterablesTest.java @@ -65,6 +65,7 @@ import java.util.SortedSet; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -74,7 +75,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class IterablesTest extends TestCase { public void testSize0() { diff --git a/android/guava-tests/test/com/google/common/collect/IteratorsTest.java b/android/guava-tests/test/com/google/common/collect/IteratorsTest.java index dcab9733a34d..c940e7490157 100644 --- a/android/guava-tests/test/com/google/common/collect/IteratorsTest.java +++ b/android/guava-tests/test/com/google/common/collect/IteratorsTest.java @@ -74,6 +74,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -82,7 +83,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class IteratorsTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/LegacyComparable.java b/android/guava-tests/test/com/google/common/collect/LegacyComparable.java index 93c92aa82cf8..c7285a92d912 100644 --- a/android/guava-tests/test/com/google/common/collect/LegacyComparable.java +++ b/android/guava-tests/test/com/google/common/collect/LegacyComparable.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ */ @SuppressWarnings({"ComparableType", "rawtypes"}) // https://github.com/google/guava/issues/989 @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked class LegacyComparable implements Comparable, Serializable { static final LegacyComparable X = new LegacyComparable("x"); static final LegacyComparable Y = new LegacyComparable("y"); diff --git a/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java b/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java index 2b0208031910..cf1ed0f76f36 100644 --- a/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java @@ -46,6 +46,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -54,7 +55,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedHashMultimapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java b/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java index 7300941887ef..05b175132743 100644 --- a/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java @@ -31,6 +31,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link LinkedHashMultiset}. @@ -38,7 +39,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedHashMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java b/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java index b0f2f618dd74..2c942644628b 100644 --- a/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java @@ -51,6 +51,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -59,7 +60,7 @@ * @author Mike Bostock */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedListMultimapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ListsImplTest.java b/android/guava-tests/test/com/google/common/collect/ListsImplTest.java index b99d65fcda5a..68ce8362d7f3 100644 --- a/android/guava-tests/test/com/google/common/collect/ListsImplTest.java +++ b/android/guava-tests/test/com/google/common/collect/ListsImplTest.java @@ -34,11 +34,12 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Tests the package level *impl methods directly using various types of lists. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ListsImplTest extends TestCase { /** Describes how a list is modifiable */ diff --git a/android/guava-tests/test/com/google/common/collect/ListsTest.java b/android/guava-tests/test/com/google/common/collect/ListsTest.java index 844b9f449e8b..f881b2c8c65b 100644 --- a/android/guava-tests/test/com/google/common/collect/ListsTest.java +++ b/android/guava-tests/test/com/google/common/collect/ListsTest.java @@ -61,6 +61,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@code Lists}. @@ -70,7 +71,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ListsTest extends TestCase { private static final Collection SOME_COLLECTION = asList(0, 1, 1); diff --git a/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java index de190d423ce9..b6580f68c66a 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java @@ -22,6 +22,7 @@ import com.google.common.base.Function; import com.google.common.base.Functions; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Maps#transformValues(SortedMap, Function)}. @@ -29,7 +30,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsSortedTransformValuesTest extends AbstractMapsTransformValuesTest { @Override protected SortedMap makeEmptyMap() { diff --git a/android/guava-tests/test/com/google/common/collect/MapsTest.java b/android/guava-tests/test/com/google/common/collect/MapsTest.java index ac501a51e096..b468f78bb595 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTest.java @@ -66,6 +66,7 @@ import java.util.TreeMap; import java.util.concurrent.ConcurrentMap; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -76,7 +77,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("JUnitIncompatibleType") // Many intentional violations here. public class MapsTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java index 55f3ac66348f..e1cafc86b964 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java @@ -22,6 +22,7 @@ import com.google.common.base.Function; import com.google.common.base.Functions; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Maps#transformValues(Map, Function)}. @@ -29,7 +30,7 @@ * @author Isaac Shum */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsTransformValuesTest extends AbstractMapsTransformValuesTest { @Override protected Map makeEmptyMap() { diff --git a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java index 343ebcf77056..def9d6847706 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsTransformValuesUnmodifiableIteratorTest extends MapInterfaceTest { // TODO(jlevy): Move shared code of this class and MapsTransformValuesTest // to a superclass. diff --git a/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java b/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java index a94904e19441..2ba38f132a0b 100644 --- a/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java +++ b/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -61,7 +62,7 @@ * @author Sverre Sundsdal */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MinMaxPriorityQueueTest extends TestCase { private static final Ordering SOME_COMPARATOR = Ordering.natural().reverse(); diff --git a/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java b/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java index 034b3e3d1ae0..97857ffdeb0a 100644 --- a/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java @@ -29,6 +29,7 @@ import java.util.SortedMap; import java.util.SortedSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapBuilderTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/MultimapsTest.java b/android/guava-tests/test/com/google/common/collect/MultimapsTest.java index 372e8276d571..448988bece58 100644 --- a/android/guava-tests/test/com/google/common/collect/MultimapsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultimapsTest.java @@ -66,6 +66,7 @@ import java.util.SortedSet; import java.util.TreeSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -74,7 +75,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapsTest extends TestCase { private static final Comparator INT_COMPARATOR = diff --git a/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java b/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java index 78494be1b4d5..d68c9829ec44 100644 --- a/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.base.Functions; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Tests for Multimaps.transformValues().asMap(). @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapsTransformValuesAsMapTest extends AbstractMultimapAsMapImplementsMapTest { public MultimapsTransformValuesAsMapTest() { diff --git a/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java b/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java index 85afc4728191..a442aa814691 100644 --- a/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java @@ -22,6 +22,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Multiset.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author Mike Bostock */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetsImmutableEntryTest extends TestCase { private static final @Nullable String NE = null; diff --git a/android/guava-tests/test/com/google/common/collect/MultisetsTest.java b/android/guava-tests/test/com/google/common/collect/MultisetsTest.java index 13da822e65cd..0921dc79dea3 100644 --- a/android/guava-tests/test/com/google/common/collect/MultisetsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultisetsTest.java @@ -32,6 +32,7 @@ import java.util.Collections; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Multisets}. @@ -41,7 +42,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetsTest extends TestCase { /* See MultisetsImmutableEntryTest for immutableEntry() tests. */ diff --git a/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java b/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java index 8d2b2bd96987..d8ff7eda0633 100644 --- a/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java @@ -23,6 +23,7 @@ import com.google.common.base.Supplier; import java.util.Map; import java.util.TreeMap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class NewCustomTableTest extends AbstractTableTest { @Override diff --git a/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java b/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java index 01c121f48cdb..6afb08a509e4 100644 --- a/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java +++ b/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ObjectArraysTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/OrderingTest.java b/android/guava-tests/test/com/google/common/collect/OrderingTest.java index 95043fc0db01..e52589461ab2 100644 --- a/android/guava-tests/test/com/google/common/collect/OrderingTest.java +++ b/android/guava-tests/test/com/google/common/collect/OrderingTest.java @@ -50,6 +50,7 @@ import java.util.RandomAccess; import junit.framework.TestCase; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -58,7 +59,7 @@ * @author Jesse Wilson */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class OrderingTest extends TestCase { // TODO(cpovirk): some of these are inexplicably slow (20-30s) under GWT diff --git a/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java b/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java index ad260ef65186..76f3b50df872 100644 --- a/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class PeekingIteratorTest extends TestCase { /** diff --git a/android/guava-tests/test/com/google/common/collect/RangeTest.java b/android/guava-tests/test/com/google/common/collect/RangeTest.java index d735749f948d..e1431f09d76e 100644 --- a/android/guava-tests/test/com/google/common/collect/RangeTest.java +++ b/android/guava-tests/test/com/google/common/collect/RangeTest.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class RangeTest extends TestCase { public void testOpen() { Range range = Range.open(4, 8); diff --git a/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java index 72e31b0e0186..308e25eb0c3b 100644 --- a/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java b/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java index 3f1f75d78ac5..74f719efe374 100644 --- a/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java +++ b/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -24,7 +25,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class RegularImmutableAsListTest extends TestCase { /** * RegularImmutableAsList should assume its input is null-free without checking, because it only diff --git a/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java index 1e697c95bbc2..86d67d5ad1e2 100644 --- a/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java @@ -21,12 +21,13 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Table.Cell; +import org.jspecify.annotations.NullMarked; /** * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class RegularImmutableTableTest extends AbstractImmutableTableTest { private static final ImmutableSet> CELLS = ImmutableSet.of( diff --git a/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java b/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java index fa7cb0c4b7f3..f17d0ee3b37e 100644 --- a/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java @@ -32,6 +32,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link Sets#union}, {@link Sets#intersection} and {@link Sets#difference}. @@ -39,7 +40,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetOperationsTest extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/SetsTest.java b/android/guava-tests/test/com/google/common/collect/SetsTest.java index 8fcde29bfd5c..2e12936c81e6 100644 --- a/android/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SetsTest.java @@ -80,6 +80,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -89,7 +90,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetsTest extends TestCase { private static final IteratorTester.KnownOrder KNOWN_ORDER = diff --git a/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java b/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java index 7dd66df559da..6ffa66df4d77 100644 --- a/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java @@ -33,6 +33,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SimpleAbstractMultisetTest extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java index 42b239aa0ff8..2dded744ce1d 100644 --- a/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java @@ -23,6 +23,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Objects; import com.google.common.testing.EqualsTester; +import org.jspecify.annotations.NullMarked; /** * Tests {@link SingletonImmutableTable}. @@ -30,7 +31,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SingletonImmutableTableTest extends AbstractImmutableTableTest { private final ImmutableTable testTable = new SingletonImmutableTable<>('a', 1, "blah"); diff --git a/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java b/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java index cd025c66db73..6ea3a034fce9 100644 --- a/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java +++ b/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java @@ -17,6 +17,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code SortedIterables}. @@ -24,7 +25,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedIterablesTest extends TestCase { public void testSameComparator() { assertTrue(SortedIterables.hasSameComparator(Ordering.natural(), Sets.newTreeSet())); diff --git a/android/guava-tests/test/com/google/common/collect/SortedListsTest.java b/android/guava-tests/test/com/google/common/collect/SortedListsTest.java index 95d2e16933e4..797f9dc6251d 100644 --- a/android/guava-tests/test/com/google/common/collect/SortedListsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SortedListsTest.java @@ -22,6 +22,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for SortedLists. @@ -29,7 +30,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedListsTest extends TestCase { private static final ImmutableList LIST_WITH_DUPS = ImmutableList.of(1, 1, 2, 4, 4, 4, 8); diff --git a/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java index f53b8b3038f0..f97c6e792ecc 100644 --- a/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@code TreeMultimap.asMap().subMap()} with {@link MapInterfaceTest}. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SubMapMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { public SubMapMultimapAsMapImplementsMapTest() { diff --git a/android/guava-tests/test/com/google/common/collect/TableCollectionTest.java b/android/guava-tests/test/com/google/common/collect/TableCollectionTest.java index 29f2d890f5be..f2ab1c6dd4ac 100644 --- a/android/guava-tests/test/com/google/common/collect/TableCollectionTest.java +++ b/android/guava-tests/test/com/google/common/collect/TableCollectionTest.java @@ -51,6 +51,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -60,7 +61,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TableCollectionTest extends TestCase { private static final Feature[] COLLECTION_FEATURES = { diff --git a/android/guava-tests/test/com/google/common/collect/TablesTest.java b/android/guava-tests/test/com/google/common/collect/TablesTest.java index 0a2b6472e4f6..57505ef2bfa0 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTest.java @@ -24,6 +24,7 @@ import com.google.common.testing.EqualsTester; import com.google.common.testing.SerializableTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTest extends TestCase { @GwtIncompatible // SerializableTester diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java index d25c2358dfbf..e5887875d742 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java @@ -22,9 +22,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesColumnMapTest extends ColumnMapTests { public TablesTransformValuesColumnMapTest() { super(false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java index 9647a6f70ccd..c1a140092acc 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java @@ -22,9 +22,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesColumnTest extends ColumnTests { public TablesTransformValuesColumnTest() { super(false, false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java index 77cfd4142c1d..0a3918b39ef6 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesRowMapTest extends RowMapTests { public TablesTransformValuesRowMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java index 95d58a58fbfc..de34b485640d 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesRowTest extends RowTests { public TablesTransformValuesRowTest() { super(false, false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java index 452c70a93d14..e06865dbc263 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.base.Function; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesTest extends AbstractTableTest { private static final Function<@Nullable String, @Nullable Character> FIRST_CHARACTER = diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java index ee813e358ff4..f8e67f990829 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java @@ -20,9 +20,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransposeColumnTest extends ColumnTests { public TablesTransposeColumnTest() { super(false, true, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java index 25f1bcfa37ce..524ed112d70a 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java @@ -20,9 +20,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransposeRowTest extends RowTests { public TablesTransposeRowTest() { super(false, true, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java b/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java index 6c87b99efecb..736c8ff4518d 100644 --- a/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java @@ -19,6 +19,7 @@ import static com.google.common.collect.Tables.transpose; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TransposedTableTest extends AbstractTableTest { @Override diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java index 4fa7b5aaeca6..f27017d6cfa2 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableColumnMapTest extends ColumnMapTests { public TreeBasedTableColumnMapTest() { super(false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java index 48049bc5913e..b4e6008e38cd 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableColumnTest extends ColumnTests { public TreeBasedTableColumnTest() { super(false, true, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java index 274594166764..59ba288793de 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapHeadMapTest extends RowMapTests { public TreeBasedTableRowMapHeadMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java index ba4235d7748a..d9c5ba1e457a 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapSubMapTest extends RowMapTests { public TreeBasedTableRowMapSubMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java index 862d78c7d1b2..cf25c9d5972d 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapTailMapTest extends RowMapTests { public TreeBasedTableRowMapTailMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java index 46a925a58f63..e9c891fa24ef 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapTest extends RowMapTests { public TreeBasedTableRowMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java index 7884b61104f4..990732ee3c67 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowTest extends RowTests { public TreeBasedTableRowTest() { super(false, true, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java index e663ff280ae1..aedd2e5d7422 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java @@ -37,6 +37,7 @@ import java.util.SortedMap; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableTest extends AbstractTableTest { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java b/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java index f69c54a15fcb..cb85a7bfb017 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java @@ -30,6 +30,7 @@ import java.util.Map.Entry; import java.util.SortedSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultimapExplicitTest extends TestCase { /** diff --git a/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java b/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java index f50a512446d6..bd4f2b945a28 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code TreeMultimap} with natural ordering. @@ -59,7 +60,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultimapNaturalTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java b/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java index 8cd6cbd57574..38149fc57386 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java @@ -41,6 +41,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Neal Kanodia */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java b/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java index a9c3d094d084..3b1b45cf2146 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java @@ -24,6 +24,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code TreeTraverser}. @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeTraverserTest extends TestCase { private static class Node { final char value; diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java index fad660a0c6f6..452e513a9430 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link UnmodifiableIterator}. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableIteratorTest extends TestCase { @SuppressWarnings("DoNotCall") diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java index 02cf78e2baa7..e1d159ae73cc 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java @@ -23,6 +23,7 @@ import java.util.ListIterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for UnmodifiableListIterator. @@ -30,7 +31,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableListIteratorTest extends TestCase { @SuppressWarnings("DoNotCall") public void testRemove() { diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java index f485b8bb0e5e..6296f494b9ea 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an unmodifiable multimap with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java index f9713c752bd5..dcd19b050459 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableColumnMapTest extends ColumnMapTests { public UnmodifiableRowSortedTableColumnMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java index c98dd1449b51..a18944d4141d 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableColumnTest extends ColumnTests { public UnmodifiableRowSortedTableColumnTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java index 7c1cc0c2850f..5fa5c14c9884 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java @@ -22,9 +22,10 @@ import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableRowMapTest extends RowMapTests { public UnmodifiableRowSortedTableRowMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java index 67c011107e0b..511eb2afb34b 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableRowTest extends RowTests { public UnmodifiableRowSortedTableRowTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java index 05d69df2e45f..a75a0437ee25 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableColumnMapTest extends ColumnMapTests { public UnmodifiableTableColumnMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java index 3296aedd9d57..70a8a7347fbc 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableColumnTest extends ColumnTests { public UnmodifiableTableColumnTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java index 69fa02cc008c..904e6a8482b6 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableRowMapTest extends RowMapTests { public UnmodifiableTableRowMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java index 973995a5af2a..e01db0878541 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableRowTest extends RowTests { public UnmodifiableTableRowTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java b/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java index c82d23b517f1..85c754c75892 100644 --- a/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java +++ b/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java @@ -21,12 +21,13 @@ import com.google.common.escape.testing.EscaperAsserts; import java.io.IOException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author David Beaumont */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayBasedCharEscaperTest extends TestCase { private static final ImmutableMap NO_REPLACEMENTS = ImmutableMap.of(); private static final ImmutableMap SIMPLE_REPLACEMENTS = diff --git a/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java b/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java index 125749470a0d..c7ad03ad4193 100644 --- a/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java +++ b/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java @@ -23,12 +23,13 @@ import com.google.common.escape.testing.EscaperAsserts; import java.io.IOException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author David Beaumont */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayBasedUnicodeEscaperTest extends TestCase { private static final ImmutableMap NO_REPLACEMENTS = ImmutableMap.of(); private static final ImmutableMap SIMPLE_REPLACEMENTS = diff --git a/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java index 5f27927038c7..f03f7b6e57ac 100644 --- a/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java index 444185d69ff0..dda6301ade7d 100644 --- a/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java b/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java index 98454b458e96..e60cf683dfbc 100644 --- a/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java +++ b/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java @@ -52,13 +52,14 @@ import java.util.EnumSet; import java.util.Map; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for BigIntegerMath. * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class BigIntegerMathTest extends TestCase { public void testCeilingPowerOfTwo() { diff --git a/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java index a0be002dd995..3c7c363b3264 100644 --- a/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java index 693a6565a8a4..86e8f9903637 100644 --- a/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/primitives/BooleansTest.java b/android/guava-tests/test/com/google/common/primitives/BooleansTest.java index 15c80b41ffb0..67ab066c41dc 100644 --- a/android/guava-tests/test/com/google/common/primitives/BooleansTest.java +++ b/android/guava-tests/test/com/google/common/primitives/BooleansTest.java @@ -32,6 +32,7 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class BooleansTest extends TestCase { private static final boolean[] EMPTY = {}; private static final boolean[] ARRAY_FALSE = {false}; diff --git a/android/guava-tests/test/com/google/common/primitives/BytesTest.java b/android/guava-tests/test/com/google/common/primitives/BytesTest.java index b395a204aac0..6c56ad0e1d7f 100644 --- a/android/guava-tests/test/com/google/common/primitives/BytesTest.java +++ b/android/guava-tests/test/com/google/common/primitives/BytesTest.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class BytesTest extends TestCase { private static final byte[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/CharsTest.java b/android/guava-tests/test/com/google/common/primitives/CharsTest.java index 6da8be85115c..5645a0f14cc7 100644 --- a/android/guava-tests/test/com/google/common/primitives/CharsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/CharsTest.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Locale; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class CharsTest extends TestCase { private static final char[] EMPTY = {}; private static final char[] ARRAY1 = {(char) 1}; diff --git a/android/guava-tests/test/com/google/common/primitives/DoublesTest.java b/android/guava-tests/test/com/google/common/primitives/DoublesTest.java index bf0d211ebd7e..fa7aa36cbf2d 100644 --- a/android/guava-tests/test/com/google/common/primitives/DoublesTest.java +++ b/android/guava-tests/test/com/google/common/primitives/DoublesTest.java @@ -38,6 +38,7 @@ import java.util.List; import java.util.regex.Pattern; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class DoublesTest extends TestCase { private static final double[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/FloatsTest.java b/android/guava-tests/test/com/google/common/primitives/FloatsTest.java index c35cbc4799d4..6522be8bff55 100644 --- a/android/guava-tests/test/com/google/common/primitives/FloatsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/FloatsTest.java @@ -37,6 +37,7 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FloatsTest extends TestCase { private static final float[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/IntsTest.java b/android/guava-tests/test/com/google/common/primitives/IntsTest.java index a64cf2642c7f..2c5aa1913727 100644 --- a/android/guava-tests/test/com/google/common/primitives/IntsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/IntsTest.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("cast") // redundant casts are intentional and harmless public class IntsTest extends TestCase { private static final int[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/LongsTest.java b/android/guava-tests/test/com/google/common/primitives/LongsTest.java index b84972e53716..0bfa4dd5d82d 100644 --- a/android/guava-tests/test/com/google/common/primitives/LongsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/LongsTest.java @@ -39,6 +39,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class LongsTest extends TestCase { private static final long[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java index 2c903ac7acdb..67654ea330ef 100644 --- a/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/primitives/ShortsTest.java b/android/guava-tests/test/com/google/common/primitives/ShortsTest.java index 9f40936dd7eb..60d8670c4be9 100644 --- a/android/guava-tests/test/com/google/common/primitives/ShortsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/ShortsTest.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class ShortsTest extends TestCase { private static final short[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java b/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java index d2770657fd99..e186066e4b63 100644 --- a/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java +++ b/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java @@ -32,13 +32,14 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link SignedBytes}. * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SignedBytesTest extends TestCase { private static final byte[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java index 309b0029abd3..3339f08877d5 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java @@ -34,12 +34,13 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeoutException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link FluentFuture}. The tests cover only the basics for the API. The actual logic is * tested in {@link FuturesTest}. */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FluentFutureTest extends TestCase { public void testFromFluentFuture() { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java index ade301520edc..1fc69011f37b 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java @@ -94,6 +94,7 @@ import java.util.logging.Logger; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -101,7 +102,7 @@ * * @author Nishant Thakkar */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FuturesTest extends TestCase { private static final Logger aggregateFutureLogger = diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java index 7c2b29bd6ca8..a0f455ec170c 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java b/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 17357b525a03..969357713648 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java @@ -35,10 +35,11 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Test case for {@link TrustedListenableFutureTask}. */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class TrustedListenableFutureTaskTest extends TestCase { diff --git a/android/guava/pom.xml b/android/guava/pom.xml index 424b3c4e908c..b0576e768671 100644 --- a/android/guava/pom.xml +++ b/android/guava/pom.xml @@ -28,6 +28,10 @@ listenablefuture 9999.0-empty-to-avoid-conflict-with-guava + + org.jspecify + jspecify + com.google.code.findbugs jsr305 diff --git a/android/guava/src/com/google/common/base/Absent.java b/android/guava/src/com/google/common/base/Absent.java index f96136b5efac..514181ab8b93 100644 --- a/android/guava/src/com/google/common/base/Absent.java +++ b/android/guava/src/com/google/common/base/Absent.java @@ -20,10 +20,11 @@ import java.util.Collections; import java.util.Set; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** Implementation of an {@link Optional} not containing a reference. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class Absent extends Optional { static final Absent INSTANCE = new Absent<>(); diff --git a/android/guava/src/com/google/common/base/AbstractIterator.java b/android/guava/src/com/google/common/base/AbstractIterator.java index bb0a1d324978..483307749db2 100644 --- a/android/guava/src/com/google/common/base/AbstractIterator.java +++ b/android/guava/src/com/google/common/base/AbstractIterator.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -29,7 +30,7 @@ * reasons). */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractIterator implements Iterator { private State state = State.NOT_READY; diff --git a/android/guava/src/com/google/common/base/Ascii.java b/android/guava/src/com/google/common/base/Ascii.java index aa077e83f2ac..2f778376f0fd 100644 --- a/android/guava/src/com/google/common/base/Ascii.java +++ b/android/guava/src/com/google/common/base/Ascii.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.nio.charset.StandardCharsets; +import org.jspecify.annotations.NullMarked; /** * Static methods pertaining to ASCII characters (those in the range of values {@code 0x00} through @@ -38,7 +39,7 @@ * @since 7.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class Ascii { private Ascii() {} diff --git a/android/guava/src/com/google/common/base/CaseFormat.java b/android/guava/src/com/google/common/base/CaseFormat.java index 93fa7e4b7665..8869784d386e 100644 --- a/android/guava/src/com/google/common/base/CaseFormat.java +++ b/android/guava/src/com/google/common/base/CaseFormat.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * Utility class for converting between various ASCII case formats. Behavior is undefined for @@ -29,7 +30,7 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public enum CaseFormat { /** Hyphenated variable naming convention, e.g., "lower-hyphen". */ LOWER_HYPHEN(CharMatcher.is('-'), "-") { diff --git a/android/guava/src/com/google/common/base/CharMatcher.java b/android/guava/src/com/google/common/base/CharMatcher.java index eab84634fde0..6cbcd100b824 100644 --- a/android/guava/src/com/google/common/base/CharMatcher.java +++ b/android/guava/src/com/google/common/base/CharMatcher.java @@ -23,6 +23,7 @@ import com.google.common.annotations.VisibleForTesting; import java.util.Arrays; import java.util.BitSet; +import org.jspecify.annotations.NullMarked; /** * Determines a true or false value for any Java {@code char} value, just as {@link Predicate} does @@ -61,7 +62,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class CharMatcher implements Predicate { /* * N777777777NO diff --git a/android/guava/src/com/google/common/base/Charsets.java b/android/guava/src/com/google/common/base/Charsets.java index b2223ab97e76..2152526347f2 100644 --- a/android/guava/src/com/google/common/base/Charsets.java +++ b/android/guava/src/com/google/common/base/Charsets.java @@ -19,6 +19,7 @@ import com.google.common.annotations.J2ktIncompatible; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import org.jspecify.annotations.NullMarked; /** * Contains constant definitions for the six standard {@link Charset} instances, which are @@ -33,7 +34,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public final class Charsets { /** diff --git a/android/guava/src/com/google/common/base/CommonMatcher.java b/android/guava/src/com/google/common/base/CommonMatcher.java index d63b46b5d48f..909c2fd2a9d9 100644 --- a/android/guava/src/com/google/common/base/CommonMatcher.java +++ b/android/guava/src/com/google/common/base/CommonMatcher.java @@ -15,6 +15,7 @@ package com.google.common.base; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; /** * The subset of the {@link java.util.regex.Matcher} API which is used by this package, and also @@ -22,7 +23,7 @@ * javadoc for details. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class CommonMatcher { public abstract boolean matches(); diff --git a/android/guava/src/com/google/common/base/CommonPattern.java b/android/guava/src/com/google/common/base/CommonPattern.java index c425d52609d6..6e6a6ff49f0c 100644 --- a/android/guava/src/com/google/common/base/CommonPattern.java +++ b/android/guava/src/com/google/common/base/CommonPattern.java @@ -15,6 +15,7 @@ package com.google.common.base; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; /** * The subset of the {@link java.util.regex.Pattern} API which is used by this package, and also @@ -22,7 +23,7 @@ * javadoc for details. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class CommonPattern { public abstract CommonMatcher matcher(CharSequence t); diff --git a/android/guava/src/com/google/common/base/Converter.java b/android/guava/src/com/google/common/base/Converter.java index 789050fd17e1..8a033f6db101 100644 --- a/android/guava/src/com/google/common/base/Converter.java +++ b/android/guava/src/com/google/common/base/Converter.java @@ -26,6 +26,7 @@ import java.io.Serializable; import java.util.Iterator; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * A function from {@code A} to {@code B} with an associated reverse function from {@code B} @@ -115,7 +116,7 @@ * @since 16.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked /* * 1. The type parameter is rather than so that we can use T in the * doForward and doBackward methods to indicate that the parameter cannot be null. (We also take diff --git a/android/guava/src/com/google/common/base/Defaults.java b/android/guava/src/com/google/common/base/Defaults.java index 089f4b572438..2d5b34b96d8d 100644 --- a/android/guava/src/com/google/common/base/Defaults.java +++ b/android/guava/src/com/google/common/base/Defaults.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * This class provides default values for all Java types, as defined by the JLS. @@ -28,7 +29,7 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class Defaults { private Defaults() {} diff --git a/android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 890e3a36062a..000000000000 --- a/android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 The Guava Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.common.base; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import com.google.common.annotations.GwtCompatible; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import javax.annotation.Nonnull; -import javax.annotation.meta.TypeQualifierDefault; - -/** - * Marks all "top-level" types as non-null in a way that is recognized by Kotlin. Note that this - * unfortunately includes type-variable usages, so we also provide {@link ParametricNullness} to - * "undo" it as best we can. - */ -@GwtCompatible -@Retention(RUNTIME) -@Target(TYPE) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/base/Enums.java b/android/guava/src/com/google/common/base/Enums.java index d1749f016d08..c2a8808d6d7c 100644 --- a/android/guava/src/com/google/common/base/Enums.java +++ b/android/guava/src/com/google/common/base/Enums.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.WeakHashMap; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * Utility methods for working with {@link Enum} instances. @@ -35,7 +36,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class Enums { private Enums() {} diff --git a/android/guava/src/com/google/common/base/Equivalence.java b/android/guava/src/com/google/common/base/Equivalence.java index 02c3423016b8..4faf6f167177 100644 --- a/android/guava/src/com/google/common/base/Equivalence.java +++ b/android/guava/src/com/google/common/base/Equivalence.java @@ -21,6 +21,7 @@ import java.io.Serializable; import javax.annotation.CheckForNull; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ * source-compatible since 4.0) */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked /* * The type parameter is rather than so that we can use T in the * doEquivalent and doHash methods to indicate that the parameter cannot be null. diff --git a/android/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java b/android/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java index 677075522028..7dda55087c7b 100644 --- a/android/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java +++ b/android/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java @@ -15,11 +15,12 @@ package com.google.common.base; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; /** * Holder for extra methods of {@code Objects} only in web. Intended to be empty for regular * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked abstract class ExtraObjectsMethodsForWeb {} diff --git a/android/guava/src/com/google/common/base/FinalizablePhantomReference.java b/android/guava/src/com/google/common/base/FinalizablePhantomReference.java index 6f76b63f7647..0119337fa418 100644 --- a/android/guava/src/com/google/common/base/FinalizablePhantomReference.java +++ b/android/guava/src/com/google/common/base/FinalizablePhantomReference.java @@ -19,6 +19,7 @@ import java.lang.ref.PhantomReference; import java.lang.ref.ReferenceQueue; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * Phantom reference with a {@code finalizeReferent()} method which a background thread invokes @@ -32,7 +33,7 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class FinalizablePhantomReference extends PhantomReference implements FinalizableReference { /** diff --git a/android/guava/src/com/google/common/base/FinalizableReference.java b/android/guava/src/com/google/common/base/FinalizableReference.java index f538f9dc0e1b..693b2e05f1de 100644 --- a/android/guava/src/com/google/common/base/FinalizableReference.java +++ b/android/guava/src/com/google/common/base/FinalizableReference.java @@ -17,6 +17,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.errorprone.annotations.DoNotMock; +import org.jspecify.annotations.NullMarked; /** * Implemented by references that have code to run after garbage collection of their referents. @@ -28,7 +29,7 @@ @DoNotMock("Use an instance of one of the Finalizable*Reference classes") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface FinalizableReference { /** * Invoked on a background thread after the referent has been garbage collected unless security diff --git a/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java b/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java index 1662342fd5fa..9446fda821fc 100644 --- a/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java +++ b/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java @@ -29,6 +29,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * A reference queue with an associated background thread that dequeues references and invokes @@ -138,7 +139,7 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FinalizableReferenceQueue implements Closeable { /* * The Finalizer thread keeps a phantom reference to this object. When the client (for example, a diff --git a/android/guava/src/com/google/common/base/FinalizableSoftReference.java b/android/guava/src/com/google/common/base/FinalizableSoftReference.java index f4b7c80050fb..a740b801fec7 100644 --- a/android/guava/src/com/google/common/base/FinalizableSoftReference.java +++ b/android/guava/src/com/google/common/base/FinalizableSoftReference.java @@ -19,6 +19,7 @@ import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * Soft reference with a {@code finalizeReferent()} method which a background thread invokes after @@ -30,7 +31,7 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class FinalizableSoftReference extends SoftReference implements FinalizableReference { /** diff --git a/android/guava/src/com/google/common/base/FinalizableWeakReference.java b/android/guava/src/com/google/common/base/FinalizableWeakReference.java index 12c8dfbfceb3..82833e1a3e26 100644 --- a/android/guava/src/com/google/common/base/FinalizableWeakReference.java +++ b/android/guava/src/com/google/common/base/FinalizableWeakReference.java @@ -19,6 +19,7 @@ import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * Weak reference with a {@code finalizeReferent()} method which a background thread invokes after @@ -30,7 +31,7 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class FinalizableWeakReference extends WeakReference implements FinalizableReference { /** diff --git a/android/guava/src/com/google/common/base/Function.java b/android/guava/src/com/google/common/base/Function.java index bbc185dc88b4..7f09381025ca 100644 --- a/android/guava/src/com/google/common/base/Function.java +++ b/android/guava/src/com/google/common/base/Function.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface Function { /** * Returns the result of applying this function to {@code input}. This method is generally diff --git a/android/guava/src/com/google/common/base/FunctionalEquivalence.java b/android/guava/src/com/google/common/base/FunctionalEquivalence.java index 1cd8c416d39a..c679f41ca8fd 100644 --- a/android/guava/src/com/google/common/base/FunctionalEquivalence.java +++ b/android/guava/src/com/google/common/base/FunctionalEquivalence.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -28,7 +29,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class FunctionalEquivalence extends Equivalence implements Serializable { private static final long serialVersionUID = 0; diff --git a/android/guava/src/com/google/common/base/Functions.java b/android/guava/src/com/google/common/base/Functions.java index 67f8abb520e4..3446b203ee5d 100644 --- a/android/guava/src/com/google/common/base/Functions.java +++ b/android/guava/src/com/google/common/base/Functions.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.util.Map; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class Functions { private Functions() {} diff --git a/android/guava/src/com/google/common/base/IgnoreJRERequirement.java b/android/guava/src/com/google/common/base/IgnoreJRERequirement.java index c34a9cdd974b..bcfc8c90f0a5 100644 --- a/android/guava/src/com/google/common/base/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/base/IgnoreJRERequirement.java @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/base/Internal.java b/android/guava/src/com/google/common/base/Internal.java index 0e1ee2400f24..702fe88d2ad3 100644 --- a/android/guava/src/com/google/common/base/Internal.java +++ b/android/guava/src/com/google/common/base/Internal.java @@ -17,11 +17,12 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import java.time.Duration; +import org.jspecify.annotations.NullMarked; /** This class is for {@code com.google.common.base} use only! */ @J2ktIncompatible @GwtIncompatible // java.time.Duration -@ElementTypesAreNonnullByDefault +@NullMarked final class Internal { /** diff --git a/android/guava/src/com/google/common/base/Java8Compatibility.java b/android/guava/src/com/google/common/base/Java8Compatibility.java index 2dfbd6b1cf19..a1a2fd17d128 100644 --- a/android/guava/src/com/google/common/base/Java8Compatibility.java +++ b/android/guava/src/com/google/common/base/Java8Compatibility.java @@ -17,6 +17,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import java.nio.Buffer; +import org.jspecify.annotations.NullMarked; /** * Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See @@ -24,7 +25,7 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class Java8Compatibility { static void clear(Buffer b) { b.clear(); diff --git a/android/guava/src/com/google/common/base/JdkPattern.java b/android/guava/src/com/google/common/base/JdkPattern.java index 4788398b7c20..cbcc39198ce1 100644 --- a/android/guava/src/com/google/common/base/JdkPattern.java +++ b/android/guava/src/com/google/common/base/JdkPattern.java @@ -18,9 +18,10 @@ import java.io.Serializable; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jspecify.annotations.NullMarked; /** A regex pattern implementation which is backed by the {@link Pattern}. */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtIncompatible final class JdkPattern extends CommonPattern implements Serializable { private final Pattern pattern; diff --git a/android/guava/src/com/google/common/base/Joiner.java b/android/guava/src/com/google/common/base/Joiner.java index 2ba41d2ba16d..1b8acc7ddb17 100644 --- a/android/guava/src/com/google/common/base/Joiner.java +++ b/android/guava/src/com/google/common/base/Joiner.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Map.Entry; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -65,7 +66,7 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class Joiner { /** Returns a joiner which automatically places {@code separator} between consecutive elements. */ public static Joiner on(String separator) { diff --git a/android/guava/src/com/google/common/base/MoreObjects.java b/android/guava/src/com/google/common/base/MoreObjects.java index 1b6d5d7195bd..0e9534066d68 100644 --- a/android/guava/src/com/google/common/base/MoreObjects.java +++ b/android/guava/src/com/google/common/base/MoreObjects.java @@ -23,6 +23,7 @@ import java.util.Collection; import java.util.Map; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * Helper functions that operate on any {@code Object}, and are not already provided in {@link @@ -36,7 +37,7 @@ * @since 18.0 (since 2.0 as {@code Objects}) */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class MoreObjects { /** * Returns the first of two given parameters that is not {@code null}, if either is, or otherwise diff --git a/android/guava/src/com/google/common/base/NullnessCasts.java b/android/guava/src/com/google/common/base/NullnessCasts.java index 1ada6bf26148..517c5a98a694 100644 --- a/android/guava/src/com/google/common/base/NullnessCasts.java +++ b/android/guava/src/com/google/common/base/NullnessCasts.java @@ -16,11 +16,12 @@ import com.google.common.annotations.GwtCompatible; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class NullnessCasts { /** * Accepts a {@code @Nullable T} and returns a plain {@code T}, without performing any check that diff --git a/android/guava/src/com/google/common/base/Objects.java b/android/guava/src/com/google/common/base/Objects.java index 6d33497b642f..e0b97894b6d0 100644 --- a/android/guava/src/com/google/common/base/Objects.java +++ b/android/guava/src/com/google/common/base/Objects.java @@ -17,6 +17,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Arrays; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class Objects extends ExtraObjectsMethodsForWeb { private Objects() {} diff --git a/android/guava/src/com/google/common/base/Optional.java b/android/guava/src/com/google/common/base/Optional.java index 97134fba901d..b9a5188f060a 100644 --- a/android/guava/src/com/google/common/base/Optional.java +++ b/android/guava/src/com/google/common/base/Optional.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.Set; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; /** * An immutable object that may contain a non-null reference to another object. Each instance of @@ -84,7 +85,7 @@ */ @DoNotMock("Use Optional.of(value) or Optional.absent()") @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class Optional implements Serializable { /** * Returns an {@code Optional} instance with no contained reference. diff --git a/android/guava/src/com/google/common/base/PairwiseEquivalence.java b/android/guava/src/com/google/common/base/PairwiseEquivalence.java index ea40518c5a50..90152de4ff47 100644 --- a/android/guava/src/com/google/common/base/PairwiseEquivalence.java +++ b/android/guava/src/com/google/common/base/PairwiseEquivalence.java @@ -18,10 +18,11 @@ import java.io.Serializable; import java.util.Iterator; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class PairwiseEquivalence extends Equivalence> implements Serializable { final Equivalence elementEquivalence; diff --git a/android/guava/src/com/google/common/base/ParametricNullness.java b/android/guava/src/com/google/common/base/ParametricNullness.java index 0bcc65dc2eb5..3fadb315554a 100644 --- a/android/guava/src/com/google/common/base/ParametricNullness.java +++ b/android/guava/src/com/google/common/base/ParametricNullness.java @@ -56,8 +56,8 @@ *