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..01d6667a2ae5 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 @@ -32,7 +32,6 @@ @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 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..ed7de85226ce 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 @@ -42,7 +42,6 @@ @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 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..0e9ccfa3993e 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 @@ -45,7 +45,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..40f093b3e9c2 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 @@ -43,7 +43,6 @@ @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 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..7f85e9a7bef7 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 @@ -34,7 +34,6 @@ * @author George van den Driessche */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..822cc0360355 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 @@ -41,7 +41,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..69f08865c935 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 @@ -47,7 +47,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..d9b581071bbb 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 @@ -26,5 +26,4 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @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..c9f31132f9f3 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 @@ -85,7 +85,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..3658a9614c1f 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 @@ -36,7 +36,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..3001067217fb 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 @@ -48,7 +48,6 @@ // check the order if so. // TODO: Refactor to share code with SetTestBuilder etc. @GwtCompatible -@ElementTypesAreNonnullByDefault 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..9744adad3f1d 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 @@ -33,7 +33,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..33faa54bed85 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 @@ -34,7 +34,6 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..8ce1de8073a6 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 @@ -31,7 +31,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..c6d22c8a3489 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 @@ -32,7 +32,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..b6919b4d1cba 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 @@ -35,7 +35,6 @@ /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..15228e49509f 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 @@ -31,7 +31,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..e9580c18733c 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 @@ -50,7 +50,6 @@ * @since 33.4.0 (but since 21.0 in the JRE flavor) */ @GwtCompatible -@ElementTypesAreNonnullByDefault @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..b7542b55b654 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 @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..1812f14481eb 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 @@ -26,6 +26,5 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..6aa0c33d3852 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 @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..125e41f5e82c 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 @@ -30,7 +30,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..099282bfa8ca 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 @@ -30,7 +30,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..48b0bc254f71 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 @@ -29,7 +29,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..9cd9ecb43d6b 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 @@ -27,7 +27,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..20a9ea739138 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 @@ -29,7 +29,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..74879e4574de 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 @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..d388bc0e796d 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 @@ -31,7 +31,6 @@ * @author Jesse Wilson */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..b31d43d6aba5 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 @@ -26,7 +26,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..d84cba6512ee 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 @@ -26,7 +26,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..5f188900cf2a 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 @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..9dbc4ef89766 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 @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..cddd34630593 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 @@ -26,7 +26,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..f9c58cd7f333 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 @@ -27,7 +27,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..7e22ab143059 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 @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..fe9cf74dad2a 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 @@ -31,7 +31,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..16cb2539d1f3 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 @@ -27,7 +27,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..1724bb2c8dc6 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 @@ -27,7 +27,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..3737bc71d9b8 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 @@ -30,7 +30,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..36fbb2b1cffc 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 @@ -28,7 +28,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..cf46ea617f63 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 @@ -27,7 +27,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..9b4602d045d8 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 @@ -27,7 +27,6 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..f7fc7225ad66 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 @@ -34,7 +34,6 @@ @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 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..71b92f582095 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 @@ -32,7 +32,6 @@ @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 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..39e64bfb3650 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 @@ -40,7 +40,6 @@ @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 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..7dc245387930 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 @@ -33,7 +33,6 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..2f519eabbd09 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 @@ -42,7 +42,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..7fdbbd7266ed 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 @@ -37,7 +37,6 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..aabb101db2a4 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 @@ -47,7 +47,6 @@ @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 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..1bc9be12bcc5 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 @@ -47,7 +47,6 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..683331d429d8 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 @@ -39,7 +39,6 @@ @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 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..c300d77a6ae8 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 @@ -49,7 +49,6 @@ @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 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..5ec4a49ffbb2 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 @@ -40,7 +40,6 @@ @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 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..c52a7d412e42 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 @@ -42,7 +42,6 @@ @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 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..e49fe2260991 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 @@ -35,7 +35,6 @@ /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..95f62ba1828d 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 @@ -62,7 +62,6 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..19dc5ac66a34 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 @@ -47,7 +47,6 @@ @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 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..11a15fdf6ea8 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 @@ -42,7 +42,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..938154983965 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 @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..72bfe4192011 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 @@ -31,7 +31,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..e9a3a9b9b470 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 @@ -26,6 +26,5 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..03e783682e00 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 @@ -30,7 +30,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..f9bd19f4662e 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 @@ -27,7 +27,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..8eca2d33205f 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 @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..13e7bee946ed 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 @@ -32,7 +32,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..eeacf5d1932c 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 @@ -28,7 +28,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..867258e12cfb 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 @@ -31,7 +31,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..8c24a59a5dba 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 @@ -44,7 +44,6 @@ * @author Robert Konigsberg */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..a1a02937b929 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 @@ -31,7 +31,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault @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..1013d4c411f2 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 @@ -53,7 +53,6 @@ @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 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..9e3220f0a6a9 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 @@ -42,7 +42,6 @@ @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 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..5b9bcea60f38 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 @@ -39,7 +39,6 @@ @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 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..0b8482dbd7b8 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 @@ -40,7 +40,6 @@ @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 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..a4068063adbd 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 @@ -41,7 +41,6 @@ @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 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..11b35d37ffc5 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 @@ -26,5 +26,4 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @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..2fd2289f6a3c 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 @@ -53,7 +53,6 @@ @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 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..ab98ed331c6a 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 @@ -54,7 +54,6 @@ @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 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..ebe379d8d661 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 @@ -39,7 +39,6 @@ /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..7f54eb4f7ff3 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 @@ -42,7 +42,6 @@ @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 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..92eca0686ec3 100644 --- a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -171,7 +171,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault 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..54a606d90cb4 100644 --- a/android/guava-testlib/src/com/google/common/testing/ClusterException.java +++ b/android/guava-testlib/src/com/google/common/testing/ClusterException.java @@ -59,7 +59,6 @@ * @author Luiz-Otavio Zorzella */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..692361e9aa9b 100644 --- a/android/guava-testlib/src/com/google/common/testing/DummyProxy.java +++ b/android/guava-testlib/src/com/google/common/testing/DummyProxy.java @@ -40,7 +40,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault 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..4e488f40f7c4 100644 --- a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -76,7 +76,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..b69072984683 100644 --- a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -50,7 +50,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..999bb3c374f8 100644 --- a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -40,7 +40,6 @@ * @author Jige Yu * @since 10.0 */ -@ElementTypesAreNonnullByDefault @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..d7d3ec5a8ab6 100644 --- a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -57,7 +57,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault 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..40a4662ee51d 100644 --- a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -107,7 +107,6 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // gc -@ElementTypesAreNonnullByDefault 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..1d6159b03b16 100644 --- a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -67,7 +67,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault 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..63197c66de7a 100644 --- a/android/guava-testlib/src/com/google/common/testing/Platform.java +++ b/android/guava-testlib/src/com/google/common/testing/Platform.java @@ -32,7 +32,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..1ffed6bb67b7 100644 --- a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -33,7 +33,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..72d3ea4c3b72 100644 --- a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtCompatible // but no-op! -@ElementTypesAreNonnullByDefault 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..1be61b8566bc 100644 --- a/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java @@ -30,7 +30,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..7c41a8f07b82 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDown.java @@ -25,7 +25,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..3625f62734d3 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java @@ -27,7 +27,6 @@ */ @DoNotMock("Implement with a lambda") @GwtCompatible -@ElementTypesAreNonnullByDefault 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..f34c2808147f 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownStack.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownStack.java @@ -37,7 +37,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..0f6a83c5ab82 100644 --- a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -53,7 +53,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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/TestPlatform.java b/android/guava-tests/test/com/google/common/util/concurrent/TestPlatform.java index 501e52d828d9..cd434f44c191 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/TestPlatform.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/TestPlatform.java @@ -29,9 +29,11 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeoutException; +import org.jspecify.annotations.NullUnmarked; /** Methods factored out so that they can be emulated differently in GWT. */ @GwtCompatible(emulated = true) +@NullUnmarked final class TestPlatform { static void verifyGetOnPendingFuture(Future future) { checkNotNull(future); 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..5e710a9bfdab 100644 --- a/android/guava/src/com/google/common/base/Absent.java +++ b/android/guava/src/com/google/common/base/Absent.java @@ -23,7 +23,6 @@ /** Implementation of an {@link Optional} not containing a reference. */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..09290a80e7b6 100644 --- a/android/guava/src/com/google/common/base/AbstractIterator.java +++ b/android/guava/src/com/google/common/base/AbstractIterator.java @@ -29,7 +29,6 @@ * reasons). */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..d8f5dc5f9757 100644 --- a/android/guava/src/com/google/common/base/Ascii.java +++ b/android/guava/src/com/google/common/base/Ascii.java @@ -38,7 +38,6 @@ * @since 7.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..12fb7107e6ec 100644 --- a/android/guava/src/com/google/common/base/CaseFormat.java +++ b/android/guava/src/com/google/common/base/CaseFormat.java @@ -29,7 +29,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..1c03a2e43771 100644 --- a/android/guava/src/com/google/common/base/CharMatcher.java +++ b/android/guava/src/com/google/common/base/CharMatcher.java @@ -61,7 +61,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..aa371a5735b4 100644 --- a/android/guava/src/com/google/common/base/Charsets.java +++ b/android/guava/src/com/google/common/base/Charsets.java @@ -33,7 +33,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..6d14c6bc2630 100644 --- a/android/guava/src/com/google/common/base/CommonMatcher.java +++ b/android/guava/src/com/google/common/base/CommonMatcher.java @@ -22,7 +22,6 @@ * javadoc for details. */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..6be5b01408aa 100644 --- a/android/guava/src/com/google/common/base/CommonPattern.java +++ b/android/guava/src/com/google/common/base/CommonPattern.java @@ -22,7 +22,6 @@ * javadoc for details. */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..386bbfcf9c5a 100644 --- a/android/guava/src/com/google/common/base/Converter.java +++ b/android/guava/src/com/google/common/base/Converter.java @@ -115,7 +115,6 @@ * @since 16.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault /* * 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..020e1e2d9c3e 100644 --- a/android/guava/src/com/google/common/base/Defaults.java +++ b/android/guava/src/com/google/common/base/Defaults.java @@ -28,7 +28,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault 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..69713c9fe23d 100644 --- a/android/guava/src/com/google/common/base/Enums.java +++ b/android/guava/src/com/google/common/base/Enums.java @@ -35,7 +35,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault 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..9aac7221121f 100644 --- a/android/guava/src/com/google/common/base/Equivalence.java +++ b/android/guava/src/com/google/common/base/Equivalence.java @@ -40,7 +40,6 @@ * source-compatible since 4.0) */ @GwtCompatible -@ElementTypesAreNonnullByDefault /* * 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..21cca2c109d6 100644 --- a/android/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java +++ b/android/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault 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..8392387f2647 100644 --- a/android/guava/src/com/google/common/base/FinalizablePhantomReference.java +++ b/android/guava/src/com/google/common/base/FinalizablePhantomReference.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault 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..d7e91e46e0ee 100644 --- a/android/guava/src/com/google/common/base/FinalizableReference.java +++ b/android/guava/src/com/google/common/base/FinalizableReference.java @@ -28,7 +28,6 @@ @DoNotMock("Use an instance of one of the Finalizable*Reference classes") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault 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..21656e3363e5 100644 --- a/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java +++ b/android/guava/src/com/google/common/base/FinalizableReferenceQueue.java @@ -138,7 +138,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault 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..c97acd2abcbd 100644 --- a/android/guava/src/com/google/common/base/FinalizableSoftReference.java +++ b/android/guava/src/com/google/common/base/FinalizableSoftReference.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault 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..76ed780f46d9 100644 --- a/android/guava/src/com/google/common/base/FinalizableWeakReference.java +++ b/android/guava/src/com/google/common/base/FinalizableWeakReference.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault 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..1d85bdcb5d6a 100644 --- a/android/guava/src/com/google/common/base/Function.java +++ b/android/guava/src/com/google/common/base/Function.java @@ -44,7 +44,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..f40ea7301428 100644 --- a/android/guava/src/com/google/common/base/FunctionalEquivalence.java +++ b/android/guava/src/com/google/common/base/FunctionalEquivalence.java @@ -28,7 +28,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..91336b00509a 100644 --- a/android/guava/src/com/google/common/base/Functions.java +++ b/android/guava/src/com/google/common/base/Functions.java @@ -38,7 +38,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..4d6cfd48da94 100644 --- a/android/guava/src/com/google/common/base/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/base/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @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..648d1c40638e 100644 --- a/android/guava/src/com/google/common/base/Internal.java +++ b/android/guava/src/com/google/common/base/Internal.java @@ -21,7 +21,6 @@ /** This class is for {@code com.google.common.base} use only! */ @J2ktIncompatible @GwtIncompatible // java.time.Duration -@ElementTypesAreNonnullByDefault 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..d3ee13968bc2 100644 --- a/android/guava/src/com/google/common/base/Java8Compatibility.java +++ b/android/guava/src/com/google/common/base/Java8Compatibility.java @@ -24,7 +24,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault 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..f7791dba6e95 100644 --- a/android/guava/src/com/google/common/base/JdkPattern.java +++ b/android/guava/src/com/google/common/base/JdkPattern.java @@ -20,7 +20,6 @@ import java.util.regex.Pattern; /** A regex pattern implementation which is backed by the {@link Pattern}. */ -@ElementTypesAreNonnullByDefault @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..b8cb4825c384 100644 --- a/android/guava/src/com/google/common/base/Joiner.java +++ b/android/guava/src/com/google/common/base/Joiner.java @@ -65,7 +65,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..584366e0b972 100644 --- a/android/guava/src/com/google/common/base/MoreObjects.java +++ b/android/guava/src/com/google/common/base/MoreObjects.java @@ -36,7 +36,6 @@ * @since 18.0 (since 2.0 as {@code Objects}) */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..4095fcb1cd61 100644 --- a/android/guava/src/com/google/common/base/NullnessCasts.java +++ b/android/guava/src/com/google/common/base/NullnessCasts.java @@ -20,7 +20,6 @@ /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..7dfafe67d076 100644 --- a/android/guava/src/com/google/common/base/Objects.java +++ b/android/guava/src/com/google/common/base/Objects.java @@ -30,7 +30,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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..047fcec0d75e 100644 --- a/android/guava/src/com/google/common/base/Optional.java +++ b/android/guava/src/com/google/common/base/Optional.java @@ -84,7 +84,6 @@ */ @DoNotMock("Use Optional.of(value) or Optional.absent()") @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault 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..6ff7c3fe3c6b 100644 --- a/android/guava/src/com/google/common/base/PairwiseEquivalence.java +++ b/android/guava/src/com/google/common/base/PairwiseEquivalence.java @@ -21,7 +21,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault 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 @@ *

    *
  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
  • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/base/PatternCompiler.java b/android/guava/src/com/google/common/base/PatternCompiler.java index f33d38ba06d4..90a565b1e470 100644 --- a/android/guava/src/com/google/common/base/PatternCompiler.java +++ b/android/guava/src/com/google/common/base/PatternCompiler.java @@ -23,7 +23,6 @@ * java.util.ServiceLoader} mechanism. */ @GwtIncompatible -@ElementTypesAreNonnullByDefault interface PatternCompiler { /** * Compiles the given pattern. diff --git a/android/guava/src/com/google/common/base/Platform.java b/android/guava/src/com/google/common/base/Platform.java index b937ea3dd0f9..c865c01f9544 100644 --- a/android/guava/src/com/google/common/base/Platform.java +++ b/android/guava/src/com/google/common/base/Platform.java @@ -26,7 +26,6 @@ * @author Jesse Wilson */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { private static final PatternCompiler patternCompiler = loadPatternCompiler(); diff --git a/android/guava/src/com/google/common/base/Preconditions.java b/android/guava/src/com/google/common/base/Preconditions.java index 6d00d46ff365..93ee075ea1b1 100644 --- a/android/guava/src/com/google/common/base/Preconditions.java +++ b/android/guava/src/com/google/common/base/Preconditions.java @@ -114,7 +114,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Preconditions { private Preconditions() {} diff --git a/android/guava/src/com/google/common/base/Predicate.java b/android/guava/src/com/google/common/base/Predicate.java index dc68b0e6725c..1949acbf68f0 100644 --- a/android/guava/src/com/google/common/base/Predicate.java +++ b/android/guava/src/com/google/common/base/Predicate.java @@ -45,7 +45,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Predicate { /** * Returns the result of applying this predicate to {@code input} (Java 8+ users, see notes in the diff --git a/android/guava/src/com/google/common/base/Predicates.java b/android/guava/src/com/google/common/base/Predicates.java index 17c2bf5c5baf..6ad0071aa8f9 100644 --- a/android/guava/src/com/google/common/base/Predicates.java +++ b/android/guava/src/com/google/common/base/Predicates.java @@ -40,7 +40,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Predicates { private Predicates() {} diff --git a/android/guava/src/com/google/common/base/Present.java b/android/guava/src/com/google/common/base/Present.java index 4e62da29e93b..ef79240f1e1c 100644 --- a/android/guava/src/com/google/common/base/Present.java +++ b/android/guava/src/com/google/common/base/Present.java @@ -23,7 +23,6 @@ /** Implementation of an {@link Optional} containing a reference. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Present extends Optional { private final T reference; diff --git a/android/guava/src/com/google/common/base/SmallCharMatcher.java b/android/guava/src/com/google/common/base/SmallCharMatcher.java index f0e801b67118..1e565c858b96 100644 --- a/android/guava/src/com/google/common/base/SmallCharMatcher.java +++ b/android/guava/src/com/google/common/base/SmallCharMatcher.java @@ -26,7 +26,6 @@ * @author Christopher Swenson */ @GwtIncompatible // no precomputation is done in GWT -@ElementTypesAreNonnullByDefault final class SmallCharMatcher extends NamedFastMatcher { static final int MAX_SIZE = 1023; private final char[] table; diff --git a/android/guava/src/com/google/common/base/Splitter.java b/android/guava/src/com/google/common/base/Splitter.java index 70a379796be7..bd1efa7326de 100644 --- a/android/guava/src/com/google/common/base/Splitter.java +++ b/android/guava/src/com/google/common/base/Splitter.java @@ -99,7 +99,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Splitter { private final CharMatcher trimmer; private final boolean omitEmptyStrings; diff --git a/android/guava/src/com/google/common/base/StandardSystemProperty.java b/android/guava/src/com/google/common/base/StandardSystemProperty.java index 155037761cd5..cb986b4fc033 100644 --- a/android/guava/src/com/google/common/base/StandardSystemProperty.java +++ b/android/guava/src/com/google/common/base/StandardSystemProperty.java @@ -26,7 +26,6 @@ */ @J2ktIncompatible @GwtIncompatible // java.lang.System#getProperty -@ElementTypesAreNonnullByDefault public enum StandardSystemProperty { /** Java Runtime Environment version. */ diff --git a/android/guava/src/com/google/common/base/Stopwatch.java b/android/guava/src/com/google/common/base/Stopwatch.java index f8eec737ca11..48d6250a0411 100644 --- a/android/guava/src/com/google/common/base/Stopwatch.java +++ b/android/guava/src/com/google/common/base/Stopwatch.java @@ -96,7 +96,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("GoodTime") // lots of violations -@ElementTypesAreNonnullByDefault public final class Stopwatch { private final Ticker ticker; private boolean isRunning; diff --git a/android/guava/src/com/google/common/base/Strings.java b/android/guava/src/com/google/common/base/Strings.java index 9b4def0a4af5..4ad59f5747aa 100644 --- a/android/guava/src/com/google/common/base/Strings.java +++ b/android/guava/src/com/google/common/base/Strings.java @@ -32,7 +32,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Strings { private Strings() {} diff --git a/android/guava/src/com/google/common/base/Supplier.java b/android/guava/src/com/google/common/base/Supplier.java index 6081af3c39b8..83e5d594196e 100644 --- a/android/guava/src/com/google/common/base/Supplier.java +++ b/android/guava/src/com/google/common/base/Supplier.java @@ -45,7 +45,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Supplier { /** * Retrieves an instance of the appropriate type. The returned object may or may not be a new diff --git a/android/guava/src/com/google/common/base/Suppliers.java b/android/guava/src/com/google/common/base/Suppliers.java index 9476c21872fc..169e6edff0ab 100644 --- a/android/guava/src/com/google/common/base/Suppliers.java +++ b/android/guava/src/com/google/common/base/Suppliers.java @@ -41,7 +41,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Suppliers { private Suppliers() {} diff --git a/android/guava/src/com/google/common/base/Throwables.java b/android/guava/src/com/google/common/base/Throwables.java index c461316562bc..dffa4690cc60 100644 --- a/android/guava/src/com/google/common/base/Throwables.java +++ b/android/guava/src/com/google/common/base/Throwables.java @@ -46,7 +46,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Throwables { private Throwables() {} diff --git a/android/guava/src/com/google/common/base/Ticker.java b/android/guava/src/com/google/common/base/Ticker.java index 5b7a48688659..e327a4cc907d 100644 --- a/android/guava/src/com/google/common/base/Ticker.java +++ b/android/guava/src/com/google/common/base/Ticker.java @@ -28,7 +28,6 @@ * source-compatible since 9.0) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class Ticker { /** Constructor for use by subclasses. */ protected Ticker() {} diff --git a/android/guava/src/com/google/common/base/Utf8.java b/android/guava/src/com/google/common/base/Utf8.java index c26720364c5e..6c4797670f9f 100644 --- a/android/guava/src/com/google/common/base/Utf8.java +++ b/android/guava/src/com/google/common/base/Utf8.java @@ -36,7 +36,6 @@ * @since 16.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Utf8 { /** * Returns the number of bytes in the UTF-8-encoded form of {@code sequence}. For a string, this diff --git a/android/guava/src/com/google/common/base/Verify.java b/android/guava/src/com/google/common/base/Verify.java index b2e9f5f04faf..a058c69cb602 100644 --- a/android/guava/src/com/google/common/base/Verify.java +++ b/android/guava/src/com/google/common/base/Verify.java @@ -88,7 +88,6 @@ * @since 17.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Verify { /** * Ensures that {@code expression} is {@code true}, throwing a {@code VerifyException} with no diff --git a/android/guava/src/com/google/common/base/VerifyException.java b/android/guava/src/com/google/common/base/VerifyException.java index 10b99dee722b..6ec947b9ff1c 100644 --- a/android/guava/src/com/google/common/base/VerifyException.java +++ b/android/guava/src/com/google/common/base/VerifyException.java @@ -25,7 +25,6 @@ * @since 17.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class VerifyException extends RuntimeException { /** Constructs a {@code VerifyException} with no message. */ public VerifyException() {} diff --git a/android/guava/src/com/google/common/base/internal/Finalizer.java b/android/guava/src/com/google/common/base/internal/Finalizer.java index e8ddf320ce17..9f1bef433083 100644 --- a/android/guava/src/com/google/common/base/internal/Finalizer.java +++ b/android/guava/src/com/google/common/base/internal/Finalizer.java @@ -43,7 +43,6 @@ * collected, and this class can detect when the main class loader has been garbage collected and * stop itself. */ -// no @ElementTypesAreNonNullByDefault for the reasons discussed above public class Finalizer implements Runnable { private static final Logger logger = Logger.getLogger(Finalizer.class.getName()); diff --git a/android/guava/src/com/google/common/base/package-info.java b/android/guava/src/com/google/common/base/package-info.java index bfae42674506..951fc03c1181 100644 --- a/android/guava/src/com/google/common/base/package-info.java +++ b/android/guava/src/com/google/common/base/package-info.java @@ -57,8 +57,6 @@ * Defaults}), as well as a number of classes that have been superseded by additions to the JDK. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.base; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/cache/AbstractCache.java b/android/guava/src/com/google/common/cache/AbstractCache.java index eec5fdc34f56..e5e51a5af5e1 100644 --- a/android/guava/src/com/google/common/cache/AbstractCache.java +++ b/android/guava/src/com/google/common/cache/AbstractCache.java @@ -38,7 +38,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractCache implements Cache { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/cache/AbstractLoadingCache.java b/android/guava/src/com/google/common/cache/AbstractLoadingCache.java index 5081a785b43a..cc8df3faafef 100644 --- a/android/guava/src/com/google/common/cache/AbstractLoadingCache.java +++ b/android/guava/src/com/google/common/cache/AbstractLoadingCache.java @@ -39,7 +39,6 @@ * @since 11.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractLoadingCache extends AbstractCache implements LoadingCache { diff --git a/android/guava/src/com/google/common/cache/Cache.java b/android/guava/src/com/google/common/cache/Cache.java index 985f6658291d..161f93bce572 100644 --- a/android/guava/src/com/google/common/cache/Cache.java +++ b/android/guava/src/com/google/common/cache/Cache.java @@ -42,7 +42,6 @@ */ @DoNotMock("Use CacheBuilder.newBuilder().build()") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Cache { /** diff --git a/android/guava/src/com/google/common/cache/CacheBuilder.java b/android/guava/src/com/google/common/cache/CacheBuilder.java index 2991a317c17b..b7ff90fe0b36 100644 --- a/android/guava/src/com/google/common/cache/CacheBuilder.java +++ b/android/guava/src/com/google/common/cache/CacheBuilder.java @@ -192,7 +192,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class CacheBuilder { private static final int DEFAULT_INITIAL_CAPACITY = 16; private static final int DEFAULT_CONCURRENCY_LEVEL = 4; diff --git a/android/guava/src/com/google/common/cache/CacheBuilderSpec.java b/android/guava/src/com/google/common/cache/CacheBuilderSpec.java index 9bee483cf2e3..8b511b5e6c17 100644 --- a/android/guava/src/com/google/common/cache/CacheBuilderSpec.java +++ b/android/guava/src/com/google/common/cache/CacheBuilderSpec.java @@ -84,7 +84,6 @@ */ @SuppressWarnings("GoodTime") // lots of violations (nanosecond math) @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CacheBuilderSpec { /** Parses a single value. */ private interface ValueParser { diff --git a/android/guava/src/com/google/common/cache/CacheLoader.java b/android/guava/src/com/google/common/cache/CacheLoader.java index 7e7064da98b4..35e00b146607 100644 --- a/android/guava/src/com/google/common/cache/CacheLoader.java +++ b/android/guava/src/com/google/common/cache/CacheLoader.java @@ -55,7 +55,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class CacheLoader { /** Constructor for use by subclasses. */ protected CacheLoader() {} diff --git a/android/guava/src/com/google/common/cache/CacheStats.java b/android/guava/src/com/google/common/cache/CacheStats.java index f9235bb41af1..f39fc2a37e44 100644 --- a/android/guava/src/com/google/common/cache/CacheStats.java +++ b/android/guava/src/com/google/common/cache/CacheStats.java @@ -58,7 +58,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class CacheStats { private final long hitCount; private final long missCount; diff --git a/android/guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index bcf0fcef1c48..000000000000 --- a/android/guava/src/com/google/common/cache/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.cache; - -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/cache/ForwardingCache.java b/android/guava/src/com/google/common/cache/ForwardingCache.java index f118977b09a3..80338024e9eb 100644 --- a/android/guava/src/com/google/common/cache/ForwardingCache.java +++ b/android/guava/src/com/google/common/cache/ForwardingCache.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingCache extends ForwardingObject implements Cache { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/cache/ForwardingLoadingCache.java b/android/guava/src/com/google/common/cache/ForwardingLoadingCache.java index d98e2a6278fa..296c44f484e2 100644 --- a/android/guava/src/com/google/common/cache/ForwardingLoadingCache.java +++ b/android/guava/src/com/google/common/cache/ForwardingLoadingCache.java @@ -32,7 +32,6 @@ * @since 11.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingLoadingCache extends ForwardingCache implements LoadingCache { diff --git a/android/guava/src/com/google/common/cache/IgnoreJRERequirement.java b/android/guava/src/com/google/common/cache/IgnoreJRERequirement.java index c80ab07ea20a..ea6a7b733dec 100644 --- a/android/guava/src/com/google/common/cache/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/cache/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

    Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/cache/LoadingCache.java b/android/guava/src/com/google/common/cache/LoadingCache.java index a782aef55f36..d60e9df8720b 100644 --- a/android/guava/src/com/google/common/cache/LoadingCache.java +++ b/android/guava/src/com/google/common/cache/LoadingCache.java @@ -40,7 +40,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface LoadingCache extends Cache, Function { /** diff --git a/android/guava/src/com/google/common/cache/LocalCache.java b/android/guava/src/com/google/common/cache/LocalCache.java index f4df3a99b6fb..9e98a76fbcd1 100644 --- a/android/guava/src/com/google/common/cache/LocalCache.java +++ b/android/guava/src/com/google/common/cache/LocalCache.java @@ -84,6 +84,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullUnmarked; /** * The concurrent hash map implementation built by {@link CacheBuilder}. @@ -100,7 +101,7 @@ "nullness", // too much trouble for the payoff }) @GwtCompatible(emulated = true) -// TODO(cpovirk): Annotate for nullness. +@NullUnmarked // TODO(cpovirk): Annotate for nullness. class LocalCache extends AbstractMap implements ConcurrentMap { /* diff --git a/android/guava/src/com/google/common/cache/LongAddable.java b/android/guava/src/com/google/common/cache/LongAddable.java index 9851052d6817..eaa641467738 100644 --- a/android/guava/src/com/google/common/cache/LongAddable.java +++ b/android/guava/src/com/google/common/cache/LongAddable.java @@ -22,7 +22,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface LongAddable { void increment(); diff --git a/android/guava/src/com/google/common/cache/LongAddables.java b/android/guava/src/com/google/common/cache/LongAddables.java index 249c6e149d95..e5da7c8b772a 100644 --- a/android/guava/src/com/google/common/cache/LongAddables.java +++ b/android/guava/src/com/google/common/cache/LongAddables.java @@ -24,7 +24,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class LongAddables { private static final Supplier SUPPLIER; diff --git a/android/guava/src/com/google/common/cache/LongAdder.java b/android/guava/src/com/google/common/cache/LongAdder.java index 7ead7e8eccd3..f0c44ffbc697 100644 --- a/android/guava/src/com/google/common/cache/LongAdder.java +++ b/android/guava/src/com/google/common/cache/LongAdder.java @@ -40,7 +40,6 @@ * @author Doug Lea */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class LongAdder extends Striped64 implements Serializable, LongAddable { private static final long serialVersionUID = 7249069246863182397L; diff --git a/android/guava/src/com/google/common/cache/ParametricNullness.java b/android/guava/src/com/google/common/cache/ParametricNullness.java index eaf194d4ab1c..8892bb45267d 100644 --- a/android/guava/src/com/google/common/cache/ParametricNullness.java +++ b/android/guava/src/com/google/common/cache/ParametricNullness.java @@ -56,8 +56,8 @@ *

      *
    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/cache/ReferenceEntry.java b/android/guava/src/com/google/common/cache/ReferenceEntry.java index 8ff2e6c9b4ff..839216ae1112 100644 --- a/android/guava/src/com/google/common/cache/ReferenceEntry.java +++ b/android/guava/src/com/google/common/cache/ReferenceEntry.java @@ -39,7 +39,6 @@ *
    */ @GwtIncompatible -@ElementTypesAreNonnullByDefault interface ReferenceEntry { /** Returns the value reference from this entry. */ @CheckForNull diff --git a/android/guava/src/com/google/common/cache/RemovalCause.java b/android/guava/src/com/google/common/cache/RemovalCause.java index 2e68e68b582c..8ecc1d662736 100644 --- a/android/guava/src/com/google/common/cache/RemovalCause.java +++ b/android/guava/src/com/google/common/cache/RemovalCause.java @@ -26,7 +26,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public enum RemovalCause { /** * The entry was manually removed by the user. This can result from the user invoking {@link diff --git a/android/guava/src/com/google/common/cache/RemovalListener.java b/android/guava/src/com/google/common/cache/RemovalListener.java index a7472d74c6c7..5e738bfa3c19 100644 --- a/android/guava/src/com/google/common/cache/RemovalListener.java +++ b/android/guava/src/com/google/common/cache/RemovalListener.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface RemovalListener { /** * Notifies the listener that a removal occurred at some point in the past. diff --git a/android/guava/src/com/google/common/cache/RemovalListeners.java b/android/guava/src/com/google/common/cache/RemovalListeners.java index 38edf35287af..e5999a4e80e4 100644 --- a/android/guava/src/com/google/common/cache/RemovalListeners.java +++ b/android/guava/src/com/google/common/cache/RemovalListeners.java @@ -26,7 +26,6 @@ * @since 10.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class RemovalListeners { private RemovalListeners() {} diff --git a/android/guava/src/com/google/common/cache/RemovalNotification.java b/android/guava/src/com/google/common/cache/RemovalNotification.java index b96fc570911f..c9af81d832e1 100644 --- a/android/guava/src/com/google/common/cache/RemovalNotification.java +++ b/android/guava/src/com/google/common/cache/RemovalNotification.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class RemovalNotification extends SimpleImmutableEntry<@Nullable K, @Nullable V> { private final RemovalCause cause; diff --git a/android/guava/src/com/google/common/cache/Striped64.java b/android/guava/src/com/google/common/cache/Striped64.java index e8be86e36e5d..e14725dfff53 100644 --- a/android/guava/src/com/google/common/cache/Striped64.java +++ b/android/guava/src/com/google/common/cache/Striped64.java @@ -28,7 +28,6 @@ */ @SuppressWarnings({"SunApi", "removal"}) // b/345822163 @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class Striped64 extends Number { /* * This class maintains a lazily-initialized table of atomically diff --git a/android/guava/src/com/google/common/cache/Weigher.java b/android/guava/src/com/google/common/cache/Weigher.java index d5bcd5b21472..cf552d44ec11 100644 --- a/android/guava/src/com/google/common/cache/Weigher.java +++ b/android/guava/src/com/google/common/cache/Weigher.java @@ -23,7 +23,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Weigher { /** diff --git a/android/guava/src/com/google/common/cache/package-info.java b/android/guava/src/com/google/common/cache/package-info.java index fc678d44a71c..76dacaf5e04e 100644 --- a/android/guava/src/com/google/common/cache/package-info.java +++ b/android/guava/src/com/google/common/cache/package-info.java @@ -29,8 +29,6 @@ * @author Charles Fry */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.cache; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/collect/AbstractBiMap.java b/android/guava/src/com/google/common/collect/AbstractBiMap.java index d8566f2fea78..e723bf4dd893 100644 --- a/android/guava/src/com/google/common/collect/AbstractBiMap.java +++ b/android/guava/src/com/google/common/collect/AbstractBiMap.java @@ -50,7 +50,6 @@ * @author Mike Bostock */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class AbstractBiMap extends ForwardingMap implements BiMap, Serializable { diff --git a/android/guava/src/com/google/common/collect/AbstractIndexedListIterator.java b/android/guava/src/com/google/common/collect/AbstractIndexedListIterator.java index abb3960b261e..441042ee0bde 100644 --- a/android/guava/src/com/google/common/collect/AbstractIndexedListIterator.java +++ b/android/guava/src/com/google/common/collect/AbstractIndexedListIterator.java @@ -31,7 +31,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractIndexedListIterator extends UnmodifiableListIterator { private final int size; diff --git a/android/guava/src/com/google/common/collect/AbstractIterator.java b/android/guava/src/com/google/common/collect/AbstractIterator.java index aa01300bed68..5a26b001adfa 100644 --- a/android/guava/src/com/google/common/collect/AbstractIterator.java +++ b/android/guava/src/com/google/common/collect/AbstractIterator.java @@ -63,7 +63,6 @@ // When making changes to this class, please also update the copy at // com.google.common.base.AbstractIterator @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractIterator extends UnmodifiableIterator { private State state = State.NOT_READY; diff --git a/android/guava/src/com/google/common/collect/AbstractListMultimap.java b/android/guava/src/com/google/common/collect/AbstractListMultimap.java index 51cf8c4d11c0..f7d2f1569325 100644 --- a/android/guava/src/com/google/common/collect/AbstractListMultimap.java +++ b/android/guava/src/com/google/common/collect/AbstractListMultimap.java @@ -36,7 +36,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractListMultimap extends AbstractMapBasedMultimap implements ListMultimap { /** diff --git a/android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java b/android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java index c451acb22822..088fc62be1a3 100644 --- a/android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java +++ b/android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java @@ -86,7 +86,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMapBasedMultimap extends AbstractMultimap implements Serializable { /* diff --git a/android/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java b/android/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java index 45530f267a8e..341fbd1d35c6 100644 --- a/android/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java +++ b/android/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java @@ -45,7 +45,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class AbstractMapBasedMultiset extends AbstractMultiset implements Serializable { diff --git a/android/guava/src/com/google/common/collect/AbstractMapEntry.java b/android/guava/src/com/google/common/collect/AbstractMapEntry.java index e9accf0592c2..32b37b0b8285 100644 --- a/android/guava/src/com/google/common/collect/AbstractMapEntry.java +++ b/android/guava/src/com/google/common/collect/AbstractMapEntry.java @@ -29,7 +29,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMapEntry implements Entry { diff --git a/android/guava/src/com/google/common/collect/AbstractMultimap.java b/android/guava/src/com/google/common/collect/AbstractMultimap.java index 17e84a62a855..8e0af757fcec 100644 --- a/android/guava/src/com/google/common/collect/AbstractMultimap.java +++ b/android/guava/src/com/google/common/collect/AbstractMultimap.java @@ -37,7 +37,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMultimap implements Multimap { @Override diff --git a/android/guava/src/com/google/common/collect/AbstractMultiset.java b/android/guava/src/com/google/common/collect/AbstractMultiset.java index 8203e44598a0..5e4e5f8723c1 100644 --- a/android/guava/src/com/google/common/collect/AbstractMultiset.java +++ b/android/guava/src/com/google/common/collect/AbstractMultiset.java @@ -43,7 +43,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMultiset extends AbstractCollection implements Multiset { // Query Operations diff --git a/android/guava/src/com/google/common/collect/AbstractNavigableMap.java b/android/guava/src/com/google/common/collect/AbstractNavigableMap.java index fa68dc52463e..5a0a28489830 100644 --- a/android/guava/src/com/google/common/collect/AbstractNavigableMap.java +++ b/android/guava/src/com/google/common/collect/AbstractNavigableMap.java @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class AbstractNavigableMap extends IteratorBasedAbstractMap implements NavigableMap { diff --git a/android/guava/src/com/google/common/collect/AbstractRangeSet.java b/android/guava/src/com/google/common/collect/AbstractRangeSet.java index df08b3f64e6a..44eebd023937 100644 --- a/android/guava/src/com/google/common/collect/AbstractRangeSet.java +++ b/android/guava/src/com/google/common/collect/AbstractRangeSet.java @@ -24,7 +24,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class AbstractRangeSet implements RangeSet { AbstractRangeSet() {} diff --git a/android/guava/src/com/google/common/collect/AbstractSequentialIterator.java b/android/guava/src/com/google/common/collect/AbstractSequentialIterator.java index 172fe356cb78..bacd4bfd5694 100644 --- a/android/guava/src/com/google/common/collect/AbstractSequentialIterator.java +++ b/android/guava/src/com/google/common/collect/AbstractSequentialIterator.java @@ -40,7 +40,6 @@ * @since 12.0 (in Guava as {@code AbstractLinkedIterator} since 8.0) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractSequentialIterator extends UnmodifiableIterator { @CheckForNull private T nextOrNull; diff --git a/android/guava/src/com/google/common/collect/AbstractSetMultimap.java b/android/guava/src/com/google/common/collect/AbstractSetMultimap.java index 08e5315c7c22..ab173cb50527 100644 --- a/android/guava/src/com/google/common/collect/AbstractSetMultimap.java +++ b/android/guava/src/com/google/common/collect/AbstractSetMultimap.java @@ -36,7 +36,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractSetMultimap extends AbstractMapBasedMultimap implements SetMultimap { /** diff --git a/android/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java b/android/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java index 676936f0578e..70a1744ea143 100644 --- a/android/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java +++ b/android/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java @@ -32,7 +32,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractSortedKeySortedSetMultimap< K extends @Nullable Object, V extends @Nullable Object> extends AbstractSortedSetMultimap { diff --git a/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java b/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java index 98b6211a71fd..6217ae9ba31a 100644 --- a/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/AbstractSortedMultiset.java @@ -35,7 +35,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class AbstractSortedMultiset extends AbstractMultiset implements SortedMultiset { @GwtTransient final Comparator comparator; diff --git a/android/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java b/android/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java index 91baeed4650f..554c006ccc4a 100644 --- a/android/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java +++ b/android/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java @@ -36,7 +36,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractSortedSetMultimap extends AbstractSetMultimap implements SortedSetMultimap { /** diff --git a/android/guava/src/com/google/common/collect/AbstractTable.java b/android/guava/src/com/google/common/collect/AbstractTable.java index 9484c6cf54e1..bff048a01a69 100644 --- a/android/guava/src/com/google/common/collect/AbstractTable.java +++ b/android/guava/src/com/google/common/collect/AbstractTable.java @@ -36,7 +36,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractTable< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> implements Table { diff --git a/android/guava/src/com/google/common/collect/AllEqualOrdering.java b/android/guava/src/com/google/common/collect/AllEqualOrdering.java index bb1e0027b43d..ef8fe7345a87 100644 --- a/android/guava/src/com/google/common/collect/AllEqualOrdering.java +++ b/android/guava/src/com/google/common/collect/AllEqualOrdering.java @@ -28,7 +28,6 @@ * @author Emily Soldal */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class AllEqualOrdering extends Ordering<@Nullable Object> implements Serializable { static final AllEqualOrdering INSTANCE = new AllEqualOrdering(); diff --git a/android/guava/src/com/google/common/collect/ArrayListMultimap.java b/android/guava/src/com/google/common/collect/ArrayListMultimap.java index ca596845b3a3..da2fdb8c4625 100644 --- a/android/guava/src/com/google/common/collect/ArrayListMultimap.java +++ b/android/guava/src/com/google/common/collect/ArrayListMultimap.java @@ -60,7 +60,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class ArrayListMultimap extends ArrayListMultimapGwtSerializationDependencies { // Default from ArrayList diff --git a/android/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java b/android/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java index 9a8cdfbdbd13..4b12ebf6ed9a 100644 --- a/android/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java +++ b/android/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A dummy superclass to support GWT serialization of the element types of an {@link @@ -30,7 +31,8 @@ *

    TODO(cpovirk): Consider applying this subclass approach to our other types. */ @GwtCompatible(emulated = true) -abstract class ArrayListMultimapGwtSerializationDependencies +abstract class ArrayListMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> extends AbstractListMultimap { ArrayListMultimapGwtSerializationDependencies(Map> map) { super(map); diff --git a/android/guava/src/com/google/common/collect/ArrayTable.java b/android/guava/src/com/google/common/collect/ArrayTable.java index ef2dade62a9a..2fce7e5927e6 100644 --- a/android/guava/src/com/google/common/collect/ArrayTable.java +++ b/android/guava/src/com/google/common/collect/ArrayTable.java @@ -90,7 +90,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class ArrayTable extends AbstractTable implements Serializable { diff --git a/android/guava/src/com/google/common/collect/BaseImmutableMultimap.java b/android/guava/src/com/google/common/collect/BaseImmutableMultimap.java index 2e69c2a92e39..6ebdf14f52fa 100644 --- a/android/guava/src/com/google/common/collect/BaseImmutableMultimap.java +++ b/android/guava/src/com/google/common/collect/BaseImmutableMultimap.java @@ -22,5 +22,4 @@ * retaining additional implementation details of {@link ImmutableMultimap}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class BaseImmutableMultimap extends AbstractMultimap {} diff --git a/android/guava/src/com/google/common/collect/BiMap.java b/android/guava/src/com/google/common/collect/BiMap.java index d95a71eb7ebc..c2694ed9642a 100644 --- a/android/guava/src/com/google/common/collect/BiMap.java +++ b/android/guava/src/com/google/common/collect/BiMap.java @@ -44,7 +44,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface BiMap extends Map { // Modification Operations diff --git a/android/guava/src/com/google/common/collect/BoundType.java b/android/guava/src/com/google/common/collect/BoundType.java index 00ac08c5182c..6f24a6ad62ba 100644 --- a/android/guava/src/com/google/common/collect/BoundType.java +++ b/android/guava/src/com/google/common/collect/BoundType.java @@ -24,7 +24,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public enum BoundType { /** The endpoint value is not considered part of the set ("exclusive"). */ OPEN(false), diff --git a/android/guava/src/com/google/common/collect/ByFunctionOrdering.java b/android/guava/src/com/google/common/collect/ByFunctionOrdering.java index 43ebdddf62b3..f852133e0f98 100644 --- a/android/guava/src/com/google/common/collect/ByFunctionOrdering.java +++ b/android/guava/src/com/google/common/collect/ByFunctionOrdering.java @@ -30,7 +30,6 @@ * elements. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ByFunctionOrdering extends Ordering implements Serializable { final Function function; diff --git a/android/guava/src/com/google/common/collect/CartesianList.java b/android/guava/src/com/google/common/collect/CartesianList.java index a93fb032fec6..7d20c37c56ac 100644 --- a/android/guava/src/com/google/common/collect/CartesianList.java +++ b/android/guava/src/com/google/common/collect/CartesianList.java @@ -32,7 +32,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CartesianList extends AbstractList> implements RandomAccess { private final transient ImmutableList> axes; diff --git a/android/guava/src/com/google/common/collect/ClassToInstanceMap.java b/android/guava/src/com/google/common/collect/ClassToInstanceMap.java index 094a7fdd7655..ddec8f3fffa4 100644 --- a/android/guava/src/com/google/common/collect/ClassToInstanceMap.java +++ b/android/guava/src/com/google/common/collect/ClassToInstanceMap.java @@ -52,7 +52,6 @@ */ @DoNotMock("Use ImmutableClassToInstanceMap or MutableClassToInstanceMap") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface ClassToInstanceMap extends Map, B> { /** diff --git a/android/guava/src/com/google/common/collect/CollectCollectors.java b/android/guava/src/com/google/common/collect/CollectCollectors.java index 5cdf6630e296..3686dec18fd9 100644 --- a/android/guava/src/com/google/common/collect/CollectCollectors.java +++ b/android/guava/src/com/google/common/collect/CollectCollectors.java @@ -41,7 +41,6 @@ /** Collectors utilities for {@code common.collect} internals. */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings("Java7ApiChecker") @IgnoreJRERequirement // used only from APIs with Java 8 types in them // (not used publicly by guava-android as of this writing, but we include it in the jar as a test) diff --git a/android/guava/src/com/google/common/collect/CollectPreconditions.java b/android/guava/src/com/google/common/collect/CollectPreconditions.java index c649b03233e3..98b30c6d5e7b 100644 --- a/android/guava/src/com/google/common/collect/CollectPreconditions.java +++ b/android/guava/src/com/google/common/collect/CollectPreconditions.java @@ -23,7 +23,6 @@ /** Precondition checks useful in collection implementations. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CollectPreconditions { static void checkEntryNotNull(Object key, Object value) { diff --git a/android/guava/src/com/google/common/collect/CollectSpliterators.java b/android/guava/src/com/google/common/collect/CollectSpliterators.java index 31d59012d12a..95bbfa7eb759 100644 --- a/android/guava/src/com/google/common/collect/CollectSpliterators.java +++ b/android/guava/src/com/google/common/collect/CollectSpliterators.java @@ -38,7 +38,6 @@ /** Spliterator utilities for {@code common.collect} internals. */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings("Java7ApiChecker") @IgnoreJRERequirement // used only from APIs that work with Stream final class CollectSpliterators { diff --git a/android/guava/src/com/google/common/collect/Collections2.java b/android/guava/src/com/google/common/collect/Collections2.java index b01c5b41060e..0a3c8c8bf015 100644 --- a/android/guava/src/com/google/common/collect/Collections2.java +++ b/android/guava/src/com/google/common/collect/Collections2.java @@ -53,7 +53,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Collections2 { private Collections2() {} diff --git a/android/guava/src/com/google/common/collect/CompactHashMap.java b/android/guava/src/com/google/common/collect/CompactHashMap.java index 3ebd9d36447c..82c82158081f 100644 --- a/android/guava/src/com/google/common/collect/CompactHashMap.java +++ b/android/guava/src/com/google/common/collect/CompactHashMap.java @@ -80,7 +80,6 @@ * @author Jon Noack */ @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactHashMap extends AbstractMap implements Serializable { /* diff --git a/android/guava/src/com/google/common/collect/CompactHashSet.java b/android/guava/src/com/google/common/collect/CompactHashSet.java index 474763984282..25c1cc76a54d 100644 --- a/android/guava/src/com/google/common/collect/CompactHashSet.java +++ b/android/guava/src/com/google/common/collect/CompactHashSet.java @@ -75,7 +75,6 @@ * @author Jon Noack */ @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactHashSet extends AbstractSet implements Serializable { // TODO(user): cache all field accesses in local vars diff --git a/android/guava/src/com/google/common/collect/CompactHashing.java b/android/guava/src/com/google/common/collect/CompactHashing.java index 2a07d41d56a3..a8f91cb8b4c5 100644 --- a/android/guava/src/com/google/common/collect/CompactHashing.java +++ b/android/guava/src/com/google/common/collect/CompactHashing.java @@ -31,7 +31,6 @@ * @author Jon Noack */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class CompactHashing { private CompactHashing() {} diff --git a/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java b/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java index 38b9a98822f0..75394405de45 100644 --- a/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java +++ b/android/guava/src/com/google/common/collect/CompactLinkedHashMap.java @@ -50,7 +50,6 @@ */ @J2ktIncompatible // no support for access-order mode in LinkedHashMap delegate @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactLinkedHashMap extends CompactHashMap { // TODO(lowasser): implement removeEldestEntry so this can be used as a drop-in replacement diff --git a/android/guava/src/com/google/common/collect/CompactLinkedHashSet.java b/android/guava/src/com/google/common/collect/CompactLinkedHashSet.java index 21d48058ad72..16e9d023cc9c 100644 --- a/android/guava/src/com/google/common/collect/CompactLinkedHashSet.java +++ b/android/guava/src/com/google/common/collect/CompactLinkedHashSet.java @@ -49,7 +49,6 @@ * @author Louis Wasserman */ @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactLinkedHashSet extends CompactHashSet { /** Creates an empty {@code CompactLinkedHashSet} instance. */ diff --git a/android/guava/src/com/google/common/collect/ComparatorOrdering.java b/android/guava/src/com/google/common/collect/ComparatorOrdering.java index 8b3407074421..405ae8430529 100644 --- a/android/guava/src/com/google/common/collect/ComparatorOrdering.java +++ b/android/guava/src/com/google/common/collect/ComparatorOrdering.java @@ -26,7 +26,6 @@ /** An ordering for a pre-existing comparator. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ComparatorOrdering extends Ordering implements Serializable { final Comparator comparator; diff --git a/android/guava/src/com/google/common/collect/Comparators.java b/android/guava/src/com/google/common/collect/Comparators.java index 147b3637ecfd..2b4e950791f6 100644 --- a/android/guava/src/com/google/common/collect/Comparators.java +++ b/android/guava/src/com/google/common/collect/Comparators.java @@ -44,7 +44,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Comparators { private Comparators() {} diff --git a/android/guava/src/com/google/common/collect/ComparisonChain.java b/android/guava/src/com/google/common/collect/ComparisonChain.java index ee4d8ddb4ec9..c1471634f506 100644 --- a/android/guava/src/com/google/common/collect/ComparisonChain.java +++ b/android/guava/src/com/google/common/collect/ComparisonChain.java @@ -54,7 +54,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ComparisonChain { private ComparisonChain() {} diff --git a/android/guava/src/com/google/common/collect/CompoundOrdering.java b/android/guava/src/com/google/common/collect/CompoundOrdering.java index 78d0064286da..4dac31e56a28 100644 --- a/android/guava/src/com/google/common/collect/CompoundOrdering.java +++ b/android/guava/src/com/google/common/collect/CompoundOrdering.java @@ -25,7 +25,6 @@ /** An ordering that tries several comparators in order. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class CompoundOrdering extends Ordering implements Serializable { final Comparator[] comparators; diff --git a/android/guava/src/com/google/common/collect/ComputationException.java b/android/guava/src/com/google/common/collect/ComputationException.java index b05577c412cc..d39160c5c869 100644 --- a/android/guava/src/com/google/common/collect/ComputationException.java +++ b/android/guava/src/com/google/common/collect/ComputationException.java @@ -34,7 +34,6 @@ */ @Deprecated @GwtCompatible -@ElementTypesAreNonnullByDefault public class ComputationException extends RuntimeException { /** Creates a new instance with the given cause. */ public ComputationException(@CheckForNull Throwable cause) { diff --git a/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java b/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java index 35048bccf5c2..087d580daa3e 100644 --- a/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java +++ b/android/guava/src/com/google/common/collect/ConcurrentHashMultiset.java @@ -61,7 +61,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ConcurrentHashMultiset extends AbstractMultiset implements Serializable { /* diff --git a/android/guava/src/com/google/common/collect/ConsumingQueueIterator.java b/android/guava/src/com/google/common/collect/ConsumingQueueIterator.java index 3a923ae21f10..42dd1c2bf886 100644 --- a/android/guava/src/com/google/common/collect/ConsumingQueueIterator.java +++ b/android/guava/src/com/google/common/collect/ConsumingQueueIterator.java @@ -26,7 +26,6 @@ * iterates. This class is not thread safe. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class ConsumingQueueIterator extends AbstractIterator { private final Queue queue; diff --git a/android/guava/src/com/google/common/collect/ContiguousSet.java b/android/guava/src/com/google/common/collect/ContiguousSet.java index 539c67383a21..574e7ff36b57 100644 --- a/android/guava/src/com/google/common/collect/ContiguousSet.java +++ b/android/guava/src/com/google/common/collect/ContiguousSet.java @@ -50,7 +50,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // allow ungenerified Comparable types -@ElementTypesAreNonnullByDefault public abstract class ContiguousSet extends ImmutableSortedSet { /** * Returns a {@code ContiguousSet} containing the same values in the given domain {@linkplain diff --git a/android/guava/src/com/google/common/collect/Count.java b/android/guava/src/com/google/common/collect/Count.java index 7aa555080135..b79dedff35ba 100644 --- a/android/guava/src/com/google/common/collect/Count.java +++ b/android/guava/src/com/google/common/collect/Count.java @@ -24,7 +24,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Count implements Serializable { private int value; diff --git a/android/guava/src/com/google/common/collect/Cut.java b/android/guava/src/com/google/common/collect/Cut.java index b64e054abfae..404f0e851e95 100644 --- a/android/guava/src/com/google/common/collect/Cut.java +++ b/android/guava/src/com/google/common/collect/Cut.java @@ -32,7 +32,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class Cut implements Comparable>, Serializable { final C endpoint; diff --git a/android/guava/src/com/google/common/collect/DenseImmutableTable.java b/android/guava/src/com/google/common/collect/DenseImmutableTable.java index 88620dc4a1e5..3f78a3af645b 100644 --- a/android/guava/src/com/google/common/collect/DenseImmutableTable.java +++ b/android/guava/src/com/google/common/collect/DenseImmutableTable.java @@ -30,7 +30,6 @@ /** A {@code RegularImmutableTable} optimized for dense data. */ @GwtCompatible @Immutable(containerOf = {"R", "C", "V"}) -@ElementTypesAreNonnullByDefault final class DenseImmutableTable extends RegularImmutableTable { private final ImmutableMap rowKeyToIndex; private final ImmutableMap columnKeyToIndex; diff --git a/android/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java index 931c3e72c70a..975d61d8eec2 100644 --- a/android/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java @@ -25,7 +25,6 @@ */ @SuppressWarnings("serial") // uses writeReplace, not default serialization @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DescendingImmutableSortedMultiset extends ImmutableSortedMultiset { private final transient ImmutableSortedMultiset forward; diff --git a/android/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java b/android/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java index 10b3fa8666b2..74270688e14c 100644 --- a/android/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java +++ b/android/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java @@ -26,7 +26,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DescendingImmutableSortedSet extends ImmutableSortedSet { private final ImmutableSortedSet forward; diff --git a/android/guava/src/com/google/common/collect/DescendingMultiset.java b/android/guava/src/com/google/common/collect/DescendingMultiset.java index 23ff8319c01d..f3545c4d59e1 100644 --- a/android/guava/src/com/google/common/collect/DescendingMultiset.java +++ b/android/guava/src/com/google/common/collect/DescendingMultiset.java @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class DescendingMultiset extends ForwardingMultiset implements SortedMultiset { abstract SortedMultiset forwardMultiset(); diff --git a/android/guava/src/com/google/common/collect/DiscreteDomain.java b/android/guava/src/com/google/common/collect/DiscreteDomain.java index 96160a99ffad..d34f8e142b04 100644 --- a/android/guava/src/com/google/common/collect/DiscreteDomain.java +++ b/android/guava/src/com/google/common/collect/DiscreteDomain.java @@ -45,7 +45,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class DiscreteDomain { /** diff --git a/android/guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index e1c640ff5db4..000000000000 --- a/android/guava/src/com/google/common/collect/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; - -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/collect/EmptyContiguousSet.java b/android/guava/src/com/google/common/collect/EmptyContiguousSet.java index 79a945ff9735..17d713f7ae88 100644 --- a/android/guava/src/com/google/common/collect/EmptyContiguousSet.java +++ b/android/guava/src/com/google/common/collect/EmptyContiguousSet.java @@ -32,7 +32,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // allow ungenerified Comparable types -@ElementTypesAreNonnullByDefault final class EmptyContiguousSet extends ContiguousSet { EmptyContiguousSet(DiscreteDomain domain) { super(domain); diff --git a/android/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java b/android/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java index 8a60301826df..f01b66c2548f 100644 --- a/android/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java +++ b/android/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java @@ -25,7 +25,6 @@ * @author Jared Levy */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault class EmptyImmutableListMultimap extends ImmutableListMultimap { static final EmptyImmutableListMultimap INSTANCE = new EmptyImmutableListMultimap(); diff --git a/android/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java b/android/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java index 087112e10a51..1633fa7a406a 100644 --- a/android/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java +++ b/android/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java @@ -25,7 +25,6 @@ * @author Mike Ward */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault class EmptyImmutableSetMultimap extends ImmutableSetMultimap { static final EmptyImmutableSetMultimap INSTANCE = new EmptyImmutableSetMultimap(); diff --git a/android/guava/src/com/google/common/collect/EnumBiMap.java b/android/guava/src/com/google/common/collect/EnumBiMap.java index b7d297272d60..fcb99ac46d55 100644 --- a/android/guava/src/com/google/common/collect/EnumBiMap.java +++ b/android/guava/src/com/google/common/collect/EnumBiMap.java @@ -42,7 +42,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class EnumBiMap, V extends Enum> extends AbstractBiMap { /* * J2CL's EnumMap does not need the Class instance, so we can use Object.class instead. (Or we diff --git a/android/guava/src/com/google/common/collect/EnumHashBiMap.java b/android/guava/src/com/google/common/collect/EnumHashBiMap.java index c7432d404608..65afe41e9fa6 100644 --- a/android/guava/src/com/google/common/collect/EnumHashBiMap.java +++ b/android/guava/src/com/google/common/collect/EnumHashBiMap.java @@ -45,7 +45,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class EnumHashBiMap, V extends @Nullable Object> extends AbstractBiMap { transient Class keyTypeOrObjectUnderJ2cl; diff --git a/android/guava/src/com/google/common/collect/EnumMultiset.java b/android/guava/src/com/google/common/collect/EnumMultiset.java index 44beb013d4d5..076523744fa2 100644 --- a/android/guava/src/com/google/common/collect/EnumMultiset.java +++ b/android/guava/src/com/google/common/collect/EnumMultiset.java @@ -46,7 +46,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class EnumMultiset> extends AbstractMultiset implements Serializable { /** Creates an empty {@code EnumMultiset}. */ diff --git a/android/guava/src/com/google/common/collect/EvictingQueue.java b/android/guava/src/com/google/common/collect/EvictingQueue.java index 71770b72ae11..3edcd03632ce 100644 --- a/android/guava/src/com/google/common/collect/EvictingQueue.java +++ b/android/guava/src/com/google/common/collect/EvictingQueue.java @@ -44,7 +44,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class EvictingQueue extends ForwardingQueue implements Serializable { private final Queue delegate; diff --git a/android/guava/src/com/google/common/collect/ExplicitOrdering.java b/android/guava/src/com/google/common/collect/ExplicitOrdering.java index 383318af5bb4..ddccb85bc2a8 100644 --- a/android/guava/src/com/google/common/collect/ExplicitOrdering.java +++ b/android/guava/src/com/google/common/collect/ExplicitOrdering.java @@ -23,7 +23,6 @@ /** An ordering that compares objects according to a given order. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ExplicitOrdering extends Ordering implements Serializable { final ImmutableMap rankMap; diff --git a/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java b/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java index 8146cdb675c1..e7121d7b9df4 100644 --- a/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredEntryMultimap.java @@ -46,7 +46,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault class FilteredEntryMultimap extends AbstractMultimap implements FilteredMultimap { final Multimap unfiltered; diff --git a/android/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java b/android/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java index 20413f8c4096..ed2b05f17b78 100644 --- a/android/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java @@ -29,7 +29,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredEntrySetMultimap extends FilteredEntryMultimap implements FilteredSetMultimap { diff --git a/android/guava/src/com/google/common/collect/FilteredKeyListMultimap.java b/android/guava/src/com/google/common/collect/FilteredKeyListMultimap.java index c82c8daf770d..f1c499f74d7c 100644 --- a/android/guava/src/com/google/common/collect/FilteredKeyListMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredKeyListMultimap.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredKeyListMultimap extends FilteredKeyMultimap implements ListMultimap { FilteredKeyListMultimap(ListMultimap unfiltered, Predicate keyPredicate) { diff --git a/android/guava/src/com/google/common/collect/FilteredKeyMultimap.java b/android/guava/src/com/google/common/collect/FilteredKeyMultimap.java index 8b699d48ba7c..7e9b5505955a 100644 --- a/android/guava/src/com/google/common/collect/FilteredKeyMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredKeyMultimap.java @@ -38,7 +38,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault class FilteredKeyMultimap extends AbstractMultimap implements FilteredMultimap { final Multimap unfiltered; diff --git a/android/guava/src/com/google/common/collect/FilteredKeySetMultimap.java b/android/guava/src/com/google/common/collect/FilteredKeySetMultimap.java index e492a5c1dea9..ac56459b9448 100644 --- a/android/guava/src/com/google/common/collect/FilteredKeySetMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredKeySetMultimap.java @@ -29,7 +29,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredKeySetMultimap extends FilteredKeyMultimap implements FilteredSetMultimap { diff --git a/android/guava/src/com/google/common/collect/FilteredMultimap.java b/android/guava/src/com/google/common/collect/FilteredMultimap.java index 4e1fa066f80b..29b4dd1fd7e5 100644 --- a/android/guava/src/com/google/common/collect/FilteredMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredMultimap.java @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface FilteredMultimap extends Multimap { Multimap unfiltered(); diff --git a/android/guava/src/com/google/common/collect/FilteredMultimapValues.java b/android/guava/src/com/google/common/collect/FilteredMultimapValues.java index 63009b032869..cb1659f8aa59 100644 --- a/android/guava/src/com/google/common/collect/FilteredMultimapValues.java +++ b/android/guava/src/com/google/common/collect/FilteredMultimapValues.java @@ -35,7 +35,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredMultimapValues extends AbstractCollection { @Weak private final FilteredMultimap multimap; diff --git a/android/guava/src/com/google/common/collect/FilteredSetMultimap.java b/android/guava/src/com/google/common/collect/FilteredSetMultimap.java index 8e2ff7c0c1a6..f858af50bc3c 100644 --- a/android/guava/src/com/google/common/collect/FilteredSetMultimap.java +++ b/android/guava/src/com/google/common/collect/FilteredSetMultimap.java @@ -25,7 +25,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface FilteredSetMultimap extends FilteredMultimap, SetMultimap { @Override diff --git a/android/guava/src/com/google/common/collect/FluentIterable.java b/android/guava/src/com/google/common/collect/FluentIterable.java index 4cc0d043c106..eb333f727572 100644 --- a/android/guava/src/com/google/common/collect/FluentIterable.java +++ b/android/guava/src/com/google/common/collect/FluentIterable.java @@ -112,7 +112,6 @@ * @since 12.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class FluentIterable implements Iterable { // We store 'iterable' and use it instead of 'this' to allow Iterables to perform instanceof // checks on the _original_ iterable when FluentIterable.from is used. diff --git a/android/guava/src/com/google/common/collect/ForwardingBlockingDeque.java b/android/guava/src/com/google/common/collect/ForwardingBlockingDeque.java index 13b5b236e3fb..5ed05134cf66 100644 --- a/android/guava/src/com/google/common/collect/ForwardingBlockingDeque.java +++ b/android/guava/src/com/google/common/collect/ForwardingBlockingDeque.java @@ -49,7 +49,6 @@ @Deprecated @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingBlockingDeque extends ForwardingDeque implements BlockingDeque { diff --git a/android/guava/src/com/google/common/collect/ForwardingCollection.java b/android/guava/src/com/google/common/collect/ForwardingCollection.java index ca1edc118303..e03f1ceebb82 100644 --- a/android/guava/src/com/google/common/collect/ForwardingCollection.java +++ b/android/guava/src/com/google/common/collect/ForwardingCollection.java @@ -47,7 +47,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingCollection extends ForwardingObject implements Collection { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/android/guava/src/com/google/common/collect/ForwardingConcurrentMap.java b/android/guava/src/com/google/common/collect/ForwardingConcurrentMap.java index b662b0774a0f..6552cc45bab6 100644 --- a/android/guava/src/com/google/common/collect/ForwardingConcurrentMap.java +++ b/android/guava/src/com/google/common/collect/ForwardingConcurrentMap.java @@ -37,7 +37,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingConcurrentMap extends ForwardingMap implements ConcurrentMap { diff --git a/android/guava/src/com/google/common/collect/ForwardingDeque.java b/android/guava/src/com/google/common/collect/ForwardingDeque.java index 2730dad0ee8b..2caae14d7f35 100644 --- a/android/guava/src/com/google/common/collect/ForwardingDeque.java +++ b/android/guava/src/com/google/common/collect/ForwardingDeque.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingDeque extends ForwardingQueue implements Deque { diff --git a/android/guava/src/com/google/common/collect/ForwardingImmutableCollection.java b/android/guava/src/com/google/common/collect/ForwardingImmutableCollection.java index 043fe5863593..c0b9c5e54d74 100644 --- a/android/guava/src/com/google/common/collect/ForwardingImmutableCollection.java +++ b/android/guava/src/com/google/common/collect/ForwardingImmutableCollection.java @@ -24,7 +24,6 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault class ForwardingImmutableCollection { private ForwardingImmutableCollection() {} } diff --git a/android/guava/src/com/google/common/collect/ForwardingImmutableList.java b/android/guava/src/com/google/common/collect/ForwardingImmutableList.java index bd5480d589c4..2b9092ea4c93 100644 --- a/android/guava/src/com/google/common/collect/ForwardingImmutableList.java +++ b/android/guava/src/com/google/common/collect/ForwardingImmutableList.java @@ -24,7 +24,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ForwardingImmutableList { private ForwardingImmutableList() {} } diff --git a/android/guava/src/com/google/common/collect/ForwardingImmutableMap.java b/android/guava/src/com/google/common/collect/ForwardingImmutableMap.java index 22cc9ff8711c..a36715743f0a 100644 --- a/android/guava/src/com/google/common/collect/ForwardingImmutableMap.java +++ b/android/guava/src/com/google/common/collect/ForwardingImmutableMap.java @@ -24,7 +24,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ForwardingImmutableMap { private ForwardingImmutableMap() {} } diff --git a/android/guava/src/com/google/common/collect/ForwardingImmutableSet.java b/android/guava/src/com/google/common/collect/ForwardingImmutableSet.java index 047d5fd32216..c7d7bf6d778b 100644 --- a/android/guava/src/com/google/common/collect/ForwardingImmutableSet.java +++ b/android/guava/src/com/google/common/collect/ForwardingImmutableSet.java @@ -24,7 +24,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ForwardingImmutableSet { private ForwardingImmutableSet() {} } diff --git a/android/guava/src/com/google/common/collect/ForwardingIterator.java b/android/guava/src/com/google/common/collect/ForwardingIterator.java index 1f5a8f110eaf..0924bbdfe293 100644 --- a/android/guava/src/com/google/common/collect/ForwardingIterator.java +++ b/android/guava/src/com/google/common/collect/ForwardingIterator.java @@ -37,7 +37,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingIterator extends ForwardingObject implements Iterator { diff --git a/android/guava/src/com/google/common/collect/ForwardingList.java b/android/guava/src/com/google/common/collect/ForwardingList.java index e9b4d8e35b6d..2b013f1908a4 100644 --- a/android/guava/src/com/google/common/collect/ForwardingList.java +++ b/android/guava/src/com/google/common/collect/ForwardingList.java @@ -51,7 +51,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingList extends ForwardingCollection implements List { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/android/guava/src/com/google/common/collect/ForwardingListIterator.java b/android/guava/src/com/google/common/collect/ForwardingListIterator.java index a2ac32b6fad9..2fdc88570542 100644 --- a/android/guava/src/com/google/common/collect/ForwardingListIterator.java +++ b/android/guava/src/com/google/common/collect/ForwardingListIterator.java @@ -37,7 +37,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListIterator extends ForwardingIterator implements ListIterator { diff --git a/android/guava/src/com/google/common/collect/ForwardingListMultimap.java b/android/guava/src/com/google/common/collect/ForwardingListMultimap.java index 11779c0bb826..ae1cdcfd551a 100644 --- a/android/guava/src/com/google/common/collect/ForwardingListMultimap.java +++ b/android/guava/src/com/google/common/collect/ForwardingListMultimap.java @@ -35,7 +35,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListMultimap extends ForwardingMultimap implements ListMultimap { diff --git a/android/guava/src/com/google/common/collect/ForwardingMap.java b/android/guava/src/com/google/common/collect/ForwardingMap.java index 24c40f23c9d8..b3756a55350b 100644 --- a/android/guava/src/com/google/common/collect/ForwardingMap.java +++ b/android/guava/src/com/google/common/collect/ForwardingMap.java @@ -55,7 +55,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMap extends ForwardingObject implements Map { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/android/guava/src/com/google/common/collect/ForwardingMapEntry.java b/android/guava/src/com/google/common/collect/ForwardingMapEntry.java index 7fe1386aa32f..5af9221f3906 100644 --- a/android/guava/src/com/google/common/collect/ForwardingMapEntry.java +++ b/android/guava/src/com/google/common/collect/ForwardingMapEntry.java @@ -48,7 +48,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMapEntry extends ForwardingObject implements Map.Entry { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/android/guava/src/com/google/common/collect/ForwardingMultimap.java b/android/guava/src/com/google/common/collect/ForwardingMultimap.java index a3db0618ed80..f50cd8982d30 100644 --- a/android/guava/src/com/google/common/collect/ForwardingMultimap.java +++ b/android/guava/src/com/google/common/collect/ForwardingMultimap.java @@ -38,7 +38,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMultimap extends ForwardingObject implements Multimap { diff --git a/android/guava/src/com/google/common/collect/ForwardingMultiset.java b/android/guava/src/com/google/common/collect/ForwardingMultiset.java index d1187d4c5b63..7407fabb5df2 100644 --- a/android/guava/src/com/google/common/collect/ForwardingMultiset.java +++ b/android/guava/src/com/google/common/collect/ForwardingMultiset.java @@ -48,7 +48,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMultiset extends ForwardingCollection implements Multiset { diff --git a/android/guava/src/com/google/common/collect/ForwardingNavigableMap.java b/android/guava/src/com/google/common/collect/ForwardingNavigableMap.java index c7f0d0fe2f78..b881fafc41be 100644 --- a/android/guava/src/com/google/common/collect/ForwardingNavigableMap.java +++ b/android/guava/src/com/google/common/collect/ForwardingNavigableMap.java @@ -54,7 +54,6 @@ * @since 12.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingNavigableMap extends ForwardingSortedMap implements NavigableMap { diff --git a/android/guava/src/com/google/common/collect/ForwardingNavigableSet.java b/android/guava/src/com/google/common/collect/ForwardingNavigableSet.java index 97f137a593d6..71954fab110b 100644 --- a/android/guava/src/com/google/common/collect/ForwardingNavigableSet.java +++ b/android/guava/src/com/google/common/collect/ForwardingNavigableSet.java @@ -50,7 +50,6 @@ * @since 12.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingNavigableSet extends ForwardingSortedSet implements NavigableSet { diff --git a/android/guava/src/com/google/common/collect/ForwardingObject.java b/android/guava/src/com/google/common/collect/ForwardingObject.java index 64af9082d224..712b14fa1343 100644 --- a/android/guava/src/com/google/common/collect/ForwardingObject.java +++ b/android/guava/src/com/google/common/collect/ForwardingObject.java @@ -44,7 +44,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingObject { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/collect/ForwardingQueue.java b/android/guava/src/com/google/common/collect/ForwardingQueue.java index 43c2eaafb56d..fa07c242fb13 100644 --- a/android/guava/src/com/google/common/collect/ForwardingQueue.java +++ b/android/guava/src/com/google/common/collect/ForwardingQueue.java @@ -46,7 +46,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingQueue extends ForwardingCollection implements Queue { diff --git a/android/guava/src/com/google/common/collect/ForwardingSet.java b/android/guava/src/com/google/common/collect/ForwardingSet.java index bc27272b0267..9eb403629286 100644 --- a/android/guava/src/com/google/common/collect/ForwardingSet.java +++ b/android/guava/src/com/google/common/collect/ForwardingSet.java @@ -47,7 +47,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSet extends ForwardingCollection implements Set { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/android/guava/src/com/google/common/collect/ForwardingSetMultimap.java b/android/guava/src/com/google/common/collect/ForwardingSetMultimap.java index 2691fe1cbe06..4f44e9d31cf8 100644 --- a/android/guava/src/com/google/common/collect/ForwardingSetMultimap.java +++ b/android/guava/src/com/google/common/collect/ForwardingSetMultimap.java @@ -36,7 +36,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSetMultimap extends ForwardingMultimap implements SetMultimap { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/collect/ForwardingSortedMap.java b/android/guava/src/com/google/common/collect/ForwardingSortedMap.java index 9779b97a785f..127e1ca73ac6 100644 --- a/android/guava/src/com/google/common/collect/ForwardingSortedMap.java +++ b/android/guava/src/com/google/common/collect/ForwardingSortedMap.java @@ -51,7 +51,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedMap extends ForwardingMap implements SortedMap { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/android/guava/src/com/google/common/collect/ForwardingSortedMultiset.java b/android/guava/src/com/google/common/collect/ForwardingSortedMultiset.java index 7777357414de..8ac7fa3de215 100644 --- a/android/guava/src/com/google/common/collect/ForwardingSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/ForwardingSortedMultiset.java @@ -44,7 +44,6 @@ * @since 15.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedMultiset extends ForwardingMultiset implements SortedMultiset { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/collect/ForwardingSortedSet.java b/android/guava/src/com/google/common/collect/ForwardingSortedSet.java index ad7ef12235ef..3a6af5e5b251 100644 --- a/android/guava/src/com/google/common/collect/ForwardingSortedSet.java +++ b/android/guava/src/com/google/common/collect/ForwardingSortedSet.java @@ -54,7 +54,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedSet extends ForwardingSet implements SortedSet { diff --git a/android/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java b/android/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java index b91a68b3445a..38e1bc50ca07 100644 --- a/android/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java +++ b/android/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java @@ -35,7 +35,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedSetMultimap< K extends @Nullable Object, V extends @Nullable Object> extends ForwardingSetMultimap implements SortedSetMultimap { diff --git a/android/guava/src/com/google/common/collect/ForwardingTable.java b/android/guava/src/com/google/common/collect/ForwardingTable.java index 4fcb858b725f..c4060ffa6d6f 100644 --- a/android/guava/src/com/google/common/collect/ForwardingTable.java +++ b/android/guava/src/com/google/common/collect/ForwardingTable.java @@ -33,7 +33,6 @@ * @since 7.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingTable< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> extends ForwardingObject implements Table { diff --git a/android/guava/src/com/google/common/collect/GeneralRange.java b/android/guava/src/com/google/common/collect/GeneralRange.java index aff4b1bca7e1..0410355779c4 100644 --- a/android/guava/src/com/google/common/collect/GeneralRange.java +++ b/android/guava/src/com/google/common/collect/GeneralRange.java @@ -38,7 +38,6 @@ * @author Louis Wasserman */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class GeneralRange implements Serializable { /** Converts a Range to a GeneralRange. */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 diff --git a/android/guava/src/com/google/common/collect/GwtTransient.java b/android/guava/src/com/google/common/collect/GwtTransient.java index ce5ea48848c9..9c09c53c946f 100644 --- a/android/guava/src/com/google/common/collect/GwtTransient.java +++ b/android/guava/src/com/google/common/collect/GwtTransient.java @@ -33,5 +33,4 @@ @GwtCompatible @Retention(RUNTIME) @Target(FIELD) -@ElementTypesAreNonnullByDefault @interface GwtTransient {} diff --git a/android/guava/src/com/google/common/collect/HashBasedTable.java b/android/guava/src/com/google/common/collect/HashBasedTable.java index 21882e62d406..787c411d5019 100644 --- a/android/guava/src/com/google/common/collect/HashBasedTable.java +++ b/android/guava/src/com/google/common/collect/HashBasedTable.java @@ -47,7 +47,6 @@ * @since 7.0 */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault public class HashBasedTable extends StandardTable { private static class Factory implements Supplier>, Serializable { final int expectedSize; diff --git a/android/guava/src/com/google/common/collect/HashBiMap.java b/android/guava/src/com/google/common/collect/HashBiMap.java index a2933a5cdfdd..3836e3f5558f 100644 --- a/android/guava/src/com/google/common/collect/HashBiMap.java +++ b/android/guava/src/com/google/common/collect/HashBiMap.java @@ -54,7 +54,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class HashBiMap extends AbstractMap implements BiMap, Serializable { diff --git a/android/guava/src/com/google/common/collect/HashMultimap.java b/android/guava/src/com/google/common/collect/HashMultimap.java index 34861180c989..5183823a3307 100644 --- a/android/guava/src/com/google/common/collect/HashMultimap.java +++ b/android/guava/src/com/google/common/collect/HashMultimap.java @@ -50,7 +50,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class HashMultimap extends HashMultimapGwtSerializationDependencies { private static final int DEFAULT_VALUES_PER_KEY = 2; diff --git a/android/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java b/android/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java index 0922c3839080..e46fa7ddd6b1 100644 --- a/android/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java +++ b/android/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A dummy superclass to support GWT serialization of the element types of a {@link HashMultimap}. @@ -30,7 +31,9 @@ *

    TODO(cpovirk): Consider applying this subclass approach to our other types. */ @GwtCompatible(emulated = true) -abstract class HashMultimapGwtSerializationDependencies extends AbstractSetMultimap { +abstract class HashMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> + extends AbstractSetMultimap { HashMultimapGwtSerializationDependencies(Map> map) { super(map); } diff --git a/android/guava/src/com/google/common/collect/HashMultiset.java b/android/guava/src/com/google/common/collect/HashMultiset.java index 9ed604d97bc0..ac3f9229d9e8 100644 --- a/android/guava/src/com/google/common/collect/HashMultiset.java +++ b/android/guava/src/com/google/common/collect/HashMultiset.java @@ -29,7 +29,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class HashMultiset extends AbstractMapBasedMultiset { /** Creates a new, empty {@code HashMultiset} using the default initial capacity. */ diff --git a/android/guava/src/com/google/common/collect/Hashing.java b/android/guava/src/com/google/common/collect/Hashing.java index ee4376d7078d..6ce9398f7ff8 100644 --- a/android/guava/src/com/google/common/collect/Hashing.java +++ b/android/guava/src/com/google/common/collect/Hashing.java @@ -30,7 +30,6 @@ * @author Austin Appleby */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Hashing { private Hashing() {} diff --git a/android/guava/src/com/google/common/collect/IgnoreJRERequirement.java b/android/guava/src/com/google/common/collect/IgnoreJRERequirement.java index 2a1006831267..a5e2448cdd32 100644 --- a/android/guava/src/com/google/common/collect/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/collect/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

    Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/collect/ImmutableAsList.java b/android/guava/src/com/google/common/collect/ImmutableAsList.java index b7c585cc2f1a..a65456476033 100644 --- a/android/guava/src/com/google/common/collect/ImmutableAsList.java +++ b/android/guava/src/com/google/common/collect/ImmutableAsList.java @@ -33,7 +33,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") -@ElementTypesAreNonnullByDefault abstract class ImmutableAsList extends ImmutableList { abstract ImmutableCollection delegateCollection(); diff --git a/android/guava/src/com/google/common/collect/ImmutableBiMap.java b/android/guava/src/com/google/common/collect/ImmutableBiMap.java index 1206543c2af3..156f14a4caeb 100644 --- a/android/guava/src/com/google/common/collect/ImmutableBiMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableBiMap.java @@ -44,7 +44,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public abstract class ImmutableBiMap extends ImmutableMap implements BiMap { /** diff --git a/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java b/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java index 160cce078fbc..7c979bf74a7d 100644 --- a/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java @@ -37,7 +37,6 @@ */ @Immutable(containerOf = "B") @GwtIncompatible -@ElementTypesAreNonnullByDefault // TODO(b/278589132): Remove the redundant "@NonNull" on B once it's no longer required by J2KT. public final class ImmutableClassToInstanceMap extends ForwardingMap, B> diff --git a/android/guava/src/com/google/common/collect/ImmutableCollection.java b/android/guava/src/com/google/common/collect/ImmutableCollection.java index 0acdf9789754..e6f9eb816c5e 100644 --- a/android/guava/src/com/google/common/collect/ImmutableCollection.java +++ b/android/guava/src/com/google/common/collect/ImmutableCollection.java @@ -169,7 +169,6 @@ @DoNotMock("Use ImmutableList.of or another implementation") @GwtCompatible(emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault // TODO(kevinb): I think we should push everything down to "BaseImmutableCollection" or something, // just to do everything we can to emphasize the "practically an interface" nature of this class. public abstract class ImmutableCollection extends AbstractCollection implements Serializable { diff --git a/android/guava/src/com/google/common/collect/ImmutableEntry.java b/android/guava/src/com/google/common/collect/ImmutableEntry.java index f88fcc1c6a3f..4685f2a8375c 100644 --- a/android/guava/src/com/google/common/collect/ImmutableEntry.java +++ b/android/guava/src/com/google/common/collect/ImmutableEntry.java @@ -26,7 +26,6 @@ * common.collect} as a superclass. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault class ImmutableEntry extends AbstractMapEntry implements Serializable { @ParametricNullness final K key; diff --git a/android/guava/src/com/google/common/collect/ImmutableEnumMap.java b/android/guava/src/com/google/common/collect/ImmutableEnumMap.java index 553e89aec8fe..b3e19b76d4c9 100644 --- a/android/guava/src/com/google/common/collect/ImmutableEnumMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableEnumMap.java @@ -35,7 +35,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault final class ImmutableEnumMap, V> extends IteratorBasedImmutableMap { static , V> ImmutableMap asImmutable(EnumMap map) { switch (map.size()) { diff --git a/android/guava/src/com/google/common/collect/ImmutableEnumSet.java b/android/guava/src/com/google/common/collect/ImmutableEnumSet.java index 2f80c4436b7c..815c4b15ee1c 100644 --- a/android/guava/src/com/google/common/collect/ImmutableEnumSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableEnumSet.java @@ -35,7 +35,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault final class ImmutableEnumSet> extends ImmutableSet { static > ImmutableSet asImmutable(EnumSet set) { switch (set.size()) { diff --git a/android/guava/src/com/google/common/collect/ImmutableList.java b/android/guava/src/com/google/common/collect/ImmutableList.java index f930fea794c9..e4f7e3a943e6 100644 --- a/android/guava/src/com/google/common/collect/ImmutableList.java +++ b/android/guava/src/com/google/common/collect/ImmutableList.java @@ -59,7 +59,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableList extends ImmutableCollection implements List, RandomAccess { diff --git a/android/guava/src/com/google/common/collect/ImmutableListMultimap.java b/android/guava/src/com/google/common/collect/ImmutableListMultimap.java index 928d8b2b26fe..923773ca59b0 100644 --- a/android/guava/src/com/google/common/collect/ImmutableListMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableListMultimap.java @@ -51,7 +51,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class ImmutableListMultimap extends ImmutableMultimap implements ListMultimap { /** diff --git a/android/guava/src/com/google/common/collect/ImmutableMap.java b/android/guava/src/com/google/common/collect/ImmutableMap.java index 83a6969ee34b..01bf70cf049e 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableMap.java @@ -68,7 +68,6 @@ @DoNotMock("Use ImmutableMap.of or another implementation") @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableMap implements Map, Serializable { /** diff --git a/android/guava/src/com/google/common/collect/ImmutableMapEntrySet.java b/android/guava/src/com/google/common/collect/ImmutableMapEntrySet.java index 27a4c2c3367c..4ab4fd7e5255 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMapEntrySet.java +++ b/android/guava/src/com/google/common/collect/ImmutableMapEntrySet.java @@ -33,7 +33,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ImmutableMapEntrySet extends ImmutableSet> { static final class RegularEntrySet extends ImmutableMapEntrySet { private final transient ImmutableMap map; diff --git a/android/guava/src/com/google/common/collect/ImmutableMapKeySet.java b/android/guava/src/com/google/common/collect/ImmutableMapKeySet.java index cd9f4accf328..a0eee2763c7b 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMapKeySet.java +++ b/android/guava/src/com/google/common/collect/ImmutableMapKeySet.java @@ -29,7 +29,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class ImmutableMapKeySet extends IndexedImmutableSet { private final ImmutableMap map; diff --git a/android/guava/src/com/google/common/collect/ImmutableMapValues.java b/android/guava/src/com/google/common/collect/ImmutableMapValues.java index 0ddf84ffe759..c1b59d1a2a8f 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMapValues.java +++ b/android/guava/src/com/google/common/collect/ImmutableMapValues.java @@ -30,7 +30,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class ImmutableMapValues extends ImmutableCollection { private final ImmutableMap map; diff --git a/android/guava/src/com/google/common/collect/ImmutableMultimap.java b/android/guava/src/com/google/common/collect/ImmutableMultimap.java index b1af877d61c2..8e79cad35ac7 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableMultimap.java @@ -72,7 +72,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class ImmutableMultimap extends BaseImmutableMultimap implements Serializable { diff --git a/android/guava/src/com/google/common/collect/ImmutableMultiset.java b/android/guava/src/com/google/common/collect/ImmutableMultiset.java index 0b0d06c5dfc3..6e255ba9c25f 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -56,7 +56,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableMultiset extends ImmutableMultisetGwtSerializationDependencies implements Multiset { diff --git a/android/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java b/android/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java index 2469a188a2a6..a8b1899d280c 100644 --- a/android/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java +++ b/android/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java @@ -37,5 +37,4 @@ * and make types non-final. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ImmutableMultisetGwtSerializationDependencies extends ImmutableCollection {} diff --git a/android/guava/src/com/google/common/collect/ImmutableRangeMap.java b/android/guava/src/com/google/common/collect/ImmutableRangeMap.java index 0b4669cdfb26..65e5deea4ab1 100644 --- a/android/guava/src/com/google/common/collect/ImmutableRangeMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableRangeMap.java @@ -47,7 +47,6 @@ * @since 14.0 */ @GwtIncompatible // NavigableMap -@ElementTypesAreNonnullByDefault public class ImmutableRangeMap, V> implements RangeMap, Serializable { private static final ImmutableRangeMap, Object> EMPTY = diff --git a/android/guava/src/com/google/common/collect/ImmutableRangeSet.java b/android/guava/src/com/google/common/collect/ImmutableRangeSet.java index 3e96d3f0cd40..1f6dc808828e 100644 --- a/android/guava/src/com/google/common/collect/ImmutableRangeSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableRangeSet.java @@ -53,7 +53,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ImmutableRangeSet extends AbstractRangeSet implements Serializable { diff --git a/android/guava/src/com/google/common/collect/ImmutableSet.java b/android/guava/src/com/google/common/collect/ImmutableSet.java index a7c1f897bcff..6abda07e0dce 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSet.java @@ -51,7 +51,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableSet extends ImmutableCollection implements Set { /** diff --git a/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java b/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java index 4395c29dbfc0..d079a4f551b4 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java +++ b/android/guava/src/com/google/common/collect/ImmutableSetMultimap.java @@ -61,7 +61,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class ImmutableSetMultimap extends ImmutableMultimap implements SetMultimap { /** diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMap.java b/android/guava/src/com/google/common/collect/ImmutableSortedMap.java index c4659111ce5d..653d33be9b46 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedMap.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedMap.java @@ -62,7 +62,6 @@ * @since 2.0 (implements {@code NavigableMap} since 12.0) */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class ImmutableSortedMap extends ImmutableMap implements NavigableMap { /** diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index b4c208b58d57..ed164152afa4 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -56,7 +56,6 @@ * @since 12.0 */ @GwtIncompatible // hasn't been tested yet -@ElementTypesAreNonnullByDefault public abstract class ImmutableSortedMultiset extends ImmutableMultiset implements SortedMultiset { // TODO(lowasser): GWT compatibility diff --git a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java index 2d84cc4d381f..68e7240aa76b 100644 --- a/android/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/android/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -62,7 +62,6 @@ // TODO(benyu): benchmark and optimize all creation paths, which are a mess now @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableSortedSet extends ImmutableSet implements NavigableSet, SortedIterable { /** diff --git a/android/guava/src/com/google/common/collect/ImmutableTable.java b/android/guava/src/com/google/common/collect/ImmutableTable.java index 8f4efecf13c7..75f7feafe101 100644 --- a/android/guava/src/com/google/common/collect/ImmutableTable.java +++ b/android/guava/src/com/google/common/collect/ImmutableTable.java @@ -51,7 +51,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ImmutableTable extends AbstractTable implements Serializable { diff --git a/android/guava/src/com/google/common/collect/IndexedImmutableSet.java b/android/guava/src/com/google/common/collect/IndexedImmutableSet.java index 805f15becca5..d7ec08a02f14 100644 --- a/android/guava/src/com/google/common/collect/IndexedImmutableSet.java +++ b/android/guava/src/com/google/common/collect/IndexedImmutableSet.java @@ -22,7 +22,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class IndexedImmutableSet extends ImmutableSet { abstract E get(int index); diff --git a/android/guava/src/com/google/common/collect/Interner.java b/android/guava/src/com/google/common/collect/Interner.java index 8b48fcded9ef..e8a9002d5cd5 100644 --- a/android/guava/src/com/google/common/collect/Interner.java +++ b/android/guava/src/com/google/common/collect/Interner.java @@ -34,7 +34,6 @@ @DoNotMock("Use Interners.new*Interner") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface Interner { /** * Chooses and returns the representative instance for any of a collection of instances that are diff --git a/android/guava/src/com/google/common/collect/Interners.java b/android/guava/src/com/google/common/collect/Interners.java index 449806b439dd..b30e8c47978d 100644 --- a/android/guava/src/com/google/common/collect/Interners.java +++ b/android/guava/src/com/google/common/collect/Interners.java @@ -33,7 +33,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Interners { private Interners() {} diff --git a/android/guava/src/com/google/common/collect/Iterables.java b/android/guava/src/com/google/common/collect/Iterables.java index f6c4499a7a42..e3002a6915b6 100644 --- a/android/guava/src/com/google/common/collect/Iterables.java +++ b/android/guava/src/com/google/common/collect/Iterables.java @@ -62,7 +62,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Iterables { private Iterables() {} diff --git a/android/guava/src/com/google/common/collect/Iterators.java b/android/guava/src/com/google/common/collect/Iterators.java index b610262a4fc7..2d6460ecc225 100644 --- a/android/guava/src/com/google/common/collect/Iterators.java +++ b/android/guava/src/com/google/common/collect/Iterators.java @@ -69,7 +69,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Iterators { private Iterators() {} diff --git a/android/guava/src/com/google/common/collect/LexicographicalOrdering.java b/android/guava/src/com/google/common/collect/LexicographicalOrdering.java index 91fc7bf7241c..c7c3a9f9b5aa 100644 --- a/android/guava/src/com/google/common/collect/LexicographicalOrdering.java +++ b/android/guava/src/com/google/common/collect/LexicographicalOrdering.java @@ -25,7 +25,6 @@ /** An ordering which sorts iterables by comparing corresponding elements pairwise. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class LexicographicalOrdering extends Ordering> implements Serializable { final Comparator elementOrder; diff --git a/android/guava/src/com/google/common/collect/LinkedHashMultimap.java b/android/guava/src/com/google/common/collect/LinkedHashMultimap.java index d01096f33bef..37e108265dd6 100644 --- a/android/guava/src/com/google/common/collect/LinkedHashMultimap.java +++ b/android/guava/src/com/google/common/collect/LinkedHashMultimap.java @@ -80,7 +80,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class LinkedHashMultimap extends LinkedHashMultimapGwtSerializationDependencies { diff --git a/android/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java b/android/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java index bb4a2e490e45..75e76024e2de 100644 --- a/android/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java +++ b/android/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A dummy superclass to support GWT serialization of the element types of a {@link @@ -30,7 +31,8 @@ *

    TODO(cpovirk): Consider applying this subclass approach to our other types. */ @GwtCompatible(emulated = true) -abstract class LinkedHashMultimapGwtSerializationDependencies +abstract class LinkedHashMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> extends AbstractSetMultimap { LinkedHashMultimapGwtSerializationDependencies(Map> map) { super(map); diff --git a/android/guava/src/com/google/common/collect/LinkedHashMultiset.java b/android/guava/src/com/google/common/collect/LinkedHashMultiset.java index 867c3f93f314..a17c823ffe6a 100644 --- a/android/guava/src/com/google/common/collect/LinkedHashMultiset.java +++ b/android/guava/src/com/google/common/collect/LinkedHashMultiset.java @@ -34,7 +34,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class LinkedHashMultiset extends AbstractMapBasedMultiset { diff --git a/android/guava/src/com/google/common/collect/LinkedListMultimap.java b/android/guava/src/com/google/common/collect/LinkedListMultimap.java index f5b566f95875..f8df316cf723 100644 --- a/android/guava/src/com/google/common/collect/LinkedListMultimap.java +++ b/android/guava/src/com/google/common/collect/LinkedListMultimap.java @@ -95,7 +95,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class LinkedListMultimap extends AbstractMultimap implements ListMultimap, Serializable { /* diff --git a/android/guava/src/com/google/common/collect/ListMultimap.java b/android/guava/src/com/google/common/collect/ListMultimap.java index 29e58077cdaa..6aa92c09f2cf 100644 --- a/android/guava/src/com/google/common/collect/ListMultimap.java +++ b/android/guava/src/com/google/common/collect/ListMultimap.java @@ -40,7 +40,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface ListMultimap extends Multimap { /** diff --git a/android/guava/src/com/google/common/collect/Lists.java b/android/guava/src/com/google/common/collect/Lists.java index e253bf1e48ac..9e579836da4d 100644 --- a/android/guava/src/com/google/common/collect/Lists.java +++ b/android/guava/src/com/google/common/collect/Lists.java @@ -66,7 +66,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Lists { private Lists() {} diff --git a/android/guava/src/com/google/common/collect/MapDifference.java b/android/guava/src/com/google/common/collect/MapDifference.java index 5000e4b527c1..c073871f377d 100644 --- a/android/guava/src/com/google/common/collect/MapDifference.java +++ b/android/guava/src/com/google/common/collect/MapDifference.java @@ -30,7 +30,6 @@ */ @DoNotMock("Use Maps.difference") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface MapDifference { /** * Returns {@code true} if there are no differences between the two maps; that is, if the maps are diff --git a/android/guava/src/com/google/common/collect/MapMaker.java b/android/guava/src/com/google/common/collect/MapMaker.java index 4fb4ec8242cf..69a964bf3c28 100644 --- a/android/guava/src/com/google/common/collect/MapMaker.java +++ b/android/guava/src/com/google/common/collect/MapMaker.java @@ -88,7 +88,6 @@ */ @J2ktIncompatible @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class MapMaker { private static final int DEFAULT_INITIAL_CAPACITY = 16; private static final int DEFAULT_CONCURRENCY_LEVEL = 4; diff --git a/android/guava/src/com/google/common/collect/MapMakerInternalMap.java b/android/guava/src/com/google/common/collect/MapMakerInternalMap.java index 44e64ebc2629..fbdae74af5a7 100644 --- a/android/guava/src/com/google/common/collect/MapMakerInternalMap.java +++ b/android/guava/src/com/google/common/collect/MapMakerInternalMap.java @@ -51,6 +51,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullUnmarked; /** * The concurrent hash map implementation built by {@link MapMaker}. @@ -73,7 +74,7 @@ "GuardedBy", // TODO(b/35466881): Fix or suppress. "nullness", // too much trouble for the payoff }) -// TODO(cpovirk): Annotate for nullness. +@NullUnmarked // TODO(cpovirk): Annotate for nullness. class MapMakerInternalMap< K, V, diff --git a/android/guava/src/com/google/common/collect/Maps.java b/android/guava/src/com/google/common/collect/Maps.java index 3487d24cb210..83ad6f2fb460 100644 --- a/android/guava/src/com/google/common/collect/Maps.java +++ b/android/guava/src/com/google/common/collect/Maps.java @@ -89,7 +89,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Maps { private Maps() {} diff --git a/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java b/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java index dc9a28f2737f..b05bbb4d9b5f 100644 --- a/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java +++ b/android/guava/src/com/google/common/collect/MinMaxPriorityQueue.java @@ -102,7 +102,6 @@ * @since 8.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class MinMaxPriorityQueue extends AbstractQueue { /** diff --git a/android/guava/src/com/google/common/collect/MoreCollectors.java b/android/guava/src/com/google/common/collect/MoreCollectors.java index 059ca0bbc9cc..7faf98751ce6 100644 --- a/android/guava/src/com/google/common/collect/MoreCollectors.java +++ b/android/guava/src/com/google/common/collect/MoreCollectors.java @@ -36,7 +36,6 @@ * @since 33.2.0 (available since 21.0 in guava-jre) */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings("Java7ApiChecker") @IgnoreJRERequirement // Users will use this only if they're already using streams. public final class MoreCollectors { diff --git a/android/guava/src/com/google/common/collect/Multimap.java b/android/guava/src/com/google/common/collect/Multimap.java index 75a8193a922e..bdead95f6cfb 100644 --- a/android/guava/src/com/google/common/collect/Multimap.java +++ b/android/guava/src/com/google/common/collect/Multimap.java @@ -161,7 +161,6 @@ */ @DoNotMock("Use ImmutableMultimap, HashMultimap, or another implementation") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Multimap { // Query Operations diff --git a/android/guava/src/com/google/common/collect/MultimapBuilder.java b/android/guava/src/com/google/common/collect/MultimapBuilder.java index 96aacfb3205e..0104cf4f8cb6 100644 --- a/android/guava/src/com/google/common/collect/MultimapBuilder.java +++ b/android/guava/src/com/google/common/collect/MultimapBuilder.java @@ -59,7 +59,6 @@ * @since 16.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class MultimapBuilder { /* * Leaving K and V as upper bounds rather than the actual key and value types allows type diff --git a/android/guava/src/com/google/common/collect/Multimaps.java b/android/guava/src/com/google/common/collect/Multimaps.java index 3a782206f10d..ff1406fb6599 100644 --- a/android/guava/src/com/google/common/collect/Multimaps.java +++ b/android/guava/src/com/google/common/collect/Multimaps.java @@ -70,7 +70,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Multimaps { private Multimaps() {} diff --git a/android/guava/src/com/google/common/collect/Multiset.java b/android/guava/src/com/google/common/collect/Multiset.java index a504a363f125..ffb20106ea98 100644 --- a/android/guava/src/com/google/common/collect/Multiset.java +++ b/android/guava/src/com/google/common/collect/Multiset.java @@ -89,7 +89,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Multiset extends Collection { // Query Operations diff --git a/android/guava/src/com/google/common/collect/Multisets.java b/android/guava/src/com/google/common/collect/Multisets.java index efd5dd1e01ea..bbf39bc94615 100644 --- a/android/guava/src/com/google/common/collect/Multisets.java +++ b/android/guava/src/com/google/common/collect/Multisets.java @@ -62,7 +62,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Multisets { private Multisets() {} diff --git a/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java b/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java index c289b175744e..d48aaff40ec6 100644 --- a/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java +++ b/android/guava/src/com/google/common/collect/MutableClassToInstanceMap.java @@ -48,7 +48,6 @@ @J2ktIncompatible @GwtIncompatible @SuppressWarnings("serial") // using writeReplace instead of standard serialization -@ElementTypesAreNonnullByDefault public final class MutableClassToInstanceMap extends ForwardingMap, B> implements ClassToInstanceMap, Serializable { diff --git a/android/guava/src/com/google/common/collect/NaturalOrdering.java b/android/guava/src/com/google/common/collect/NaturalOrdering.java index dae531270173..6a25165062b8 100644 --- a/android/guava/src/com/google/common/collect/NaturalOrdering.java +++ b/android/guava/src/com/google/common/collect/NaturalOrdering.java @@ -27,7 +27,6 @@ /** An ordering that uses the natural order of the values. */ @GwtCompatible(serializable = true) @SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this?? -@ElementTypesAreNonnullByDefault final class NaturalOrdering extends Ordering> implements Serializable { static final NaturalOrdering INSTANCE = new NaturalOrdering(); diff --git a/android/guava/src/com/google/common/collect/NullnessCasts.java b/android/guava/src/com/google/common/collect/NullnessCasts.java index 4f894dbd3139..23ebbb1e1808 100644 --- a/android/guava/src/com/google/common/collect/NullnessCasts.java +++ b/android/guava/src/com/google/common/collect/NullnessCasts.java @@ -20,7 +20,6 @@ /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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/collect/NullsFirstOrdering.java b/android/guava/src/com/google/common/collect/NullsFirstOrdering.java index c451ea8c0aed..59848f5d57b8 100644 --- a/android/guava/src/com/google/common/collect/NullsFirstOrdering.java +++ b/android/guava/src/com/google/common/collect/NullsFirstOrdering.java @@ -24,7 +24,6 @@ /** An ordering that treats {@code null} as less than all other values. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class NullsFirstOrdering extends Ordering<@Nullable T> implements Serializable { final Ordering ordering; diff --git a/android/guava/src/com/google/common/collect/NullsLastOrdering.java b/android/guava/src/com/google/common/collect/NullsLastOrdering.java index 88917852e67d..74e329375fc2 100644 --- a/android/guava/src/com/google/common/collect/NullsLastOrdering.java +++ b/android/guava/src/com/google/common/collect/NullsLastOrdering.java @@ -24,7 +24,6 @@ /** An ordering that treats {@code null} as greater than all other values. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class NullsLastOrdering extends Ordering<@Nullable T> implements Serializable { final Ordering ordering; diff --git a/android/guava/src/com/google/common/collect/ObjectArrays.java b/android/guava/src/com/google/common/collect/ObjectArrays.java index e7dc155d0257..0ba76c96f1ff 100644 --- a/android/guava/src/com/google/common/collect/ObjectArrays.java +++ b/android/guava/src/com/google/common/collect/ObjectArrays.java @@ -36,7 +36,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault @SuppressWarnings("AvoidObjectArrays") public final class ObjectArrays { diff --git a/android/guava/src/com/google/common/collect/ObjectCountHashMap.java b/android/guava/src/com/google/common/collect/ObjectCountHashMap.java index 29d5bcde4039..5d952cf8f6ba 100644 --- a/android/guava/src/com/google/common/collect/ObjectCountHashMap.java +++ b/android/guava/src/com/google/common/collect/ObjectCountHashMap.java @@ -29,6 +29,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Arrays; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ *

    In the absence of element deletions, this will iterate over elements in insertion order. */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked class ObjectCountHashMap { /** Creates an empty {@code ObjectCountHashMap} instance. */ diff --git a/android/guava/src/com/google/common/collect/ObjectCountLinkedHashMap.java b/android/guava/src/com/google/common/collect/ObjectCountLinkedHashMap.java index 266606a153fc..71a3cd57dedf 100644 --- a/android/guava/src/com/google/common/collect/ObjectCountLinkedHashMap.java +++ b/android/guava/src/com/google/common/collect/ObjectCountLinkedHashMap.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.VisibleForTesting; import java.util.Arrays; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -28,7 +29,7 @@ * footprint. */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked class ObjectCountLinkedHashMap extends ObjectCountHashMap { /** Creates an empty {@code ObjectCountLinkedHashMap} instance. */ static ObjectCountLinkedHashMap create() { diff --git a/android/guava/src/com/google/common/collect/Ordering.java b/android/guava/src/com/google/common/collect/Ordering.java index 342f2013bf74..1696240a47c3 100644 --- a/android/guava/src/com/google/common/collect/Ordering.java +++ b/android/guava/src/com/google/common/collect/Ordering.java @@ -151,7 +151,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class Ordering implements Comparator { // Natural order diff --git a/android/guava/src/com/google/common/collect/ParametricNullness.java b/android/guava/src/com/google/common/collect/ParametricNullness.java index 207c05262e41..8074de5d5689 100644 --- a/android/guava/src/com/google/common/collect/ParametricNullness.java +++ b/android/guava/src/com/google/common/collect/ParametricNullness.java @@ -56,8 +56,8 @@ *

      *
    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/collect/PeekingIterator.java b/android/guava/src/com/google/common/collect/PeekingIterator.java index 8524ed7514dc..bf1e10d9bdde 100644 --- a/android/guava/src/com/google/common/collect/PeekingIterator.java +++ b/android/guava/src/com/google/common/collect/PeekingIterator.java @@ -35,7 +35,6 @@ */ @DoNotMock("Use Iterators.peekingIterator") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface PeekingIterator extends Iterator { /** * Returns the next element in the iteration, without advancing the iteration. diff --git a/android/guava/src/com/google/common/collect/Platform.java b/android/guava/src/com/google/common/collect/Platform.java index b876118e08aa..e7a7e1366943 100644 --- a/android/guava/src/com/google/common/collect/Platform.java +++ b/android/guava/src/com/google/common/collect/Platform.java @@ -29,7 +29,6 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { /** Returns the platform preferred implementation of a map based on a hash table. */ static diff --git a/android/guava/src/com/google/common/collect/Queues.java b/android/guava/src/com/google/common/collect/Queues.java index c61be1414a03..9be7b4989e80 100644 --- a/android/guava/src/com/google/common/collect/Queues.java +++ b/android/guava/src/com/google/common/collect/Queues.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Queues { private Queues() {} diff --git a/android/guava/src/com/google/common/collect/Range.java b/android/guava/src/com/google/common/collect/Range.java index baf6bf55be40..2ee4a8d1351d 100644 --- a/android/guava/src/com/google/common/collect/Range.java +++ b/android/guava/src/com/google/common/collect/Range.java @@ -120,7 +120,6 @@ @GwtCompatible @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @Immutable(containerOf = "C") -@ElementTypesAreNonnullByDefault public final class Range extends RangeGwtSerializationDependencies implements Predicate, Serializable { @SuppressWarnings("unchecked") diff --git a/android/guava/src/com/google/common/collect/RangeMap.java b/android/guava/src/com/google/common/collect/RangeMap.java index 6533a952e82d..88f40289e960 100644 --- a/android/guava/src/com/google/common/collect/RangeMap.java +++ b/android/guava/src/com/google/common/collect/RangeMap.java @@ -37,7 +37,6 @@ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @DoNotMock("Use ImmutableRangeMap or TreeRangeMap") @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface RangeMap { /* * TODO(cpovirk): These docs sometimes say "map" and sometimes say "range map." Pick one, or at diff --git a/android/guava/src/com/google/common/collect/RangeSet.java b/android/guava/src/com/google/common/collect/RangeSet.java index e1d252d613c7..1cfefc278a06 100644 --- a/android/guava/src/com/google/common/collect/RangeSet.java +++ b/android/guava/src/com/google/common/collect/RangeSet.java @@ -51,7 +51,6 @@ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @DoNotMock("Use ImmutableRangeSet or TreeRangeSet") @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface RangeSet { // Query methods diff --git a/android/guava/src/com/google/common/collect/RegularContiguousSet.java b/android/guava/src/com/google/common/collect/RegularContiguousSet.java index f4804620fd92..1fa71acb0a20 100644 --- a/android/guava/src/com/google/common/collect/RegularContiguousSet.java +++ b/android/guava/src/com/google/common/collect/RegularContiguousSet.java @@ -36,7 +36,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 -@ElementTypesAreNonnullByDefault final class RegularContiguousSet extends ContiguousSet { private final Range range; diff --git a/android/guava/src/com/google/common/collect/RegularImmutableAsList.java b/android/guava/src/com/google/common/collect/RegularImmutableAsList.java index 928506e4462c..7ad3ee48be6b 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableAsList.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableAsList.java @@ -30,7 +30,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("serial") // uses writeReplace, not default serialization -@ElementTypesAreNonnullByDefault class RegularImmutableAsList extends ImmutableAsList { private final ImmutableCollection delegate; private final ImmutableList delegateList; diff --git a/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java b/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java index 0188e6367269..6ab5c5642f4e 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableBiMap.java @@ -30,7 +30,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault final class RegularImmutableBiMap extends ImmutableBiMap { static final RegularImmutableBiMap EMPTY = new RegularImmutableBiMap<>(); diff --git a/android/guava/src/com/google/common/collect/RegularImmutableList.java b/android/guava/src/com/google/common/collect/RegularImmutableList.java index 9cf0e1e3341a..784d7ae65dec 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableList.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableList.java @@ -33,7 +33,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault class RegularImmutableList extends ImmutableList { static final ImmutableList EMPTY = new RegularImmutableList<>(new Object[0], 0); diff --git a/android/guava/src/com/google/common/collect/RegularImmutableMap.java b/android/guava/src/com/google/common/collect/RegularImmutableMap.java index 0cff6ea90994..b2ef47c01c33 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableMap.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableMap.java @@ -37,7 +37,6 @@ * @author Louis Wasserman */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault final class RegularImmutableMap extends ImmutableMap { private static final byte ABSENT = -1; diff --git a/android/guava/src/com/google/common/collect/RegularImmutableMultiset.java b/android/guava/src/com/google/common/collect/RegularImmutableMultiset.java index 0e59465ad1b6..0f9c8a76ee3d 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableMultiset.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableMultiset.java @@ -32,7 +32,6 @@ */ @GwtCompatible(emulated = true, serializable = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault class RegularImmutableMultiset extends ImmutableMultiset { static final RegularImmutableMultiset EMPTY = new RegularImmutableMultiset<>(ObjectCountHashMap.create()); diff --git a/android/guava/src/com/google/common/collect/RegularImmutableSet.java b/android/guava/src/com/google/common/collect/RegularImmutableSet.java index 9ef261adc2af..a77290037550 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableSet.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableSet.java @@ -32,7 +32,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault final class RegularImmutableSet extends ImmutableSet { private static final Object[] EMPTY_ARRAY = new Object[0]; static final RegularImmutableSet EMPTY = diff --git a/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java b/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java index fe73ca11859e..3eddbec080c1 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java @@ -32,7 +32,6 @@ */ @SuppressWarnings("serial") // uses writeReplace, not default serialization @GwtIncompatible -@ElementTypesAreNonnullByDefault final class RegularImmutableSortedMultiset extends ImmutableSortedMultiset { private static final long[] ZERO_CUMULATIVE_COUNTS = {0}; diff --git a/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java index ef3d3ad4a550..768ad48a11f9 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableSortedSet.java @@ -40,7 +40,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings({"serial", "rawtypes"}) -@ElementTypesAreNonnullByDefault final class RegularImmutableSortedSet extends ImmutableSortedSet { static final RegularImmutableSortedSet NATURAL_EMPTY_SET = new RegularImmutableSortedSet<>(ImmutableList.of(), Ordering.natural()); diff --git a/android/guava/src/com/google/common/collect/RegularImmutableTable.java b/android/guava/src/com/google/common/collect/RegularImmutableTable.java index 97be4c13bc9f..deae2187fd33 100644 --- a/android/guava/src/com/google/common/collect/RegularImmutableTable.java +++ b/android/guava/src/com/google/common/collect/RegularImmutableTable.java @@ -34,7 +34,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class RegularImmutableTable extends ImmutableTable { RegularImmutableTable() {} diff --git a/android/guava/src/com/google/common/collect/ReverseNaturalOrdering.java b/android/guava/src/com/google/common/collect/ReverseNaturalOrdering.java index f0c40cb61262..a91cd9c82cb0 100644 --- a/android/guava/src/com/google/common/collect/ReverseNaturalOrdering.java +++ b/android/guava/src/com/google/common/collect/ReverseNaturalOrdering.java @@ -25,7 +25,6 @@ /** An ordering that uses the reverse of the natural order of the values. */ @GwtCompatible(serializable = true) @SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this?? -@ElementTypesAreNonnullByDefault final class ReverseNaturalOrdering extends Ordering> implements Serializable { static final ReverseNaturalOrdering INSTANCE = new ReverseNaturalOrdering(); diff --git a/android/guava/src/com/google/common/collect/ReverseOrdering.java b/android/guava/src/com/google/common/collect/ReverseOrdering.java index 6c1e74dd73d5..89271576597c 100644 --- a/android/guava/src/com/google/common/collect/ReverseOrdering.java +++ b/android/guava/src/com/google/common/collect/ReverseOrdering.java @@ -26,7 +26,6 @@ /** An ordering that uses the reverse of a given order. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ReverseOrdering extends Ordering implements Serializable { final Ordering forwardOrder; diff --git a/android/guava/src/com/google/common/collect/RowSortedTable.java b/android/guava/src/com/google/common/collect/RowSortedTable.java index 2c2d773f78db..0bd724a82d26 100644 --- a/android/guava/src/com/google/common/collect/RowSortedTable.java +++ b/android/guava/src/com/google/common/collect/RowSortedTable.java @@ -34,7 +34,6 @@ * @since 8.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface RowSortedTable< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> extends Table { diff --git a/android/guava/src/com/google/common/collect/Serialization.java b/android/guava/src/com/google/common/collect/Serialization.java index e12e84cd2b2a..d9a11b612267 100644 --- a/android/guava/src/com/google/common/collect/Serialization.java +++ b/android/guava/src/com/google/common/collect/Serialization.java @@ -36,7 +36,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault final class Serialization { private Serialization() {} diff --git a/android/guava/src/com/google/common/collect/SetMultimap.java b/android/guava/src/com/google/common/collect/SetMultimap.java index b7a54570a496..4b398859030b 100644 --- a/android/guava/src/com/google/common/collect/SetMultimap.java +++ b/android/guava/src/com/google/common/collect/SetMultimap.java @@ -52,7 +52,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface SetMultimap extends Multimap { /** diff --git a/android/guava/src/com/google/common/collect/Sets.java b/android/guava/src/com/google/common/collect/Sets.java index 884773bc08ac..03efa00847e4 100644 --- a/android/guava/src/com/google/common/collect/Sets.java +++ b/android/guava/src/com/google/common/collect/Sets.java @@ -70,7 +70,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Sets { private Sets() {} diff --git a/android/guava/src/com/google/common/collect/SingletonImmutableSet.java b/android/guava/src/com/google/common/collect/SingletonImmutableSet.java index 08b978240386..c527cdad4036 100644 --- a/android/guava/src/com/google/common/collect/SingletonImmutableSet.java +++ b/android/guava/src/com/google/common/collect/SingletonImmutableSet.java @@ -33,7 +33,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault final class SingletonImmutableSet extends ImmutableSet { // We deliberately avoid caching the asList and hashCode here, to ensure that with // compressed oops, a SingletonImmutableSet packs all the way down to the optimal 16 bytes. diff --git a/android/guava/src/com/google/common/collect/SingletonImmutableTable.java b/android/guava/src/com/google/common/collect/SingletonImmutableTable.java index 6f839ceb4ca1..5e4975ce2895 100644 --- a/android/guava/src/com/google/common/collect/SingletonImmutableTable.java +++ b/android/guava/src/com/google/common/collect/SingletonImmutableTable.java @@ -29,7 +29,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault class SingletonImmutableTable extends ImmutableTable { final R singleRowKey; final C singleColumnKey; diff --git a/android/guava/src/com/google/common/collect/SortedIterable.java b/android/guava/src/com/google/common/collect/SortedIterable.java index 64ec08ef315b..515fd207ddb8 100644 --- a/android/guava/src/com/google/common/collect/SortedIterable.java +++ b/android/guava/src/com/google/common/collect/SortedIterable.java @@ -26,7 +26,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface SortedIterable extends Iterable { /** * Returns the {@code Comparator} by which the elements of this iterable are ordered, or {@code diff --git a/android/guava/src/com/google/common/collect/SortedIterables.java b/android/guava/src/com/google/common/collect/SortedIterables.java index 68b231a381e5..5b61bc9b643e 100644 --- a/android/guava/src/com/google/common/collect/SortedIterables.java +++ b/android/guava/src/com/google/common/collect/SortedIterables.java @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class SortedIterables { private SortedIterables() {} diff --git a/android/guava/src/com/google/common/collect/SortedLists.java b/android/guava/src/com/google/common/collect/SortedLists.java index 9525fb2f4415..45e93772b4a1 100644 --- a/android/guava/src/com/google/common/collect/SortedLists.java +++ b/android/guava/src/com/google/common/collect/SortedLists.java @@ -36,7 +36,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class SortedLists { private SortedLists() {} diff --git a/android/guava/src/com/google/common/collect/SortedMapDifference.java b/android/guava/src/com/google/common/collect/SortedMapDifference.java index 46cac8a3da54..7019378e99ec 100644 --- a/android/guava/src/com/google/common/collect/SortedMapDifference.java +++ b/android/guava/src/com/google/common/collect/SortedMapDifference.java @@ -27,7 +27,6 @@ * @since 8.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface SortedMapDifference extends MapDifference { diff --git a/android/guava/src/com/google/common/collect/SortedMultiset.java b/android/guava/src/com/google/common/collect/SortedMultiset.java index 87969b52c0d9..c3c627199f54 100644 --- a/android/guava/src/com/google/common/collect/SortedMultiset.java +++ b/android/guava/src/com/google/common/collect/SortedMultiset.java @@ -43,7 +43,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public interface SortedMultiset extends SortedMultisetBridge, SortedIterable { /** diff --git a/android/guava/src/com/google/common/collect/SortedMultisetBridge.java b/android/guava/src/com/google/common/collect/SortedMultisetBridge.java index 72d50beb692f..336f59957e94 100644 --- a/android/guava/src/com/google/common/collect/SortedMultisetBridge.java +++ b/android/guava/src/com/google/common/collect/SortedMultisetBridge.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault interface SortedMultisetBridge extends Multiset { @Override SortedSet elementSet(); diff --git a/android/guava/src/com/google/common/collect/SortedMultisets.java b/android/guava/src/com/google/common/collect/SortedMultisets.java index f602a42a1145..e868bcdaeb3c 100644 --- a/android/guava/src/com/google/common/collect/SortedMultisets.java +++ b/android/guava/src/com/google/common/collect/SortedMultisets.java @@ -37,7 +37,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class SortedMultisets { private SortedMultisets() {} diff --git a/android/guava/src/com/google/common/collect/SortedSetMultimap.java b/android/guava/src/com/google/common/collect/SortedSetMultimap.java index 8454aeccb60e..8a4af8eb0515 100644 --- a/android/guava/src/com/google/common/collect/SortedSetMultimap.java +++ b/android/guava/src/com/google/common/collect/SortedSetMultimap.java @@ -49,7 +49,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface SortedSetMultimap extends SetMultimap { // Following Javadoc copied from Multimap. diff --git a/android/guava/src/com/google/common/collect/SparseImmutableTable.java b/android/guava/src/com/google/common/collect/SparseImmutableTable.java index f7222b120e00..f6ab2c94c45a 100644 --- a/android/guava/src/com/google/common/collect/SparseImmutableTable.java +++ b/android/guava/src/com/google/common/collect/SparseImmutableTable.java @@ -27,7 +27,6 @@ /** A {@code RegularImmutableTable} optimized for sparse data. */ @GwtCompatible @Immutable(containerOf = {"R", "C", "V"}) -@ElementTypesAreNonnullByDefault final class SparseImmutableTable extends RegularImmutableTable { static final ImmutableTable EMPTY = new SparseImmutableTable<>( diff --git a/android/guava/src/com/google/common/collect/StandardRowSortedTable.java b/android/guava/src/com/google/common/collect/StandardRowSortedTable.java index bea5b7bb3a86..a7739ad6db2e 100644 --- a/android/guava/src/com/google/common/collect/StandardRowSortedTable.java +++ b/android/guava/src/com/google/common/collect/StandardRowSortedTable.java @@ -46,7 +46,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault class StandardRowSortedTable extends StandardTable implements RowSortedTable { /* diff --git a/android/guava/src/com/google/common/collect/StandardTable.java b/android/guava/src/com/google/common/collect/StandardTable.java index b14276cefb6c..2c1fd2929173 100644 --- a/android/guava/src/com/google/common/collect/StandardTable.java +++ b/android/guava/src/com/google/common/collect/StandardTable.java @@ -68,7 +68,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault class StandardTable extends AbstractTable implements Serializable { @GwtTransient final Map> backingMap; @GwtTransient final Supplier> factory; diff --git a/android/guava/src/com/google/common/collect/Streams.java b/android/guava/src/com/google/common/collect/Streams.java index 434494960723..56f304e71f52 100644 --- a/android/guava/src/com/google/common/collect/Streams.java +++ b/android/guava/src/com/google/common/collect/Streams.java @@ -58,7 +58,6 @@ * @since 33.4.0 (but since 21.0 in the JRE flavor) */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings("Java7ApiChecker") /* * Users will use most of these methods only if they're already using Stream. For a few other diff --git a/android/guava/src/com/google/common/collect/Synchronized.java b/android/guava/src/com/google/common/collect/Synchronized.java index 759fad911d75..8c0ec47dfe75 100644 --- a/android/guava/src/com/google/common/collect/Synchronized.java +++ b/android/guava/src/com/google/common/collect/Synchronized.java @@ -58,7 +58,6 @@ */ @J2ktIncompatible @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault /* * I have decided not to bother adding @ParametricNullness annotations in this class. Adding them is * a lot of busy work, and the annotation matters only when the APIs to be annotated are visible to diff --git a/android/guava/src/com/google/common/collect/Table.java b/android/guava/src/com/google/common/collect/Table.java index 05ceb1af8f0e..51afcf2eb4c8 100644 --- a/android/guava/src/com/google/common/collect/Table.java +++ b/android/guava/src/com/google/common/collect/Table.java @@ -66,7 +66,6 @@ */ @DoNotMock("Use ImmutableTable, HashBasedTable, or another implementation") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Table< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> { // TODO(jlevy): Consider adding methods similar to ConcurrentMap methods. diff --git a/android/guava/src/com/google/common/collect/TableCollectors.java b/android/guava/src/com/google/common/collect/TableCollectors.java index 41ebdd0fedb3..31bb45d1704a 100644 --- a/android/guava/src/com/google/common/collect/TableCollectors.java +++ b/android/guava/src/com/google/common/collect/TableCollectors.java @@ -30,7 +30,6 @@ /** Collectors utilities for {@code common.collect.Table} internals. */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings("Java7ApiChecker") @IgnoreJRERequirement // used only from APIs with Java 8 types in them // (not used publicly by guava-android as of this writing, but we include it in the jar as a test) diff --git a/android/guava/src/com/google/common/collect/Tables.java b/android/guava/src/com/google/common/collect/Tables.java index 31cf155ddeba..c8984f5a251c 100644 --- a/android/guava/src/com/google/common/collect/Tables.java +++ b/android/guava/src/com/google/common/collect/Tables.java @@ -50,7 +50,6 @@ * @since 7.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Tables { private Tables() {} diff --git a/android/guava/src/com/google/common/collect/TopKSelector.java b/android/guava/src/com/google/common/collect/TopKSelector.java index 68317c968948..020daad2565a 100644 --- a/android/guava/src/com/google/common/collect/TopKSelector.java +++ b/android/guava/src/com/google/common/collect/TopKSelector.java @@ -56,7 +56,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class TopKSelector< T extends @Nullable Object> { diff --git a/android/guava/src/com/google/common/collect/TransformedIterator.java b/android/guava/src/com/google/common/collect/TransformedIterator.java index 2456cecde991..a866c7c05061 100644 --- a/android/guava/src/com/google/common/collect/TransformedIterator.java +++ b/android/guava/src/com/google/common/collect/TransformedIterator.java @@ -29,7 +29,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class TransformedIterator implements Iterator { final Iterator backingIterator; diff --git a/android/guava/src/com/google/common/collect/TransformedListIterator.java b/android/guava/src/com/google/common/collect/TransformedListIterator.java index 22b4b7c42db2..0ebe3acacc8a 100644 --- a/android/guava/src/com/google/common/collect/TransformedListIterator.java +++ b/android/guava/src/com/google/common/collect/TransformedListIterator.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class TransformedListIterator extends TransformedIterator implements ListIterator { TransformedListIterator(ListIterator backingIterator) { diff --git a/android/guava/src/com/google/common/collect/TreeBasedTable.java b/android/guava/src/com/google/common/collect/TreeBasedTable.java index f3e1ded4c0f3..3837bc38c09f 100644 --- a/android/guava/src/com/google/common/collect/TreeBasedTable.java +++ b/android/guava/src/com/google/common/collect/TreeBasedTable.java @@ -68,7 +68,6 @@ * @since 7.0 */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault public class TreeBasedTable extends StandardRowSortedTable { private final Comparator columnComparator; diff --git a/android/guava/src/com/google/common/collect/TreeMultimap.java b/android/guava/src/com/google/common/collect/TreeMultimap.java index 289ea54f67b2..d7b14a9930dc 100644 --- a/android/guava/src/com/google/common/collect/TreeMultimap.java +++ b/android/guava/src/com/google/common/collect/TreeMultimap.java @@ -73,7 +73,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class TreeMultimap extends AbstractSortedKeySortedSetMultimap { private transient Comparator keyComparator; diff --git a/android/guava/src/com/google/common/collect/TreeMultiset.java b/android/guava/src/com/google/common/collect/TreeMultiset.java index f938800a859b..eb8560a478c7 100644 --- a/android/guava/src/com/google/common/collect/TreeMultiset.java +++ b/android/guava/src/com/google/common/collect/TreeMultiset.java @@ -58,7 +58,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class TreeMultiset extends AbstractSortedMultiset implements Serializable { diff --git a/android/guava/src/com/google/common/collect/TreeRangeMap.java b/android/guava/src/com/google/common/collect/TreeRangeMap.java index 77857423fae2..5ba56e75a0c1 100644 --- a/android/guava/src/com/google/common/collect/TreeRangeMap.java +++ b/android/guava/src/com/google/common/collect/TreeRangeMap.java @@ -52,7 +52,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtIncompatible // NavigableMap -@ElementTypesAreNonnullByDefault public final class TreeRangeMap implements RangeMap { private final NavigableMap, RangeMapEntry> entriesByLowerBound; diff --git a/android/guava/src/com/google/common/collect/TreeRangeSet.java b/android/guava/src/com/google/common/collect/TreeRangeSet.java index 65dad64b3d01..6a623b387843 100644 --- a/android/guava/src/com/google/common/collect/TreeRangeSet.java +++ b/android/guava/src/com/google/common/collect/TreeRangeSet.java @@ -41,7 +41,6 @@ * @since 14.0 */ @GwtIncompatible // uses NavigableMap -@ElementTypesAreNonnullByDefault public class TreeRangeSet> extends AbstractRangeSet implements Serializable { diff --git a/android/guava/src/com/google/common/collect/TreeTraverser.java b/android/guava/src/com/google/common/collect/TreeTraverser.java index 8c31e3529052..9a713c0df1ae 100644 --- a/android/guava/src/com/google/common/collect/TreeTraverser.java +++ b/android/guava/src/com/google/common/collect/TreeTraverser.java @@ -75,7 +75,6 @@ @Deprecated @Beta @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TreeTraverser { /** Constructor for use by subclasses. */ public TreeTraverser() {} diff --git a/android/guava/src/com/google/common/collect/UnmodifiableIterator.java b/android/guava/src/com/google/common/collect/UnmodifiableIterator.java index 03e52aa2037d..d66e6fcbcab0 100644 --- a/android/guava/src/com/google/common/collect/UnmodifiableIterator.java +++ b/android/guava/src/com/google/common/collect/UnmodifiableIterator.java @@ -32,7 +32,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class UnmodifiableIterator implements Iterator { /** Constructor for use by subclasses. */ protected UnmodifiableIterator() {} diff --git a/android/guava/src/com/google/common/collect/UnmodifiableListIterator.java b/android/guava/src/com/google/common/collect/UnmodifiableListIterator.java index f3d3b921b7dc..f58a4f414ec2 100644 --- a/android/guava/src/com/google/common/collect/UnmodifiableListIterator.java +++ b/android/guava/src/com/google/common/collect/UnmodifiableListIterator.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class UnmodifiableListIterator extends UnmodifiableIterator implements ListIterator { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java b/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java index 9bf322d1f9d1..354a5e421f17 100644 --- a/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java +++ b/android/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java @@ -34,7 +34,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class UnmodifiableSortedMultiset extends UnmodifiableMultiset implements SortedMultiset { UnmodifiableSortedMultiset(SortedMultiset delegate) { diff --git a/android/guava/src/com/google/common/collect/UsingToStringOrdering.java b/android/guava/src/com/google/common/collect/UsingToStringOrdering.java index 3443b43e7223..3167946b1582 100644 --- a/android/guava/src/com/google/common/collect/UsingToStringOrdering.java +++ b/android/guava/src/com/google/common/collect/UsingToStringOrdering.java @@ -21,7 +21,6 @@ /** An ordering that uses the natural order of the string representation of the values. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class UsingToStringOrdering extends Ordering implements Serializable { static final UsingToStringOrdering INSTANCE = new UsingToStringOrdering(); diff --git a/android/guava/src/com/google/common/collect/package-info.java b/android/guava/src/com/google/common/collect/package-info.java index ad169a6852c8..b076e568cee9 100644 --- a/android/guava/src/com/google/common/collect/package-info.java +++ b/android/guava/src/com/google/common/collect/package-info.java @@ -120,8 +120,6 @@ * */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.collect; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java b/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java index dbe6e3568035..c437f84d91af 100644 --- a/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java +++ b/android/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java @@ -41,7 +41,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ArrayBasedCharEscaper extends CharEscaper { // The replacement array (see ArrayBasedEscaperMap). private final char[][] replacements; diff --git a/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java b/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java index ea0b9c6772d7..d8036839d57f 100644 --- a/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java +++ b/android/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java @@ -36,7 +36,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class ArrayBasedEscaperMap { /** * Returns a new ArrayBasedEscaperMap for creating ArrayBasedCharEscaper or diff --git a/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java b/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java index 8514390e5454..55bf685a1640 100644 --- a/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java +++ b/android/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java @@ -42,7 +42,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ArrayBasedUnicodeEscaper extends UnicodeEscaper { // The replacement array (see ArrayBasedEscaperMap). private final char[][] replacements; diff --git a/android/guava/src/com/google/common/escape/CharEscaper.java b/android/guava/src/com/google/common/escape/CharEscaper.java index 136240ec639e..430778321cb8 100644 --- a/android/guava/src/com/google/common/escape/CharEscaper.java +++ b/android/guava/src/com/google/common/escape/CharEscaper.java @@ -40,7 +40,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class CharEscaper extends Escaper { /** Constructor for use by subclasses. */ protected CharEscaper() {} diff --git a/android/guava/src/com/google/common/escape/CharEscaperBuilder.java b/android/guava/src/com/google/common/escape/CharEscaperBuilder.java index 97528cb569c1..45d228a3b44a 100644 --- a/android/guava/src/com/google/common/escape/CharEscaperBuilder.java +++ b/android/guava/src/com/google/common/escape/CharEscaperBuilder.java @@ -34,7 +34,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class CharEscaperBuilder { /** * Simple decorator that turns an array of replacement char[]s into a CharEscaper, this results in diff --git a/android/guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 992c9a3e4d84..000000000000 --- a/android/guava/src/com/google/common/escape/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.escape; - -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/escape/Escaper.java b/android/guava/src/com/google/common/escape/Escaper.java index 31b7df0e64ab..16d9b6d1994c 100644 --- a/android/guava/src/com/google/common/escape/Escaper.java +++ b/android/guava/src/com/google/common/escape/Escaper.java @@ -56,7 +56,6 @@ */ @DoNotMock("Use Escapers.nullEscaper() or another methods from the *Escapers classes") @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class Escaper { // TODO(dbeaumont): evaluate custom implementations, considering package private constructor. /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/escape/Escapers.java b/android/guava/src/com/google/common/escape/Escapers.java index e3e50d965e28..4ad8deb60a6f 100644 --- a/android/guava/src/com/google/common/escape/Escapers.java +++ b/android/guava/src/com/google/common/escape/Escapers.java @@ -31,7 +31,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Escapers { private Escapers() {} diff --git a/android/guava/src/com/google/common/escape/ParametricNullness.java b/android/guava/src/com/google/common/escape/ParametricNullness.java index f964ca4a4f61..9ac5d62e1296 100644 --- a/android/guava/src/com/google/common/escape/ParametricNullness.java +++ b/android/guava/src/com/google/common/escape/ParametricNullness.java @@ -56,8 +56,8 @@ *
        *
      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/escape/Platform.java b/android/guava/src/com/google/common/escape/Platform.java index 67efe4551e5f..3480ee215e91 100644 --- a/android/guava/src/com/google/common/escape/Platform.java +++ b/android/guava/src/com/google/common/escape/Platform.java @@ -24,7 +24,6 @@ * @author Jesse Wilson */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { private Platform() {} diff --git a/android/guava/src/com/google/common/escape/UnicodeEscaper.java b/android/guava/src/com/google/common/escape/UnicodeEscaper.java index 280915c7551e..90d8cdc6aa21 100644 --- a/android/guava/src/com/google/common/escape/UnicodeEscaper.java +++ b/android/guava/src/com/google/common/escape/UnicodeEscaper.java @@ -50,7 +50,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class UnicodeEscaper extends Escaper { /** The amount of padding (chars) to use when growing the escape buffer. */ private static final int DEST_PAD = 32; diff --git a/android/guava/src/com/google/common/escape/package-info.java b/android/guava/src/com/google/common/escape/package-info.java index 4c525386e6f6..e70f41ddbfc8 100644 --- a/android/guava/src/com/google/common/escape/package-info.java +++ b/android/guava/src/com/google/common/escape/package-info.java @@ -25,8 +25,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.escape; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java b/android/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java index 28bc4b23e0c3..652e5e50bc6a 100644 --- a/android/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java +++ b/android/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java @@ -30,5 +30,4 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) -@ElementTypesAreNonnullByDefault public @interface AllowConcurrentEvents {} diff --git a/android/guava/src/com/google/common/eventbus/AsyncEventBus.java b/android/guava/src/com/google/common/eventbus/AsyncEventBus.java index 4f387a712841..a6dac17f2289 100644 --- a/android/guava/src/com/google/common/eventbus/AsyncEventBus.java +++ b/android/guava/src/com/google/common/eventbus/AsyncEventBus.java @@ -23,7 +23,6 @@ * @author Cliff Biffle * @since 10.0 */ -@ElementTypesAreNonnullByDefault public class AsyncEventBus extends EventBus { /** diff --git a/android/guava/src/com/google/common/eventbus/DeadEvent.java b/android/guava/src/com/google/common/eventbus/DeadEvent.java index 2cdb23f712d7..90910b9b0805 100644 --- a/android/guava/src/com/google/common/eventbus/DeadEvent.java +++ b/android/guava/src/com/google/common/eventbus/DeadEvent.java @@ -27,7 +27,6 @@ * @author Cliff Biffle * @since 10.0 */ -@ElementTypesAreNonnullByDefault public class DeadEvent { private final Object source; diff --git a/android/guava/src/com/google/common/eventbus/Dispatcher.java b/android/guava/src/com/google/common/eventbus/Dispatcher.java index 44f7c46ba0cd..c941a04a11a6 100644 --- a/android/guava/src/com/google/common/eventbus/Dispatcher.java +++ b/android/guava/src/com/google/common/eventbus/Dispatcher.java @@ -32,7 +32,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault abstract class Dispatcher { /** diff --git a/android/guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index e8542bba63ec..000000000000 --- a/android/guava/src/com/google/common/eventbus/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.eventbus; - -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/eventbus/EventBus.java b/android/guava/src/com/google/common/eventbus/EventBus.java index bc606c673e1c..6adf3c70f833 100644 --- a/android/guava/src/com/google/common/eventbus/EventBus.java +++ b/android/guava/src/com/google/common/eventbus/EventBus.java @@ -147,7 +147,6 @@ * @author Cliff Biffle * @since 10.0 */ -@ElementTypesAreNonnullByDefault public class EventBus { private static final Logger logger = Logger.getLogger(EventBus.class.getName()); diff --git a/android/guava/src/com/google/common/eventbus/ParametricNullness.java b/android/guava/src/com/google/common/eventbus/ParametricNullness.java index 47c7d8d4d063..fd07ef09cb60 100644 --- a/android/guava/src/com/google/common/eventbus/ParametricNullness.java +++ b/android/guava/src/com/google/common/eventbus/ParametricNullness.java @@ -56,8 +56,8 @@ *
          *
        • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
        • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/eventbus/Subscribe.java b/android/guava/src/com/google/common/eventbus/Subscribe.java index 88477f1bae75..0449efe2e113 100644 --- a/android/guava/src/com/google/common/eventbus/Subscribe.java +++ b/android/guava/src/com/google/common/eventbus/Subscribe.java @@ -35,5 +35,4 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) -@ElementTypesAreNonnullByDefault public @interface Subscribe {} diff --git a/android/guava/src/com/google/common/eventbus/Subscriber.java b/android/guava/src/com/google/common/eventbus/Subscriber.java index 71ee197c9b25..98c09f5c8d98 100644 --- a/android/guava/src/com/google/common/eventbus/Subscriber.java +++ b/android/guava/src/com/google/common/eventbus/Subscriber.java @@ -32,7 +32,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault class Subscriber { /** Creates a {@code Subscriber} for {@code method} on {@code listener}. */ diff --git a/android/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java b/android/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java index 63c7d557fec9..c7a755b09407 100644 --- a/android/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java +++ b/android/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java @@ -23,7 +23,6 @@ * * @since 16.0 */ -@ElementTypesAreNonnullByDefault public class SubscriberExceptionContext { private final EventBus eventBus; private final Object event; diff --git a/android/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java b/android/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java index 1c2fbb109adb..47b6f014dbf4 100644 --- a/android/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java +++ b/android/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java @@ -20,7 +20,6 @@ * * @since 16.0 */ -@ElementTypesAreNonnullByDefault public interface SubscriberExceptionHandler { /** Handles exceptions thrown by subscribers. */ void handleException(Throwable exception, SubscriberExceptionContext context); diff --git a/android/guava/src/com/google/common/eventbus/SubscriberRegistry.java b/android/guava/src/com/google/common/eventbus/SubscriberRegistry.java index 345aeee333ef..ae96474eb285 100644 --- a/android/guava/src/com/google/common/eventbus/SubscriberRegistry.java +++ b/android/guava/src/com/google/common/eventbus/SubscriberRegistry.java @@ -51,7 +51,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault final class SubscriberRegistry { /** diff --git a/android/guava/src/com/google/common/eventbus/package-info.java b/android/guava/src/com/google/common/eventbus/package-info.java index bd675415c15b..d722c08a0aab 100644 --- a/android/guava/src/com/google/common/eventbus/package-info.java +++ b/android/guava/src/com/google/common/eventbus/package-info.java @@ -20,8 +20,6 @@ * href="https://github.com/google/guava/wiki/EventBusExplained">{@code EventBus}. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.eventbus; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/graph/AbstractBaseGraph.java b/android/guava/src/com/google/common/graph/AbstractBaseGraph.java index 16cbdde7eec6..11986e9ec5ca 100644 --- a/android/guava/src/com/google/common/graph/AbstractBaseGraph.java +++ b/android/guava/src/com/google/common/graph/AbstractBaseGraph.java @@ -42,7 +42,6 @@ * @author James Sexton * @param Node parameter type */ -@ElementTypesAreNonnullByDefault abstract class AbstractBaseGraph implements BaseGraph { /** diff --git a/android/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java b/android/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java index ac452d4d610a..66a7404e26d5 100644 --- a/android/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java @@ -40,7 +40,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault abstract class AbstractDirectedNetworkConnections implements NetworkConnections { /** Keys are edges incoming to the origin node, values are the source node. */ final Map inEdgeMap; diff --git a/android/guava/src/com/google/common/graph/AbstractGraph.java b/android/guava/src/com/google/common/graph/AbstractGraph.java index 1dc245300694..e3d27ab95fcd 100644 --- a/android/guava/src/com/google/common/graph/AbstractGraph.java +++ b/android/guava/src/com/google/common/graph/AbstractGraph.java @@ -28,7 +28,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public abstract class AbstractGraph extends AbstractBaseGraph implements Graph { /** Constructor for use by subclasses. */ public AbstractGraph() {} diff --git a/android/guava/src/com/google/common/graph/AbstractGraphBuilder.java b/android/guava/src/com/google/common/graph/AbstractGraphBuilder.java index a4e1543f1d63..84e461a46c37 100644 --- a/android/guava/src/com/google/common/graph/AbstractGraphBuilder.java +++ b/android/guava/src/com/google/common/graph/AbstractGraphBuilder.java @@ -23,7 +23,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault abstract class AbstractGraphBuilder { final boolean directed; boolean allowsSelfLoops = false; diff --git a/android/guava/src/com/google/common/graph/AbstractNetwork.java b/android/guava/src/com/google/common/graph/AbstractNetwork.java index 269065a21a35..7c5b1b3f75ec 100644 --- a/android/guava/src/com/google/common/graph/AbstractNetwork.java +++ b/android/guava/src/com/google/common/graph/AbstractNetwork.java @@ -51,7 +51,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public abstract class AbstractNetwork implements Network { /** Constructor for use by subclasses. */ public AbstractNetwork() {} diff --git a/android/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java b/android/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java index 8f736d7baa23..6622b5cf7e11 100644 --- a/android/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java @@ -32,7 +32,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault abstract class AbstractUndirectedNetworkConnections implements NetworkConnections { /** Keys are edges incident to the origin node, values are the node at the other end. */ final Map incidentEdgeMap; diff --git a/android/guava/src/com/google/common/graph/AbstractValueGraph.java b/android/guava/src/com/google/common/graph/AbstractValueGraph.java index 98167c50218f..f1baf5fc2fe3 100644 --- a/android/guava/src/com/google/common/graph/AbstractValueGraph.java +++ b/android/guava/src/com/google/common/graph/AbstractValueGraph.java @@ -37,7 +37,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public abstract class AbstractValueGraph extends AbstractBaseGraph implements ValueGraph { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/graph/BaseGraph.java b/android/guava/src/com/google/common/graph/BaseGraph.java index 0fa83e3ad146..a451989e712b 100644 --- a/android/guava/src/com/google/common/graph/BaseGraph.java +++ b/android/guava/src/com/google/common/graph/BaseGraph.java @@ -24,7 +24,6 @@ * @author James Sexton * @param Node parameter type */ -@ElementTypesAreNonnullByDefault interface BaseGraph extends SuccessorsFunction, PredecessorsFunction { // // Graph-level accessors diff --git a/android/guava/src/com/google/common/graph/DirectedGraphConnections.java b/android/guava/src/com/google/common/graph/DirectedGraphConnections.java index 76c214de61bd..05cc2c488d1e 100644 --- a/android/guava/src/com/google/common/graph/DirectedGraphConnections.java +++ b/android/guava/src/com/google/common/graph/DirectedGraphConnections.java @@ -50,7 +50,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault final class DirectedGraphConnections implements GraphConnections { /** * A wrapper class to indicate a node is both a predecessor and successor while still providing diff --git a/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java b/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java index bd0e546f26e3..ad4defffe1d8 100644 --- a/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java @@ -39,7 +39,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class DirectedMultiNetworkConnections extends AbstractDirectedNetworkConnections { private DirectedMultiNetworkConnections( diff --git a/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java b/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java index e1db65708eb0..c866a252c254 100644 --- a/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/DirectedNetworkConnections.java @@ -32,7 +32,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class DirectedNetworkConnections extends AbstractDirectedNetworkConnections { DirectedNetworkConnections(Map inEdgeMap, Map outEdgeMap, int selfLoopCount) { diff --git a/android/guava/src/com/google/common/graph/EdgesConnecting.java b/android/guava/src/com/google/common/graph/EdgesConnecting.java index 797970ba29c1..56cedca2ba57 100644 --- a/android/guava/src/com/google/common/graph/EdgesConnecting.java +++ b/android/guava/src/com/google/common/graph/EdgesConnecting.java @@ -34,7 +34,6 @@ * @author James Sexton * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class EdgesConnecting extends AbstractSet { private final Map nodeToOutEdge; diff --git a/android/guava/src/com/google/common/graph/ElementOrder.java b/android/guava/src/com/google/common/graph/ElementOrder.java index fc2abbb59f9a..650c44538b8b 100644 --- a/android/guava/src/com/google/common/graph/ElementOrder.java +++ b/android/guava/src/com/google/common/graph/ElementOrder.java @@ -46,7 +46,6 @@ */ @Beta @Immutable -@ElementTypesAreNonnullByDefault public final class ElementOrder { private final Type type; diff --git a/android/guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 0798de0c9883..000000000000 --- a/android/guava/src/com/google/common/graph/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.graph; - -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/graph/EndpointPair.java b/android/guava/src/com/google/common/graph/EndpointPair.java index fe2397c6b97b..fec21aec7006 100644 --- a/android/guava/src/com/google/common/graph/EndpointPair.java +++ b/android/guava/src/com/google/common/graph/EndpointPair.java @@ -39,7 +39,6 @@ */ @Beta @Immutable(containerOf = {"N"}) -@ElementTypesAreNonnullByDefault public abstract class EndpointPair implements Iterable { private final N nodeU; private final N nodeV; diff --git a/android/guava/src/com/google/common/graph/EndpointPairIterator.java b/android/guava/src/com/google/common/graph/EndpointPairIterator.java index 7096dbe3da2a..c7755f34a488 100644 --- a/android/guava/src/com/google/common/graph/EndpointPairIterator.java +++ b/android/guava/src/com/google/common/graph/EndpointPairIterator.java @@ -32,7 +32,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault abstract class EndpointPairIterator extends AbstractIterator> { private final BaseGraph graph; private final Iterator nodeIterator; diff --git a/android/guava/src/com/google/common/graph/ForwardingGraph.java b/android/guava/src/com/google/common/graph/ForwardingGraph.java index f4ddf425db29..99faf4c999aa 100644 --- a/android/guava/src/com/google/common/graph/ForwardingGraph.java +++ b/android/guava/src/com/google/common/graph/ForwardingGraph.java @@ -24,7 +24,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault abstract class ForwardingGraph extends AbstractGraph { abstract BaseGraph delegate(); diff --git a/android/guava/src/com/google/common/graph/ForwardingNetwork.java b/android/guava/src/com/google/common/graph/ForwardingNetwork.java index fd211524efb0..391642f3de08 100644 --- a/android/guava/src/com/google/common/graph/ForwardingNetwork.java +++ b/android/guava/src/com/google/common/graph/ForwardingNetwork.java @@ -26,7 +26,6 @@ * @author James Sexton * @author Joshua O'Madadhain */ -@ElementTypesAreNonnullByDefault abstract class ForwardingNetwork extends AbstractNetwork { abstract Network delegate(); diff --git a/android/guava/src/com/google/common/graph/ForwardingValueGraph.java b/android/guava/src/com/google/common/graph/ForwardingValueGraph.java index 70ed6e5595f3..3f27b550669c 100644 --- a/android/guava/src/com/google/common/graph/ForwardingValueGraph.java +++ b/android/guava/src/com/google/common/graph/ForwardingValueGraph.java @@ -26,7 +26,6 @@ * @author James Sexton * @author Joshua O'Madadhain */ -@ElementTypesAreNonnullByDefault abstract class ForwardingValueGraph extends AbstractValueGraph { abstract ValueGraph delegate(); diff --git a/android/guava/src/com/google/common/graph/Graph.java b/android/guava/src/com/google/common/graph/Graph.java index b765dabcbbdc..8ee14f51d9cc 100644 --- a/android/guava/src/com/google/common/graph/Graph.java +++ b/android/guava/src/com/google/common/graph/Graph.java @@ -103,7 +103,6 @@ */ @Beta @DoNotMock("Use GraphBuilder to create a real instance") -@ElementTypesAreNonnullByDefault public interface Graph extends BaseGraph { // // Graph-level accessors diff --git a/android/guava/src/com/google/common/graph/GraphBuilder.java b/android/guava/src/com/google/common/graph/GraphBuilder.java index e275c43a5958..8d25db4ad646 100644 --- a/android/guava/src/com/google/common/graph/GraphBuilder.java +++ b/android/guava/src/com/google/common/graph/GraphBuilder.java @@ -71,7 +71,6 @@ */ @Beta @DoNotMock -@ElementTypesAreNonnullByDefault public final class GraphBuilder extends AbstractGraphBuilder { /** Creates a new instance with the specified edge directionality. */ diff --git a/android/guava/src/com/google/common/graph/GraphConnections.java b/android/guava/src/com/google/common/graph/GraphConnections.java index 7d4f8f0cf02b..0ac3eb3d73c2 100644 --- a/android/guava/src/com/google/common/graph/GraphConnections.java +++ b/android/guava/src/com/google/common/graph/GraphConnections.java @@ -29,7 +29,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault interface GraphConnections { Set adjacentNodes(); diff --git a/android/guava/src/com/google/common/graph/GraphConstants.java b/android/guava/src/com/google/common/graph/GraphConstants.java index 263d6fd40617..f0e9013444cb 100644 --- a/android/guava/src/com/google/common/graph/GraphConstants.java +++ b/android/guava/src/com/google/common/graph/GraphConstants.java @@ -18,7 +18,6 @@ /** A utility class to hold various constants used by the Guava Graph library. */ -@ElementTypesAreNonnullByDefault final class GraphConstants { private GraphConstants() {} diff --git a/android/guava/src/com/google/common/graph/Graphs.java b/android/guava/src/com/google/common/graph/Graphs.java index 948fd000181a..7a2b75d13234 100644 --- a/android/guava/src/com/google/common/graph/Graphs.java +++ b/android/guava/src/com/google/common/graph/Graphs.java @@ -45,7 +45,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class Graphs extends GraphsBridgeMethods { private Graphs() {} diff --git a/android/guava/src/com/google/common/graph/GraphsBridgeMethods.java b/android/guava/src/com/google/common/graph/GraphsBridgeMethods.java index fd89a67d81aa..5cbb790bfabf 100644 --- a/android/guava/src/com/google/common/graph/GraphsBridgeMethods.java +++ b/android/guava/src/com/google/common/graph/GraphsBridgeMethods.java @@ -8,7 +8,6 @@ * changed. This provides binary compatibility for users who compiled against the old signatures. */ @Beta -@ElementTypesAreNonnullByDefault abstract class GraphsBridgeMethods { @SuppressWarnings("PreferredInterfaceType") diff --git a/android/guava/src/com/google/common/graph/ImmutableGraph.java b/android/guava/src/com/google/common/graph/ImmutableGraph.java index f829e9699993..e2d77374522f 100644 --- a/android/guava/src/com/google/common/graph/ImmutableGraph.java +++ b/android/guava/src/com/google/common/graph/ImmutableGraph.java @@ -45,7 +45,6 @@ */ @Beta @Immutable(containerOf = {"N"}) -@ElementTypesAreNonnullByDefault public class ImmutableGraph extends ForwardingGraph { @SuppressWarnings("Immutable") // The backing graph must be immutable. private final BaseGraph backingGraph; diff --git a/android/guava/src/com/google/common/graph/ImmutableNetwork.java b/android/guava/src/com/google/common/graph/ImmutableNetwork.java index c29f8a392813..42bdf8fb1645 100644 --- a/android/guava/src/com/google/common/graph/ImmutableNetwork.java +++ b/android/guava/src/com/google/common/graph/ImmutableNetwork.java @@ -46,7 +46,6 @@ @Beta @Immutable(containerOf = {"N", "E"}) @SuppressWarnings("Immutable") // Extends StandardNetwork but uses ImmutableMaps. -@ElementTypesAreNonnullByDefault public final class ImmutableNetwork extends StandardNetwork { private ImmutableNetwork(Network network) { diff --git a/android/guava/src/com/google/common/graph/ImmutableValueGraph.java b/android/guava/src/com/google/common/graph/ImmutableValueGraph.java index eb17067fca43..ed0b100777bc 100644 --- a/android/guava/src/com/google/common/graph/ImmutableValueGraph.java +++ b/android/guava/src/com/google/common/graph/ImmutableValueGraph.java @@ -44,7 +44,6 @@ @Beta @Immutable(containerOf = {"N", "V"}) @SuppressWarnings("Immutable") // Extends StandardValueGraph but uses ImmutableMaps. -@ElementTypesAreNonnullByDefault public final class ImmutableValueGraph extends StandardValueGraph { private ImmutableValueGraph(ValueGraph graph) { diff --git a/android/guava/src/com/google/common/graph/IncidentEdgeSet.java b/android/guava/src/com/google/common/graph/IncidentEdgeSet.java index ac94b65779d4..99dbd8913691 100644 --- a/android/guava/src/com/google/common/graph/IncidentEdgeSet.java +++ b/android/guava/src/com/google/common/graph/IncidentEdgeSet.java @@ -24,7 +24,6 @@ * Abstract base class for an incident edges set that allows different implementations of {@link * AbstractSet#iterator()}. */ -@ElementTypesAreNonnullByDefault abstract class IncidentEdgeSet extends AbstractSet> { final N node; final BaseGraph graph; diff --git a/android/guava/src/com/google/common/graph/InvalidatableSet.java b/android/guava/src/com/google/common/graph/InvalidatableSet.java index f8834b589ae9..f261cc09cbde 100644 --- a/android/guava/src/com/google/common/graph/InvalidatableSet.java +++ b/android/guava/src/com/google/common/graph/InvalidatableSet.java @@ -10,7 +10,6 @@ * A subclass of `ForwardingSet` that throws `IllegalStateException` on invocation of any method * (except `hashCode` and `equals`) if the provided `Supplier` returns false. */ -@ElementTypesAreNonnullByDefault final class InvalidatableSet extends ForwardingSet { private final Supplier validator; private final Set delegate; diff --git a/android/guava/src/com/google/common/graph/MapIteratorCache.java b/android/guava/src/com/google/common/graph/MapIteratorCache.java index 05cdde8c3f12..973d95f4c057 100644 --- a/android/guava/src/com/google/common/graph/MapIteratorCache.java +++ b/android/guava/src/com/google/common/graph/MapIteratorCache.java @@ -41,7 +41,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault class MapIteratorCache { private final Map backingMap; diff --git a/android/guava/src/com/google/common/graph/MapRetrievalCache.java b/android/guava/src/com/google/common/graph/MapRetrievalCache.java index ada78f28414d..d6d80f485061 100644 --- a/android/guava/src/com/google/common/graph/MapRetrievalCache.java +++ b/android/guava/src/com/google/common/graph/MapRetrievalCache.java @@ -27,7 +27,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault final class MapRetrievalCache extends MapIteratorCache { // See the note about volatile in the superclass. @CheckForNull private transient volatile CacheEntry cacheEntry1; diff --git a/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java b/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java index 620f986a555a..7fcbccc7ff5a 100644 --- a/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java +++ b/android/guava/src/com/google/common/graph/MultiEdgesConnecting.java @@ -35,7 +35,6 @@ * @author James Sexton * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault abstract class MultiEdgesConnecting extends AbstractSet { private final Map outEdgeToNode; diff --git a/android/guava/src/com/google/common/graph/MutableGraph.java b/android/guava/src/com/google/common/graph/MutableGraph.java index b1f3359cab58..8324079f6c08 100644 --- a/android/guava/src/com/google/common/graph/MutableGraph.java +++ b/android/guava/src/com/google/common/graph/MutableGraph.java @@ -29,7 +29,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface MutableGraph extends Graph { /** diff --git a/android/guava/src/com/google/common/graph/MutableNetwork.java b/android/guava/src/com/google/common/graph/MutableNetwork.java index 64acb13162af..d702903604cf 100644 --- a/android/guava/src/com/google/common/graph/MutableNetwork.java +++ b/android/guava/src/com/google/common/graph/MutableNetwork.java @@ -30,7 +30,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface MutableNetwork extends Network { /** diff --git a/android/guava/src/com/google/common/graph/MutableValueGraph.java b/android/guava/src/com/google/common/graph/MutableValueGraph.java index f32d2ee7a38c..a376917fd743 100644 --- a/android/guava/src/com/google/common/graph/MutableValueGraph.java +++ b/android/guava/src/com/google/common/graph/MutableValueGraph.java @@ -30,7 +30,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface MutableValueGraph extends ValueGraph { /** diff --git a/android/guava/src/com/google/common/graph/Network.java b/android/guava/src/com/google/common/graph/Network.java index 867b990dcf06..d538eb7620d3 100644 --- a/android/guava/src/com/google/common/graph/Network.java +++ b/android/guava/src/com/google/common/graph/Network.java @@ -103,7 +103,6 @@ */ @Beta @DoNotMock("Use NetworkBuilder to create a real instance") -@ElementTypesAreNonnullByDefault public interface Network extends SuccessorsFunction, PredecessorsFunction { // // Network-level accessors diff --git a/android/guava/src/com/google/common/graph/NetworkBuilder.java b/android/guava/src/com/google/common/graph/NetworkBuilder.java index c1f37147b8bd..9af9acc74e3f 100644 --- a/android/guava/src/com/google/common/graph/NetworkBuilder.java +++ b/android/guava/src/com/google/common/graph/NetworkBuilder.java @@ -73,7 +73,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class NetworkBuilder extends AbstractGraphBuilder { boolean allowsParallelEdges = false; ElementOrder edgeOrder = ElementOrder.insertion(); diff --git a/android/guava/src/com/google/common/graph/NetworkConnections.java b/android/guava/src/com/google/common/graph/NetworkConnections.java index 94d1780d3135..2a03d7910fce 100644 --- a/android/guava/src/com/google/common/graph/NetworkConnections.java +++ b/android/guava/src/com/google/common/graph/NetworkConnections.java @@ -28,7 +28,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault interface NetworkConnections { Set adjacentNodes(); diff --git a/android/guava/src/com/google/common/graph/ParametricNullness.java b/android/guava/src/com/google/common/graph/ParametricNullness.java index 32fd5ee7ecaa..634ee0e19782 100644 --- a/android/guava/src/com/google/common/graph/ParametricNullness.java +++ b/android/guava/src/com/google/common/graph/ParametricNullness.java @@ -56,8 +56,8 @@ *
            *
          • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
          • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/graph/PredecessorsFunction.java b/android/guava/src/com/google/common/graph/PredecessorsFunction.java index 750a8acd603b..f9ca48ae77b9 100644 --- a/android/guava/src/com/google/common/graph/PredecessorsFunction.java +++ b/android/guava/src/com/google/common/graph/PredecessorsFunction.java @@ -80,7 +80,6 @@ */ @Beta @DoNotMock("Implement with a lambda, or use GraphBuilder to build a Graph with the desired edges") -@ElementTypesAreNonnullByDefault public interface PredecessorsFunction { /** diff --git a/android/guava/src/com/google/common/graph/StandardMutableGraph.java b/android/guava/src/com/google/common/graph/StandardMutableGraph.java index 1be9640f419e..840dd5e095a5 100644 --- a/android/guava/src/com/google/common/graph/StandardMutableGraph.java +++ b/android/guava/src/com/google/common/graph/StandardMutableGraph.java @@ -28,7 +28,6 @@ * @author James Sexton * @param Node parameter type */ -@ElementTypesAreNonnullByDefault final class StandardMutableGraph extends ForwardingGraph implements MutableGraph { private final MutableValueGraph backingValueGraph; diff --git a/android/guava/src/com/google/common/graph/StandardMutableNetwork.java b/android/guava/src/com/google/common/graph/StandardMutableNetwork.java index c58b6d39093e..23512b6f97d5 100644 --- a/android/guava/src/com/google/common/graph/StandardMutableNetwork.java +++ b/android/guava/src/com/google/common/graph/StandardMutableNetwork.java @@ -40,7 +40,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class StandardMutableNetwork extends StandardNetwork implements MutableNetwork { diff --git a/android/guava/src/com/google/common/graph/StandardMutableValueGraph.java b/android/guava/src/com/google/common/graph/StandardMutableValueGraph.java index 1ad474083610..162480bccbab 100644 --- a/android/guava/src/com/google/common/graph/StandardMutableValueGraph.java +++ b/android/guava/src/com/google/common/graph/StandardMutableValueGraph.java @@ -41,7 +41,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault final class StandardMutableValueGraph extends StandardValueGraph implements MutableValueGraph { diff --git a/android/guava/src/com/google/common/graph/StandardNetwork.java b/android/guava/src/com/google/common/graph/StandardNetwork.java index 9c3cfd5a01b2..19f9e47887ff 100644 --- a/android/guava/src/com/google/common/graph/StandardNetwork.java +++ b/android/guava/src/com/google/common/graph/StandardNetwork.java @@ -48,7 +48,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault class StandardNetwork extends AbstractNetwork { private final boolean isDirected; private final boolean allowsParallelEdges; diff --git a/android/guava/src/com/google/common/graph/StandardValueGraph.java b/android/guava/src/com/google/common/graph/StandardValueGraph.java index a5f3553087d9..a99dce96300b 100644 --- a/android/guava/src/com/google/common/graph/StandardValueGraph.java +++ b/android/guava/src/com/google/common/graph/StandardValueGraph.java @@ -43,7 +43,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault class StandardValueGraph extends AbstractValueGraph { private final boolean isDirected; private final boolean allowsSelfLoops; diff --git a/android/guava/src/com/google/common/graph/SuccessorsFunction.java b/android/guava/src/com/google/common/graph/SuccessorsFunction.java index c29bb4b94360..f74f437c2937 100644 --- a/android/guava/src/com/google/common/graph/SuccessorsFunction.java +++ b/android/guava/src/com/google/common/graph/SuccessorsFunction.java @@ -80,7 +80,6 @@ */ @Beta @DoNotMock("Implement with a lambda, or use GraphBuilder to build a Graph with the desired edges") -@ElementTypesAreNonnullByDefault public interface SuccessorsFunction { /** diff --git a/android/guava/src/com/google/common/graph/Traverser.java b/android/guava/src/com/google/common/graph/Traverser.java index 3eca88e12529..0c54486343df 100644 --- a/android/guava/src/com/google/common/graph/Traverser.java +++ b/android/guava/src/com/google/common/graph/Traverser.java @@ -64,7 +64,6 @@ @DoNotMock( "Call forGraph or forTree, passing a lambda or a Graph with the desired edges (built with" + " GraphBuilder)") -@ElementTypesAreNonnullByDefault public abstract class Traverser { private final SuccessorsFunction successorFunction; diff --git a/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java b/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java index 4eeb2328fe0e..e50cb5523eb8 100644 --- a/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java +++ b/android/guava/src/com/google/common/graph/UndirectedGraphConnections.java @@ -37,7 +37,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault final class UndirectedGraphConnections implements GraphConnections { private final Map adjacentNodeValues; diff --git a/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java b/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java index 6caac3b715dd..04ae1094ef68 100644 --- a/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java @@ -39,7 +39,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class UndirectedMultiNetworkConnections extends AbstractUndirectedNetworkConnections { diff --git a/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java b/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java index 190897f8825d..5d3473c20ece 100644 --- a/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java +++ b/android/guava/src/com/google/common/graph/UndirectedNetworkConnections.java @@ -32,7 +32,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class UndirectedNetworkConnections extends AbstractUndirectedNetworkConnections { UndirectedNetworkConnections(Map incidentEdgeMap) { diff --git a/android/guava/src/com/google/common/graph/ValueGraph.java b/android/guava/src/com/google/common/graph/ValueGraph.java index 0b182a219f68..4f4b98df8ee6 100644 --- a/android/guava/src/com/google/common/graph/ValueGraph.java +++ b/android/guava/src/com/google/common/graph/ValueGraph.java @@ -106,7 +106,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface ValueGraph extends BaseGraph { // // ValueGraph-level accessors diff --git a/android/guava/src/com/google/common/graph/ValueGraphBuilder.java b/android/guava/src/com/google/common/graph/ValueGraphBuilder.java index a4014606d656..65658b951355 100644 --- a/android/guava/src/com/google/common/graph/ValueGraphBuilder.java +++ b/android/guava/src/com/google/common/graph/ValueGraphBuilder.java @@ -73,7 +73,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class ValueGraphBuilder extends AbstractGraphBuilder { /** Creates a new instance with the specified edge directionality. */ diff --git a/android/guava/src/com/google/common/graph/package-info.java b/android/guava/src/com/google/common/graph/package-info.java index 32d8b0157bb3..45036904dd5c 100644 --- a/android/guava/src/com/google/common/graph/package-info.java +++ b/android/guava/src/com/google/common/graph/package-info.java @@ -22,8 +22,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.graph; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/hash/AbstractByteHasher.java b/android/guava/src/com/google/common/hash/AbstractByteHasher.java index 2c8682575a74..bd96e8aead3f 100644 --- a/android/guava/src/com/google/common/hash/AbstractByteHasher.java +++ b/android/guava/src/com/google/common/hash/AbstractByteHasher.java @@ -31,7 +31,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault abstract class AbstractByteHasher extends AbstractHasher { private final ByteBuffer scratch = ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN); diff --git a/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java b/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java index 820fe963bf84..257e566c2564 100644 --- a/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java +++ b/android/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java @@ -30,7 +30,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault abstract class AbstractCompositeHashFunction extends AbstractHashFunction { @SuppressWarnings("Immutable") // array not modified after creation diff --git a/android/guava/src/com/google/common/hash/AbstractHashFunction.java b/android/guava/src/com/google/common/hash/AbstractHashFunction.java index 73085560024f..d6f91bf83d5a 100644 --- a/android/guava/src/com/google/common/hash/AbstractHashFunction.java +++ b/android/guava/src/com/google/common/hash/AbstractHashFunction.java @@ -28,7 +28,6 @@ *

            TODO(lowasser): make public */ @Immutable -@ElementTypesAreNonnullByDefault abstract class AbstractHashFunction implements HashFunction { @Override public HashCode hashObject( diff --git a/android/guava/src/com/google/common/hash/AbstractHasher.java b/android/guava/src/com/google/common/hash/AbstractHasher.java index 905a425c934a..4b26aa2356eb 100644 --- a/android/guava/src/com/google/common/hash/AbstractHasher.java +++ b/android/guava/src/com/google/common/hash/AbstractHasher.java @@ -26,7 +26,6 @@ * * @author Dimitris Andreou */ -@ElementTypesAreNonnullByDefault abstract class AbstractHasher implements Hasher { @Override @CanIgnoreReturnValue diff --git a/android/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java b/android/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java index 4969e35b22ba..54c76de19564 100644 --- a/android/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java +++ b/android/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java @@ -30,7 +30,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault abstract class AbstractNonStreamingHashFunction extends AbstractHashFunction { @Override public Hasher newHasher() { diff --git a/android/guava/src/com/google/common/hash/AbstractStreamingHasher.java b/android/guava/src/com/google/common/hash/AbstractStreamingHasher.java index 875bc6ec493b..e28520d12701 100644 --- a/android/guava/src/com/google/common/hash/AbstractStreamingHasher.java +++ b/android/guava/src/com/google/common/hash/AbstractStreamingHasher.java @@ -28,7 +28,6 @@ * @author Dimitris Andreou */ // TODO(kevinb): this class still needs some design-and-document-for-inheritance love -@ElementTypesAreNonnullByDefault abstract class AbstractStreamingHasher extends AbstractHasher { /** Buffer via which we pass data to the hash algorithm (the implementor) */ private final ByteBuffer buffer; diff --git a/android/guava/src/com/google/common/hash/BloomFilter.java b/android/guava/src/com/google/common/hash/BloomFilter.java index 445de963a784..02e1ca747554 100644 --- a/android/guava/src/com/google/common/hash/BloomFilter.java +++ b/android/guava/src/com/google/common/hash/BloomFilter.java @@ -69,7 +69,6 @@ * @since 11.0 (thread-safe since 23.0) */ @Beta -@ElementTypesAreNonnullByDefault public final class BloomFilter implements Predicate, Serializable { /** * A strategy to translate T instances, to {@code numHashFunctions} bit indexes. diff --git a/android/guava/src/com/google/common/hash/BloomFilterStrategies.java b/android/guava/src/com/google/common/hash/BloomFilterStrategies.java index 7c5650b2d531..3cbe543a1d9d 100644 --- a/android/guava/src/com/google/common/hash/BloomFilterStrategies.java +++ b/android/guava/src/com/google/common/hash/BloomFilterStrategies.java @@ -37,7 +37,6 @@ * @author Dimitris Andreou * @author Kurt Alfred Kluever */ -@ElementTypesAreNonnullByDefault enum BloomFilterStrategies implements BloomFilter.Strategy { /** * See "Less Hashing, Same Performance: Building a Better Bloom Filter" by Adam Kirsch and Michael diff --git a/android/guava/src/com/google/common/hash/ChecksumHashFunction.java b/android/guava/src/com/google/common/hash/ChecksumHashFunction.java index 159adbb8194b..380c3a39ab6e 100644 --- a/android/guava/src/com/google/common/hash/ChecksumHashFunction.java +++ b/android/guava/src/com/google/common/hash/ChecksumHashFunction.java @@ -27,7 +27,6 @@ * @author Colin Decker */ @Immutable -@ElementTypesAreNonnullByDefault final class ChecksumHashFunction extends AbstractHashFunction implements Serializable { private final ImmutableSupplier checksumSupplier; private final int bits; diff --git a/android/guava/src/com/google/common/hash/Crc32cHashFunction.java b/android/guava/src/com/google/common/hash/Crc32cHashFunction.java index 8e17e6538c21..f965178dddef 100644 --- a/android/guava/src/com/google/common/hash/Crc32cHashFunction.java +++ b/android/guava/src/com/google/common/hash/Crc32cHashFunction.java @@ -24,7 +24,6 @@ * @author Kurt Alfred Kluever */ @Immutable -@ElementTypesAreNonnullByDefault final class Crc32cHashFunction extends AbstractHashFunction { static final HashFunction CRC_32_C = new Crc32cHashFunction(); diff --git a/android/guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a2382b3514cc..000000000000 --- a/android/guava/src/com/google/common/hash/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.hash; - -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/hash/FarmHashFingerprint64.java b/android/guava/src/com/google/common/hash/FarmHashFingerprint64.java index 329a981c48eb..3785093f0924 100644 --- a/android/guava/src/com/google/common/hash/FarmHashFingerprint64.java +++ b/android/guava/src/com/google/common/hash/FarmHashFingerprint64.java @@ -38,7 +38,6 @@ * @author Kyle Maddison * @author Geoff Pike */ -@ElementTypesAreNonnullByDefault final class FarmHashFingerprint64 extends AbstractNonStreamingHashFunction { static final HashFunction FARMHASH_FINGERPRINT_64 = new FarmHashFingerprint64(); diff --git a/android/guava/src/com/google/common/hash/Fingerprint2011.java b/android/guava/src/com/google/common/hash/Fingerprint2011.java index 1b01e0092418..f54232bc482f 100644 --- a/android/guava/src/com/google/common/hash/Fingerprint2011.java +++ b/android/guava/src/com/google/common/hash/Fingerprint2011.java @@ -28,7 +28,6 @@ * @author kylemaddison@google.com (Kyle Maddison) * @author gpike@google.com (Geoff Pike) */ -@ElementTypesAreNonnullByDefault final class Fingerprint2011 extends AbstractNonStreamingHashFunction { static final HashFunction FINGERPRINT_2011 = new Fingerprint2011(); diff --git a/android/guava/src/com/google/common/hash/Funnel.java b/android/guava/src/com/google/common/hash/Funnel.java index 9d80dabcf6ed..02f9fd8baa6b 100644 --- a/android/guava/src/com/google/common/hash/Funnel.java +++ b/android/guava/src/com/google/common/hash/Funnel.java @@ -44,7 +44,6 @@ */ @Beta @DoNotMock("Implement with a lambda") -@ElementTypesAreNonnullByDefault public interface Funnel extends Serializable { /** diff --git a/android/guava/src/com/google/common/hash/Funnels.java b/android/guava/src/com/google/common/hash/Funnels.java index 1d1d0a49948c..81f1bb957cef 100644 --- a/android/guava/src/com/google/common/hash/Funnels.java +++ b/android/guava/src/com/google/common/hash/Funnels.java @@ -31,7 +31,6 @@ * @since 11.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class Funnels { private Funnels() {} diff --git a/android/guava/src/com/google/common/hash/HashCode.java b/android/guava/src/com/google/common/hash/HashCode.java index 9c31454b7145..166b87ac505d 100644 --- a/android/guava/src/com/google/common/hash/HashCode.java +++ b/android/guava/src/com/google/common/hash/HashCode.java @@ -32,7 +32,6 @@ * @author Kurt Alfred Kluever * @since 11.0 */ -@ElementTypesAreNonnullByDefault public abstract class HashCode { HashCode() {} diff --git a/android/guava/src/com/google/common/hash/HashFunction.java b/android/guava/src/com/google/common/hash/HashFunction.java index d4b7f8a01fcc..2d0783fc74b9 100644 --- a/android/guava/src/com/google/common/hash/HashFunction.java +++ b/android/guava/src/com/google/common/hash/HashFunction.java @@ -116,7 +116,6 @@ * @since 11.0 */ @Immutable -@ElementTypesAreNonnullByDefault public interface HashFunction { /** * Begins a new hash code computation by returning an initialized, stateful {@code Hasher} diff --git a/android/guava/src/com/google/common/hash/Hasher.java b/android/guava/src/com/google/common/hash/Hasher.java index f9a74c046aa2..dc29c642875d 100644 --- a/android/guava/src/com/google/common/hash/Hasher.java +++ b/android/guava/src/com/google/common/hash/Hasher.java @@ -54,7 +54,6 @@ * @since 11.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface Hasher extends PrimitiveSink { @CanIgnoreReturnValue @Override diff --git a/android/guava/src/com/google/common/hash/Hashing.java b/android/guava/src/com/google/common/hash/Hashing.java index 0b4793ffdcb5..34f32baca37a 100644 --- a/android/guava/src/com/google/common/hash/Hashing.java +++ b/android/guava/src/com/google/common/hash/Hashing.java @@ -42,7 +42,6 @@ * @author Kurt Alfred Kluever * @since 11.0 */ -@ElementTypesAreNonnullByDefault public final class Hashing { /** * Returns a general-purpose, temporary-use, non-cryptographic hash function. The algorithm diff --git a/android/guava/src/com/google/common/hash/HashingInputStream.java b/android/guava/src/com/google/common/hash/HashingInputStream.java index bf9464ce5573..f49dfd62daa5 100644 --- a/android/guava/src/com/google/common/hash/HashingInputStream.java +++ b/android/guava/src/com/google/common/hash/HashingInputStream.java @@ -29,7 +29,6 @@ * @since 16.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class HashingInputStream extends FilterInputStream { private final Hasher hasher; diff --git a/android/guava/src/com/google/common/hash/HashingOutputStream.java b/android/guava/src/com/google/common/hash/HashingOutputStream.java index e106202ecc68..20f1316a558c 100644 --- a/android/guava/src/com/google/common/hash/HashingOutputStream.java +++ b/android/guava/src/com/google/common/hash/HashingOutputStream.java @@ -28,7 +28,6 @@ * @since 16.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class HashingOutputStream extends FilterOutputStream { private final Hasher hasher; diff --git a/android/guava/src/com/google/common/hash/IgnoreJRERequirement.java b/android/guava/src/com/google/common/hash/IgnoreJRERequirement.java index 0de7c9a92439..8799c56dd850 100644 --- a/android/guava/src/com/google/common/hash/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/hash/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

            Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/hash/ImmutableSupplier.java b/android/guava/src/com/google/common/hash/ImmutableSupplier.java index 24f711a313fa..b6a74a77b719 100644 --- a/android/guava/src/com/google/common/hash/ImmutableSupplier.java +++ b/android/guava/src/com/google/common/hash/ImmutableSupplier.java @@ -23,5 +23,4 @@ */ // TODO(cpovirk): Should we just use ChecksumType directly instead of defining this type? @Immutable -@ElementTypesAreNonnullByDefault interface ImmutableSupplier extends Supplier {} diff --git a/android/guava/src/com/google/common/hash/Java8Compatibility.java b/android/guava/src/com/google/common/hash/Java8Compatibility.java index c15f2b3cc575..52f71e788558 100644 --- a/android/guava/src/com/google/common/hash/Java8Compatibility.java +++ b/android/guava/src/com/google/common/hash/Java8Compatibility.java @@ -22,7 +22,6 @@ * https://github.com/google/guava/issues/3990 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class Java8Compatibility { static void clear(Buffer b) { b.clear(); diff --git a/android/guava/src/com/google/common/hash/LittleEndianByteArray.java b/android/guava/src/com/google/common/hash/LittleEndianByteArray.java index 119582f07a0e..d42d5bd48b7f 100644 --- a/android/guava/src/com/google/common/hash/LittleEndianByteArray.java +++ b/android/guava/src/com/google/common/hash/LittleEndianByteArray.java @@ -30,7 +30,6 @@ * @author Kevin Damm * @author Kyle Maddison */ -@ElementTypesAreNonnullByDefault final class LittleEndianByteArray { /** The instance that actually does the work; delegates to Unsafe or a pure-Java fallback. */ diff --git a/android/guava/src/com/google/common/hash/LongAddable.java b/android/guava/src/com/google/common/hash/LongAddable.java index 5c6a7f0c7db8..75e64335c1b0 100644 --- a/android/guava/src/com/google/common/hash/LongAddable.java +++ b/android/guava/src/com/google/common/hash/LongAddable.java @@ -20,7 +20,6 @@ * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault interface LongAddable { void increment(); diff --git a/android/guava/src/com/google/common/hash/LongAddables.java b/android/guava/src/com/google/common/hash/LongAddables.java index 7c371ec88fdc..5ae9ba0b138b 100644 --- a/android/guava/src/com/google/common/hash/LongAddables.java +++ b/android/guava/src/com/google/common/hash/LongAddables.java @@ -22,7 +22,6 @@ * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault final class LongAddables { private static final Supplier SUPPLIER; diff --git a/android/guava/src/com/google/common/hash/LongAdder.java b/android/guava/src/com/google/common/hash/LongAdder.java index dc864aa9a417..bd08428ff3a4 100644 --- a/android/guava/src/com/google/common/hash/LongAdder.java +++ b/android/guava/src/com/google/common/hash/LongAdder.java @@ -38,7 +38,6 @@ * @since 1.8 * @author Doug Lea */ -@ElementTypesAreNonnullByDefault final class LongAdder extends Striped64 implements Serializable, LongAddable { private static final long serialVersionUID = 7249069246863182397L; diff --git a/android/guava/src/com/google/common/hash/MacHashFunction.java b/android/guava/src/com/google/common/hash/MacHashFunction.java index 6d53a54c39e2..390b49c30234 100644 --- a/android/guava/src/com/google/common/hash/MacHashFunction.java +++ b/android/guava/src/com/google/common/hash/MacHashFunction.java @@ -30,7 +30,6 @@ * @author Kurt Alfred Kluever */ @Immutable -@ElementTypesAreNonnullByDefault final class MacHashFunction extends AbstractHashFunction { @SuppressWarnings("Immutable") // cloned before each use diff --git a/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java b/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java index 0fe3347eae48..9a435b9edc13 100644 --- a/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java +++ b/android/guava/src/com/google/common/hash/MessageDigestHashFunction.java @@ -34,7 +34,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault final class MessageDigestHashFunction extends AbstractHashFunction implements Serializable { @SuppressWarnings("Immutable") // cloned before each use diff --git a/android/guava/src/com/google/common/hash/Murmur3_128HashFunction.java b/android/guava/src/com/google/common/hash/Murmur3_128HashFunction.java index d1304f8273c5..813272d47803 100644 --- a/android/guava/src/com/google/common/hash/Murmur3_128HashFunction.java +++ b/android/guava/src/com/google/common/hash/Murmur3_128HashFunction.java @@ -41,7 +41,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault final class Murmur3_128HashFunction extends AbstractHashFunction implements Serializable { static final HashFunction MURMUR3_128 = new Murmur3_128HashFunction(0); diff --git a/android/guava/src/com/google/common/hash/Murmur3_32HashFunction.java b/android/guava/src/com/google/common/hash/Murmur3_32HashFunction.java index 083158fc57fa..11dbd2a41b98 100644 --- a/android/guava/src/com/google/common/hash/Murmur3_32HashFunction.java +++ b/android/guava/src/com/google/common/hash/Murmur3_32HashFunction.java @@ -51,7 +51,6 @@ * @author Kurt Alfred Kluever */ @Immutable -@ElementTypesAreNonnullByDefault final class Murmur3_32HashFunction extends AbstractHashFunction implements Serializable { static final HashFunction MURMUR3_32 = new Murmur3_32HashFunction(0, /* supplementaryPlaneFix= */ false); diff --git a/android/guava/src/com/google/common/hash/ParametricNullness.java b/android/guava/src/com/google/common/hash/ParametricNullness.java index 4ebc40bb741e..f5a8614a8762 100644 --- a/android/guava/src/com/google/common/hash/ParametricNullness.java +++ b/android/guava/src/com/google/common/hash/ParametricNullness.java @@ -56,8 +56,8 @@ *

              *
            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/hash/PrimitiveSink.java b/android/guava/src/com/google/common/hash/PrimitiveSink.java index ecd6a32c8379..71c5eceb7bff 100644 --- a/android/guava/src/com/google/common/hash/PrimitiveSink.java +++ b/android/guava/src/com/google/common/hash/PrimitiveSink.java @@ -26,7 +26,6 @@ * @since 12.0 (in 11.0 as {@code Sink}) */ @Beta -@ElementTypesAreNonnullByDefault public interface PrimitiveSink { /** * Puts a byte into this sink. diff --git a/android/guava/src/com/google/common/hash/SipHashFunction.java b/android/guava/src/com/google/common/hash/SipHashFunction.java index a226b61a50b9..977e7af038da 100644 --- a/android/guava/src/com/google/common/hash/SipHashFunction.java +++ b/android/guava/src/com/google/common/hash/SipHashFunction.java @@ -34,7 +34,6 @@ * @author Daniel J. Bernstein */ @Immutable -@ElementTypesAreNonnullByDefault final class SipHashFunction extends AbstractHashFunction implements Serializable { static final HashFunction SIP_HASH_24 = new SipHashFunction(2, 4, 0x0706050403020100L, 0x0f0e0d0c0b0a0908L); diff --git a/android/guava/src/com/google/common/hash/Striped64.java b/android/guava/src/com/google/common/hash/Striped64.java index 6cbbd7f5aa80..9592f9f218b0 100644 --- a/android/guava/src/com/google/common/hash/Striped64.java +++ b/android/guava/src/com/google/common/hash/Striped64.java @@ -27,7 +27,6 @@ * so. */ @GwtIncompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings({"SunApi", "removal"}) // b/345822163 abstract class Striped64 extends Number { /* diff --git a/android/guava/src/com/google/common/hash/package-info.java b/android/guava/src/com/google/common/hash/package-info.java index d210f7ef7b46..5cfe6c89cdd4 100644 --- a/android/guava/src/com/google/common/hash/package-info.java +++ b/android/guava/src/com/google/common/hash/package-info.java @@ -20,8 +20,6 @@ * href="https://github.com/google/guava/wiki/HashingExplained">hashing. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.hash; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a28b716632d4..000000000000 --- a/android/guava/src/com/google/common/html/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.html; - -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/html/HtmlEscapers.java b/android/guava/src/com/google/common/html/HtmlEscapers.java index 51e70e92a7db..6da547570bdc 100644 --- a/android/guava/src/com/google/common/html/HtmlEscapers.java +++ b/android/guava/src/com/google/common/html/HtmlEscapers.java @@ -36,7 +36,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class HtmlEscapers { /** * Returns an {@link Escaper} instance that escapes HTML metacharacters as specified by *
            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/html/package-info.java b/android/guava/src/com/google/common/html/package-info.java index 1a97bccd1ab1..6aee2f46084e 100644 --- a/android/guava/src/com/google/common/html/package-info.java +++ b/android/guava/src/com/google/common/html/package-info.java @@ -21,8 +21,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.html; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/io/AppendableWriter.java b/android/guava/src/com/google/common/io/AppendableWriter.java index 8566569a96d1..ccf3df01427c 100644 --- a/android/guava/src/com/google/common/io/AppendableWriter.java +++ b/android/guava/src/com/google/common/io/AppendableWriter.java @@ -34,7 +34,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault class AppendableWriter extends Writer { private final Appendable target; private boolean closed; diff --git a/android/guava/src/com/google/common/io/BaseEncoding.java b/android/guava/src/com/google/common/io/BaseEncoding.java index 52da773485f0..da7df1605049 100644 --- a/android/guava/src/com/google/common/io/BaseEncoding.java +++ b/android/guava/src/com/google/common/io/BaseEncoding.java @@ -126,7 +126,6 @@ * @since 14.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class BaseEncoding { // TODO(lowasser): consider making encodeTo(Appendable, byte[], int, int) public. diff --git a/android/guava/src/com/google/common/io/ByteArrayDataInput.java b/android/guava/src/com/google/common/io/ByteArrayDataInput.java index 9fa295904d48..758c51ebfa85 100644 --- a/android/guava/src/com/google/common/io/ByteArrayDataInput.java +++ b/android/guava/src/com/google/common/io/ByteArrayDataInput.java @@ -35,7 +35,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ByteArrayDataInput extends DataInput { @Override void readFully(byte b[]); diff --git a/android/guava/src/com/google/common/io/ByteArrayDataOutput.java b/android/guava/src/com/google/common/io/ByteArrayDataOutput.java index 487783531601..8366a5790a8c 100644 --- a/android/guava/src/com/google/common/io/ByteArrayDataOutput.java +++ b/android/guava/src/com/google/common/io/ByteArrayDataOutput.java @@ -28,7 +28,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ByteArrayDataOutput extends DataOutput { @Override void write(int b); diff --git a/android/guava/src/com/google/common/io/ByteProcessor.java b/android/guava/src/com/google/common/io/ByteProcessor.java index cfb531c5a7f9..5947de3ab58c 100644 --- a/android/guava/src/com/google/common/io/ByteProcessor.java +++ b/android/guava/src/com/google/common/io/ByteProcessor.java @@ -33,7 +33,6 @@ @DoNotMock("Implement it normally") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ByteProcessor { /** * This method will be called for each chunk of bytes in an input stream. The implementation diff --git a/android/guava/src/com/google/common/io/ByteSink.java b/android/guava/src/com/google/common/io/ByteSink.java index f6727a987a2d..d3013cb1ffb3 100644 --- a/android/guava/src/com/google/common/io/ByteSink.java +++ b/android/guava/src/com/google/common/io/ByteSink.java @@ -48,7 +48,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ByteSink { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/io/ByteSource.java b/android/guava/src/com/google/common/io/ByteSource.java index 8da642c1b57e..a4da540bd27e 100644 --- a/android/guava/src/com/google/common/io/ByteSource.java +++ b/android/guava/src/com/google/common/io/ByteSource.java @@ -76,7 +76,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ByteSource { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/io/ByteStreams.java b/android/guava/src/com/google/common/io/ByteStreams.java index f869fe9cfaa8..cb4ad5cbc3c3 100644 --- a/android/guava/src/com/google/common/io/ByteStreams.java +++ b/android/guava/src/com/google/common/io/ByteStreams.java @@ -55,7 +55,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ByteStreams { private static final int BUFFER_SIZE = 8192; diff --git a/android/guava/src/com/google/common/io/CharSequenceReader.java b/android/guava/src/com/google/common/io/CharSequenceReader.java index a5614041f0f1..38e1be1b1cb6 100644 --- a/android/guava/src/com/google/common/io/CharSequenceReader.java +++ b/android/guava/src/com/google/common/io/CharSequenceReader.java @@ -36,7 +36,6 @@ // TODO(cgdecker): make this public? as a type, or a method in CharStreams? @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class CharSequenceReader extends Reader { @CheckForNull private CharSequence seq; diff --git a/android/guava/src/com/google/common/io/CharSink.java b/android/guava/src/com/google/common/io/CharSink.java index 912a6093c893..a013d519a442 100644 --- a/android/guava/src/com/google/common/io/CharSink.java +++ b/android/guava/src/com/google/common/io/CharSink.java @@ -53,7 +53,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class CharSink { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/io/CharSource.java b/android/guava/src/com/google/common/io/CharSource.java index 3e9a1cb06337..e67e4bf51a34 100644 --- a/android/guava/src/com/google/common/io/CharSource.java +++ b/android/guava/src/com/google/common/io/CharSource.java @@ -84,7 +84,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class CharSource { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/io/CharStreams.java b/android/guava/src/com/google/common/io/CharStreams.java index 877de824de79..d518caf19957 100644 --- a/android/guava/src/com/google/common/io/CharStreams.java +++ b/android/guava/src/com/google/common/io/CharStreams.java @@ -45,7 +45,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CharStreams { // 2K chars (4K bytes) diff --git a/android/guava/src/com/google/common/io/Closeables.java b/android/guava/src/com/google/common/io/Closeables.java index aca51a996fb9..363e12d7c1f4 100644 --- a/android/guava/src/com/google/common/io/Closeables.java +++ b/android/guava/src/com/google/common/io/Closeables.java @@ -33,7 +33,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Closeables { @VisibleForTesting static final Logger logger = Logger.getLogger(Closeables.class.getName()); diff --git a/android/guava/src/com/google/common/io/Closer.java b/android/guava/src/com/google/common/io/Closer.java index b947cd0994f8..3169e56a173a 100644 --- a/android/guava/src/com/google/common/io/Closer.java +++ b/android/guava/src/com/google/common/io/Closer.java @@ -81,7 +81,6 @@ // Coffee's for {@link Closer closers} only. @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Closer implements Closeable { /** Creates a new {@link Closer}. */ public static Closer create() { diff --git a/android/guava/src/com/google/common/io/CountingInputStream.java b/android/guava/src/com/google/common/io/CountingInputStream.java index bc481dd7433b..c2f73f5ff114 100644 --- a/android/guava/src/com/google/common/io/CountingInputStream.java +++ b/android/guava/src/com/google/common/io/CountingInputStream.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CountingInputStream extends FilterInputStream { private long count; diff --git a/android/guava/src/com/google/common/io/CountingOutputStream.java b/android/guava/src/com/google/common/io/CountingOutputStream.java index 1cbfe081fdfb..c2273f8c5e3f 100644 --- a/android/guava/src/com/google/common/io/CountingOutputStream.java +++ b/android/guava/src/com/google/common/io/CountingOutputStream.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CountingOutputStream extends FilterOutputStream { private long count; diff --git a/android/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 48bc10f192a1..000000000000 --- a/android/guava/src/com/google/common/io/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.io; - -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/io/FileBackedOutputStream.java b/android/guava/src/com/google/common/io/FileBackedOutputStream.java index 954ab70adee0..ab0629d1d1d0 100644 --- a/android/guava/src/com/google/common/io/FileBackedOutputStream.java +++ b/android/guava/src/com/google/common/io/FileBackedOutputStream.java @@ -65,7 +65,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible -@ElementTypesAreNonnullByDefault public final class FileBackedOutputStream extends OutputStream { private final int fileThreshold; private final boolean resetOnFinalize; diff --git a/android/guava/src/com/google/common/io/FileWriteMode.java b/android/guava/src/com/google/common/io/FileWriteMode.java index 47cf251e76eb..c253b00afe1f 100644 --- a/android/guava/src/com/google/common/io/FileWriteMode.java +++ b/android/guava/src/com/google/common/io/FileWriteMode.java @@ -25,7 +25,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public enum FileWriteMode { /** Specifies that writes to the opened file should append to the end of the file. */ APPEND diff --git a/android/guava/src/com/google/common/io/Files.java b/android/guava/src/com/google/common/io/Files.java index a8d83e39cc7a..11c49d63e5c3 100644 --- a/android/guava/src/com/google/common/io/Files.java +++ b/android/guava/src/com/google/common/io/Files.java @@ -70,7 +70,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Files { private Files() {} diff --git a/android/guava/src/com/google/common/io/Flushables.java b/android/guava/src/com/google/common/io/Flushables.java index 4a42e4a407a8..412a09bbfe82 100644 --- a/android/guava/src/com/google/common/io/Flushables.java +++ b/android/guava/src/com/google/common/io/Flushables.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Flushables { private static final Logger logger = Logger.getLogger(Flushables.class.getName()); diff --git a/android/guava/src/com/google/common/io/IgnoreJRERequirement.java b/android/guava/src/com/google/common/io/IgnoreJRERequirement.java index b1b8e1032cc0..383163d4977c 100644 --- a/android/guava/src/com/google/common/io/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/io/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

              Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java b/android/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java index 5ed1dce275f9..56b20fbb96a6 100644 --- a/android/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java +++ b/android/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java @@ -38,7 +38,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible // java.nio.file -@ElementTypesAreNonnullByDefault // Users are unlikely to use this unless they're already interacting with MoreFiles and Path. @IgnoreJRERequirement public final class InsecureRecursiveDeleteException extends FileSystemException { diff --git a/android/guava/src/com/google/common/io/Java8Compatibility.java b/android/guava/src/com/google/common/io/Java8Compatibility.java index bd3e6e055339..f1cd446ed330 100644 --- a/android/guava/src/com/google/common/io/Java8Compatibility.java +++ b/android/guava/src/com/google/common/io/Java8Compatibility.java @@ -24,7 +24,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class Java8Compatibility { static void clear(Buffer b) { b.clear(); diff --git a/android/guava/src/com/google/common/io/LineBuffer.java b/android/guava/src/com/google/common/io/LineBuffer.java index 201dfd61617d..83029d5183f3 100644 --- a/android/guava/src/com/google/common/io/LineBuffer.java +++ b/android/guava/src/com/google/common/io/LineBuffer.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class LineBuffer { /** Holds partial line contents. */ private StringBuilder line = new StringBuilder(); diff --git a/android/guava/src/com/google/common/io/LineProcessor.java b/android/guava/src/com/google/common/io/LineProcessor.java index c0e08fa119f0..5f45f941f0c8 100644 --- a/android/guava/src/com/google/common/io/LineProcessor.java +++ b/android/guava/src/com/google/common/io/LineProcessor.java @@ -31,7 +31,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface LineProcessor { /** diff --git a/android/guava/src/com/google/common/io/LineReader.java b/android/guava/src/com/google/common/io/LineReader.java index 54bf04c7caad..9afcf288088c 100644 --- a/android/guava/src/com/google/common/io/LineReader.java +++ b/android/guava/src/com/google/common/io/LineReader.java @@ -37,7 +37,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class LineReader { private final Readable readable; @CheckForNull private final Reader reader; diff --git a/android/guava/src/com/google/common/io/LittleEndianDataInputStream.java b/android/guava/src/com/google/common/io/LittleEndianDataInputStream.java index 54b1b14e87fa..ad9cf179ee3c 100644 --- a/android/guava/src/com/google/common/io/LittleEndianDataInputStream.java +++ b/android/guava/src/com/google/common/io/LittleEndianDataInputStream.java @@ -41,7 +41,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class LittleEndianDataInputStream extends FilterInputStream implements DataInput { /** diff --git a/android/guava/src/com/google/common/io/LittleEndianDataOutputStream.java b/android/guava/src/com/google/common/io/LittleEndianDataOutputStream.java index dbb7e8eef7b7..dd3746cc6781 100644 --- a/android/guava/src/com/google/common/io/LittleEndianDataOutputStream.java +++ b/android/guava/src/com/google/common/io/LittleEndianDataOutputStream.java @@ -36,7 +36,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class LittleEndianDataOutputStream extends FilterOutputStream implements DataOutput { /** diff --git a/android/guava/src/com/google/common/io/MoreFiles.java b/android/guava/src/com/google/common/io/MoreFiles.java index 58787f95d220..928859735b1b 100644 --- a/android/guava/src/com/google/common/io/MoreFiles.java +++ b/android/guava/src/com/google/common/io/MoreFiles.java @@ -69,7 +69,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible // java.nio.file -@ElementTypesAreNonnullByDefault @IgnoreJRERequirement // Users will use this only if they're already using Path. public final class MoreFiles { diff --git a/android/guava/src/com/google/common/io/MultiInputStream.java b/android/guava/src/com/google/common/io/MultiInputStream.java index 068baf679010..92540f438bef 100644 --- a/android/guava/src/com/google/common/io/MultiInputStream.java +++ b/android/guava/src/com/google/common/io/MultiInputStream.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class MultiInputStream extends InputStream { private Iterator it; diff --git a/android/guava/src/com/google/common/io/MultiReader.java b/android/guava/src/com/google/common/io/MultiReader.java index 9e3a7eccbb9e..de5d3b55e208 100644 --- a/android/guava/src/com/google/common/io/MultiReader.java +++ b/android/guava/src/com/google/common/io/MultiReader.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault class MultiReader extends Reader { private final Iterator it; @CheckForNull private Reader current; diff --git a/android/guava/src/com/google/common/io/ParametricNullness.java b/android/guava/src/com/google/common/io/ParametricNullness.java index 881c07d49804..32eee700e1c6 100644 --- a/android/guava/src/com/google/common/io/ParametricNullness.java +++ b/android/guava/src/com/google/common/io/ParametricNullness.java @@ -56,8 +56,8 @@ *

                *
              • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
              • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/io/PatternFilenameFilter.java b/android/guava/src/com/google/common/io/PatternFilenameFilter.java index ee0a0bda20f4..e92eb66528c6 100644 --- a/android/guava/src/com/google/common/io/PatternFilenameFilter.java +++ b/android/guava/src/com/google/common/io/PatternFilenameFilter.java @@ -31,7 +31,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class PatternFilenameFilter implements FilenameFilter { private final Pattern pattern; diff --git a/android/guava/src/com/google/common/io/ReaderInputStream.java b/android/guava/src/com/google/common/io/ReaderInputStream.java index 9f09ac0894cb..3a804b170de8 100644 --- a/android/guava/src/com/google/common/io/ReaderInputStream.java +++ b/android/guava/src/com/google/common/io/ReaderInputStream.java @@ -47,7 +47,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class ReaderInputStream extends InputStream { private final Reader reader; private final CharsetEncoder encoder; diff --git a/android/guava/src/com/google/common/io/RecursiveDeleteOption.java b/android/guava/src/com/google/common/io/RecursiveDeleteOption.java index 1dfe3ad5eb45..c7cb270c8d44 100644 --- a/android/guava/src/com/google/common/io/RecursiveDeleteOption.java +++ b/android/guava/src/com/google/common/io/RecursiveDeleteOption.java @@ -31,7 +31,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible // java.nio.file -@ElementTypesAreNonnullByDefault public enum RecursiveDeleteOption { /** * Specifies that the recursive delete should not throw an exception when it can't be guaranteed diff --git a/android/guava/src/com/google/common/io/Resources.java b/android/guava/src/com/google/common/io/Resources.java index ea9daea96a6c..e953c7944e9a 100644 --- a/android/guava/src/com/google/common/io/Resources.java +++ b/android/guava/src/com/google/common/io/Resources.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Resources { private Resources() {} diff --git a/android/guava/src/com/google/common/io/TempFileCreator.java b/android/guava/src/com/google/common/io/TempFileCreator.java index 769761280b27..6a65e39d2572 100644 --- a/android/guava/src/com/google/common/io/TempFileCreator.java +++ b/android/guava/src/com/google/common/io/TempFileCreator.java @@ -51,7 +51,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible -@ElementTypesAreNonnullByDefault abstract class TempFileCreator { static final TempFileCreator INSTANCE = pickSecureCreator(); diff --git a/android/guava/src/com/google/common/io/package-info.java b/android/guava/src/com/google/common/io/package-info.java index e4eebbd0d798..83eb21439117 100644 --- a/android/guava/src/com/google/common/io/package-info.java +++ b/android/guava/src/com/google/common/io/package-info.java @@ -28,8 +28,6 @@ * @author Chris Nokleberg */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.io; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/math/BigDecimalMath.java b/android/guava/src/com/google/common/math/BigDecimalMath.java index d7094047999f..e1a7a10d4b98 100644 --- a/android/guava/src/com/google/common/math/BigDecimalMath.java +++ b/android/guava/src/com/google/common/math/BigDecimalMath.java @@ -27,7 +27,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class BigDecimalMath { private BigDecimalMath() {} diff --git a/android/guava/src/com/google/common/math/BigIntegerMath.java b/android/guava/src/com/google/common/math/BigIntegerMath.java index ada0f0f57c80..204ac38874d9 100644 --- a/android/guava/src/com/google/common/math/BigIntegerMath.java +++ b/android/guava/src/com/google/common/math/BigIntegerMath.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class BigIntegerMath { /** * Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to diff --git a/android/guava/src/com/google/common/math/DoubleMath.java b/android/guava/src/com/google/common/math/DoubleMath.java index 531334cf4d5a..5729f829826f 100644 --- a/android/guava/src/com/google/common/math/DoubleMath.java +++ b/android/guava/src/com/google/common/math/DoubleMath.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class DoubleMath { /* * This method returns a value y such that rounding y DOWN (towards zero) gives the same result as diff --git a/android/guava/src/com/google/common/math/DoubleUtils.java b/android/guava/src/com/google/common/math/DoubleUtils.java index f10367cf7cc5..e2331a71c624 100644 --- a/android/guava/src/com/google/common/math/DoubleUtils.java +++ b/android/guava/src/com/google/common/math/DoubleUtils.java @@ -34,7 +34,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DoubleUtils { private DoubleUtils() {} diff --git a/android/guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 84999ea49499..000000000000 --- a/android/guava/src/com/google/common/math/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.math; - -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/math/IgnoreJRERequirement.java b/android/guava/src/com/google/common/math/IgnoreJRERequirement.java index 264757baf15b..4d9e99fd0df0 100644 --- a/android/guava/src/com/google/common/math/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/math/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/math/IntMath.java b/android/guava/src/com/google/common/math/IntMath.java index 74b6de68a681..44c7d67accf6 100644 --- a/android/guava/src/com/google/common/math/IntMath.java +++ b/android/guava/src/com/google/common/math/IntMath.java @@ -47,7 +47,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class IntMath { @VisibleForTesting static final int MAX_SIGNED_POWER_OF_TWO = 1 << (Integer.SIZE - 2); diff --git a/android/guava/src/com/google/common/math/LinearTransformation.java b/android/guava/src/com/google/common/math/LinearTransformation.java index 463e8f9b8a35..f4d1885a02bb 100644 --- a/android/guava/src/com/google/common/math/LinearTransformation.java +++ b/android/guava/src/com/google/common/math/LinearTransformation.java @@ -36,7 +36,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class LinearTransformation { /** * Constructor for use by subclasses inside Guava. diff --git a/android/guava/src/com/google/common/math/LongMath.java b/android/guava/src/com/google/common/math/LongMath.java index 16e0248d99e4..facc7810f278 100644 --- a/android/guava/src/com/google/common/math/LongMath.java +++ b/android/guava/src/com/google/common/math/LongMath.java @@ -47,7 +47,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class LongMath { @VisibleForTesting static final long MAX_SIGNED_POWER_OF_TWO = 1L << (Long.SIZE - 2); diff --git a/android/guava/src/com/google/common/math/MathPreconditions.java b/android/guava/src/com/google/common/math/MathPreconditions.java index d8b7b10bf4cd..33e142d0b7e3 100644 --- a/android/guava/src/com/google/common/math/MathPreconditions.java +++ b/android/guava/src/com/google/common/math/MathPreconditions.java @@ -25,7 +25,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class MathPreconditions { @CanIgnoreReturnValue static int checkPositive(String role, int x) { diff --git a/android/guava/src/com/google/common/math/PairedStats.java b/android/guava/src/com/google/common/math/PairedStats.java index c60a62b0aee3..dc42cf11f5a4 100644 --- a/android/guava/src/com/google/common/math/PairedStats.java +++ b/android/guava/src/com/google/common/math/PairedStats.java @@ -39,7 +39,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class PairedStats implements Serializable { private final Stats xStats; diff --git a/android/guava/src/com/google/common/math/PairedStatsAccumulator.java b/android/guava/src/com/google/common/math/PairedStatsAccumulator.java index 0eeebb0ffbbd..e8a772e9539b 100644 --- a/android/guava/src/com/google/common/math/PairedStatsAccumulator.java +++ b/android/guava/src/com/google/common/math/PairedStatsAccumulator.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class PairedStatsAccumulator { /** Creates a new accumulator. */ public PairedStatsAccumulator() {} diff --git a/android/guava/src/com/google/common/math/ParametricNullness.java b/android/guava/src/com/google/common/math/ParametricNullness.java index 612fa934a6d5..a18ba9348f9a 100644 --- a/android/guava/src/com/google/common/math/ParametricNullness.java +++ b/android/guava/src/com/google/common/math/ParametricNullness.java @@ -56,8 +56,8 @@ *

                  *
                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/math/Quantiles.java b/android/guava/src/com/google/common/math/Quantiles.java index e02b26db57ce..37ba5a93f68b 100644 --- a/android/guava/src/com/google/common/math/Quantiles.java +++ b/android/guava/src/com/google/common/math/Quantiles.java @@ -128,7 +128,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Quantiles { /** * Constructor for a type that is not meant to be instantiated. diff --git a/android/guava/src/com/google/common/math/Stats.java b/android/guava/src/com/google/common/math/Stats.java index d4df2f7af314..2f6eb5f987ea 100644 --- a/android/guava/src/com/google/common/math/Stats.java +++ b/android/guava/src/com/google/common/math/Stats.java @@ -64,7 +64,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Stats implements Serializable { private final long count; diff --git a/android/guava/src/com/google/common/math/StatsAccumulator.java b/android/guava/src/com/google/common/math/StatsAccumulator.java index 5e6e9b445e4a..1a2b528225be 100644 --- a/android/guava/src/com/google/common/math/StatsAccumulator.java +++ b/android/guava/src/com/google/common/math/StatsAccumulator.java @@ -37,7 +37,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class StatsAccumulator { /** Creates a new accumulator. */ public StatsAccumulator() {} diff --git a/android/guava/src/com/google/common/math/ToDoubleRounder.java b/android/guava/src/com/google/common/math/ToDoubleRounder.java index 2e7e7fae0944..7525e3f990f1 100644 --- a/android/guava/src/com/google/common/math/ToDoubleRounder.java +++ b/android/guava/src/com/google/common/math/ToDoubleRounder.java @@ -25,7 +25,6 @@ * a {@link RoundingMode}. */ @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class ToDoubleRounder> { /** * Returns x rounded to either the greatest double less than or equal to the precise value of x, diff --git a/android/guava/src/com/google/common/math/package-info.java b/android/guava/src/com/google/common/math/package-info.java index 02580e1a4220..23b73a7be7b4 100644 --- a/android/guava/src/com/google/common/math/package-info.java +++ b/android/guava/src/com/google/common/math/package-info.java @@ -22,9 +22,7 @@ *

                  See the Guava User Guide article on math utilities. */ -@ParametersAreNonnullByDefault @CheckReturnValue package com.google.common.math; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index d8cfd7377d0e..000000000000 --- a/android/guava/src/com/google/common/net/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.net; - -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/net/HostAndPort.java b/android/guava/src/com/google/common/net/HostAndPort.java index 2a4011cf0e8c..4a4546b384ab 100644 --- a/android/guava/src/com/google/common/net/HostAndPort.java +++ b/android/guava/src/com/google/common/net/HostAndPort.java @@ -62,7 +62,6 @@ */ @Immutable @GwtCompatible -@ElementTypesAreNonnullByDefault public final class HostAndPort implements Serializable { /** Magic value indicating the absence of a port number. */ private static final int NO_PORT = -1; diff --git a/android/guava/src/com/google/common/net/HostSpecifier.java b/android/guava/src/com/google/common/net/HostSpecifier.java index 65194112ebb8..80ab799aa110 100644 --- a/android/guava/src/com/google/common/net/HostSpecifier.java +++ b/android/guava/src/com/google/common/net/HostSpecifier.java @@ -44,7 +44,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class HostSpecifier { private final String canonicalForm; diff --git a/android/guava/src/com/google/common/net/HttpHeaders.java b/android/guava/src/com/google/common/net/HttpHeaders.java index c45303be7308..df6ac99c39c8 100644 --- a/android/guava/src/com/google/common/net/HttpHeaders.java +++ b/android/guava/src/com/google/common/net/HttpHeaders.java @@ -31,7 +31,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class HttpHeaders { private HttpHeaders() {} diff --git a/android/guava/src/com/google/common/net/InetAddresses.java b/android/guava/src/com/google/common/net/InetAddresses.java index 0371bec7dc39..f9fcf8cca60b 100644 --- a/android/guava/src/com/google/common/net/InetAddresses.java +++ b/android/guava/src/com/google/common/net/InetAddresses.java @@ -103,7 +103,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class InetAddresses { private static final int IPV4_PART_COUNT = 4; private static final int IPV6_PART_COUNT = 8; diff --git a/android/guava/src/com/google/common/net/InternetDomainName.java b/android/guava/src/com/google/common/net/InternetDomainName.java index 7f75203eb0b0..51827074669f 100644 --- a/android/guava/src/com/google/common/net/InternetDomainName.java +++ b/android/guava/src/com/google/common/net/InternetDomainName.java @@ -74,7 +74,6 @@ */ @GwtCompatible(emulated = true) @Immutable -@ElementTypesAreNonnullByDefault public final class InternetDomainName { private static final CharMatcher DOTS_MATCHER = CharMatcher.anyOf(".\u3002\uFF0E\uFF61"); diff --git a/android/guava/src/com/google/common/net/MediaType.java b/android/guava/src/com/google/common/net/MediaType.java index 6a2e3017f2e8..2fb8d5028d19 100644 --- a/android/guava/src/com/google/common/net/MediaType.java +++ b/android/guava/src/com/google/common/net/MediaType.java @@ -72,7 +72,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class MediaType { private static final String CHARSET_ATTRIBUTE = "charset"; private static final ImmutableListMultimap UTF_8_CONSTANT_PARAMETERS = diff --git a/android/guava/src/com/google/common/net/ParametricNullness.java b/android/guava/src/com/google/common/net/ParametricNullness.java index 83b9eb6fa6a3..5b3af1736ee1 100644 --- a/android/guava/src/com/google/common/net/ParametricNullness.java +++ b/android/guava/src/com/google/common/net/ParametricNullness.java @@ -56,8 +56,8 @@ *

                    *
                  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                  • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/net/PercentEscaper.java b/android/guava/src/com/google/common/net/PercentEscaper.java index fa023bdf0c60..d8cd8454e6c3 100644 --- a/android/guava/src/com/google/common/net/PercentEscaper.java +++ b/android/guava/src/com/google/common/net/PercentEscaper.java @@ -51,7 +51,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class PercentEscaper extends UnicodeEscaper { // In some escapers spaces are escaped to '+' diff --git a/android/guava/src/com/google/common/net/UrlEscapers.java b/android/guava/src/com/google/common/net/UrlEscapers.java index 68cbd01e34bc..60fadbfea894 100644 --- a/android/guava/src/com/google/common/net/UrlEscapers.java +++ b/android/guava/src/com/google/common/net/UrlEscapers.java @@ -29,7 +29,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class UrlEscapers { private UrlEscapers() {} diff --git a/android/guava/src/com/google/common/net/package-info.java b/android/guava/src/com/google/common/net/package-info.java index 6a74ecee4918..a6673a108739 100644 --- a/android/guava/src/com/google/common/net/package-info.java +++ b/android/guava/src/com/google/common/net/package-info.java @@ -21,8 +21,6 @@ * @author Craig Berry */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.net; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/primitives/Booleans.java b/android/guava/src/com/google/common/primitives/Booleans.java index c282266b08a0..55814db536ef 100644 --- a/android/guava/src/com/google/common/primitives/Booleans.java +++ b/android/guava/src/com/google/common/primitives/Booleans.java @@ -43,7 +43,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Booleans { private Booleans() {} diff --git a/android/guava/src/com/google/common/primitives/Bytes.java b/android/guava/src/com/google/common/primitives/Bytes.java index 7b2354efeb7b..0df032121a23 100644 --- a/android/guava/src/com/google/common/primitives/Bytes.java +++ b/android/guava/src/com/google/common/primitives/Bytes.java @@ -44,7 +44,6 @@ // TODO(kevinb): how to prevent warning on UnsignedBytes when building GWT // javadoc? @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Bytes { private Bytes() {} diff --git a/android/guava/src/com/google/common/primitives/Chars.java b/android/guava/src/com/google/common/primitives/Chars.java index bf1547f45f53..05347bdd6688 100644 --- a/android/guava/src/com/google/common/primitives/Chars.java +++ b/android/guava/src/com/google/common/primitives/Chars.java @@ -46,7 +46,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Chars { private Chars() {} diff --git a/android/guava/src/com/google/common/primitives/Doubles.java b/android/guava/src/com/google/common/primitives/Doubles.java index 5123de0ffc4f..42e8dca632e8 100644 --- a/android/guava/src/com/google/common/primitives/Doubles.java +++ b/android/guava/src/com/google/common/primitives/Doubles.java @@ -49,7 +49,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Doubles extends DoublesMethodsForWeb { private Doubles() {} diff --git a/android/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java b/android/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java index 949cbe0f5a6b..04d96512211d 100644 --- a/android/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java +++ b/android/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class DoublesMethodsForWeb {} diff --git a/android/guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 44f6869c7cda..000000000000 --- a/android/guava/src/com/google/common/primitives/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.primitives; - -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/primitives/Floats.java b/android/guava/src/com/google/common/primitives/Floats.java index ff3cd4637ba3..2f9bcc82b3d3 100644 --- a/android/guava/src/com/google/common/primitives/Floats.java +++ b/android/guava/src/com/google/common/primitives/Floats.java @@ -47,7 +47,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Floats extends FloatsMethodsForWeb { private Floats() {} diff --git a/android/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java b/android/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java index 801e2f3ef110..acdb42f275b1 100644 --- a/android/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java +++ b/android/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class FloatsMethodsForWeb {} diff --git a/android/guava/src/com/google/common/primitives/IgnoreJRERequirement.java b/android/guava/src/com/google/common/primitives/IgnoreJRERequirement.java index a5afd04818dc..0013432f9912 100644 --- a/android/guava/src/com/google/common/primitives/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/primitives/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                    Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/primitives/ImmutableDoubleArray.java b/android/guava/src/com/google/common/primitives/ImmutableDoubleArray.java index 296ed4d9a64b..40cbbc1c528a 100644 --- a/android/guava/src/com/google/common/primitives/ImmutableDoubleArray.java +++ b/android/guava/src/com/google/common/primitives/ImmutableDoubleArray.java @@ -85,7 +85,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class ImmutableDoubleArray implements Serializable { private static final ImmutableDoubleArray EMPTY = new ImmutableDoubleArray(new double[0]); diff --git a/android/guava/src/com/google/common/primitives/ImmutableIntArray.java b/android/guava/src/com/google/common/primitives/ImmutableIntArray.java index 07a6dbbddf1e..22890954becb 100644 --- a/android/guava/src/com/google/common/primitives/ImmutableIntArray.java +++ b/android/guava/src/com/google/common/primitives/ImmutableIntArray.java @@ -85,7 +85,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class ImmutableIntArray implements Serializable { private static final ImmutableIntArray EMPTY = new ImmutableIntArray(new int[0]); diff --git a/android/guava/src/com/google/common/primitives/ImmutableLongArray.java b/android/guava/src/com/google/common/primitives/ImmutableLongArray.java index 1fecc6f833ce..2c1436446991 100644 --- a/android/guava/src/com/google/common/primitives/ImmutableLongArray.java +++ b/android/guava/src/com/google/common/primitives/ImmutableLongArray.java @@ -85,7 +85,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class ImmutableLongArray implements Serializable { private static final ImmutableLongArray EMPTY = new ImmutableLongArray(new long[0]); diff --git a/android/guava/src/com/google/common/primitives/Ints.java b/android/guava/src/com/google/common/primitives/Ints.java index 730583f55c14..0a6d1930983f 100644 --- a/android/guava/src/com/google/common/primitives/Ints.java +++ b/android/guava/src/com/google/common/primitives/Ints.java @@ -46,7 +46,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Ints extends IntsMethodsForWeb { private Ints() {} diff --git a/android/guava/src/com/google/common/primitives/IntsMethodsForWeb.java b/android/guava/src/com/google/common/primitives/IntsMethodsForWeb.java index c59c6b05862d..cb87bd2929f8 100644 --- a/android/guava/src/com/google/common/primitives/IntsMethodsForWeb.java +++ b/android/guava/src/com/google/common/primitives/IntsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class IntsMethodsForWeb {} diff --git a/android/guava/src/com/google/common/primitives/Longs.java b/android/guava/src/com/google/common/primitives/Longs.java index fcedce63c2ea..828128e29b4a 100644 --- a/android/guava/src/com/google/common/primitives/Longs.java +++ b/android/guava/src/com/google/common/primitives/Longs.java @@ -45,7 +45,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Longs { private Longs() {} diff --git a/android/guava/src/com/google/common/primitives/ParametricNullness.java b/android/guava/src/com/google/common/primitives/ParametricNullness.java index c40ea499d4ce..9af83702c0b1 100644 --- a/android/guava/src/com/google/common/primitives/ParametricNullness.java +++ b/android/guava/src/com/google/common/primitives/ParametricNullness.java @@ -56,8 +56,8 @@ *

                      *
                    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/primitives/ParseRequest.java b/android/guava/src/com/google/common/primitives/ParseRequest.java index a102d69b06e1..97b0f1b57abc 100644 --- a/android/guava/src/com/google/common/primitives/ParseRequest.java +++ b/android/guava/src/com/google/common/primitives/ParseRequest.java @@ -18,7 +18,6 @@ /** A string to be parsed as a number and the radix to interpret it in. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class ParseRequest { final String rawValue; final int radix; diff --git a/android/guava/src/com/google/common/primitives/Primitives.java b/android/guava/src/com/google/common/primitives/Primitives.java index cfd1eac46d11..364f72eef27c 100644 --- a/android/guava/src/com/google/common/primitives/Primitives.java +++ b/android/guava/src/com/google/common/primitives/Primitives.java @@ -30,7 +30,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Primitives { private Primitives() {} diff --git a/android/guava/src/com/google/common/primitives/Shorts.java b/android/guava/src/com/google/common/primitives/Shorts.java index 43730a2823b3..3d80d90f5cc1 100644 --- a/android/guava/src/com/google/common/primitives/Shorts.java +++ b/android/guava/src/com/google/common/primitives/Shorts.java @@ -44,7 +44,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Shorts extends ShortsMethodsForWeb { private Shorts() {} diff --git a/android/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java b/android/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java index bb0ff103ce2f..c36276838cc6 100644 --- a/android/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java +++ b/android/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ShortsMethodsForWeb {} diff --git a/android/guava/src/com/google/common/primitives/SignedBytes.java b/android/guava/src/com/google/common/primitives/SignedBytes.java index 549adca8dc84..0204de6dcb59 100644 --- a/android/guava/src/com/google/common/primitives/SignedBytes.java +++ b/android/guava/src/com/google/common/primitives/SignedBytes.java @@ -36,7 +36,6 @@ // TODO(kevinb): how to prevent warning on UnsignedBytes when building GWT // javadoc? @GwtCompatible -@ElementTypesAreNonnullByDefault public final class SignedBytes { private SignedBytes() {} diff --git a/android/guava/src/com/google/common/primitives/UnsignedBytes.java b/android/guava/src/com/google/common/primitives/UnsignedBytes.java index 25410827e438..377c2d61bebb 100644 --- a/android/guava/src/com/google/common/primitives/UnsignedBytes.java +++ b/android/guava/src/com/google/common/primitives/UnsignedBytes.java @@ -49,7 +49,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class UnsignedBytes { private UnsignedBytes() {} diff --git a/android/guava/src/com/google/common/primitives/UnsignedInteger.java b/android/guava/src/com/google/common/primitives/UnsignedInteger.java index b0c7588774b5..e739e440076a 100644 --- a/android/guava/src/com/google/common/primitives/UnsignedInteger.java +++ b/android/guava/src/com/google/common/primitives/UnsignedInteger.java @@ -40,7 +40,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class UnsignedInteger extends Number implements Comparable { public static final UnsignedInteger ZERO = fromIntBits(0); public static final UnsignedInteger ONE = fromIntBits(1); diff --git a/android/guava/src/com/google/common/primitives/UnsignedInts.java b/android/guava/src/com/google/common/primitives/UnsignedInts.java index 4909b68b94ac..513a633d425b 100644 --- a/android/guava/src/com/google/common/primitives/UnsignedInts.java +++ b/android/guava/src/com/google/common/primitives/UnsignedInts.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class UnsignedInts { static final long INT_MASK = 0xffffffffL; diff --git a/android/guava/src/com/google/common/primitives/UnsignedLong.java b/android/guava/src/com/google/common/primitives/UnsignedLong.java index d803634f4946..04af18937005 100644 --- a/android/guava/src/com/google/common/primitives/UnsignedLong.java +++ b/android/guava/src/com/google/common/primitives/UnsignedLong.java @@ -38,7 +38,6 @@ * @since 11.0 */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault public final class UnsignedLong extends Number implements Comparable, Serializable { private static final long UNSIGNED_MASK = 0x7fffffffffffffffL; diff --git a/android/guava/src/com/google/common/primitives/UnsignedLongs.java b/android/guava/src/com/google/common/primitives/UnsignedLongs.java index 724d6dc59e0f..96f4628d4d76 100644 --- a/android/guava/src/com/google/common/primitives/UnsignedLongs.java +++ b/android/guava/src/com/google/common/primitives/UnsignedLongs.java @@ -48,7 +48,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class UnsignedLongs { private UnsignedLongs() {} diff --git a/android/guava/src/com/google/common/primitives/package-info.java b/android/guava/src/com/google/common/primitives/package-info.java index ad38c111393c..d714422528d9 100644 --- a/android/guava/src/com/google/common/primitives/package-info.java +++ b/android/guava/src/com/google/common/primitives/package-info.java @@ -63,9 +63,7 @@ *
                    • {@link Primitives} *
                    */ -@ParametersAreNonnullByDefault @CheckReturnValue package com.google.common.primitives; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java b/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java index 1c0318aa9519..75ef93a41b68 100644 --- a/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java +++ b/android/guava/src/com/google/common/reflect/AbstractInvocationHandler.java @@ -38,7 +38,6 @@ * @author Ben Yu * @since 12.0 */ -@ElementTypesAreNonnullByDefault public abstract class AbstractInvocationHandler implements InvocationHandler { /** Constructor for use by subclasses. */ public AbstractInvocationHandler() {} diff --git a/android/guava/src/com/google/common/reflect/ClassPath.java b/android/guava/src/com/google/common/reflect/ClassPath.java index d15bb5055d33..9541f4e83981 100644 --- a/android/guava/src/com/google/common/reflect/ClassPath.java +++ b/android/guava/src/com/google/common/reflect/ClassPath.java @@ -90,7 +90,6 @@ * @author Ben Yu * @since 14.0 */ -@ElementTypesAreNonnullByDefault public final class ClassPath { private static final Logger logger = Logger.getLogger(ClassPath.class.getName()); diff --git a/android/guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 0e8ef3cb7bcb..000000000000 --- a/android/guava/src/com/google/common/reflect/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.reflect; - -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/reflect/IgnoreJRERequirement.java b/android/guava/src/com/google/common/reflect/IgnoreJRERequirement.java index 8b03ca33209b..a56902603307 100644 --- a/android/guava/src/com/google/common/reflect/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/reflect/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                    Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java index 6273704a1072..5b8db7020f0a 100644 --- a/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java @@ -28,7 +28,6 @@ * @author Ben Yu * @since 13.0 */ -@ElementTypesAreNonnullByDefault public final class ImmutableTypeToInstanceMap extends ForwardingMap, B> implements TypeToInstanceMap { diff --git a/android/guava/src/com/google/common/reflect/Invokable.java b/android/guava/src/com/google/common/reflect/Invokable.java index ca405566f2d3..0d7adc93237c 100644 --- a/android/guava/src/com/google/common/reflect/Invokable.java +++ b/android/guava/src/com/google/common/reflect/Invokable.java @@ -61,7 +61,6 @@ * @since 14.0 (no longer implements {@link AccessibleObject} or {@code GenericDeclaration} since * 31.0) */ -@ElementTypesAreNonnullByDefault public abstract class Invokable implements AnnotatedElement, Member { private final AccessibleObject accessibleObject; private final Member member; diff --git a/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java index 0ac86f54bcd7..645153040972 100644 --- a/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java @@ -36,7 +36,6 @@ * @author Ben Yu * @since 13.0 */ -@ElementTypesAreNonnullByDefault public final class MutableTypeToInstanceMap extends ForwardingMap, B> implements TypeToInstanceMap { /** Creates a new map. */ diff --git a/android/guava/src/com/google/common/reflect/Parameter.java b/android/guava/src/com/google/common/reflect/Parameter.java index a0c6d7b1bbee..6d80c519164c 100644 --- a/android/guava/src/com/google/common/reflect/Parameter.java +++ b/android/guava/src/com/google/common/reflect/Parameter.java @@ -29,7 +29,6 @@ * @author Ben Yu * @since 14.0 */ -@ElementTypesAreNonnullByDefault public final class Parameter implements AnnotatedElement { private final Invokable declaration; diff --git a/android/guava/src/com/google/common/reflect/ParametricNullness.java b/android/guava/src/com/google/common/reflect/ParametricNullness.java index 372a53bb616f..4cc7fd284847 100644 --- a/android/guava/src/com/google/common/reflect/ParametricNullness.java +++ b/android/guava/src/com/google/common/reflect/ParametricNullness.java @@ -56,8 +56,8 @@ *

                      *
                    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/reflect/Reflection.java b/android/guava/src/com/google/common/reflect/Reflection.java index 09e966d12bd0..3cc06250c344 100644 --- a/android/guava/src/com/google/common/reflect/Reflection.java +++ b/android/guava/src/com/google/common/reflect/Reflection.java @@ -25,7 +25,6 @@ * * @since 12.0 */ -@ElementTypesAreNonnullByDefault public final class Reflection { /** diff --git a/android/guava/src/com/google/common/reflect/TypeCapture.java b/android/guava/src/com/google/common/reflect/TypeCapture.java index 2be7b4fddad1..effb382b2826 100644 --- a/android/guava/src/com/google/common/reflect/TypeCapture.java +++ b/android/guava/src/com/google/common/reflect/TypeCapture.java @@ -24,7 +24,6 @@ * * @author Ben Yu */ -@ElementTypesAreNonnullByDefault abstract class TypeCapture { /** Returns the captured type. */ diff --git a/android/guava/src/com/google/common/reflect/TypeParameter.java b/android/guava/src/com/google/common/reflect/TypeParameter.java index 69cd8291a909..347806bca518 100644 --- a/android/guava/src/com/google/common/reflect/TypeParameter.java +++ b/android/guava/src/com/google/common/reflect/TypeParameter.java @@ -33,7 +33,6 @@ * @author Ben Yu * @since 12.0 */ -@ElementTypesAreNonnullByDefault /* * A nullable bound would let users create a TypeParameter instance for a parameter with a nullable * bound. However, it would also let them create `new TypeParameter<@Nullable T>() {}`, which diff --git a/android/guava/src/com/google/common/reflect/TypeResolver.java b/android/guava/src/com/google/common/reflect/TypeResolver.java index e9c3a1d19de3..73a077f03957 100644 --- a/android/guava/src/com/google/common/reflect/TypeResolver.java +++ b/android/guava/src/com/google/common/reflect/TypeResolver.java @@ -50,7 +50,6 @@ * @author Ben Yu * @since 15.0 */ -@ElementTypesAreNonnullByDefault public final class TypeResolver { private final TypeTable typeTable; diff --git a/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java b/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java index fe61a2cc510b..efc273056354 100644 --- a/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java +++ b/android/guava/src/com/google/common/reflect/TypeToInstanceMap.java @@ -41,7 +41,6 @@ * @since 13.0 */ @DoNotMock("Use ImmutableTypeToInstanceMap or MutableTypeToInstanceMap") -@ElementTypesAreNonnullByDefault public interface TypeToInstanceMap extends Map, B> { diff --git a/android/guava/src/com/google/common/reflect/TypeToken.java b/android/guava/src/com/google/common/reflect/TypeToken.java index f1b97a9692b3..d8ecc414f1cd 100644 --- a/android/guava/src/com/google/common/reflect/TypeToken.java +++ b/android/guava/src/com/google/common/reflect/TypeToken.java @@ -99,7 +99,6 @@ * @since 12.0 */ @SuppressWarnings("serial") // SimpleTypeToken is the serialized form. -@ElementTypesAreNonnullByDefault public abstract class TypeToken extends TypeCapture implements Serializable { private final Type runtimeType; diff --git a/android/guava/src/com/google/common/reflect/TypeVisitor.java b/android/guava/src/com/google/common/reflect/TypeVisitor.java index 416397bc77d6..db3d4a71b527 100644 --- a/android/guava/src/com/google/common/reflect/TypeVisitor.java +++ b/android/guava/src/com/google/common/reflect/TypeVisitor.java @@ -54,7 +54,6 @@ * * @author Ben Yu */ -@ElementTypesAreNonnullByDefault abstract class TypeVisitor { private final Set visited = Sets.newHashSet(); diff --git a/android/guava/src/com/google/common/reflect/Types.java b/android/guava/src/com/google/common/reflect/Types.java index d608027d4ef3..2378c2df1d9d 100644 --- a/android/guava/src/com/google/common/reflect/Types.java +++ b/android/guava/src/com/google/common/reflect/Types.java @@ -52,7 +52,6 @@ * * @author Ben Yu */ -@ElementTypesAreNonnullByDefault final class Types { /** Class#toString without the "class " and "interface " prefixes */ diff --git a/android/guava/src/com/google/common/reflect/package-info.java b/android/guava/src/com/google/common/reflect/package-info.java index 1fc793e2ad86..58de94042167 100644 --- a/android/guava/src/com/google/common/reflect/package-info.java +++ b/android/guava/src/com/google/common/reflect/package-info.java @@ -17,8 +17,6 @@ * href="https://github.com/google/guava">Guava library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.reflect; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java b/android/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java index 635c92be2d90..4452dd68bfc5 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java @@ -35,7 +35,6 @@ /** Implementations of {@code Futures.catching*}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings({ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || "ShortCircuitBoolean", diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java b/android/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java index d7af78c589f5..d520a064b77f 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java @@ -33,7 +33,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractExecutionThreadService implements Service { /* use AbstractService for state management */ private final Service delegate = diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java index 409ab362b284..8a384dd7f569 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractFuture.java @@ -76,7 +76,6 @@ }) @GwtCompatible(emulated = true) @ReflectionSupport(value = ReflectionSupport.Level.FULL) -@ElementTypesAreNonnullByDefault public abstract class AbstractFuture extends InternalFutureFailureAccess implements ListenableFuture { static final boolean GENERATE_CANCELLATION_CAUSES; diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractIdleService.java b/android/guava/src/com/google/common/util/concurrent/AbstractIdleService.java index 0bf690a56728..882a5430fd04 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractIdleService.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractIdleService.java @@ -35,7 +35,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractIdleService implements Service { /* Thread names will look like {@code "MyService STARTING"}. */ diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java b/android/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java index 192c07e4c153..e56043858842 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java @@ -37,7 +37,6 @@ @CheckReturnValue @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractListeningExecutorService extends AbstractExecutorService implements ListeningExecutorService { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java b/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java index f39053fb09ac..414be386bcd0 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java @@ -102,7 +102,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractScheduledService implements Service { private static final LazyLogger logger = new LazyLogger(AbstractScheduledService.class); diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractService.java b/android/guava/src/com/google/common/util/concurrent/AbstractService.java index 6ead7b4deea9..e76499a6a1e3 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractService.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractService.java @@ -51,7 +51,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractService implements Service { private static final ListenerCallQueue.Event STARTING_EVENT = new ListenerCallQueue.Event() { diff --git a/android/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java b/android/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java index d57b526aa886..98dc67ed8e18 100644 --- a/android/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java @@ -32,7 +32,6 @@ /** Implementations of {@code Futures.transform*}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings({ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || "ShortCircuitBoolean", diff --git a/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java b/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java index c2409debd289..8b77af98e732 100644 --- a/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/AggregateFuture.java @@ -42,7 +42,6 @@ * @param the type of the output (i.e. this) future */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings( // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || "ShortCircuitBoolean") diff --git a/android/guava/src/com/google/common/util/concurrent/AggregateFutureState.java b/android/guava/src/com/google/common/util/concurrent/AggregateFutureState.java index 45a9551834ec..4de212d41d6b 100644 --- a/android/guava/src/com/google/common/util/concurrent/AggregateFutureState.java +++ b/android/guava/src/com/google/common/util/concurrent/AggregateFutureState.java @@ -39,7 +39,6 @@ */ @GwtCompatible(emulated = true) @ReflectionSupport(value = ReflectionSupport.Level.FULL) -@ElementTypesAreNonnullByDefault abstract class AggregateFutureState extends AbstractFuture.TrustedFuture { // Lazily initialized the first time we see an exception; not released until all the input futures diff --git a/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java b/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java index 99167db07724..3cdad62125f7 100644 --- a/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java +++ b/android/guava/src/com/google/common/util/concurrent/AsyncCallable.java @@ -28,7 +28,6 @@ * @since 20.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface AsyncCallable { /** * Computes a result {@code Future}. The output {@code Future} need not be {@linkplain diff --git a/android/guava/src/com/google/common/util/concurrent/AsyncFunction.java b/android/guava/src/com/google/common/util/concurrent/AsyncFunction.java index cd70d20dc515..c5be9dcdb0e3 100644 --- a/android/guava/src/com/google/common/util/concurrent/AsyncFunction.java +++ b/android/guava/src/com/google/common/util/concurrent/AsyncFunction.java @@ -26,7 +26,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface AsyncFunction { /** * Returns an output {@code Future} to use in place of the given {@code input}. The output {@code diff --git a/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java b/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java index 7528307a78b4..c6d2a2723f96 100644 --- a/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java +++ b/android/guava/src/com/google/common/util/concurrent/AtomicDouble.java @@ -53,7 +53,6 @@ * @author Martin Buchholz * @since 11.0 */ -@ElementTypesAreNonnullByDefault public class AtomicDouble extends Number implements Serializable { private static final long serialVersionUID = 0L; diff --git a/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java b/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java index c349f3626d51..0ccfcf9f2be4 100644 --- a/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java +++ b/android/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java @@ -50,7 +50,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public class AtomicDoubleArray implements Serializable { private static final long serialVersionUID = 0L; diff --git a/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java b/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java index 0c3b5e7d36be..cc023048df1c 100644 --- a/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java +++ b/android/guava/src/com/google/common/util/concurrent/AtomicLongMap.java @@ -58,7 +58,6 @@ */ @GwtCompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class AtomicLongMap implements Serializable { private final ConcurrentHashMap map; diff --git a/android/guava/src/com/google/common/util/concurrent/Atomics.java b/android/guava/src/com/google/common/util/concurrent/Atomics.java index c1b6964ec23c..e49b0c1e7f1c 100644 --- a/android/guava/src/com/google/common/util/concurrent/Atomics.java +++ b/android/guava/src/com/google/common/util/concurrent/Atomics.java @@ -26,7 +26,6 @@ * @since 10.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Atomics { private Atomics() {} diff --git a/android/guava/src/com/google/common/util/concurrent/Callables.java b/android/guava/src/com/google/common/util/concurrent/Callables.java index 6a586bb2ee8b..a022a23a085c 100644 --- a/android/guava/src/com/google/common/util/concurrent/Callables.java +++ b/android/guava/src/com/google/common/util/concurrent/Callables.java @@ -30,7 +30,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Callables { private Callables() {} diff --git a/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java b/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java index 9bc95f6de678..ab0ae62d301e 100644 --- a/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ClosingFuture.java @@ -191,7 +191,6 @@ // TODO(dpb): Consider reusing one CloseableList for the entire pipeline, modulo combinations. @DoNotMock("Use ClosingFuture.from(Futures.immediate*Future)") @J2ktIncompatible -@ElementTypesAreNonnullByDefault // TODO(dpb): GWT compatibility. public final class ClosingFuture { diff --git a/android/guava/src/com/google/common/util/concurrent/CollectionFuture.java b/android/guava/src/com/google/common/util/concurrent/CollectionFuture.java index 080904a9f6a8..c31571151c33 100644 --- a/android/guava/src/com/google/common/util/concurrent/CollectionFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/CollectionFuture.java @@ -29,7 +29,6 @@ /** Aggregate future that collects (stores) results of each future. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class CollectionFuture extends AggregateFuture { /* diff --git a/android/guava/src/com/google/common/util/concurrent/CombinedFuture.java b/android/guava/src/com/google/common/util/concurrent/CombinedFuture.java index 9495eeb63723..453e351178a0 100644 --- a/android/guava/src/com/google/common/util/concurrent/CombinedFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/CombinedFuture.java @@ -32,7 +32,6 @@ /** Aggregate future that computes its value by calling a callable. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CombinedFuture extends AggregateFuture<@Nullable Object, V> { @CheckForNull @LazyInit private CombinedFutureInterruptibleTask task; diff --git a/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java b/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java index 6e2ae47a3c73..eb12adb296ac 100644 --- a/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java +++ b/android/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java @@ -160,7 +160,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class CycleDetectingLockFactory { /** diff --git a/android/guava/src/com/google/common/util/concurrent/DirectExecutor.java b/android/guava/src/com/google/common/util/concurrent/DirectExecutor.java index 0c3a46b703c3..30229714c638 100644 --- a/android/guava/src/com/google/common/util/concurrent/DirectExecutor.java +++ b/android/guava/src/com/google/common/util/concurrent/DirectExecutor.java @@ -22,7 +22,6 @@ * execute}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault enum DirectExecutor implements Executor { INSTANCE; diff --git a/android/guava/src/com/google/common/util/concurrent/DirectExecutorService.java b/android/guava/src/com/google/common/util/concurrent/DirectExecutorService.java index 41811cfc6a85..8ccd000b50f1 100644 --- a/android/guava/src/com/google/common/util/concurrent/DirectExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/DirectExecutorService.java @@ -27,7 +27,6 @@ /** See newDirectExecutorService javadoc for behavioral notes. */ @J2ktIncompatible // Emulated @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DirectExecutorService extends AbstractListeningExecutorService { /** Lock used whenever accessing the state variables (runningTasks, shutdown) of the executor */ diff --git a/android/guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 34871255e812..000000000000 --- a/android/guava/src/com/google/common/util/concurrent/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.util.concurrent; - -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/util/concurrent/ExecutionError.java b/android/guava/src/com/google/common/util/concurrent/ExecutionError.java index a5a2a1a3aae9..37034845ea06 100644 --- a/android/guava/src/com/google/common/util/concurrent/ExecutionError.java +++ b/android/guava/src/com/google/common/util/concurrent/ExecutionError.java @@ -28,7 +28,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class ExecutionError extends Error { /* * Ideally, this class would have exposed only constructors that require a non-null cause. See diff --git a/android/guava/src/com/google/common/util/concurrent/ExecutionList.java b/android/guava/src/com/google/common/util/concurrent/ExecutionList.java index fa8020fbcc71..7a3efb0ff89c 100644 --- a/android/guava/src/com/google/common/util/concurrent/ExecutionList.java +++ b/android/guava/src/com/google/common/util/concurrent/ExecutionList.java @@ -41,7 +41,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ExecutionList { /** Logger to log exceptions caught when running runnables. */ private static final LazyLogger log = new LazyLogger(ExecutionList.class); diff --git a/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java b/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java index 4e13a9d0b315..3ab2c0d354be 100644 --- a/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java +++ b/android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java @@ -85,7 +85,6 @@ * * @since 26.0 */ -@ElementTypesAreNonnullByDefault @J2ktIncompatible public final class ExecutionSequencer { diff --git a/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java b/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java index 6761493b16b6..3cbb80cf7bbe 100644 --- a/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java @@ -37,7 +37,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class FakeTimeLimiter implements TimeLimiter { /** Creates a new {@link FakeTimeLimiter}. */ public FakeTimeLimiter() {} diff --git a/android/guava/src/com/google/common/util/concurrent/FluentFuture.java b/android/guava/src/com/google/common/util/concurrent/FluentFuture.java index c332aba828ba..6c42304d299e 100644 --- a/android/guava/src/com/google/common/util/concurrent/FluentFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/FluentFuture.java @@ -74,7 +74,6 @@ */ @DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture") @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class FluentFuture extends GwtFluentFutureCatchingSpecialization { diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java b/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java index 13aa80b5129b..a1a255f243d2 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java @@ -47,7 +47,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingBlockingDeque extends ForwardingDeque implements BlockingDeque { diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java b/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java index 79ec94a1e5db..76d2c0fd9bbb 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java @@ -39,7 +39,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingBlockingQueue extends ForwardingQueue implements BlockingQueue { diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingCondition.java b/android/guava/src/com/google/common/util/concurrent/ForwardingCondition.java index 885cca7fcd3a..5393dbdb615c 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingCondition.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingCondition.java @@ -21,7 +21,6 @@ /** Forwarding wrapper around a {@code Condition}. */ @J2ktIncompatible -@ElementTypesAreNonnullByDefault abstract class ForwardingCondition implements Condition { abstract Condition delegate(); diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java b/android/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java index 986278dafa02..6a6919343466 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingExecutorService extends ForwardingObject implements ExecutorService { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java b/android/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java index cb779c34ed4b..3fdb360faa09 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java @@ -34,7 +34,6 @@ * forwards to that future and adds the desired methods. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class ForwardingFluentFuture extends FluentFuture { private final ListenableFuture delegate; diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingFuture.java b/android/guava/src/com/google/common/util/concurrent/ForwardingFuture.java index 635c4f6eb14a..980363487087 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingFuture.java @@ -35,7 +35,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingFuture extends ForwardingObject implements Future { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java b/android/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java index ccd2dd7b13f3..216c25c153fa 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java @@ -30,7 +30,6 @@ * @since 4.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListenableFuture extends ForwardingFuture implements ListenableFuture { diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java b/android/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java index 25dbf0de76f5..fdd205957a36 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java @@ -34,7 +34,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListeningExecutorService extends ForwardingExecutorService implements ListeningExecutorService { /** Constructor for use by subclasses. */ diff --git a/android/guava/src/com/google/common/util/concurrent/ForwardingLock.java b/android/guava/src/com/google/common/util/concurrent/ForwardingLock.java index 558b6e3decc0..7ff05340ebc0 100644 --- a/android/guava/src/com/google/common/util/concurrent/ForwardingLock.java +++ b/android/guava/src/com/google/common/util/concurrent/ForwardingLock.java @@ -21,7 +21,6 @@ /** Forwarding wrapper around a {@code Lock}. */ @J2ktIncompatible -@ElementTypesAreNonnullByDefault abstract class ForwardingLock implements Lock { abstract Lock delegate(); diff --git a/android/guava/src/com/google/common/util/concurrent/FutureCallback.java b/android/guava/src/com/google/common/util/concurrent/FutureCallback.java index f5684e7c907a..3af949526eb0 100644 --- a/android/guava/src/com/google/common/util/concurrent/FutureCallback.java +++ b/android/guava/src/com/google/common/util/concurrent/FutureCallback.java @@ -29,7 +29,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface FutureCallback { /** Invoked with the result of the {@code Future} computation when it is successful. */ void onSuccess(@ParametricNullness V result); diff --git a/android/guava/src/com/google/common/util/concurrent/Futures.java b/android/guava/src/com/google/common/util/concurrent/Futures.java index a432af0b1b06..fcdb566382cb 100644 --- a/android/guava/src/com/google/common/util/concurrent/Futures.java +++ b/android/guava/src/com/google/common/util/concurrent/Futures.java @@ -77,7 +77,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Futures extends GwtFuturesCatchingSpecialization { // A note on memory visibility. diff --git a/android/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java b/android/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java index 0a4e7bd4352e..7366773f2119 100644 --- a/android/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java +++ b/android/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java @@ -40,7 +40,6 @@ /** Static methods used to implement {@link Futures#getChecked(Future, Class)}. */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class FuturesGetChecked { @CanIgnoreReturnValue @ParametricNullness diff --git a/android/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java b/android/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java index fdbe50909a7d..863d97f9de8f 100644 --- a/android/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java +++ b/android/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java @@ -25,7 +25,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible // Super-sourced -@ElementTypesAreNonnullByDefault abstract class GwtFluentFutureCatchingSpecialization extends AbstractFuture { /* diff --git a/android/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java b/android/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java index 35adfdb67201..f6b210ca3466 100644 --- a/android/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java +++ b/android/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java @@ -25,7 +25,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible // Super-sourced -@ElementTypesAreNonnullByDefault abstract class GwtFuturesCatchingSpecialization { /* * This server copy of the class is empty. The corresponding GWT copy contains alternative diff --git a/android/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java b/android/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java index 082aa64fb44e..b7cababe8921 100644 --- a/android/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java +++ b/android/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                      Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java b/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java index 62ae63eaaa4c..fbec44e10c5e 100644 --- a/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ImmediateFuture.java @@ -27,7 +27,6 @@ /** Implementation of {@link Futures#immediateFuture}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault // TODO(cpovirk): Make this final (but that may break Mockito spy calls). class ImmediateFuture implements ListenableFuture { static final ListenableFuture NULL = new ImmediateFuture<@Nullable Object>(null); diff --git a/android/guava/src/com/google/common/util/concurrent/Internal.java b/android/guava/src/com/google/common/util/concurrent/Internal.java index 840cbd1a449e..782a20410920 100644 --- a/android/guava/src/com/google/common/util/concurrent/Internal.java +++ b/android/guava/src/com/google/common/util/concurrent/Internal.java @@ -21,7 +21,6 @@ /** This class is for {@code com.google.common.util.concurrent} use only! */ @J2ktIncompatible @GwtIncompatible // java.time.Duration -@ElementTypesAreNonnullByDefault @SuppressWarnings("Java7ApiChecker") @IgnoreJRERequirement // We use this method only from within APIs that require a Duration. final class Internal { diff --git a/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java b/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java index 6ca5e9ff6f2d..cce2cc42257e 100644 --- a/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java +++ b/android/guava/src/com/google/common/util/concurrent/InterruptibleTask.java @@ -28,7 +28,6 @@ @GwtCompatible(emulated = true) @ReflectionSupport(value = ReflectionSupport.Level.FULL) -@ElementTypesAreNonnullByDefault // Some Android 5.0.x Samsung devices have bugs in JDK reflection APIs that cause // getDeclaredField to throw a NoSuchFieldException when the field is definitely there. // Since this class only needs CAS on one field, we can avoid this bug by extending AtomicReference diff --git a/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java b/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java index eb3a24707270..6d3557636fe6 100644 --- a/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java +++ b/android/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java @@ -39,7 +39,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class JdkFutureAdapters { /** * Assigns a thread to the given {@link Future} to provide {@link ListenableFuture} functionality. diff --git a/android/guava/src/com/google/common/util/concurrent/LazyLogger.java b/android/guava/src/com/google/common/util/concurrent/LazyLogger.java index 61fefe804a64..e0f2100139d7 100644 --- a/android/guava/src/com/google/common/util/concurrent/LazyLogger.java +++ b/android/guava/src/com/google/common/util/concurrent/LazyLogger.java @@ -20,7 +20,6 @@ /** A holder for a {@link Logger} that is initialized only when requested. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class LazyLogger { private final Object lock = new Object(); diff --git a/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java b/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java index cdc2ee110b99..9f077dd9507f 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java @@ -102,22 +102,20 @@ * @since 1.0 */ /* - * Some of the annotations below were added after we released our separate + * The annotation below was added after we released our separate * com.google.guava:listenablefuture:1.0 artifact. (For more on that artifact, see * https://github.com/google/guava/releases/tag/v27.0) This means that the copy of ListenableFuture * in com.google.guava:guava differs from the "frozen" copy in the listenablefuture artifact. This - * could in principle cause problems for some users. Still, we expect that the benefits of the - * nullness annotations in particular will outweigh the costs. (And it's worth noting that we have - * released multiple ListenableFuture.class files that are not byte-for-byte compatible even from - * the beginning, thanks to using different `-source -target` values for compiling our `-jre` and - * `-android` "flavors.") + * could in principle cause problems for some users. Still, we expect that the benefits will + * outweigh the costs. (And it's worth noting that we have released multiple ListenableFuture.class + * files that are not byte-for-byte compatible even from the beginning, thanks to using different + * `-source -target` values for compiling our `-jre` and `-android` "flavors.") * * (We could consider releasing a listenablefuture:1.0.1 someday. But we would want to look into how * that affects users, especially users of the Android Gradle Plugin, since the plugin developers * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -@ElementTypesAreNonnullByDefault public interface ListenableFuture extends Future { /** * Registers a listener to be {@linkplain Executor#execute(Runnable) run} on the given executor. diff --git a/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java b/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java index 161fa895f416..6b31f9ea887f 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class ListenableFutureTask extends FutureTask implements ListenableFuture { // TODO(cpovirk): explore ways of making ListenableFutureTask final. There are some valid reasons diff --git a/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java b/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java index f6e5d9f9e1ec..cadf87910af3 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java @@ -25,6 +25,5 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface ListenableScheduledFuture extends ScheduledFuture, ListenableFuture {} diff --git a/android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java b/android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java index e6284e1c7ded..4370bf23b767 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java @@ -54,7 +54,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class ListenerCallQueue { // TODO(cpovirk): consider using the logger associated with listener.getClass(). private static final LazyLogger logger = new LazyLogger(ListenerCallQueue.class); diff --git a/android/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java b/android/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java index 83ea759f8e74..76d1cf8f25de 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java @@ -37,7 +37,6 @@ "Use TestingExecutors.sameThreadScheduledExecutor, or wrap a real Executor from " + "java.util.concurrent.Executors with MoreExecutors.listeningDecorator") @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ListeningExecutorService extends ExecutorService { /** * @return a {@code ListenableFuture} representing pending completion of the task diff --git a/android/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java b/android/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java index 3b5fad2e2ea9..c9128f3c0a56 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ListeningScheduledExecutorService extends ScheduledExecutorService, ListeningExecutorService { diff --git a/android/guava/src/com/google/common/util/concurrent/Monitor.java b/android/guava/src/com/google/common/util/concurrent/Monitor.java index a1098a436c97..756ac7ad061d 100644 --- a/android/guava/src/com/google/common/util/concurrent/Monitor.java +++ b/android/guava/src/com/google/common/util/concurrent/Monitor.java @@ -203,7 +203,6 @@ @J2ktIncompatible @GwtIncompatible @SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress. -@ElementTypesAreNonnullByDefault public final class Monitor { // TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock. // TODO(user): "Port" jsr166 tests for ReentrantLock. diff --git a/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java index 19fc43b3feae..cb3d58f8b96b 100644 --- a/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java +++ b/android/guava/src/com/google/common/util/concurrent/MoreExecutors.java @@ -63,7 +63,6 @@ * @since 3.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class MoreExecutors { private MoreExecutors() {} diff --git a/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java b/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java index a3a914e8970a..ad6f03f83a26 100644 --- a/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java +++ b/android/guava/src/com/google/common/util/concurrent/NullnessCasts.java @@ -20,7 +20,6 @@ /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible -@ElementTypesAreNonnullByDefault 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/util/concurrent/OverflowAvoidingLockSupport.java b/android/guava/src/com/google/common/util/concurrent/OverflowAvoidingLockSupport.java index 905726597fcb..b9e0bb05d189 100644 --- a/android/guava/src/com/google/common/util/concurrent/OverflowAvoidingLockSupport.java +++ b/android/guava/src/com/google/common/util/concurrent/OverflowAvoidingLockSupport.java @@ -25,7 +25,6 @@ * signal on 32 bit devices running Android Q. */ @J2ktIncompatible -@ElementTypesAreNonnullByDefault final class OverflowAvoidingLockSupport { // Represents the max nanoseconds representable on a linux timespec with a 32 bit tv_sec static final long MAX_NANOSECONDS_THRESHOLD = (1L + Integer.MAX_VALUE) * 1_000_000_000L - 1L; diff --git a/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java b/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java index e8fcce6ee681..f12f1133e6df 100644 --- a/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java +++ b/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java @@ -56,8 +56,8 @@ *

                        *
                      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/util/concurrent/Partially.java b/android/guava/src/com/google/common/util/concurrent/Partially.java index 7aa16e776fd5..c40ab4e007ee 100644 --- a/android/guava/src/com/google/common/util/concurrent/Partially.java +++ b/android/guava/src/com/google/common/util/concurrent/Partially.java @@ -32,7 +32,6 @@ * version. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Partially { /** * The presence of this annotation on an API indicates that the method may be used with the diff --git a/android/guava/src/com/google/common/util/concurrent/Platform.java b/android/guava/src/com/google/common/util/concurrent/Platform.java index 92d2d12db4b5..faff16140724 100644 --- a/android/guava/src/com/google/common/util/concurrent/Platform.java +++ b/android/guava/src/com/google/common/util/concurrent/Platform.java @@ -22,7 +22,6 @@ /** Methods factored out so that they can be emulated differently in GWT. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { static boolean isInstanceOfThrowableClass( @CheckForNull Throwable t, Class expectedClass) { diff --git a/android/guava/src/com/google/common/util/concurrent/RateLimiter.java b/android/guava/src/com/google/common/util/concurrent/RateLimiter.java index f78fc4b5ad73..131205949600 100644 --- a/android/guava/src/com/google/common/util/concurrent/RateLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/RateLimiter.java @@ -96,7 +96,6 @@ @Beta @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class RateLimiter { /** * Creates a {@code RateLimiter} with the specified stable throughput, given as "permits per diff --git a/android/guava/src/com/google/common/util/concurrent/Runnables.java b/android/guava/src/com/google/common/util/concurrent/Runnables.java index f5b27f8afe9d..13c85b019a9d 100644 --- a/android/guava/src/com/google/common/util/concurrent/Runnables.java +++ b/android/guava/src/com/google/common/util/concurrent/Runnables.java @@ -22,7 +22,6 @@ * @since 16.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Runnables { private static final Runnable EMPTY_RUNNABLE = diff --git a/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java b/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java index 2fcddadbcab4..daed275556ef 100644 --- a/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java +++ b/android/guava/src/com/google/common/util/concurrent/SequentialExecutor.java @@ -50,7 +50,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class SequentialExecutor implements Executor { private static final LazyLogger log = new LazyLogger(SequentialExecutor.class); diff --git a/android/guava/src/com/google/common/util/concurrent/Service.java b/android/guava/src/com/google/common/util/concurrent/Service.java index 449df322779d..4c03738ec598 100644 --- a/android/guava/src/com/google/common/util/concurrent/Service.java +++ b/android/guava/src/com/google/common/util/concurrent/Service.java @@ -55,7 +55,6 @@ @DoNotMock("Create an AbstractIdleService") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface Service { /** * If the service state is {@link State#NEW}, this initiates service startup and returns diff --git a/android/guava/src/com/google/common/util/concurrent/ServiceManager.java b/android/guava/src/com/google/common/util/concurrent/ServiceManager.java index a599d1b7d2db..30a27e749d9c 100644 --- a/android/guava/src/com/google/common/util/concurrent/ServiceManager.java +++ b/android/guava/src/com/google/common/util/concurrent/ServiceManager.java @@ -122,7 +122,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ServiceManager implements ServiceManagerBridge { private static final LazyLogger logger = new LazyLogger(ServiceManager.class); private static final ListenerCallQueue.Event HEALTHY_EVENT = diff --git a/android/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java b/android/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java index 71fe01c0bb63..5f959acceb37 100644 --- a/android/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java +++ b/android/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java @@ -28,7 +28,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault interface ServiceManagerBridge { ImmutableMultimap servicesByState(); } diff --git a/android/guava/src/com/google/common/util/concurrent/SettableFuture.java b/android/guava/src/com/google/common/util/concurrent/SettableFuture.java index 0a9e194657f8..f4c9d4bbb2d1 100644 --- a/android/guava/src/com/google/common/util/concurrent/SettableFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/SettableFuture.java @@ -33,7 +33,6 @@ * @since 9.0 (in 1.0 as {@code ValueFuture}) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class SettableFuture extends AbstractFuture.TrustedFuture { /** diff --git a/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java index 5d2713204bc4..4ad31785b1e4 100644 --- a/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java @@ -48,7 +48,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault // TODO: b/227335009 - Maybe change interruption behavior, but it requires thought. @SuppressWarnings("Interruption") public final class SimpleTimeLimiter implements TimeLimiter { diff --git a/android/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java b/android/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java index 6f21ab6a3364..6d1bdbdd7b4f 100644 --- a/android/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java @@ -24,7 +24,6 @@ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class SmoothRateLimiter extends RateLimiter { /* * How is the RateLimiter designed, and why? diff --git a/android/guava/src/com/google/common/util/concurrent/Striped.java b/android/guava/src/com/google/common/util/concurrent/Striped.java index 74684cec8fa2..1ff9b90287e5 100644 --- a/android/guava/src/com/google/common/util/concurrent/Striped.java +++ b/android/guava/src/com/google/common/util/concurrent/Striped.java @@ -84,7 +84,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class Striped { /** * If there are at least this many stripes, we assume the memory usage of a ConcurrentMap will be diff --git a/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java b/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java index 327dd555b37c..36ec3fff1e36 100644 --- a/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java +++ b/android/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java @@ -51,7 +51,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ThreadFactoryBuilder { @CheckForNull private String nameFormat = null; @CheckForNull private Boolean daemon = null; diff --git a/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java b/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java index 35695ad023af..c735b5469b5e 100644 --- a/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java +++ b/android/guava/src/com/google/common/util/concurrent/TimeLimiter.java @@ -36,7 +36,6 @@ @J2ktIncompatible @GwtIncompatible @SuppressWarnings("GoodTime") // should have java.time.Duration overloads -@ElementTypesAreNonnullByDefault public interface TimeLimiter { /** diff --git a/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java b/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java index e067a62e4515..c1e66ffde014 100644 --- a/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/TimeoutFuture.java @@ -40,7 +40,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class TimeoutFuture extends FluentFuture.TrustedFuture { static ListenableFuture create( ListenableFuture delegate, diff --git a/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java b/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java index 929c9fb1ea23..68f0bead1cd0 100644 --- a/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java +++ b/android/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java @@ -31,7 +31,6 @@ * performance reasons. */ @GwtCompatible -@ElementTypesAreNonnullByDefault class TrustedListenableFutureTask extends FluentFuture.TrustedFuture implements RunnableFuture { diff --git a/android/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java b/android/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java index 9890c89d6786..604dcd22feb2 100644 --- a/android/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java +++ b/android/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class UncaughtExceptionHandlers { private UncaughtExceptionHandlers() {} diff --git a/android/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java b/android/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java index bb6f5e04d054..051c51f38b57 100644 --- a/android/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java +++ b/android/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class UncheckedExecutionException extends RuntimeException { /* * Ideally, this class would have exposed only constructors that require a non-null cause. See diff --git a/android/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java b/android/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java index 181de101f3ba..55f09ad08ef5 100644 --- a/android/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java +++ b/android/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java @@ -26,7 +26,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class UncheckedTimeoutException extends RuntimeException { public UncheckedTimeoutException() {} diff --git a/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java b/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java index 63674a3ccaa6..5791133c06cf 100644 --- a/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java +++ b/android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java @@ -46,7 +46,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Uninterruptibles { // Implementation Note: As of 3-7-11, the logic for each blocking/timeout diff --git a/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java b/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java index d6684b80980b..a48d7423330a 100644 --- a/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java @@ -45,7 +45,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class WrappingExecutorService implements ExecutorService { private final ExecutorService delegate; diff --git a/android/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java b/android/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java index d533fc632bd0..a403e98022e9 100644 --- a/android/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java +++ b/android/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class WrappingScheduledExecutorService extends WrappingExecutorService implements ScheduledExecutorService { final ScheduledExecutorService delegate; diff --git a/android/guava/src/com/google/common/util/concurrent/package-info.java b/android/guava/src/com/google/common/util/concurrent/package-info.java index 7df382a54e82..f82cf6e621dc 100644 --- a/android/guava/src/com/google/common/util/concurrent/package-info.java +++ b/android/guava/src/com/google/common/util/concurrent/package-info.java @@ -25,8 +25,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.util.concurrent; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index b4fb4e3fe470..000000000000 --- a/android/guava/src/com/google/common/xml/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.xml; - -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/xml/ParametricNullness.java b/android/guava/src/com/google/common/xml/ParametricNullness.java index 439707a2edb1..0d989c7cefa6 100644 --- a/android/guava/src/com/google/common/xml/ParametricNullness.java +++ b/android/guava/src/com/google/common/xml/ParametricNullness.java @@ -56,8 +56,8 @@ *
                          *
                        • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                        • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/xml/XmlEscapers.java b/android/guava/src/com/google/common/xml/XmlEscapers.java index 33241f3f3299..de62e2edd9a3 100644 --- a/android/guava/src/com/google/common/xml/XmlEscapers.java +++ b/android/guava/src/com/google/common/xml/XmlEscapers.java @@ -38,7 +38,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class XmlEscapers { private XmlEscapers() {} diff --git a/android/guava/src/com/google/common/xml/package-info.java b/android/guava/src/com/google/common/xml/package-info.java index 8693276272ef..9ff4ea7aeb7d 100644 --- a/android/guava/src/com/google/common/xml/package-info.java +++ b/android/guava/src/com/google/common/xml/package-info.java @@ -21,8 +21,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.xml; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/android/pom.xml b/android/pom.xml index ae6f9a117a1f..74554b817e76 100644 --- a/android/pom.xml +++ b/android/pom.xml @@ -417,6 +417,11 @@ + + org.jspecify + jspecify + 1.0.0 + com.google.code.findbugs jsr305 diff --git a/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java b/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java index cdc2ee110b99..9f077dd9507f 100644 --- a/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java @@ -102,22 +102,20 @@ * @since 1.0 */ /* - * Some of the annotations below were added after we released our separate + * The annotation below was added after we released our separate * com.google.guava:listenablefuture:1.0 artifact. (For more on that artifact, see * https://github.com/google/guava/releases/tag/v27.0) This means that the copy of ListenableFuture * in com.google.guava:guava differs from the "frozen" copy in the listenablefuture artifact. This - * could in principle cause problems for some users. Still, we expect that the benefits of the - * nullness annotations in particular will outweigh the costs. (And it's worth noting that we have - * released multiple ListenableFuture.class files that are not byte-for-byte compatible even from - * the beginning, thanks to using different `-source -target` values for compiling our `-jre` and - * `-android` "flavors.") + * could in principle cause problems for some users. Still, we expect that the benefits will + * outweigh the costs. (And it's worth noting that we have released multiple ListenableFuture.class + * files that are not byte-for-byte compatible even from the beginning, thanks to using different + * `-source -target` values for compiling our `-jre` and `-android` "flavors.") * * (We could consider releasing a listenablefuture:1.0.1 someday. But we would want to look into how * that affects users, especially users of the Android Gradle Plugin, since the plugin developers * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -@ElementTypesAreNonnullByDefault public interface ListenableFuture extends Future { /** * Registers a listener to be {@linkplain Executor#execute(Runnable) run} on the given executor. diff --git a/guava-gwt/pom.xml b/guava-gwt/pom.xml index afe4fa0bc461..ce79b45f3693 100644 --- a/guava-gwt/pom.xml +++ b/guava-gwt/pom.xml @@ -334,7 +334,12 @@ - + + + + + + diff --git a/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/LocalCache.java b/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/LocalCache.java index 9bdbe5d4f9cd..9d970a42ed33 100644 --- a/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/LocalCache.java +++ b/guava-gwt/src-super/com/google/common/cache/super/com/google/common/cache/LocalCache.java @@ -50,6 +50,7 @@ * @author Charles Fry * @author Jon Donovan */ +@SuppressWarnings("nullness") public class LocalCache implements ConcurrentMap { private static final int UNSET_INT = CacheBuilder.UNSET_INT; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/AbstractSortedMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/AbstractSortedMultiset.java index 45709eebba13..a432f5ec7d54 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/AbstractSortedMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/AbstractSortedMultiset.java @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class AbstractSortedMultiset extends AbstractMultiset implements SortedMultiset { @GwtTransient final Comparator comparator; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java index 55af586e9101..1d0901e11dc4 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java @@ -19,9 +19,11 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -abstract class ArrayListMultimapGwtSerializationDependencies +abstract class ArrayListMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> extends AbstractListMultimap { ArrayListMultimapGwtSerializationDependencies(Map> map) { super(map); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/DescendingMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/DescendingMultiset.java index a5924b88fd3b..2ee78ab23dd5 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/DescendingMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/DescendingMultiset.java @@ -31,7 +31,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class DescendingMultiset extends ForwardingMultiset implements SortedMultiset { abstract SortedMultiset forwardMultiset(); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/EnumMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/EnumMultiset.java index f4676a0f6435..8bfaff0e24be 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/EnumMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/EnumMultiset.java @@ -25,7 +25,6 @@ @GwtCompatible(emulated = true) @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class EnumMultiset> extends AbstractMapBasedMultiset implements Serializable { public static > EnumMultiset create(Class type) { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableCollection.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableCollection.java index 2f3ff079ef4d..d30e7fd4ac92 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableCollection.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableCollection.java @@ -26,7 +26,6 @@ * @author Hayward Chan */ // TODO: Make this class GWT serializable. -@ElementTypesAreNonnullByDefault class ForwardingImmutableCollection extends ImmutableCollection { final transient Collection delegate; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableList.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableList.java index e9ea9e95cd15..82743678a91b 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableList.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableList.java @@ -25,7 +25,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault abstract class ForwardingImmutableList extends ImmutableList { ForwardingImmutableList() {} diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java index 1b13ed3ea151..0101f76c0a2d 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableMap.java @@ -28,7 +28,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault public abstract class ForwardingImmutableMap extends ImmutableMap { final transient Map delegate; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableSet.java index 111b919da0d7..7ed0d09d2497 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingImmutableSet.java @@ -26,7 +26,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault @SuppressWarnings("serial") // Serialization only done in GWT. public abstract class ForwardingImmutableSet extends ImmutableSet { private final transient Set delegate; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingSortedMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingSortedMultiset.java index 0d8d3f636346..42380758a531 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingSortedMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ForwardingSortedMultiset.java @@ -37,7 +37,6 @@ * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedMultiset extends ForwardingMultiset implements SortedMultiset { /** Constructor for use by subclasses. */ diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/HashMultimapGwtSerializationDependencies.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/HashMultimapGwtSerializationDependencies.java index a38f9e807e4c..92ff76a3d0b7 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/HashMultimapGwtSerializationDependencies.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/HashMultimapGwtSerializationDependencies.java @@ -19,9 +19,12 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -abstract class HashMultimapGwtSerializationDependencies extends AbstractSetMultimap { +abstract class HashMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> + extends AbstractSetMultimap { HashMultimapGwtSerializationDependencies(Map> map) { super(map); } diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMap.java index 1da198c7b6bc..da4e0e73f9da 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableBiMap.java @@ -32,7 +32,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault public abstract class ImmutableBiMap extends ForwardingImmutableMap implements BiMap { public static diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java index a6d2a8ba0ff0..77ba991a1c23 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableCollection.java @@ -33,7 +33,6 @@ * @author Jesse Wilson */ @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableCollection extends AbstractCollection implements Serializable { static final int SPLITERATOR_CHARACTERISTICS = Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMap.java index 72db1e73ddb5..f49899166265 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumMap.java @@ -27,7 +27,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class ImmutableEnumMap extends ForwardingImmutableMap { static ImmutableMap asImmutable(Map map) { for (Entry entry : checkNotNull(map).entrySet()) { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumSet.java index 7c57d244b38a..be7e4b7284e4 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableEnumSet.java @@ -24,7 +24,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class ImmutableEnumSet extends ForwardingImmutableSet { static ImmutableSet asImmutable(Set delegate) { switch (delegate.size()) { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java index f0038cf641b3..53707342a575 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableList.java @@ -38,7 +38,6 @@ * @author Hayward Chan */ @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableList extends ImmutableCollection implements List, RandomAccess { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java index 8312220f9a0b..12a7ecedc4ed 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableMap.java @@ -49,7 +49,6 @@ * @see ImmutableSortedMap * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault public abstract class ImmutableMap implements Map, Serializable { abstract static class IteratorBasedImmutableMap extends ImmutableMap { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java index 6fd8ee8de0ae..d91ede2130f8 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSet.java @@ -40,7 +40,6 @@ * @see ImmutableSortedSet * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault @SuppressWarnings("serial") // Serialization only done in GWT. public abstract class ImmutableSet extends ImmutableCollection implements Set { ImmutableSet() {} diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMap.java index a08906a86473..cdea3a01cbbc 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedMap.java @@ -41,7 +41,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault public final class ImmutableSortedMap extends ForwardingImmutableMap implements SortedMap { diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java index 978b0397d497..cd078b5de098 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSortedSet.java @@ -37,7 +37,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault public abstract class ImmutableSortedSet extends ForwardingImmutableSet implements SortedSet, SortedIterable { // TODO(cpovirk): split into ImmutableSortedSet/ForwardingImmutableSortedSet? diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableBiMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableBiMap.java index ad469780e2ac..fe42a142b06e 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableBiMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableBiMap.java @@ -20,7 +20,6 @@ * GWT emulation of {@link JdkBackedImmutableBiMap}. Never used, but must exist so that the client * is willing to deserialize maps that were this type on the server. */ -@ElementTypesAreNonnullByDefault class JdkBackedImmutableBiMap extends RegularImmutableBiMap { private JdkBackedImmutableBiMap(ImmutableMap delegate, ImmutableBiMap inverse) { super(delegate, inverse); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableMap.java index 574d619def6f..88d1611e7dec 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/JdkBackedImmutableMap.java @@ -22,7 +22,6 @@ * GWT emulation of {@link JdkBackedImmutableMap}. Never used, but must exist so that the client is * willing to deserialize maps that were this type on the server. */ -@ElementTypesAreNonnullByDefault final class JdkBackedImmutableMap extends ForwardingImmutableMap { JdkBackedImmutableMap(Map delegate) { super(delegate); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java index 6410801d9d7a..95b326c32259 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java @@ -19,9 +19,11 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -abstract class LinkedHashMultimapGwtSerializationDependencies +abstract class LinkedHashMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> extends AbstractSetMultimap { LinkedHashMultimapGwtSerializationDependencies(Map> map) { super(map); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/MapMaker.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/MapMaker.java index 459ab06cf59b..a0d535ca8ff2 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/MapMaker.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/MapMaker.java @@ -27,7 +27,6 @@ * * @author Charles Fry */ -@ElementTypesAreNonnullByDefault public final class MapMaker { private int initialCapacity = 16; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableBiMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableBiMap.java index 6c6234ba4371..bd9665038525 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableBiMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableBiMap.java @@ -24,7 +24,6 @@ * @author Jared Levy * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault @SuppressWarnings("serial") class RegularImmutableBiMap extends ImmutableBiMap { static final RegularImmutableBiMap EMPTY = diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java index 47c07c3723b6..cd551596a2eb 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableList.java @@ -27,7 +27,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault class RegularImmutableList extends ForwardingImmutableList { static final ImmutableList EMPTY = new RegularImmutableList(emptyList()); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java index d3a455e306b9..e00ee41331c5 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMap.java @@ -23,7 +23,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class RegularImmutableMap extends ForwardingImmutableMap { static final ImmutableMap EMPTY = new RegularImmutableMap(); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMultiset.java index 06d6e4466d4f..52890cb8cb33 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableMultiset.java @@ -17,7 +17,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** Never actually created; instead delegates to JdkBackedImmutableMultiset. */ -@ElementTypesAreNonnullByDefault class RegularImmutableMultiset extends ImmutableMultiset { static final ImmutableMultiset EMPTY = JdkBackedImmutableMultiset.create(ImmutableList.of()); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSet.java index 84a52b3f5fda..30752512de41 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSet.java @@ -24,7 +24,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class RegularImmutableSet extends ForwardingImmutableSet { static final RegularImmutableSet EMPTY = new RegularImmutableSet(Collections.emptySet()); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSortedSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSortedSet.java index c8bb8d7d5703..b15365d59ed3 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSortedSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/RegularImmutableSortedSet.java @@ -25,7 +25,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class RegularImmutableSortedSet extends ImmutableSortedSet { /** true if this set is a subset of another immutable sorted set. */ diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableBiMap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableBiMap.java index dc1ae96e4eea..f87f8b1f8e6b 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableBiMap.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableBiMap.java @@ -26,7 +26,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class SingletonImmutableBiMap extends ImmutableBiMap { // These references are used both by the custom field serializer, and by the diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableList.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableList.java index a49e143bccb6..7c525f413355 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableList.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableList.java @@ -26,7 +26,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class SingletonImmutableList extends ForwardingImmutableList { final transient List delegate; diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableSet.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableSet.java index 63576d0fb8af..fe08d2c3f6b9 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableSet.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SingletonImmutableSet.java @@ -25,7 +25,6 @@ * * @author Hayward Chan */ -@ElementTypesAreNonnullByDefault final class SingletonImmutableSet extends ImmutableSet { // This reference is used both by the custom field serializer, and by the diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SortedMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SortedMultiset.java index 9ebd1d1b8ad3..32032a6a3bed 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SortedMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/SortedMultiset.java @@ -28,7 +28,6 @@ * @author Louis Wasserman * @since 11.0 */ -@ElementTypesAreNonnullByDefault public interface SortedMultiset extends Multiset, SortedIterable { Comparator comparator(); diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/UnmodifiableSortedMultiset.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/UnmodifiableSortedMultiset.java index 3b31f0f99fe9..e1851c6abdd5 100644 --- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/UnmodifiableSortedMultiset.java +++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/UnmodifiableSortedMultiset.java @@ -28,7 +28,6 @@ * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault final class UnmodifiableSortedMultiset extends UnmodifiableMultiset implements SortedMultiset { UnmodifiableSortedMultiset(SortedMultiset delegate) { diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java index c92fae2d0dff..82e03ef57c90 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AbstractFuture.java @@ -37,7 +37,6 @@ /** Emulation for AbstractFuture in GWT. */ @SuppressWarnings("nullness") // TODO(b/147136275): Remove once our checker understands & and |. -@ElementTypesAreNonnullByDefault public abstract class AbstractFuture extends InternalFutureFailureAccess implements ListenableFuture { diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AggregateFutureState.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AggregateFutureState.java index f7d9dd21fe3e..75473b39905e 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AggregateFutureState.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/AggregateFutureState.java @@ -22,7 +22,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** Emulation of AggregateFutureState. */ -@ElementTypesAreNonnullByDefault abstract class AggregateFutureState extends AbstractFuture.TrustedFuture { // Lazily initialized the first time we see an exception; not released until all the input futures diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java index 1e9cff859223..f1a58dfd9286 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java @@ -23,7 +23,6 @@ * versions of the {@link FluentFuture#catching(Class, com.google.common.base.Function) * FluentFuture.catching} family of methods. Those versions have slightly different signatures. */ -@ElementTypesAreNonnullByDefault abstract class GwtFluentFutureCatchingSpecialization extends AbstractFuture { /* diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java index 6a112ec85d12..5139b18c7952 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java @@ -23,7 +23,6 @@ * the {@link Futures#catching(ListenableFuture, Class, com.google.common.base.Function) * Futures.catching} family of methods. Those versions have slightly different signatures. */ -@ElementTypesAreNonnullByDefault abstract class GwtFuturesCatchingSpecialization { /* * In the GWT versions of the methods (below), every exceptionType parameter is required to be diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/InterruptibleTask.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/InterruptibleTask.java index 8d4217bbd7da..e9e38332deb5 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/InterruptibleTask.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/InterruptibleTask.java @@ -21,7 +21,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** Emulation for InterruptibleTask in GWT. */ -@ElementTypesAreNonnullByDefault abstract class InterruptibleTask implements Runnable { @Override diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/ListenableFuture.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/ListenableFuture.java index 5a6307a61e56..b50aeca7431b 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/ListenableFuture.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/ListenableFuture.java @@ -27,7 +27,6 @@ * Java super source for ListenableFuture, implementing a structural thenable via a default method. * For restrictions, please refer to the documentation of the then() method. */ -@ElementTypesAreNonnullByDefault public interface ListenableFuture extends Future, IThenable { void addListener(Runnable listener, Executor executor); diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Platform.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Platform.java index 430e1abd7c78..a4be0de7c6be 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Platform.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Platform.java @@ -18,7 +18,6 @@ /** Methods factored out so that they can be emulated differently in GWT. */ -@ElementTypesAreNonnullByDefault final class Platform { static boolean isInstanceOfThrowableClass(Throwable t, Class expectedClass) { /* diff --git a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Uninterruptibles.java b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Uninterruptibles.java index add601819431..79b65ad5f2ac 100644 --- a/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Uninterruptibles.java +++ b/guava-gwt/src-super/com/google/common/util/concurrent/super/com/google/common/util/concurrent/Uninterruptibles.java @@ -22,7 +22,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** Emulation of Uninterruptibles in GWT. */ -@ElementTypesAreNonnullByDefault public final class Uninterruptibles { private Uninterruptibles() {} diff --git a/guava-testlib/pom.xml b/guava-testlib/pom.xml index 6a696351e4c6..ddf8a4ae5795 100644 --- a/guava-testlib/pom.xml +++ b/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/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java index f281cd83414b..01d6667a2ae5 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java @@ -32,7 +32,6 @@ @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 public abstract class AbstractCollectionTester extends AbstractContainerTester, E> { diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java index 56163a6f6740..ed7de85226ce 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java @@ -42,7 +42,6 @@ @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 public abstract class AbstractContainerTester extends AbstractTester> { protected SampleElements samples; diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java index 8ed255891105..a411af8d3441 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java @@ -46,7 +46,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractIteratorTester> { private Stimulus[] stimuli; private final Iterator elementsToInsert; diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java index f85b01fbbc7e..40f093b3e9c2 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java @@ -43,7 +43,6 @@ @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 public abstract class AbstractMapTester extends AbstractContainerTester, Entry> { protected Map getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java index 5ffe110e7dbe..7f85e9a7bef7 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java @@ -34,7 +34,6 @@ * @author George van den Driessche */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public class AbstractTester extends TestCase { private G subjectGenerator; private String suiteName; diff --git a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java index 6312a67bc66a..822cc0360355 100644 --- a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java @@ -41,7 +41,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class DerivedCollectionGenerators { public static class MapEntrySetGenerator implements TestSetGenerator>, DerivedGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/ElementTypesAreNonnullByDefault.java b/guava-testlib/src/com/google/common/collect/testing/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 80379ccb8c69..000000000000 --- a/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/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/guava-testlib/src/com/google/common/collect/testing/Helpers.java index a9e7ac04d84a..69f08865c935 100644 --- a/guava-testlib/src/com/google/common/collect/testing/Helpers.java +++ b/guava-testlib/src/com/google/common/collect/testing/Helpers.java @@ -47,7 +47,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public class Helpers { // Clone of Objects.equal static boolean equal(@Nullable Object a, @Nullable Object b) { diff --git a/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java b/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java index 7bc6548bcab2..d9b581071bbb 100644 --- a/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java +++ b/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                          Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java index 01409884607a..c9f31132f9f3 100644 --- a/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java @@ -85,7 +85,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class IteratorTester extends AbstractIteratorTester> { /** diff --git a/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java index a781d0ab0266..3658a9614c1f 100644 --- a/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java @@ -36,7 +36,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ListIteratorTester extends AbstractIteratorTester> { protected ListIteratorTester( diff --git a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java index 8c3fdeadccb1..3001067217fb 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java +++ b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java @@ -48,7 +48,6 @@ // check the order if so. // TODO: Refactor to share code with SetTestBuilder etc. @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class MapInterfaceTest extends TestCase { diff --git a/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java b/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java index 67b7cdb485e4..9744adad3f1d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java +++ b/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java @@ -33,7 +33,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class MinimalCollection extends AbstractCollection { // TODO: expose allow nulls parameter? diff --git a/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java b/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java index 971e69a2436b..33faa54bed85 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java +++ b/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java @@ -34,7 +34,6 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class MinimalSet extends MinimalCollection implements Set { @SuppressWarnings("unchecked") // empty Object[] as E[] diff --git a/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java b/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java index faeee278d0d9..8ce1de8073a6 100644 --- a/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java @@ -31,7 +31,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class OneSizeGenerator implements OneSizeTestContainerGenerator { private final TestContainerGenerator generator; diff --git a/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java b/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java index 9cb5a87e79e6..c6d22c8a3489 100644 --- a/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java @@ -32,7 +32,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface OneSizeTestContainerGenerator extends TestSubjectGenerator, TestContainerGenerator { TestContainerGenerator getInnerGenerator(); diff --git a/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java b/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java index 9f32428f8732..b6919b4d1cba 100644 --- a/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java +++ b/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java @@ -35,7 +35,6 @@ /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-testlib/src/com/google/common/collect/testing/SampleElements.java b/guava-testlib/src/com/google/common/collect/testing/SampleElements.java index e1606a19d977..15228e49509f 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SampleElements.java +++ b/guava-testlib/src/com/google/common/collect/testing/SampleElements.java @@ -31,7 +31,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class SampleElements implements Iterable { // TODO: rename e3, e4 => missing1, missing2 private final E e0; diff --git a/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java index 131cbf814db5..2508fd5888fe 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java @@ -50,7 +50,6 @@ * @since 21.0 (but only since 33.4.0 in the Android flavor) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class SpliteratorTester { /** Return type from "contains the following elements" assertions. */ public interface Ordered { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java index 07b465bb889a..b7542b55b654 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestCharacterListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java index 63c35be86abc..1812f14481eb 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java @@ -26,6 +26,5 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestCollectionGenerator extends TestContainerGenerator, E> {} diff --git a/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java index b26a6a5832f9..6aa0c33d3852 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestCollidingSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java index c6792bfdf519..125e41f5e82c 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java @@ -30,7 +30,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestContainerGenerator { /** Returns the sample elements that this generate populates its container with. */ SampleElements samples(); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java index b4b97c601339..099282bfa8ca 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java @@ -30,7 +30,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestEnumMapGenerator implements TestMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java index 307fc1533fab..48b0bc254f71 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java @@ -29,7 +29,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestEnumSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java index 633329c1e626..9cd9ecb43d6b 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java @@ -27,7 +27,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestIntegerSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java index 73b44b616f1d..20a9ea739138 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java @@ -29,7 +29,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestIntegerSortedSetGenerator extends TestIntegerSetGenerator { @Override protected abstract SortedSet create(Integer[] elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java index 34117f898874..74879e4574de 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestListGenerator extends TestCollectionGenerator { @Override List create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java index 57376d4987e1..d388bc0e796d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java @@ -31,7 +31,6 @@ * @author Jesse Wilson */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestMapEntrySetGenerator< K extends @Nullable Object, V extends @Nullable Object> implements TestSetGenerator> { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java index efc85fc5563b..b31d43d6aba5 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java @@ -26,7 +26,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestMapGenerator extends TestContainerGenerator, Map.Entry> { K[] createKeyArray(int length); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java index c5b093b1880d..d84cba6512ee 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java @@ -26,7 +26,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestQueueGenerator extends TestCollectionGenerator { @Override Queue create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java index 2ed582aa7a36..5f188900cf2a 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestSetGenerator extends TestCollectionGenerator { @Override Set create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java index 107a8e76cea7..9dbc4ef89766 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestSortedMapGenerator extends TestMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java index 10abd8b4d171..cddd34630593 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java @@ -26,7 +26,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestSortedSetGenerator extends TestSetGenerator { @Override SortedSet create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java index 081e9eaddd26..f9c58cd7f333 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java @@ -27,7 +27,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringCollectionGenerator implements TestCollectionGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java index fe1de2eb2450..7e22ab143059 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java @@ -26,7 +26,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java index 0900629a55c8..fe9cf74dad2a 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java @@ -31,7 +31,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringMapGenerator implements TestMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java index 1102c3456bd0..16cb2539d1f3 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java @@ -27,7 +27,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringQueueGenerator implements TestQueueGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java index 2949e4aca819..1724bb2c8dc6 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java @@ -27,7 +27,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java index 8a8f758290d6..3737bc71d9b8 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java @@ -30,7 +30,6 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringSortedMapGenerator extends TestStringMapGenerator implements TestSortedMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java index e83dd74ac1c5..36fbb2b1cffc 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java @@ -28,7 +28,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringSortedSetGenerator extends TestStringSetGenerator implements TestSortedSetGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java index 431e7e8103d7..cf46ea617f63 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java @@ -27,7 +27,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestSubjectGenerator { T createTestSubject(); } diff --git a/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java index d4d772b81e1d..9b4602d045d8 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java @@ -27,7 +27,6 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestUnhashableCollectionGenerator> implements TestCollectionGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java index 99d4aa4c7039..f7fc7225ad66 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java @@ -34,7 +34,6 @@ @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 public abstract class AbstractBiMapTester extends AbstractMapTester { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java index 32749e4e21a3..71b92f582095 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java @@ -32,7 +32,6 @@ @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 public class AbstractListMultimapTester extends AbstractMultimapTester> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java index a48e4940662f..39e64bfb3650 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java @@ -40,7 +40,6 @@ @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 public abstract class AbstractMultimapTester< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends AbstractContainerTester> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java index bacd16155b88..7dc245387930 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java @@ -33,7 +33,6 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class BiMapGenerators { public static class ImmutableBiMapGenerator extends TestStringBiMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java index 3dbb5cd9e89c..2f519eabbd09 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java @@ -42,7 +42,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class DerivedGoogleCollectionGenerators { public static class MapGenerator implements TestMapGenerator, DerivedGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ElementTypesAreNonnullByDefault.java b/guava-testlib/src/com/google/common/collect/testing/google/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index c666efdcbff8..000000000000 --- a/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/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java index e5dd65c4b6d1..7fdbbd7266ed 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java @@ -37,7 +37,6 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class ListGenerators { private ListGenerators() {} diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java index 12e31fbd383b..aabb101db2a4 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java @@ -47,7 +47,6 @@ @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 public class ListMultimapAsMapTester extends AbstractListMultimapTester { public void testAsMapValuesImplementList() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java index c42680043e7d..1bc9be12bcc5 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java @@ -47,7 +47,6 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class MapGenerators { public static class ImmutableMapGenerator extends TestStringMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java index a5d80d9d9de5..683331d429d8 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java @@ -39,7 +39,6 @@ @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 public class MultimapEqualsTester extends AbstractMultimapTester> { public void testEqualsTrue() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java index 0d04d181123d..c300d77a6ae8 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java @@ -49,7 +49,6 @@ @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 public class MultimapPutTester extends AbstractMultimapTester> { @MapFeature.Require(absent = SUPPORTS_PUT) diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java index b3bc461a932c..5ec4a49ffbb2 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java @@ -40,7 +40,6 @@ @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 public class MultimapSizeTester extends AbstractMultimapTester> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java index 50c3d367c59a..c52a7d412e42 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java @@ -42,7 +42,6 @@ @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 public class MultisetIteratorTester extends AbstractMultisetTester { @CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, KNOWN_ORDER}) public void testRemovingIteratorKnownOrder() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java b/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java index a9704ce4739b..e49fe2260991 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java @@ -35,7 +35,6 @@ /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java index 908b733338be..95f62ba1828d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java @@ -62,7 +62,6 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public class SetGenerators { public static class ImmutableSetCopyOfGenerator extends TestStringSetGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java index 456d566a0bfd..19dc5ac66a34 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java @@ -47,7 +47,6 @@ @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 public class SetMultimapAsMapTester extends AbstractMultimapTester> { public void testAsMapValuesImplementSet() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java index 49b73296018c..11a15fdf6ea8 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java @@ -42,7 +42,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class SortedMapGenerators { public static class ImmutableSortedMapGenerator extends TestStringSortedMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java index 5194e50c603a..938154983965 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestBiMapGenerator extends TestContainerGenerator, Entry> { K[] createKeyArray(int length); diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java index 96e56e38b6ae..72bfe4192011 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java @@ -31,7 +31,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestEnumMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java index 6a71573f11b6..e9a3a9b9b470 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java @@ -26,6 +26,5 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestListMultimapGenerator extends TestMultimapGenerator> {} diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java index 79c6874bffbb..03e783682e00 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java @@ -30,7 +30,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestMultimapGenerator< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends TestContainerGenerator> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java index 272313253dea..f9bd19f4662e 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java @@ -27,7 +27,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TestMultisetGenerator extends TestCollectionGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java index 1f59dd0beecb..8eca2d33205f 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringBiMapGenerator implements TestBiMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java index 8c9140ed44d8..13e7bee946ed 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java @@ -32,7 +32,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringListMultimapGenerator implements TestListMultimapGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java index b7b2558d9919..eeacf5d1932c 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java @@ -28,7 +28,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java index e03cd52d01ea..867258e12cfb 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java @@ -31,7 +31,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TestStringSetMultimapGenerator implements TestSetMultimapGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java b/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java index f590df0b51a6..600c4900257c 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java @@ -44,7 +44,6 @@ * @author Robert Konigsberg */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class UnmodifiableCollectionTests { public static void assertMapEntryIsUnmodifiable(Entry entry) { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java index 002831ef3c13..a1a02937b929 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java @@ -31,7 +31,6 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault @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/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java index 8bcb6b62e000..1013d4c411f2 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java @@ -53,7 +53,6 @@ @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 public class CollectionIteratorTester extends AbstractCollectionTester { public void testIterator() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java index 9e40e4128247..9e3220f0a6a9 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java @@ -42,7 +42,6 @@ @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 public class ConcurrentMapPutIfAbsentTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java index 21dd73bf0d93..5b9bcea60f38 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java @@ -39,7 +39,6 @@ @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 public class ConcurrentMapRemoveTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java index 50e39d13201a..0b8482dbd7b8 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java @@ -40,7 +40,6 @@ @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 public class ConcurrentMapReplaceEntryTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java index 4b55fef8def3..a4068063adbd 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java @@ -41,7 +41,6 @@ @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 public class ConcurrentMapReplaceTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ElementTypesAreNonnullByDefault.java b/guava-testlib/src/com/google/common/collect/testing/testers/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 6d5d26c79493..000000000000 --- a/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/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java b/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java index 42976bcb76f8..11b35d37ffc5 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                          Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java index 3cdbc3737132..2fd2289f6a3c 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java @@ -53,7 +53,6 @@ @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 public class ListListIteratorTester extends AbstractListTester { @CollectionFeature.Require(absent = SUPPORTS_REMOVE) @ListFeature.Require(absent = {SUPPORTS_SET, SUPPORTS_ADD_WITH_INDEX}) diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java index 5d1722173f10..ab98ed331c6a 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java @@ -54,7 +54,6 @@ @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 public class MapPutAllTester extends AbstractMapTester { private List> containsNullKey; diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java b/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java index b014de3146e4..ebe379d8d661 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java @@ -39,7 +39,6 @@ /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java index a8cda429574a..7f54eb4f7ff3 100644 --- a/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java @@ -42,7 +42,6 @@ @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 public class SortedSetNavigationTester extends AbstractSetTester { private SortedSet sortedSet; diff --git a/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java b/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java index 249731a39a21..0f84e106e4e7 100644 --- a/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java +++ b/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java @@ -105,7 +105,6 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // com.google.common.reflect.ClassPath -@ElementTypesAreNonnullByDefault public abstract class AbstractPackageSanityTests extends TestCase { /** diff --git a/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java b/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java index a178b418f60e..43a65ea4e6e5 100644 --- a/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -176,7 +176,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class ArbitraryInstances { private static final Ordering BY_FIELD_NAME = diff --git a/guava-testlib/src/com/google/common/testing/ClassSanityTester.java b/guava-testlib/src/com/google/common/testing/ClassSanityTester.java index 12933eaeaee7..e2b04431d4f5 100644 --- a/guava-testlib/src/com/google/common/testing/ClassSanityTester.java +++ b/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/guava-testlib/src/com/google/common/testing/ClusterException.java b/guava-testlib/src/com/google/common/testing/ClusterException.java index 2b8d4eb77e72..54a606d90cb4 100644 --- a/guava-testlib/src/com/google/common/testing/ClusterException.java +++ b/guava-testlib/src/com/google/common/testing/ClusterException.java @@ -59,7 +59,6 @@ * @author Luiz-Otavio Zorzella */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class ClusterException extends RuntimeException { final Collection exceptions; diff --git a/guava-testlib/src/com/google/common/testing/CollectorTester.java b/guava-testlib/src/com/google/common/testing/CollectorTester.java index 94f6a5a010fa..588eb2e2d654 100644 --- a/guava-testlib/src/com/google/common/testing/CollectorTester.java +++ b/guava-testlib/src/com/google/common/testing/CollectorTester.java @@ -46,7 +46,6 @@ * @since 21.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class CollectorTester< T extends @Nullable Object, A extends @Nullable Object, R extends @Nullable Object> { /** diff --git a/guava-testlib/src/com/google/common/testing/DummyProxy.java b/guava-testlib/src/com/google/common/testing/DummyProxy.java index 3494a66bb2c0..692361e9aa9b 100644 --- a/guava-testlib/src/com/google/common/testing/DummyProxy.java +++ b/guava-testlib/src/com/google/common/testing/DummyProxy.java @@ -40,7 +40,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault abstract class DummyProxy { /** diff --git a/guava-testlib/src/com/google/common/testing/ElementTypesAreNonnullByDefault.java b/guava-testlib/src/com/google/common/testing/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 1362176b5a12..000000000000 --- a/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/guava-testlib/src/com/google/common/testing/EqualsTester.java b/guava-testlib/src/com/google/common/testing/EqualsTester.java index 5f02dba84855..4e488f40f7c4 100644 --- a/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -76,7 +76,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class EqualsTester { private static final int REPETITIONS = 3; diff --git a/guava-testlib/src/com/google/common/testing/EquivalenceTester.java b/guava-testlib/src/com/google/common/testing/EquivalenceTester.java index ec34752c57ab..b69072984683 100644 --- a/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -50,7 +50,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class EquivalenceTester { private static final int REPETITIONS = 3; diff --git a/guava-testlib/src/com/google/common/testing/FakeTicker.java b/guava-testlib/src/com/google/common/testing/FakeTicker.java index 3ffc27b71b42..29c5bba0933a 100644 --- a/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -39,7 +39,6 @@ * @author Jige Yu * @since 10.0 */ -@ElementTypesAreNonnullByDefault @GwtCompatible public class FakeTicker extends Ticker { diff --git a/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java b/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java index 0d38191f5ede..d7d3ec5a8ab6 100644 --- a/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -57,7 +57,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class ForwardingWrapperTester { private boolean testsEquals = false; diff --git a/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java b/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java index fe465ffc62ee..8ff58aec5f97 100644 --- a/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java +++ b/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java @@ -125,6 +125,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; /** @@ -134,6 +135,8 @@ */ @GwtIncompatible @J2ktIncompatible +@NullUnmarked +@SuppressWarnings("nullness") class FreshValueGenerator { private static final ImmutableMap, Method> GENERATORS; diff --git a/guava-testlib/src/com/google/common/testing/GcFinalization.java b/guava-testlib/src/com/google/common/testing/GcFinalization.java index fb0facf24fd8..40a4662ee51d 100644 --- a/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -107,7 +107,6 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // gc -@ElementTypesAreNonnullByDefault public final class GcFinalization { private GcFinalization() {} diff --git a/guava-testlib/src/com/google/common/testing/NullPointerTester.java b/guava-testlib/src/com/google/common/testing/NullPointerTester.java index 8b2ac49633c5..a6d0a02eae7c 100644 --- a/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -69,7 +69,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class NullPointerTester { private final ClassToInstanceMap defaults = MutableClassToInstanceMap.create(); diff --git a/guava-testlib/src/com/google/common/testing/Platform.java b/guava-testlib/src/com/google/common/testing/Platform.java index 9726d2de0eb1..63197c66de7a 100644 --- a/guava-testlib/src/com/google/common/testing/Platform.java +++ b/guava-testlib/src/com/google/common/testing/Platform.java @@ -32,7 +32,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { /** Serializes and deserializes the specified object. */ @SuppressWarnings("unchecked") diff --git a/guava-testlib/src/com/google/common/testing/RelationshipTester.java b/guava-testlib/src/com/google/common/testing/RelationshipTester.java index d1caedd4e8d1..1ffed6bb67b7 100644 --- a/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -33,7 +33,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class RelationshipTester { static class ItemReporter { diff --git a/guava-testlib/src/com/google/common/testing/SerializableTester.java b/guava-testlib/src/com/google/common/testing/SerializableTester.java index c2f8cc169b0b..72d3ea4c3b72 100644 --- a/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtCompatible // but no-op! -@ElementTypesAreNonnullByDefault public final class SerializableTester { private SerializableTester() {} diff --git a/guava-testlib/src/com/google/common/testing/SloppyTearDown.java b/guava-testlib/src/com/google/common/testing/SloppyTearDown.java index 10d9dc04ecd4..1be61b8566bc 100644 --- a/guava-testlib/src/com/google/common/testing/SloppyTearDown.java +++ b/guava-testlib/src/com/google/common/testing/SloppyTearDown.java @@ -30,7 +30,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class SloppyTearDown implements TearDown { private static final Logger logger = Logger.getLogger(SloppyTearDown.class.getName()); diff --git a/guava-testlib/src/com/google/common/testing/TearDown.java b/guava-testlib/src/com/google/common/testing/TearDown.java index 0259a1f3ba1c..d8aa25814521 100644 --- a/guava-testlib/src/com/google/common/testing/TearDown.java +++ b/guava-testlib/src/com/google/common/testing/TearDown.java @@ -26,7 +26,6 @@ */ @FunctionalInterface @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TearDown { /** * Performs a single tear-down operation. See test-libraries-for-java's {@code diff --git a/guava-testlib/src/com/google/common/testing/TearDownAccepter.java b/guava-testlib/src/com/google/common/testing/TearDownAccepter.java index ec4319bab550..3625f62734d3 100644 --- a/guava-testlib/src/com/google/common/testing/TearDownAccepter.java +++ b/guava-testlib/src/com/google/common/testing/TearDownAccepter.java @@ -27,7 +27,6 @@ */ @DoNotMock("Implement with a lambda") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface TearDownAccepter { /** * Registers a TearDown implementor which will be run after the test proper. diff --git a/guava-testlib/src/com/google/common/testing/TearDownStack.java b/guava-testlib/src/com/google/common/testing/TearDownStack.java index b16869865907..f34c2808147f 100644 --- a/guava-testlib/src/com/google/common/testing/TearDownStack.java +++ b/guava-testlib/src/com/google/common/testing/TearDownStack.java @@ -37,7 +37,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class TearDownStack implements TearDownAccepter { private static final Logger logger = Logger.getLogger(TearDownStack.class.getName()); diff --git a/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/guava-testlib/src/com/google/common/testing/TestLogHandler.java index aba2131935bb..0f6a83c5ab82 100644 --- a/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -53,7 +53,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class TestLogHandler extends Handler { private final Object lock = new Object(); diff --git a/guava-testlib/src/com/google/common/testing/package-info.java b/guava-testlib/src/com/google/common/testing/package-info.java index 3c0849ffca63..ee913c788291 100644 --- a/guava-testlib/src/com/google/common/testing/package-info.java +++ b/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/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java b/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java index ca07ffae0fbd..05ff429bbdf5 100644 --- a/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/pom.xml b/guava-tests/pom.xml index f05a079b2f94..6e320afcb9a5 100644 --- a/guava-tests/pom.xml +++ b/guava-tests/pom.xml @@ -21,6 +21,10 @@ ${project.version} test + + org.jspecify + jspecify + com.google.code.findbugs jsr305 diff --git a/guava-tests/test/com/google/common/base/CharMatcherTest.java b/guava-tests/test/com/google/common/base/CharMatcherTest.java index 67e83a7fb030..1d47a3dc8a85 100644 --- a/guava-tests/test/com/google/common/base/CharMatcherTest.java +++ b/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/guava-tests/test/com/google/common/base/EquivalenceTest.java b/guava-tests/test/com/google/common/base/EquivalenceTest.java index 9bc96b0d24e7..8b5db3ab2ae2 100644 --- a/guava-tests/test/com/google/common/base/EquivalenceTest.java +++ b/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/guava-tests/test/com/google/common/base/FunctionsTest.java b/guava-tests/test/com/google/common/base/FunctionsTest.java index 1241200daafa..54380fe53d3b 100644 --- a/guava-tests/test/com/google/common/base/FunctionsTest.java +++ b/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/guava-tests/test/com/google/common/base/JoinerTest.java b/guava-tests/test/com/google/common/base/JoinerTest.java index c02127e9d55d..5d427dd7a5d6 100644 --- a/guava-tests/test/com/google/common/base/JoinerTest.java +++ b/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/guava-tests/test/com/google/common/base/OptionalTest.java b/guava-tests/test/com/google/common/base/OptionalTest.java index ec197f5c2b82..3c6e2e9f072b 100644 --- a/guava-tests/test/com/google/common/base/OptionalTest.java +++ b/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/guava-tests/test/com/google/common/base/PreconditionsTest.java b/guava-tests/test/com/google/common/base/PreconditionsTest.java index 71845c8e5892..10ee1296bd13 100644 --- a/guava-tests/test/com/google/common/base/PreconditionsTest.java +++ b/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/guava-tests/test/com/google/common/base/PredicatesTest.java b/guava-tests/test/com/google/common/base/PredicatesTest.java index f1918c6d8c42..6fc9660f4bd7 100644 --- a/guava-tests/test/com/google/common/base/PredicatesTest.java +++ b/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/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java index e8f98fdd542e..2315bae34bc6 100644 --- a/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/base/SplitterTest.java b/guava-tests/test/com/google/common/base/SplitterTest.java index 71a37a5f08e0..d5b5a9aeb373 100644 --- a/guava-tests/test/com/google/common/base/SplitterTest.java +++ b/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/guava-tests/test/com/google/common/base/StringsTest.java b/guava-tests/test/com/google/common/base/StringsTest.java index 494f321c208d..79fd2651cd24 100644 --- a/guava-tests/test/com/google/common/base/StringsTest.java +++ b/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/guava-tests/test/com/google/common/base/SuppliersTest.java b/guava-tests/test/com/google/common/base/SuppliersTest.java index 9a1150a0fc02..5971816134e7 100644 --- a/guava-tests/test/com/google/common/base/SuppliersTest.java +++ b/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/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java index 0fa5fdbdb7b4..c496603719d7 100644 --- a/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java b/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java index 9dfa3fde21f6..21c7b8bde46c 100644 --- a/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java b/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java index b0cb64e5faab..9a6615fa449d 100644 --- a/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java b/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java index 45f877a17ecf..6f1b6f7e8c6b 100644 --- a/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java b/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java index 1b6d6656483e..c935a962b9fe 100644 --- a/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java b/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java index a0f25ca5c29a..80c9526665f4 100644 --- a/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java b/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java index 1a86566d0cfc..6808c3cf13fa 100644 --- a/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java index 84b920902557..682f16d54d5a 100644 --- a/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java b/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java index b1f64347ee53..e93736a6b89f 100644 --- a/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java b/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java index 5eada001250c..2d6a94d28e67 100644 --- a/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java +++ b/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/guava-tests/test/com/google/common/collect/AbstractTableTest.java b/guava-tests/test/com/google/common/collect/AbstractTableTest.java index 264bb06f0a80..4f479f49d9be 100644 --- a/guava-tests/test/com/google/common/collect/AbstractTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java b/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java index bc18b493baa4..37f513ae3b29 100644 --- a/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java +++ b/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/guava-tests/test/com/google/common/collect/ArrayTableTest.java b/guava-tests/test/com/google/common/collect/ArrayTableTest.java index 9755891f9d62..a0399d3cf49f 100644 --- a/guava-tests/test/com/google/common/collect/ArrayTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java b/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java index 44815e122dfa..16c98c5cae61 100644 --- a/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java +++ b/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/guava-tests/test/com/google/common/collect/Collections2Test.java b/guava-tests/test/com/google/common/collect/Collections2Test.java index b14550a4719d..69adcaeb6fe5 100644 --- a/guava-tests/test/com/google/common/collect/Collections2Test.java +++ b/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/guava-tests/test/com/google/common/collect/ComparatorsTest.java b/guava-tests/test/com/google/common/collect/ComparatorsTest.java index 963f22ada1f0..8710c49fafed 100644 --- a/guava-tests/test/com/google/common/collect/ComparatorsTest.java +++ b/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/guava-tests/test/com/google/common/collect/ComparisonChainTest.java b/guava-tests/test/com/google/common/collect/ComparisonChainTest.java index 689d7711c446..8bb8ddf99ee3 100644 --- a/guava-tests/test/com/google/common/collect/ComparisonChainTest.java +++ b/guava-tests/test/com/google/common/collect/ComparisonChainTest.java @@ -30,6 +30,7 @@ import java.util.Comparator; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ComparisonChainTest extends TestCase { private static final DontCompareMe DONT_COMPARE_ME = new DontCompareMe(); diff --git a/guava-tests/test/com/google/common/collect/CountTest.java b/guava-tests/test/com/google/common/collect/CountTest.java index a6f6019b7901..86323cc8f728 100644 --- a/guava-tests/test/com/google/common/collect/CountTest.java +++ b/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/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java b/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java index 1c928638a96e..163688c867bc 100644 --- a/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/EnumBiMapTest.java b/guava-tests/test/com/google/common/collect/EnumBiMapTest.java index 31eab3bc14db..4f5cea264617 100644 --- a/guava-tests/test/com/google/common/collect/EnumBiMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/EvictingQueueTest.java b/guava-tests/test/com/google/common/collect/EvictingQueueTest.java index 7ba7923aed5c..1d8cdd383907 100644 --- a/guava-tests/test/com/google/common/collect/EvictingQueueTest.java +++ b/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/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java b/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java index 652a23045e50..78d4e958ccc3 100644 --- a/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/FilteredMapTest.java b/guava-tests/test/com/google/common/collect/FilteredMapTest.java index 049e28645723..70e561443e70 100644 --- a/guava-tests/test/com/google/common/collect/FilteredMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java b/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java index c4015cb72701..7fb754300d59 100644 --- a/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java index 3cabcda48d17..b09fc124a98d 100644 --- a/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java index b021a0de47f0..a2f6c8739265 100644 --- a/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/GeneralRangeTest.java b/guava-tests/test/com/google/common/collect/GeneralRangeTest.java index e85aa2787640..b9dbffcd501c 100644 --- a/guava-tests/test/com/google/common/collect/GeneralRangeTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java index dc77b8cac28c..16657ccc4799 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java index 48d0d4785122..238c04bba9d6 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java index e007fe077b2f..923ffe197faa 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java index 265e2983d0e1..1b6f4a44a97f 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashBasedTableTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableTest.java index d5ed5751ad52..a6a23beaaf30 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashBiMapTest.java b/guava-tests/test/com/google/common/collect/HashBiMapTest.java index 32988d42bd3d..988c028bf9ae 100644 --- a/guava-tests/test/com/google/common/collect/HashBiMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashMultimapTest.java b/guava-tests/test/com/google/common/collect/HashMultimapTest.java index 0fa8ac353c9a..e4decb57c2c8 100644 --- a/guava-tests/test/com/google/common/collect/HashMultimapTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashMultisetTest.java b/guava-tests/test/com/google/common/collect/HashMultisetTest.java index f2d56cda9a17..294a75bf88a4 100644 --- a/guava-tests/test/com/google/common/collect/HashMultisetTest.java +++ b/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/guava-tests/test/com/google/common/collect/HashingTest.java b/guava-tests/test/com/google/common/collect/HashingTest.java index c68d2c2bd731..07162702e118 100644 --- a/guava-tests/test/com/google/common/collect/HashingTest.java +++ b/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/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java index 72c935c8f3d0..f742f10ca78a 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.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; /** @@ -60,7 +61,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableBiMapTest extends TestCase { // TODO: Reduce duplication of ImmutableMapTest code diff --git a/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java index e6ab485fa565..b64001e1da16 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java @@ -41,6 +41,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code ImmutableEnumMap}. @@ -48,7 +49,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableEnumMapTest extends TestCase { public static class ImmutableEnumMapGenerator extends TestEnumMapGenerator { @Override diff --git a/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java b/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java index 8eeefa4bcccc..354e1ef16835 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.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; /** @@ -58,7 +59,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableListMultimapTest extends TestCase { public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator { @Override diff --git a/guava-tests/test/com/google/common/collect/ImmutableListTest.java b/guava-tests/test/com/google/common/collect/ImmutableListTest.java index e9abcf1092b3..ddd71f4e1e0b 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableListTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableListTest.java @@ -53,6 +53,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; /** @@ -63,7 +64,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableListTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableMapTest.java index 7a4d1243149e..91df03876a3c 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableMapTest.java @@ -70,6 +70,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; /** @@ -80,7 +81,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMapTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java index f216745044e3..0d7889408235 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java b/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java index d1219082014a..7d8860a873dd 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java +++ b/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/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java b/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java index 361b9a02b2c8..e226d529e215 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java @@ -53,6 +53,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 Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultisetTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java index 317644e1421d..f8dfc39a2990 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java b/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java index 71777cf78680..3061cd4fa7a6 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.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 Mike Ward */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetMultimapTest extends TestCase { private static final class ImmutableSetMultimapGenerator extends TestStringSetMultimapGenerator { @Override diff --git a/guava-tests/test/com/google/common/collect/ImmutableSetTest.java b/guava-tests/test/com/google/common/collect/ImmutableSetTest.java index 691c97dcfaa5..e072256ffdc8 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSetTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSetTest.java @@ -48,6 +48,7 @@ import java.util.stream.Collector; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -58,7 +59,7 @@ * @author Nick Kralevich */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java index 83e46ccdb8bd..83e60204c222 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java @@ -58,6 +58,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; /** @@ -69,7 +70,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedMapTest extends TestCase { // TODO: Avoid duplicating code in ImmutableMapTest diff --git a/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java b/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java index 6144de2aefe3..dba23de99ab1 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java @@ -60,6 +60,7 @@ import java.util.stream.Collector; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -68,7 +69,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableTableTest.java b/guava-tests/test/com/google/common/collect/ImmutableTableTest.java index 4428b46a78d9..4b40a94977de 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableTableTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableTableTest.java @@ -28,6 +28,7 @@ import com.google.common.testing.CollectorTester; import com.google.common.testing.SerializableTester; import java.util.stream.Collector; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableTableTest extends AbstractTableReadTest { @Override protected Table create(@Nullable Object... data) { diff --git a/guava-tests/test/com/google/common/collect/IterablesTest.java b/guava-tests/test/com/google/common/collect/IterablesTest.java index 9eaeab45b3cc..822afba35109 100644 --- a/guava-tests/test/com/google/common/collect/IterablesTest.java +++ b/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/guava-tests/test/com/google/common/collect/IteratorsTest.java b/guava-tests/test/com/google/common/collect/IteratorsTest.java index 77f9fa804315..c61e04ba7df4 100644 --- a/guava-tests/test/com/google/common/collect/IteratorsTest.java +++ b/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/guava-tests/test/com/google/common/collect/LegacyComparable.java b/guava-tests/test/com/google/common/collect/LegacyComparable.java index 93c92aa82cf8..c7285a92d912 100644 --- a/guava-tests/test/com/google/common/collect/LegacyComparable.java +++ b/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/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java b/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java index ac6ee54b10e0..451917e3c70f 100644 --- a/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java @@ -48,6 +48,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; /** @@ -56,7 +57,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedHashMultimapTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java b/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java index 7300941887ef..05b175132743 100644 --- a/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java +++ b/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/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java b/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java index ed4df7f0ec42..502ac3e16289 100644 --- a/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.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; /** @@ -58,7 +59,7 @@ * @author Mike Bostock */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedListMultimapTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ListsImplTest.java b/guava-tests/test/com/google/common/collect/ListsImplTest.java index b99d65fcda5a..68ce8362d7f3 100644 --- a/guava-tests/test/com/google/common/collect/ListsImplTest.java +++ b/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/guava-tests/test/com/google/common/collect/ListsTest.java b/guava-tests/test/com/google/common/collect/ListsTest.java index 844b9f449e8b..f881b2c8c65b 100644 --- a/guava-tests/test/com/google/common/collect/ListsTest.java +++ b/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/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java b/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java index de190d423ce9..b6580f68c66a 100644 --- a/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java +++ b/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/guava-tests/test/com/google/common/collect/MapsTest.java b/guava-tests/test/com/google/common/collect/MapsTest.java index 67b8c934f6dc..40e7a73e7f73 100644 --- a/guava-tests/test/com/google/common/collect/MapsTest.java +++ b/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/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java b/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java index 55f3ac66348f..e1cafc86b964 100644 --- a/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java +++ b/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/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java b/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java index 343ebcf77056..def9d6847706 100644 --- a/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java +++ b/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/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java b/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java index a94904e19441..2ba38f132a0b 100644 --- a/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java +++ b/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/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java b/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java index 7b1e66b23996..acdf8eb513d1 100644 --- a/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java +++ b/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java @@ -25,6 +25,7 @@ import java.util.NoSuchElementException; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MoreCollectorsTest extends TestCase { public void testToOptionalEmpty() { assertThat(Stream.empty().collect(toOptional())).isEmpty(); diff --git a/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java b/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java index 034b3e3d1ae0..97857ffdeb0a 100644 --- a/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java +++ b/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/guava-tests/test/com/google/common/collect/MultimapsTest.java b/guava-tests/test/com/google/common/collect/MultimapsTest.java index d79c3043b702..6731614f8152 100644 --- a/guava-tests/test/com/google/common/collect/MultimapsTest.java +++ b/guava-tests/test/com/google/common/collect/MultimapsTest.java @@ -76,6 +76,7 @@ import java.util.stream.Collector; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -84,7 +85,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapsTest extends TestCase { private static final Comparator INT_COMPARATOR = diff --git a/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java b/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java index 78494be1b4d5..d68c9829ec44 100644 --- a/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java b/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java index 85afc4728191..a442aa814691 100644 --- a/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java +++ b/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/guava-tests/test/com/google/common/collect/MultisetsTest.java b/guava-tests/test/com/google/common/collect/MultisetsTest.java index fc540ec3174c..c9581b616584 100644 --- a/guava-tests/test/com/google/common/collect/MultisetsTest.java +++ b/guava-tests/test/com/google/common/collect/MultisetsTest.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.function.BiPredicate; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Multisets}. @@ -43,7 +44,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetsTest extends TestCase { /* See MultisetsImmutableEntryTest for immutableEntry() tests. */ diff --git a/guava-tests/test/com/google/common/collect/NewCustomTableTest.java b/guava-tests/test/com/google/common/collect/NewCustomTableTest.java index 8d2b2bd96987..d8ff7eda0633 100644 --- a/guava-tests/test/com/google/common/collect/NewCustomTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/ObjectArraysTest.java b/guava-tests/test/com/google/common/collect/ObjectArraysTest.java index 01c121f48cdb..6afb08a509e4 100644 --- a/guava-tests/test/com/google/common/collect/ObjectArraysTest.java +++ b/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/guava-tests/test/com/google/common/collect/OrderingTest.java b/guava-tests/test/com/google/common/collect/OrderingTest.java index 95043fc0db01..e52589461ab2 100644 --- a/guava-tests/test/com/google/common/collect/OrderingTest.java +++ b/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/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java b/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java index ad260ef65186..76f3b50df872 100644 --- a/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java +++ b/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/guava-tests/test/com/google/common/collect/RangeTest.java b/guava-tests/test/com/google/common/collect/RangeTest.java index d735749f948d..e1431f09d76e 100644 --- a/guava-tests/test/com/google/common/collect/RangeTest.java +++ b/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/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java index 72e31b0e0186..308e25eb0c3b 100644 --- a/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java b/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java index 3f1f75d78ac5..74f719efe374 100644 --- a/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java +++ b/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/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java b/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java index 1e697c95bbc2..86d67d5ad1e2 100644 --- a/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/SetOperationsTest.java b/guava-tests/test/com/google/common/collect/SetOperationsTest.java index fa7cb0c4b7f3..f17d0ee3b37e 100644 --- a/guava-tests/test/com/google/common/collect/SetOperationsTest.java +++ b/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/guava-tests/test/com/google/common/collect/SetsTest.java b/guava-tests/test/com/google/common/collect/SetsTest.java index fa467f7c58fd..de4b4cf28fd3 100644 --- a/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/guava-tests/test/com/google/common/collect/SetsTest.java @@ -84,6 +84,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; /** @@ -93,7 +94,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetsTest extends TestCase { private static final IteratorTester.KnownOrder KNOWN_ORDER = diff --git a/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java b/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java index 7dd66df559da..6ffa66df4d77 100644 --- a/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java +++ b/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/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java b/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java index 42b239aa0ff8..2dded744ce1d 100644 --- a/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/SortedIterablesTest.java b/guava-tests/test/com/google/common/collect/SortedIterablesTest.java index cd025c66db73..6ea3a034fce9 100644 --- a/guava-tests/test/com/google/common/collect/SortedIterablesTest.java +++ b/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/guava-tests/test/com/google/common/collect/SortedListsTest.java b/guava-tests/test/com/google/common/collect/SortedListsTest.java index 95d2e16933e4..797f9dc6251d 100644 --- a/guava-tests/test/com/google/common/collect/SortedListsTest.java +++ b/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/guava-tests/test/com/google/common/collect/StreamsTest.java b/guava-tests/test/com/google/common/collect/StreamsTest.java index c7087544e7ab..c1f286908bf2 100644 --- a/guava-tests/test/com/google/common/collect/StreamsTest.java +++ b/guava-tests/test/com/google/common/collect/StreamsTest.java @@ -40,11 +40,12 @@ import java.util.stream.LongStream; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Unit test for {@link Streams}. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class StreamsTest extends TestCase { /* * Full and proper black-box testing of a Stream-returning method is extremely involved, and is diff --git a/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java index f53b8b3038f0..f97c6e792ecc 100644 --- a/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TableCollectionTest.java b/guava-tests/test/com/google/common/collect/TableCollectionTest.java index 29f2d890f5be..f2ab1c6dd4ac 100644 --- a/guava-tests/test/com/google/common/collect/TableCollectionTest.java +++ b/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/guava-tests/test/com/google/common/collect/TableCollectorsTest.java b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java index 15d3f9efe5fd..afdf96928515 100644 --- a/guava-tests/test/com/google/common/collect/TableCollectorsTest.java +++ b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java @@ -32,11 +32,12 @@ import java.util.stream.Collector; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Unit tests for {@link TableCollectors}. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TableCollectorsTest extends TestCase { public void testToImmutableTable() { Collector, ?, ImmutableTable> collector = diff --git a/guava-tests/test/com/google/common/collect/TablesTest.java b/guava-tests/test/com/google/common/collect/TablesTest.java index 4ea911bbbb29..ebf096d3f429 100644 --- a/guava-tests/test/com/google/common/collect/TablesTest.java +++ b/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 public void testImmutableEntrySerialization() { diff --git a/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java index d25c2358dfbf..e5887875d742 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java index 9647a6f70ccd..c1a140092acc 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java +++ b/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/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java index 77cfd4142c1d..0a3918b39ef6 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java index 95d58a58fbfc..de34b485640d 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java +++ b/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/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java index 452c70a93d14..e06865dbc263 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java +++ b/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/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java b/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java index ee813e358ff4..f8e67f990829 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java +++ b/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/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java b/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java index 25f1bcfa37ce..524ed112d70a 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java +++ b/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/guava-tests/test/com/google/common/collect/TransposedTableTest.java b/guava-tests/test/com/google/common/collect/TransposedTableTest.java index 6c87b99efecb..736c8ff4518d 100644 --- a/guava-tests/test/com/google/common/collect/TransposedTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java index 4fa7b5aaeca6..f27017d6cfa2 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java index 48049bc5913e..b4e6008e38cd 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java index 274594166764..59ba288793de 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java index ba4235d7748a..d9c5ba1e457a 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java index 862d78c7d1b2..cf25c9d5972d 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java index 46a925a58f63..e9c891fa24ef 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java index 7884b61104f4..990732ee3c67 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java index e663ff280ae1..aedd2e5d7422 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java b/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java index f69c54a15fcb..cb85a7bfb017 100644 --- a/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java b/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java index f50a512446d6..bd4f2b945a28 100644 --- a/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeMultisetTest.java b/guava-tests/test/com/google/common/collect/TreeMultisetTest.java index 8cd6cbd57574..38149fc57386 100644 --- a/guava-tests/test/com/google/common/collect/TreeMultisetTest.java +++ b/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/guava-tests/test/com/google/common/collect/TreeTraverserTest.java b/guava-tests/test/com/google/common/collect/TreeTraverserTest.java index 80e8a62a14c7..2e10b37e7a4e 100644 --- a/guava-tests/test/com/google/common/collect/TreeTraverserTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java index fad660a0c6f6..452e513a9430 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java index 02cf78e2baa7..e1d159ae73cc 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java index f485b8bb0e5e..6296f494b9ea 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java index f9713c752bd5..dcd19b050459 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java index c98dd1449b51..a18944d4141d 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java index 7c1cc0c2850f..5fa5c14c9884 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java index 67c011107e0b..511eb2afb34b 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java index 05d69df2e45f..a75a0437ee25 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java index 3296aedd9d57..70a8a7347fbc 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java index 69fa02cc008c..904e6a8482b6 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java +++ b/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/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java index 973995a5af2a..e01db0878541 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java +++ b/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/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java b/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java index c82d23b517f1..85c754c75892 100644 --- a/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java +++ b/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/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java b/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java index 125749470a0d..c7ad03ad4193 100644 --- a/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java +++ b/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/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java index 5f27927038c7..f03f7b6e57ac 100644 --- a/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java index 444185d69ff0..dda6301ade7d 100644 --- a/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/math/BigIntegerMathTest.java b/guava-tests/test/com/google/common/math/BigIntegerMathTest.java index 98454b458e96..e60cf683dfbc 100644 --- a/guava-tests/test/com/google/common/math/BigIntegerMathTest.java +++ b/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/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java index a0be002dd995..3c7c363b3264 100644 --- a/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java index 693a6565a8a4..86e8f9903637 100644 --- a/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/primitives/BooleansTest.java b/guava-tests/test/com/google/common/primitives/BooleansTest.java index 15c80b41ffb0..67ab066c41dc 100644 --- a/guava-tests/test/com/google/common/primitives/BooleansTest.java +++ b/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/guava-tests/test/com/google/common/primitives/BytesTest.java b/guava-tests/test/com/google/common/primitives/BytesTest.java index b395a204aac0..6c56ad0e1d7f 100644 --- a/guava-tests/test/com/google/common/primitives/BytesTest.java +++ b/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/guava-tests/test/com/google/common/primitives/CharsTest.java b/guava-tests/test/com/google/common/primitives/CharsTest.java index 6da8be85115c..5645a0f14cc7 100644 --- a/guava-tests/test/com/google/common/primitives/CharsTest.java +++ b/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/guava-tests/test/com/google/common/primitives/DoublesTest.java b/guava-tests/test/com/google/common/primitives/DoublesTest.java index bf0d211ebd7e..fa7aa36cbf2d 100644 --- a/guava-tests/test/com/google/common/primitives/DoublesTest.java +++ b/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/guava-tests/test/com/google/common/primitives/FloatsTest.java b/guava-tests/test/com/google/common/primitives/FloatsTest.java index c35cbc4799d4..6522be8bff55 100644 --- a/guava-tests/test/com/google/common/primitives/FloatsTest.java +++ b/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/guava-tests/test/com/google/common/primitives/IntsTest.java b/guava-tests/test/com/google/common/primitives/IntsTest.java index a64cf2642c7f..2c5aa1913727 100644 --- a/guava-tests/test/com/google/common/primitives/IntsTest.java +++ b/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/guava-tests/test/com/google/common/primitives/LongsTest.java b/guava-tests/test/com/google/common/primitives/LongsTest.java index b84972e53716..0bfa4dd5d82d 100644 --- a/guava-tests/test/com/google/common/primitives/LongsTest.java +++ b/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/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java index 2c903ac7acdb..67654ea330ef 100644 --- a/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/primitives/ShortsTest.java b/guava-tests/test/com/google/common/primitives/ShortsTest.java index 9f40936dd7eb..60d8670c4be9 100644 --- a/guava-tests/test/com/google/common/primitives/ShortsTest.java +++ b/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/guava-tests/test/com/google/common/primitives/SignedBytesTest.java b/guava-tests/test/com/google/common/primitives/SignedBytesTest.java index d2770657fd99..e186066e4b63 100644 --- a/guava-tests/test/com/google/common/primitives/SignedBytesTest.java +++ b/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/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java index 309b0029abd3..3339f08877d5 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java +++ b/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/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java b/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java index ade301520edc..1fc69011f37b 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java +++ b/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/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java index 7c2b29bd6ca8..a0f455ec170c 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java +++ b/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/guava-tests/test/com/google/common/util/concurrent/TestPlatform.java b/guava-tests/test/com/google/common/util/concurrent/TestPlatform.java index 501e52d828d9..cd434f44c191 100644 --- a/guava-tests/test/com/google/common/util/concurrent/TestPlatform.java +++ b/guava-tests/test/com/google/common/util/concurrent/TestPlatform.java @@ -29,9 +29,11 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeoutException; +import org.jspecify.annotations.NullUnmarked; /** Methods factored out so that they can be emulated differently in GWT. */ @GwtCompatible(emulated = true) +@NullUnmarked final class TestPlatform { static void verifyGetOnPendingFuture(Future future) { checkNotNull(future); diff --git a/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java b/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 17357b525a03..969357713648 100644 --- a/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java +++ b/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/guava/pom.xml b/guava/pom.xml index c87190b68fa1..e6974e4dd3ea 100644 --- a/guava/pom.xml +++ b/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/guava/src/com/google/common/base/Absent.java b/guava/src/com/google/common/base/Absent.java index f96136b5efac..5e710a9bfdab 100644 --- a/guava/src/com/google/common/base/Absent.java +++ b/guava/src/com/google/common/base/Absent.java @@ -23,7 +23,6 @@ /** Implementation of an {@link Optional} not containing a reference. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Absent extends Optional { static final Absent INSTANCE = new Absent<>(); diff --git a/guava/src/com/google/common/base/AbstractIterator.java b/guava/src/com/google/common/base/AbstractIterator.java index bb0a1d324978..09290a80e7b6 100644 --- a/guava/src/com/google/common/base/AbstractIterator.java +++ b/guava/src/com/google/common/base/AbstractIterator.java @@ -29,7 +29,6 @@ * reasons). */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractIterator implements Iterator { private State state = State.NOT_READY; diff --git a/guava/src/com/google/common/base/Ascii.java b/guava/src/com/google/common/base/Ascii.java index aa077e83f2ac..d8f5dc5f9757 100644 --- a/guava/src/com/google/common/base/Ascii.java +++ b/guava/src/com/google/common/base/Ascii.java @@ -38,7 +38,6 @@ * @since 7.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Ascii { private Ascii() {} diff --git a/guava/src/com/google/common/base/CaseFormat.java b/guava/src/com/google/common/base/CaseFormat.java index 93fa7e4b7665..12fb7107e6ec 100644 --- a/guava/src/com/google/common/base/CaseFormat.java +++ b/guava/src/com/google/common/base/CaseFormat.java @@ -29,7 +29,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public enum CaseFormat { /** Hyphenated variable naming convention, e.g., "lower-hyphen". */ LOWER_HYPHEN(CharMatcher.is('-'), "-") { diff --git a/guava/src/com/google/common/base/CharMatcher.java b/guava/src/com/google/common/base/CharMatcher.java index eab84634fde0..1c03a2e43771 100644 --- a/guava/src/com/google/common/base/CharMatcher.java +++ b/guava/src/com/google/common/base/CharMatcher.java @@ -61,7 +61,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class CharMatcher implements Predicate { /* * N777777777NO diff --git a/guava/src/com/google/common/base/Charsets.java b/guava/src/com/google/common/base/Charsets.java index b2223ab97e76..aa371a5735b4 100644 --- a/guava/src/com/google/common/base/Charsets.java +++ b/guava/src/com/google/common/base/Charsets.java @@ -33,7 +33,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Charsets { /** diff --git a/guava/src/com/google/common/base/CommonMatcher.java b/guava/src/com/google/common/base/CommonMatcher.java index d63b46b5d48f..6d14c6bc2630 100644 --- a/guava/src/com/google/common/base/CommonMatcher.java +++ b/guava/src/com/google/common/base/CommonMatcher.java @@ -22,7 +22,6 @@ * javadoc for details. */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class CommonMatcher { public abstract boolean matches(); diff --git a/guava/src/com/google/common/base/CommonPattern.java b/guava/src/com/google/common/base/CommonPattern.java index c425d52609d6..6be5b01408aa 100644 --- a/guava/src/com/google/common/base/CommonPattern.java +++ b/guava/src/com/google/common/base/CommonPattern.java @@ -22,7 +22,6 @@ * javadoc for details. */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class CommonPattern { public abstract CommonMatcher matcher(CharSequence t); diff --git a/guava/src/com/google/common/base/Converter.java b/guava/src/com/google/common/base/Converter.java index 789050fd17e1..386bbfcf9c5a 100644 --- a/guava/src/com/google/common/base/Converter.java +++ b/guava/src/com/google/common/base/Converter.java @@ -115,7 +115,6 @@ * @since 16.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault /* * 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/guava/src/com/google/common/base/Defaults.java b/guava/src/com/google/common/base/Defaults.java index 089f4b572438..020e1e2d9c3e 100644 --- a/guava/src/com/google/common/base/Defaults.java +++ b/guava/src/com/google/common/base/Defaults.java @@ -28,7 +28,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Defaults { private Defaults() {} diff --git a/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 890e3a36062a..000000000000 --- a/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/guava/src/com/google/common/base/Enums.java b/guava/src/com/google/common/base/Enums.java index d1749f016d08..69713c9fe23d 100644 --- a/guava/src/com/google/common/base/Enums.java +++ b/guava/src/com/google/common/base/Enums.java @@ -35,7 +35,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class Enums { private Enums() {} diff --git a/guava/src/com/google/common/base/Equivalence.java b/guava/src/com/google/common/base/Equivalence.java index 510f29b1ab63..cafae1cdb91d 100644 --- a/guava/src/com/google/common/base/Equivalence.java +++ b/guava/src/com/google/common/base/Equivalence.java @@ -36,7 +36,6 @@ * source-compatible since 4.0) */ @GwtCompatible -@ElementTypesAreNonnullByDefault /* * 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/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java b/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java index 677075522028..21cca2c109d6 100644 --- a/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java +++ b/guava/src/com/google/common/base/ExtraObjectsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ExtraObjectsMethodsForWeb {} diff --git a/guava/src/com/google/common/base/FinalizablePhantomReference.java b/guava/src/com/google/common/base/FinalizablePhantomReference.java index 6f76b63f7647..8392387f2647 100644 --- a/guava/src/com/google/common/base/FinalizablePhantomReference.java +++ b/guava/src/com/google/common/base/FinalizablePhantomReference.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class FinalizablePhantomReference extends PhantomReference implements FinalizableReference { /** diff --git a/guava/src/com/google/common/base/FinalizableReference.java b/guava/src/com/google/common/base/FinalizableReference.java index f538f9dc0e1b..d7e91e46e0ee 100644 --- a/guava/src/com/google/common/base/FinalizableReference.java +++ b/guava/src/com/google/common/base/FinalizableReference.java @@ -28,7 +28,6 @@ @DoNotMock("Use an instance of one of the Finalizable*Reference classes") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface FinalizableReference { /** * Invoked on a background thread after the referent has been garbage collected unless security diff --git a/guava/src/com/google/common/base/FinalizableReferenceQueue.java b/guava/src/com/google/common/base/FinalizableReferenceQueue.java index 7b087837a837..0f1a4be43a78 100644 --- a/guava/src/com/google/common/base/FinalizableReferenceQueue.java +++ b/guava/src/com/google/common/base/FinalizableReferenceQueue.java @@ -138,7 +138,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class FinalizableReferenceQueue implements Closeable { /* * The Finalizer thread keeps a phantom reference to this object. When the client (for example, a diff --git a/guava/src/com/google/common/base/FinalizableSoftReference.java b/guava/src/com/google/common/base/FinalizableSoftReference.java index f4b7c80050fb..c97acd2abcbd 100644 --- a/guava/src/com/google/common/base/FinalizableSoftReference.java +++ b/guava/src/com/google/common/base/FinalizableSoftReference.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class FinalizableSoftReference extends SoftReference implements FinalizableReference { /** diff --git a/guava/src/com/google/common/base/FinalizableWeakReference.java b/guava/src/com/google/common/base/FinalizableWeakReference.java index 12c8dfbfceb3..76ed780f46d9 100644 --- a/guava/src/com/google/common/base/FinalizableWeakReference.java +++ b/guava/src/com/google/common/base/FinalizableWeakReference.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class FinalizableWeakReference extends WeakReference implements FinalizableReference { /** diff --git a/guava/src/com/google/common/base/Function.java b/guava/src/com/google/common/base/Function.java index 10c73283c5d4..c79c5553e0e9 100644 --- a/guava/src/com/google/common/base/Function.java +++ b/guava/src/com/google/common/base/Function.java @@ -41,7 +41,6 @@ */ @GwtCompatible @FunctionalInterface -@ElementTypesAreNonnullByDefault public interface Function extends java.util.function.Function { @Override diff --git a/guava/src/com/google/common/base/FunctionalEquivalence.java b/guava/src/com/google/common/base/FunctionalEquivalence.java index 1cd8c416d39a..f40ea7301428 100644 --- a/guava/src/com/google/common/base/FunctionalEquivalence.java +++ b/guava/src/com/google/common/base/FunctionalEquivalence.java @@ -28,7 +28,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FunctionalEquivalence extends Equivalence implements Serializable { private static final long serialVersionUID = 0; diff --git a/guava/src/com/google/common/base/Functions.java b/guava/src/com/google/common/base/Functions.java index 67f8abb520e4..91336b00509a 100644 --- a/guava/src/com/google/common/base/Functions.java +++ b/guava/src/com/google/common/base/Functions.java @@ -38,7 +38,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Functions { private Functions() {} diff --git a/guava/src/com/google/common/base/IgnoreJRERequirement.java b/guava/src/com/google/common/base/IgnoreJRERequirement.java index c34a9cdd974b..4d6cfd48da94 100644 --- a/guava/src/com/google/common/base/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/base/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                          Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/base/Internal.java b/guava/src/com/google/common/base/Internal.java index 0e1ee2400f24..648d1c40638e 100644 --- a/guava/src/com/google/common/base/Internal.java +++ b/guava/src/com/google/common/base/Internal.java @@ -21,7 +21,6 @@ /** This class is for {@code com.google.common.base} use only! */ @J2ktIncompatible @GwtIncompatible // java.time.Duration -@ElementTypesAreNonnullByDefault final class Internal { /** diff --git a/guava/src/com/google/common/base/Java8Compatibility.java b/guava/src/com/google/common/base/Java8Compatibility.java index 2dfbd6b1cf19..d3ee13968bc2 100644 --- a/guava/src/com/google/common/base/Java8Compatibility.java +++ b/guava/src/com/google/common/base/Java8Compatibility.java @@ -24,7 +24,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class Java8Compatibility { static void clear(Buffer b) { b.clear(); diff --git a/guava/src/com/google/common/base/JdkPattern.java b/guava/src/com/google/common/base/JdkPattern.java index 4788398b7c20..f7791dba6e95 100644 --- a/guava/src/com/google/common/base/JdkPattern.java +++ b/guava/src/com/google/common/base/JdkPattern.java @@ -20,7 +20,6 @@ import java.util.regex.Pattern; /** A regex pattern implementation which is backed by the {@link Pattern}. */ -@ElementTypesAreNonnullByDefault @GwtIncompatible final class JdkPattern extends CommonPattern implements Serializable { private final Pattern pattern; diff --git a/guava/src/com/google/common/base/Joiner.java b/guava/src/com/google/common/base/Joiner.java index b03a626b821f..82de5b2c375b 100644 --- a/guava/src/com/google/common/base/Joiner.java +++ b/guava/src/com/google/common/base/Joiner.java @@ -65,7 +65,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class Joiner { /** Returns a joiner which automatically places {@code separator} between consecutive elements. */ public static Joiner on(String separator) { diff --git a/guava/src/com/google/common/base/MoreObjects.java b/guava/src/com/google/common/base/MoreObjects.java index 5bb341f0a69d..124be8c00b8c 100644 --- a/guava/src/com/google/common/base/MoreObjects.java +++ b/guava/src/com/google/common/base/MoreObjects.java @@ -39,7 +39,6 @@ * @since 18.0 (since 2.0 as {@code Objects}) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class MoreObjects { /** * Returns the first of two given parameters that is not {@code null}, if either is, or otherwise diff --git a/guava/src/com/google/common/base/NullnessCasts.java b/guava/src/com/google/common/base/NullnessCasts.java index 1ada6bf26148..4095fcb1cd61 100644 --- a/guava/src/com/google/common/base/NullnessCasts.java +++ b/guava/src/com/google/common/base/NullnessCasts.java @@ -20,7 +20,6 @@ /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class NullnessCasts { /** * Accepts a {@code @Nullable T} and returns a plain {@code T}, without performing any check that diff --git a/guava/src/com/google/common/base/Objects.java b/guava/src/com/google/common/base/Objects.java index 6d33497b642f..7dfafe67d076 100644 --- a/guava/src/com/google/common/base/Objects.java +++ b/guava/src/com/google/common/base/Objects.java @@ -30,7 +30,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Objects extends ExtraObjectsMethodsForWeb { private Objects() {} diff --git a/guava/src/com/google/common/base/Optional.java b/guava/src/com/google/common/base/Optional.java index af41e734914a..ba44aa5945d9 100644 --- a/guava/src/com/google/common/base/Optional.java +++ b/guava/src/com/google/common/base/Optional.java @@ -84,7 +84,6 @@ */ @DoNotMock("Use Optional.of(value) or Optional.absent()") @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault public abstract class Optional implements Serializable { /** * Returns an {@code Optional} instance with no contained reference. diff --git a/guava/src/com/google/common/base/PairwiseEquivalence.java b/guava/src/com/google/common/base/PairwiseEquivalence.java index ea40518c5a50..6ff7c3fe3c6b 100644 --- a/guava/src/com/google/common/base/PairwiseEquivalence.java +++ b/guava/src/com/google/common/base/PairwiseEquivalence.java @@ -21,7 +21,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class PairwiseEquivalence extends Equivalence> implements Serializable { final Equivalence elementEquivalence; diff --git a/guava/src/com/google/common/base/ParametricNullness.java b/guava/src/com/google/common/base/ParametricNullness.java index 0bcc65dc2eb5..3fadb315554a 100644 --- a/guava/src/com/google/common/base/ParametricNullness.java +++ b/guava/src/com/google/common/base/ParametricNullness.java @@ -56,8 +56,8 @@ *

                            *
                          • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                          • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/base/PatternCompiler.java b/guava/src/com/google/common/base/PatternCompiler.java index f33d38ba06d4..90a565b1e470 100644 --- a/guava/src/com/google/common/base/PatternCompiler.java +++ b/guava/src/com/google/common/base/PatternCompiler.java @@ -23,7 +23,6 @@ * java.util.ServiceLoader} mechanism. */ @GwtIncompatible -@ElementTypesAreNonnullByDefault interface PatternCompiler { /** * Compiles the given pattern. diff --git a/guava/src/com/google/common/base/Platform.java b/guava/src/com/google/common/base/Platform.java index 868d2a2e6161..3e525d798679 100644 --- a/guava/src/com/google/common/base/Platform.java +++ b/guava/src/com/google/common/base/Platform.java @@ -29,7 +29,6 @@ * @author Jesse Wilson */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { private static final Logger logger = Logger.getLogger(Platform.class.getName()); private static final PatternCompiler patternCompiler = loadPatternCompiler(); diff --git a/guava/src/com/google/common/base/Preconditions.java b/guava/src/com/google/common/base/Preconditions.java index 6d00d46ff365..93ee075ea1b1 100644 --- a/guava/src/com/google/common/base/Preconditions.java +++ b/guava/src/com/google/common/base/Preconditions.java @@ -114,7 +114,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Preconditions { private Preconditions() {} diff --git a/guava/src/com/google/common/base/Predicate.java b/guava/src/com/google/common/base/Predicate.java index 5877dfe4db4b..61327bf4258f 100644 --- a/guava/src/com/google/common/base/Predicate.java +++ b/guava/src/com/google/common/base/Predicate.java @@ -42,7 +42,6 @@ */ @FunctionalInterface @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Predicate extends java.util.function.Predicate { /** * Returns the result of applying this predicate to {@code input} (Java 8+ users, see notes in the diff --git a/guava/src/com/google/common/base/Predicates.java b/guava/src/com/google/common/base/Predicates.java index 17c2bf5c5baf..6ad0071aa8f9 100644 --- a/guava/src/com/google/common/base/Predicates.java +++ b/guava/src/com/google/common/base/Predicates.java @@ -40,7 +40,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Predicates { private Predicates() {} diff --git a/guava/src/com/google/common/base/Present.java b/guava/src/com/google/common/base/Present.java index 4e62da29e93b..ef79240f1e1c 100644 --- a/guava/src/com/google/common/base/Present.java +++ b/guava/src/com/google/common/base/Present.java @@ -23,7 +23,6 @@ /** Implementation of an {@link Optional} containing a reference. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Present extends Optional { private final T reference; diff --git a/guava/src/com/google/common/base/SmallCharMatcher.java b/guava/src/com/google/common/base/SmallCharMatcher.java index f0e801b67118..1e565c858b96 100644 --- a/guava/src/com/google/common/base/SmallCharMatcher.java +++ b/guava/src/com/google/common/base/SmallCharMatcher.java @@ -26,7 +26,6 @@ * @author Christopher Swenson */ @GwtIncompatible // no precomputation is done in GWT -@ElementTypesAreNonnullByDefault final class SmallCharMatcher extends NamedFastMatcher { static final int MAX_SIZE = 1023; private final char[] table; diff --git a/guava/src/com/google/common/base/Splitter.java b/guava/src/com/google/common/base/Splitter.java index 9ba2d8131245..c546d4be4e75 100644 --- a/guava/src/com/google/common/base/Splitter.java +++ b/guava/src/com/google/common/base/Splitter.java @@ -99,7 +99,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Splitter { private final CharMatcher trimmer; private final boolean omitEmptyStrings; diff --git a/guava/src/com/google/common/base/StandardSystemProperty.java b/guava/src/com/google/common/base/StandardSystemProperty.java index 155037761cd5..cb986b4fc033 100644 --- a/guava/src/com/google/common/base/StandardSystemProperty.java +++ b/guava/src/com/google/common/base/StandardSystemProperty.java @@ -26,7 +26,6 @@ */ @J2ktIncompatible @GwtIncompatible // java.lang.System#getProperty -@ElementTypesAreNonnullByDefault public enum StandardSystemProperty { /** Java Runtime Environment version. */ diff --git a/guava/src/com/google/common/base/Stopwatch.java b/guava/src/com/google/common/base/Stopwatch.java index 480f973b6d56..f3794e5cbf52 100644 --- a/guava/src/com/google/common/base/Stopwatch.java +++ b/guava/src/com/google/common/base/Stopwatch.java @@ -96,7 +96,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("GoodTime") // lots of violations -@ElementTypesAreNonnullByDefault public final class Stopwatch { private final Ticker ticker; private boolean isRunning; diff --git a/guava/src/com/google/common/base/Strings.java b/guava/src/com/google/common/base/Strings.java index 5d5bf2356be4..759be66def49 100644 --- a/guava/src/com/google/common/base/Strings.java +++ b/guava/src/com/google/common/base/Strings.java @@ -34,7 +34,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Strings { private Strings() {} diff --git a/guava/src/com/google/common/base/Supplier.java b/guava/src/com/google/common/base/Supplier.java index 518325a35ec4..5a4b0f4204a5 100644 --- a/guava/src/com/google/common/base/Supplier.java +++ b/guava/src/com/google/common/base/Supplier.java @@ -37,7 +37,6 @@ */ @GwtCompatible @FunctionalInterface -@ElementTypesAreNonnullByDefault public interface Supplier extends java.util.function.Supplier { /** * Retrieves an instance of the appropriate type. The returned object may or may not be a new diff --git a/guava/src/com/google/common/base/Suppliers.java b/guava/src/com/google/common/base/Suppliers.java index 9476c21872fc..169e6edff0ab 100644 --- a/guava/src/com/google/common/base/Suppliers.java +++ b/guava/src/com/google/common/base/Suppliers.java @@ -41,7 +41,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Suppliers { private Suppliers() {} diff --git a/guava/src/com/google/common/base/Throwables.java b/guava/src/com/google/common/base/Throwables.java index c461316562bc..dffa4690cc60 100644 --- a/guava/src/com/google/common/base/Throwables.java +++ b/guava/src/com/google/common/base/Throwables.java @@ -46,7 +46,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Throwables { private Throwables() {} diff --git a/guava/src/com/google/common/base/Ticker.java b/guava/src/com/google/common/base/Ticker.java index 5b7a48688659..e327a4cc907d 100644 --- a/guava/src/com/google/common/base/Ticker.java +++ b/guava/src/com/google/common/base/Ticker.java @@ -28,7 +28,6 @@ * source-compatible since 9.0) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class Ticker { /** Constructor for use by subclasses. */ protected Ticker() {} diff --git a/guava/src/com/google/common/base/Utf8.java b/guava/src/com/google/common/base/Utf8.java index c26720364c5e..6c4797670f9f 100644 --- a/guava/src/com/google/common/base/Utf8.java +++ b/guava/src/com/google/common/base/Utf8.java @@ -36,7 +36,6 @@ * @since 16.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Utf8 { /** * Returns the number of bytes in the UTF-8-encoded form of {@code sequence}. For a string, this diff --git a/guava/src/com/google/common/base/Verify.java b/guava/src/com/google/common/base/Verify.java index b2e9f5f04faf..a058c69cb602 100644 --- a/guava/src/com/google/common/base/Verify.java +++ b/guava/src/com/google/common/base/Verify.java @@ -88,7 +88,6 @@ * @since 17.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Verify { /** * Ensures that {@code expression} is {@code true}, throwing a {@code VerifyException} with no diff --git a/guava/src/com/google/common/base/VerifyException.java b/guava/src/com/google/common/base/VerifyException.java index 10b99dee722b..6ec947b9ff1c 100644 --- a/guava/src/com/google/common/base/VerifyException.java +++ b/guava/src/com/google/common/base/VerifyException.java @@ -25,7 +25,6 @@ * @since 17.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class VerifyException extends RuntimeException { /** Constructs a {@code VerifyException} with no message. */ public VerifyException() {} diff --git a/guava/src/com/google/common/base/internal/Finalizer.java b/guava/src/com/google/common/base/internal/Finalizer.java index e8ddf320ce17..9f1bef433083 100644 --- a/guava/src/com/google/common/base/internal/Finalizer.java +++ b/guava/src/com/google/common/base/internal/Finalizer.java @@ -43,7 +43,6 @@ * collected, and this class can detect when the main class loader has been garbage collected and * stop itself. */ -// no @ElementTypesAreNonNullByDefault for the reasons discussed above public class Finalizer implements Runnable { private static final Logger logger = Logger.getLogger(Finalizer.class.getName()); diff --git a/guava/src/com/google/common/base/package-info.java b/guava/src/com/google/common/base/package-info.java index bfae42674506..951fc03c1181 100644 --- a/guava/src/com/google/common/base/package-info.java +++ b/guava/src/com/google/common/base/package-info.java @@ -57,8 +57,6 @@ * Defaults}), as well as a number of classes that have been superseded by additions to the JDK. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.base; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/cache/AbstractCache.java b/guava/src/com/google/common/cache/AbstractCache.java index eec5fdc34f56..e5e51a5af5e1 100644 --- a/guava/src/com/google/common/cache/AbstractCache.java +++ b/guava/src/com/google/common/cache/AbstractCache.java @@ -38,7 +38,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractCache implements Cache { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/cache/AbstractLoadingCache.java b/guava/src/com/google/common/cache/AbstractLoadingCache.java index 5081a785b43a..cc8df3faafef 100644 --- a/guava/src/com/google/common/cache/AbstractLoadingCache.java +++ b/guava/src/com/google/common/cache/AbstractLoadingCache.java @@ -39,7 +39,6 @@ * @since 11.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractLoadingCache extends AbstractCache implements LoadingCache { diff --git a/guava/src/com/google/common/cache/Cache.java b/guava/src/com/google/common/cache/Cache.java index 41cce70373a0..e81c92b3d3e3 100644 --- a/guava/src/com/google/common/cache/Cache.java +++ b/guava/src/com/google/common/cache/Cache.java @@ -42,7 +42,6 @@ */ @DoNotMock("Use CacheBuilder.newBuilder().build()") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Cache { /** diff --git a/guava/src/com/google/common/cache/CacheBuilder.java b/guava/src/com/google/common/cache/CacheBuilder.java index 4662edbc13fa..a111ce1910be 100644 --- a/guava/src/com/google/common/cache/CacheBuilder.java +++ b/guava/src/com/google/common/cache/CacheBuilder.java @@ -192,7 +192,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class CacheBuilder { private static final int DEFAULT_INITIAL_CAPACITY = 16; private static final int DEFAULT_CONCURRENCY_LEVEL = 4; diff --git a/guava/src/com/google/common/cache/CacheBuilderSpec.java b/guava/src/com/google/common/cache/CacheBuilderSpec.java index 9bee483cf2e3..8b511b5e6c17 100644 --- a/guava/src/com/google/common/cache/CacheBuilderSpec.java +++ b/guava/src/com/google/common/cache/CacheBuilderSpec.java @@ -84,7 +84,6 @@ */ @SuppressWarnings("GoodTime") // lots of violations (nanosecond math) @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CacheBuilderSpec { /** Parses a single value. */ private interface ValueParser { diff --git a/guava/src/com/google/common/cache/CacheLoader.java b/guava/src/com/google/common/cache/CacheLoader.java index 15d3ee6f19b3..1183721df739 100644 --- a/guava/src/com/google/common/cache/CacheLoader.java +++ b/guava/src/com/google/common/cache/CacheLoader.java @@ -55,7 +55,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class CacheLoader { /** Constructor for use by subclasses. */ protected CacheLoader() {} diff --git a/guava/src/com/google/common/cache/CacheStats.java b/guava/src/com/google/common/cache/CacheStats.java index f9235bb41af1..f39fc2a37e44 100644 --- a/guava/src/com/google/common/cache/CacheStats.java +++ b/guava/src/com/google/common/cache/CacheStats.java @@ -58,7 +58,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class CacheStats { private final long hitCount; private final long missCount; diff --git a/guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index bcf0fcef1c48..000000000000 --- a/guava/src/com/google/common/cache/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.cache; - -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/guava/src/com/google/common/cache/ForwardingCache.java b/guava/src/com/google/common/cache/ForwardingCache.java index f118977b09a3..80338024e9eb 100644 --- a/guava/src/com/google/common/cache/ForwardingCache.java +++ b/guava/src/com/google/common/cache/ForwardingCache.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingCache extends ForwardingObject implements Cache { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/cache/ForwardingLoadingCache.java b/guava/src/com/google/common/cache/ForwardingLoadingCache.java index d98e2a6278fa..296c44f484e2 100644 --- a/guava/src/com/google/common/cache/ForwardingLoadingCache.java +++ b/guava/src/com/google/common/cache/ForwardingLoadingCache.java @@ -32,7 +32,6 @@ * @since 11.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingLoadingCache extends ForwardingCache implements LoadingCache { diff --git a/guava/src/com/google/common/cache/IgnoreJRERequirement.java b/guava/src/com/google/common/cache/IgnoreJRERequirement.java index c80ab07ea20a..ea6a7b733dec 100644 --- a/guava/src/com/google/common/cache/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/cache/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                            Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/cache/LoadingCache.java b/guava/src/com/google/common/cache/LoadingCache.java index a782aef55f36..d60e9df8720b 100644 --- a/guava/src/com/google/common/cache/LoadingCache.java +++ b/guava/src/com/google/common/cache/LoadingCache.java @@ -40,7 +40,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface LoadingCache extends Cache, Function { /** diff --git a/guava/src/com/google/common/cache/LocalCache.java b/guava/src/com/google/common/cache/LocalCache.java index 73dcee0683c4..7e000990e2f0 100644 --- a/guava/src/com/google/common/cache/LocalCache.java +++ b/guava/src/com/google/common/cache/LocalCache.java @@ -87,6 +87,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullUnmarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -104,7 +105,7 @@ "nullness", // too much trouble for the payoff }) @GwtCompatible(emulated = true) -// TODO(cpovirk): Annotate for nullness. +@NullUnmarked // TODO(cpovirk): Annotate for nullness. class LocalCache extends AbstractMap implements ConcurrentMap { /* diff --git a/guava/src/com/google/common/cache/LongAddable.java b/guava/src/com/google/common/cache/LongAddable.java index 9851052d6817..eaa641467738 100644 --- a/guava/src/com/google/common/cache/LongAddable.java +++ b/guava/src/com/google/common/cache/LongAddable.java @@ -22,7 +22,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface LongAddable { void increment(); diff --git a/guava/src/com/google/common/cache/LongAddables.java b/guava/src/com/google/common/cache/LongAddables.java index 249c6e149d95..e5da7c8b772a 100644 --- a/guava/src/com/google/common/cache/LongAddables.java +++ b/guava/src/com/google/common/cache/LongAddables.java @@ -24,7 +24,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class LongAddables { private static final Supplier SUPPLIER; diff --git a/guava/src/com/google/common/cache/LongAdder.java b/guava/src/com/google/common/cache/LongAdder.java index 7ead7e8eccd3..f0c44ffbc697 100644 --- a/guava/src/com/google/common/cache/LongAdder.java +++ b/guava/src/com/google/common/cache/LongAdder.java @@ -40,7 +40,6 @@ * @author Doug Lea */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class LongAdder extends Striped64 implements Serializable, LongAddable { private static final long serialVersionUID = 7249069246863182397L; diff --git a/guava/src/com/google/common/cache/ParametricNullness.java b/guava/src/com/google/common/cache/ParametricNullness.java index eaf194d4ab1c..8892bb45267d 100644 --- a/guava/src/com/google/common/cache/ParametricNullness.java +++ b/guava/src/com/google/common/cache/ParametricNullness.java @@ -56,8 +56,8 @@ *

                              *
                            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/cache/ReferenceEntry.java b/guava/src/com/google/common/cache/ReferenceEntry.java index 8ff2e6c9b4ff..839216ae1112 100644 --- a/guava/src/com/google/common/cache/ReferenceEntry.java +++ b/guava/src/com/google/common/cache/ReferenceEntry.java @@ -39,7 +39,6 @@ *
                            */ @GwtIncompatible -@ElementTypesAreNonnullByDefault interface ReferenceEntry { /** Returns the value reference from this entry. */ @CheckForNull diff --git a/guava/src/com/google/common/cache/RemovalCause.java b/guava/src/com/google/common/cache/RemovalCause.java index 2e68e68b582c..8ecc1d662736 100644 --- a/guava/src/com/google/common/cache/RemovalCause.java +++ b/guava/src/com/google/common/cache/RemovalCause.java @@ -26,7 +26,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public enum RemovalCause { /** * The entry was manually removed by the user. This can result from the user invoking {@link diff --git a/guava/src/com/google/common/cache/RemovalListener.java b/guava/src/com/google/common/cache/RemovalListener.java index 4713be57214f..c9a343c44d0c 100644 --- a/guava/src/com/google/common/cache/RemovalListener.java +++ b/guava/src/com/google/common/cache/RemovalListener.java @@ -34,7 +34,6 @@ */ @GwtCompatible @FunctionalInterface -@ElementTypesAreNonnullByDefault public interface RemovalListener { /** * Notifies the listener that a removal occurred at some point in the past. diff --git a/guava/src/com/google/common/cache/RemovalListeners.java b/guava/src/com/google/common/cache/RemovalListeners.java index 38edf35287af..e5999a4e80e4 100644 --- a/guava/src/com/google/common/cache/RemovalListeners.java +++ b/guava/src/com/google/common/cache/RemovalListeners.java @@ -26,7 +26,6 @@ * @since 10.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class RemovalListeners { private RemovalListeners() {} diff --git a/guava/src/com/google/common/cache/RemovalNotification.java b/guava/src/com/google/common/cache/RemovalNotification.java index b96fc570911f..c9af81d832e1 100644 --- a/guava/src/com/google/common/cache/RemovalNotification.java +++ b/guava/src/com/google/common/cache/RemovalNotification.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class RemovalNotification extends SimpleImmutableEntry<@Nullable K, @Nullable V> { private final RemovalCause cause; diff --git a/guava/src/com/google/common/cache/Striped64.java b/guava/src/com/google/common/cache/Striped64.java index e8be86e36e5d..e14725dfff53 100644 --- a/guava/src/com/google/common/cache/Striped64.java +++ b/guava/src/com/google/common/cache/Striped64.java @@ -28,7 +28,6 @@ */ @SuppressWarnings({"SunApi", "removal"}) // b/345822163 @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class Striped64 extends Number { /* * This class maintains a lazily-initialized table of atomically diff --git a/guava/src/com/google/common/cache/Weigher.java b/guava/src/com/google/common/cache/Weigher.java index bbee3f585ec4..7372a46965ce 100644 --- a/guava/src/com/google/common/cache/Weigher.java +++ b/guava/src/com/google/common/cache/Weigher.java @@ -24,7 +24,6 @@ */ @GwtCompatible @FunctionalInterface -@ElementTypesAreNonnullByDefault public interface Weigher { /** diff --git a/guava/src/com/google/common/cache/package-info.java b/guava/src/com/google/common/cache/package-info.java index fc678d44a71c..76dacaf5e04e 100644 --- a/guava/src/com/google/common/cache/package-info.java +++ b/guava/src/com/google/common/cache/package-info.java @@ -29,8 +29,6 @@ * @author Charles Fry */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.cache; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/collect/AbstractBiMap.java b/guava/src/com/google/common/collect/AbstractBiMap.java index fab709a54114..aa3a304c2169 100644 --- a/guava/src/com/google/common/collect/AbstractBiMap.java +++ b/guava/src/com/google/common/collect/AbstractBiMap.java @@ -51,7 +51,6 @@ * @author Mike Bostock */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class AbstractBiMap extends ForwardingMap implements BiMap, Serializable { diff --git a/guava/src/com/google/common/collect/AbstractIndexedListIterator.java b/guava/src/com/google/common/collect/AbstractIndexedListIterator.java index abb3960b261e..441042ee0bde 100644 --- a/guava/src/com/google/common/collect/AbstractIndexedListIterator.java +++ b/guava/src/com/google/common/collect/AbstractIndexedListIterator.java @@ -31,7 +31,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractIndexedListIterator extends UnmodifiableListIterator { private final int size; diff --git a/guava/src/com/google/common/collect/AbstractIterator.java b/guava/src/com/google/common/collect/AbstractIterator.java index aa01300bed68..5a26b001adfa 100644 --- a/guava/src/com/google/common/collect/AbstractIterator.java +++ b/guava/src/com/google/common/collect/AbstractIterator.java @@ -63,7 +63,6 @@ // When making changes to this class, please also update the copy at // com.google.common.base.AbstractIterator @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractIterator extends UnmodifiableIterator { private State state = State.NOT_READY; diff --git a/guava/src/com/google/common/collect/AbstractListMultimap.java b/guava/src/com/google/common/collect/AbstractListMultimap.java index 51cf8c4d11c0..f7d2f1569325 100644 --- a/guava/src/com/google/common/collect/AbstractListMultimap.java +++ b/guava/src/com/google/common/collect/AbstractListMultimap.java @@ -36,7 +36,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractListMultimap extends AbstractMapBasedMultimap implements ListMultimap { /** diff --git a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java index 302840a34425..81ccfaedf0b2 100644 --- a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java +++ b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java @@ -88,7 +88,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMapBasedMultimap extends AbstractMultimap implements Serializable { /* diff --git a/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java b/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java index c2d007a01990..03955bf8f32b 100644 --- a/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java +++ b/guava/src/com/google/common/collect/AbstractMapBasedMultiset.java @@ -49,7 +49,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class AbstractMapBasedMultiset extends AbstractMultiset implements Serializable { // TODO(lowasser): consider overhauling this back to Map diff --git a/guava/src/com/google/common/collect/AbstractMapEntry.java b/guava/src/com/google/common/collect/AbstractMapEntry.java index e9accf0592c2..32b37b0b8285 100644 --- a/guava/src/com/google/common/collect/AbstractMapEntry.java +++ b/guava/src/com/google/common/collect/AbstractMapEntry.java @@ -29,7 +29,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMapEntry implements Entry { diff --git a/guava/src/com/google/common/collect/AbstractMultimap.java b/guava/src/com/google/common/collect/AbstractMultimap.java index 299decbe6e9d..3a055ae36fa1 100644 --- a/guava/src/com/google/common/collect/AbstractMultimap.java +++ b/guava/src/com/google/common/collect/AbstractMultimap.java @@ -39,7 +39,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMultimap implements Multimap { @Override diff --git a/guava/src/com/google/common/collect/AbstractMultiset.java b/guava/src/com/google/common/collect/AbstractMultiset.java index 8203e44598a0..5e4e5f8723c1 100644 --- a/guava/src/com/google/common/collect/AbstractMultiset.java +++ b/guava/src/com/google/common/collect/AbstractMultiset.java @@ -43,7 +43,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractMultiset extends AbstractCollection implements Multiset { // Query Operations diff --git a/guava/src/com/google/common/collect/AbstractNavigableMap.java b/guava/src/com/google/common/collect/AbstractNavigableMap.java index fa68dc52463e..5a0a28489830 100644 --- a/guava/src/com/google/common/collect/AbstractNavigableMap.java +++ b/guava/src/com/google/common/collect/AbstractNavigableMap.java @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class AbstractNavigableMap extends IteratorBasedAbstractMap implements NavigableMap { diff --git a/guava/src/com/google/common/collect/AbstractRangeSet.java b/guava/src/com/google/common/collect/AbstractRangeSet.java index 5ed42846e318..5ba837816d4f 100644 --- a/guava/src/com/google/common/collect/AbstractRangeSet.java +++ b/guava/src/com/google/common/collect/AbstractRangeSet.java @@ -24,7 +24,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class AbstractRangeSet implements RangeSet { AbstractRangeSet() {} diff --git a/guava/src/com/google/common/collect/AbstractSequentialIterator.java b/guava/src/com/google/common/collect/AbstractSequentialIterator.java index 172fe356cb78..bacd4bfd5694 100644 --- a/guava/src/com/google/common/collect/AbstractSequentialIterator.java +++ b/guava/src/com/google/common/collect/AbstractSequentialIterator.java @@ -40,7 +40,6 @@ * @since 12.0 (in Guava as {@code AbstractLinkedIterator} since 8.0) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractSequentialIterator extends UnmodifiableIterator { @CheckForNull private T nextOrNull; diff --git a/guava/src/com/google/common/collect/AbstractSetMultimap.java b/guava/src/com/google/common/collect/AbstractSetMultimap.java index 08e5315c7c22..ab173cb50527 100644 --- a/guava/src/com/google/common/collect/AbstractSetMultimap.java +++ b/guava/src/com/google/common/collect/AbstractSetMultimap.java @@ -36,7 +36,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractSetMultimap extends AbstractMapBasedMultimap implements SetMultimap { /** diff --git a/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java b/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java index 676936f0578e..70a1744ea143 100644 --- a/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java +++ b/guava/src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java @@ -32,7 +32,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractSortedKeySortedSetMultimap< K extends @Nullable Object, V extends @Nullable Object> extends AbstractSortedSetMultimap { diff --git a/guava/src/com/google/common/collect/AbstractSortedMultiset.java b/guava/src/com/google/common/collect/AbstractSortedMultiset.java index 98b6211a71fd..6217ae9ba31a 100644 --- a/guava/src/com/google/common/collect/AbstractSortedMultiset.java +++ b/guava/src/com/google/common/collect/AbstractSortedMultiset.java @@ -35,7 +35,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class AbstractSortedMultiset extends AbstractMultiset implements SortedMultiset { @GwtTransient final Comparator comparator; diff --git a/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java b/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java index 91baeed4650f..554c006ccc4a 100644 --- a/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java +++ b/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java @@ -36,7 +36,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractSortedSetMultimap extends AbstractSetMultimap implements SortedSetMultimap { /** diff --git a/guava/src/com/google/common/collect/AbstractTable.java b/guava/src/com/google/common/collect/AbstractTable.java index 21b32ee0fc6c..67ae7ffa5692 100644 --- a/guava/src/com/google/common/collect/AbstractTable.java +++ b/guava/src/com/google/common/collect/AbstractTable.java @@ -37,7 +37,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class AbstractTable< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> implements Table { diff --git a/guava/src/com/google/common/collect/AllEqualOrdering.java b/guava/src/com/google/common/collect/AllEqualOrdering.java index bb1e0027b43d..ef8fe7345a87 100644 --- a/guava/src/com/google/common/collect/AllEqualOrdering.java +++ b/guava/src/com/google/common/collect/AllEqualOrdering.java @@ -28,7 +28,6 @@ * @author Emily Soldal */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class AllEqualOrdering extends Ordering<@Nullable Object> implements Serializable { static final AllEqualOrdering INSTANCE = new AllEqualOrdering(); diff --git a/guava/src/com/google/common/collect/ArrayListMultimap.java b/guava/src/com/google/common/collect/ArrayListMultimap.java index 63b1fd695b90..a5cf81928c65 100644 --- a/guava/src/com/google/common/collect/ArrayListMultimap.java +++ b/guava/src/com/google/common/collect/ArrayListMultimap.java @@ -60,7 +60,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class ArrayListMultimap extends ArrayListMultimapGwtSerializationDependencies { // Default from ArrayList diff --git a/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java b/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java index 9a8cdfbdbd13..4b12ebf6ed9a 100644 --- a/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A dummy superclass to support GWT serialization of the element types of an {@link @@ -30,7 +31,8 @@ *

                            TODO(cpovirk): Consider applying this subclass approach to our other types. */ @GwtCompatible(emulated = true) -abstract class ArrayListMultimapGwtSerializationDependencies +abstract class ArrayListMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> extends AbstractListMultimap { ArrayListMultimapGwtSerializationDependencies(Map> map) { super(map); diff --git a/guava/src/com/google/common/collect/ArrayTable.java b/guava/src/com/google/common/collect/ArrayTable.java index 767a0839610b..1f56b9f1074c 100644 --- a/guava/src/com/google/common/collect/ArrayTable.java +++ b/guava/src/com/google/common/collect/ArrayTable.java @@ -91,7 +91,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class ArrayTable extends AbstractTable implements Serializable { diff --git a/guava/src/com/google/common/collect/BaseImmutableMultimap.java b/guava/src/com/google/common/collect/BaseImmutableMultimap.java index 2e69c2a92e39..6ebdf14f52fa 100644 --- a/guava/src/com/google/common/collect/BaseImmutableMultimap.java +++ b/guava/src/com/google/common/collect/BaseImmutableMultimap.java @@ -22,5 +22,4 @@ * retaining additional implementation details of {@link ImmutableMultimap}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class BaseImmutableMultimap extends AbstractMultimap {} diff --git a/guava/src/com/google/common/collect/BiMap.java b/guava/src/com/google/common/collect/BiMap.java index d95a71eb7ebc..c2694ed9642a 100644 --- a/guava/src/com/google/common/collect/BiMap.java +++ b/guava/src/com/google/common/collect/BiMap.java @@ -44,7 +44,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface BiMap extends Map { // Modification Operations diff --git a/guava/src/com/google/common/collect/BoundType.java b/guava/src/com/google/common/collect/BoundType.java index 00ac08c5182c..6f24a6ad62ba 100644 --- a/guava/src/com/google/common/collect/BoundType.java +++ b/guava/src/com/google/common/collect/BoundType.java @@ -24,7 +24,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public enum BoundType { /** The endpoint value is not considered part of the set ("exclusive"). */ OPEN(false), diff --git a/guava/src/com/google/common/collect/ByFunctionOrdering.java b/guava/src/com/google/common/collect/ByFunctionOrdering.java index 43ebdddf62b3..f852133e0f98 100644 --- a/guava/src/com/google/common/collect/ByFunctionOrdering.java +++ b/guava/src/com/google/common/collect/ByFunctionOrdering.java @@ -30,7 +30,6 @@ * elements. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ByFunctionOrdering extends Ordering implements Serializable { final Function function; diff --git a/guava/src/com/google/common/collect/CartesianList.java b/guava/src/com/google/common/collect/CartesianList.java index a93fb032fec6..7d20c37c56ac 100644 --- a/guava/src/com/google/common/collect/CartesianList.java +++ b/guava/src/com/google/common/collect/CartesianList.java @@ -32,7 +32,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CartesianList extends AbstractList> implements RandomAccess { private final transient ImmutableList> axes; diff --git a/guava/src/com/google/common/collect/ClassToInstanceMap.java b/guava/src/com/google/common/collect/ClassToInstanceMap.java index 094a7fdd7655..ddec8f3fffa4 100644 --- a/guava/src/com/google/common/collect/ClassToInstanceMap.java +++ b/guava/src/com/google/common/collect/ClassToInstanceMap.java @@ -52,7 +52,6 @@ */ @DoNotMock("Use ImmutableClassToInstanceMap or MutableClassToInstanceMap") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface ClassToInstanceMap extends Map, B> { /** diff --git a/guava/src/com/google/common/collect/CollectCollectors.java b/guava/src/com/google/common/collect/CollectCollectors.java index b1ffa88868af..6405080b870c 100644 --- a/guava/src/com/google/common/collect/CollectCollectors.java +++ b/guava/src/com/google/common/collect/CollectCollectors.java @@ -41,7 +41,6 @@ /** Collectors utilities for {@code common.collect} internals. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CollectCollectors { private static final Collector> TO_IMMUTABLE_LIST = diff --git a/guava/src/com/google/common/collect/CollectPreconditions.java b/guava/src/com/google/common/collect/CollectPreconditions.java index c649b03233e3..98b30c6d5e7b 100644 --- a/guava/src/com/google/common/collect/CollectPreconditions.java +++ b/guava/src/com/google/common/collect/CollectPreconditions.java @@ -23,7 +23,6 @@ /** Precondition checks useful in collection implementations. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CollectPreconditions { static void checkEntryNotNull(Object key, Object value) { diff --git a/guava/src/com/google/common/collect/CollectSpliterators.java b/guava/src/com/google/common/collect/CollectSpliterators.java index b7bec7e7afd7..280ad205f22f 100644 --- a/guava/src/com/google/common/collect/CollectSpliterators.java +++ b/guava/src/com/google/common/collect/CollectSpliterators.java @@ -38,7 +38,6 @@ /** Spliterator utilities for {@code common.collect} internals. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CollectSpliterators { private CollectSpliterators() {} diff --git a/guava/src/com/google/common/collect/Collections2.java b/guava/src/com/google/common/collect/Collections2.java index 187233ce81f6..5dcffbd84e34 100644 --- a/guava/src/com/google/common/collect/Collections2.java +++ b/guava/src/com/google/common/collect/Collections2.java @@ -55,7 +55,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Collections2 { private Collections2() {} diff --git a/guava/src/com/google/common/collect/CompactHashMap.java b/guava/src/com/google/common/collect/CompactHashMap.java index 8ff820162331..7e6a9d1b2e53 100644 --- a/guava/src/com/google/common/collect/CompactHashMap.java +++ b/guava/src/com/google/common/collect/CompactHashMap.java @@ -84,7 +84,6 @@ * @author Jon Noack */ @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactHashMap extends AbstractMap implements Serializable { /* diff --git a/guava/src/com/google/common/collect/CompactHashSet.java b/guava/src/com/google/common/collect/CompactHashSet.java index 6b09ece422d3..c48e70df7ca2 100644 --- a/guava/src/com/google/common/collect/CompactHashSet.java +++ b/guava/src/com/google/common/collect/CompactHashSet.java @@ -79,7 +79,6 @@ * @author Jon Noack */ @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactHashSet extends AbstractSet implements Serializable { // TODO(user): cache all field accesses in local vars diff --git a/guava/src/com/google/common/collect/CompactHashing.java b/guava/src/com/google/common/collect/CompactHashing.java index 2a07d41d56a3..a8f91cb8b4c5 100644 --- a/guava/src/com/google/common/collect/CompactHashing.java +++ b/guava/src/com/google/common/collect/CompactHashing.java @@ -31,7 +31,6 @@ * @author Jon Noack */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class CompactHashing { private CompactHashing() {} diff --git a/guava/src/com/google/common/collect/CompactLinkedHashMap.java b/guava/src/com/google/common/collect/CompactLinkedHashMap.java index b23807df45ed..a58198e6e990 100644 --- a/guava/src/com/google/common/collect/CompactLinkedHashMap.java +++ b/guava/src/com/google/common/collect/CompactLinkedHashMap.java @@ -55,7 +55,6 @@ */ @J2ktIncompatible // no support for access-order mode in LinkedHashMap delegate @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactLinkedHashMap extends CompactHashMap { // TODO(lowasser): implement removeEldestEntry so this can be used as a drop-in replacement diff --git a/guava/src/com/google/common/collect/CompactLinkedHashSet.java b/guava/src/com/google/common/collect/CompactLinkedHashSet.java index c1d813cdb435..3c91e76484f2 100644 --- a/guava/src/com/google/common/collect/CompactLinkedHashSet.java +++ b/guava/src/com/google/common/collect/CompactLinkedHashSet.java @@ -51,7 +51,6 @@ * @author Louis Wasserman */ @GwtIncompatible // not worth using in GWT for now -@ElementTypesAreNonnullByDefault class CompactLinkedHashSet extends CompactHashSet { /** Creates an empty {@code CompactLinkedHashSet} instance. */ diff --git a/guava/src/com/google/common/collect/ComparatorOrdering.java b/guava/src/com/google/common/collect/ComparatorOrdering.java index 8b3407074421..405ae8430529 100644 --- a/guava/src/com/google/common/collect/ComparatorOrdering.java +++ b/guava/src/com/google/common/collect/ComparatorOrdering.java @@ -26,7 +26,6 @@ /** An ordering for a pre-existing comparator. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ComparatorOrdering extends Ordering implements Serializable { final Comparator comparator; diff --git a/guava/src/com/google/common/collect/Comparators.java b/guava/src/com/google/common/collect/Comparators.java index d77dcc82f67e..56a1fca4b44d 100644 --- a/guava/src/com/google/common/collect/Comparators.java +++ b/guava/src/com/google/common/collect/Comparators.java @@ -44,7 +44,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Comparators { private Comparators() {} diff --git a/guava/src/com/google/common/collect/ComparisonChain.java b/guava/src/com/google/common/collect/ComparisonChain.java index f8cd62cf81d1..f54704c7f717 100644 --- a/guava/src/com/google/common/collect/ComparisonChain.java +++ b/guava/src/com/google/common/collect/ComparisonChain.java @@ -89,7 +89,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ComparisonChain { private ComparisonChain() {} diff --git a/guava/src/com/google/common/collect/CompoundOrdering.java b/guava/src/com/google/common/collect/CompoundOrdering.java index 78d0064286da..4dac31e56a28 100644 --- a/guava/src/com/google/common/collect/CompoundOrdering.java +++ b/guava/src/com/google/common/collect/CompoundOrdering.java @@ -25,7 +25,6 @@ /** An ordering that tries several comparators in order. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class CompoundOrdering extends Ordering implements Serializable { final Comparator[] comparators; diff --git a/guava/src/com/google/common/collect/ComputationException.java b/guava/src/com/google/common/collect/ComputationException.java index b05577c412cc..d39160c5c869 100644 --- a/guava/src/com/google/common/collect/ComputationException.java +++ b/guava/src/com/google/common/collect/ComputationException.java @@ -34,7 +34,6 @@ */ @Deprecated @GwtCompatible -@ElementTypesAreNonnullByDefault public class ComputationException extends RuntimeException { /** Creates a new instance with the given cause. */ public ComputationException(@CheckForNull Throwable cause) { diff --git a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java index 35048bccf5c2..087d580daa3e 100644 --- a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java +++ b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java @@ -61,7 +61,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ConcurrentHashMultiset extends AbstractMultiset implements Serializable { /* diff --git a/guava/src/com/google/common/collect/ConsumingQueueIterator.java b/guava/src/com/google/common/collect/ConsumingQueueIterator.java index 3a923ae21f10..42dd1c2bf886 100644 --- a/guava/src/com/google/common/collect/ConsumingQueueIterator.java +++ b/guava/src/com/google/common/collect/ConsumingQueueIterator.java @@ -26,7 +26,6 @@ * iterates. This class is not thread safe. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class ConsumingQueueIterator extends AbstractIterator { private final Queue queue; diff --git a/guava/src/com/google/common/collect/ContiguousSet.java b/guava/src/com/google/common/collect/ContiguousSet.java index 539c67383a21..574e7ff36b57 100644 --- a/guava/src/com/google/common/collect/ContiguousSet.java +++ b/guava/src/com/google/common/collect/ContiguousSet.java @@ -50,7 +50,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // allow ungenerified Comparable types -@ElementTypesAreNonnullByDefault public abstract class ContiguousSet extends ImmutableSortedSet { /** * Returns a {@code ContiguousSet} containing the same values in the given domain {@linkplain diff --git a/guava/src/com/google/common/collect/Count.java b/guava/src/com/google/common/collect/Count.java index 7aa555080135..b79dedff35ba 100644 --- a/guava/src/com/google/common/collect/Count.java +++ b/guava/src/com/google/common/collect/Count.java @@ -24,7 +24,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Count implements Serializable { private int value; diff --git a/guava/src/com/google/common/collect/Cut.java b/guava/src/com/google/common/collect/Cut.java index b64e054abfae..404f0e851e95 100644 --- a/guava/src/com/google/common/collect/Cut.java +++ b/guava/src/com/google/common/collect/Cut.java @@ -32,7 +32,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class Cut implements Comparable>, Serializable { final C endpoint; diff --git a/guava/src/com/google/common/collect/DenseImmutableTable.java b/guava/src/com/google/common/collect/DenseImmutableTable.java index 88620dc4a1e5..3f78a3af645b 100644 --- a/guava/src/com/google/common/collect/DenseImmutableTable.java +++ b/guava/src/com/google/common/collect/DenseImmutableTable.java @@ -30,7 +30,6 @@ /** A {@code RegularImmutableTable} optimized for dense data. */ @GwtCompatible @Immutable(containerOf = {"R", "C", "V"}) -@ElementTypesAreNonnullByDefault final class DenseImmutableTable extends RegularImmutableTable { private final ImmutableMap rowKeyToIndex; private final ImmutableMap columnKeyToIndex; diff --git a/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java b/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java index 931c3e72c70a..975d61d8eec2 100644 --- a/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java @@ -25,7 +25,6 @@ */ @SuppressWarnings("serial") // uses writeReplace, not default serialization @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DescendingImmutableSortedMultiset extends ImmutableSortedMultiset { private final transient ImmutableSortedMultiset forward; diff --git a/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java b/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java index 10b3fa8666b2..74270688e14c 100644 --- a/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java @@ -26,7 +26,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DescendingImmutableSortedSet extends ImmutableSortedSet { private final ImmutableSortedSet forward; diff --git a/guava/src/com/google/common/collect/DescendingMultiset.java b/guava/src/com/google/common/collect/DescendingMultiset.java index 23ff8319c01d..f3545c4d59e1 100644 --- a/guava/src/com/google/common/collect/DescendingMultiset.java +++ b/guava/src/com/google/common/collect/DescendingMultiset.java @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class DescendingMultiset extends ForwardingMultiset implements SortedMultiset { abstract SortedMultiset forwardMultiset(); diff --git a/guava/src/com/google/common/collect/DiscreteDomain.java b/guava/src/com/google/common/collect/DiscreteDomain.java index 96160a99ffad..d34f8e142b04 100644 --- a/guava/src/com/google/common/collect/DiscreteDomain.java +++ b/guava/src/com/google/common/collect/DiscreteDomain.java @@ -45,7 +45,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class DiscreteDomain { /** diff --git a/guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index e1c640ff5db4..000000000000 --- a/guava/src/com/google/common/collect/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; - -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/guava/src/com/google/common/collect/EmptyContiguousSet.java b/guava/src/com/google/common/collect/EmptyContiguousSet.java index 79a945ff9735..17d713f7ae88 100644 --- a/guava/src/com/google/common/collect/EmptyContiguousSet.java +++ b/guava/src/com/google/common/collect/EmptyContiguousSet.java @@ -32,7 +32,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // allow ungenerified Comparable types -@ElementTypesAreNonnullByDefault final class EmptyContiguousSet extends ContiguousSet { EmptyContiguousSet(DiscreteDomain domain) { super(domain); diff --git a/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java b/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java index 8a60301826df..f01b66c2548f 100644 --- a/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java +++ b/guava/src/com/google/common/collect/EmptyImmutableListMultimap.java @@ -25,7 +25,6 @@ * @author Jared Levy */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault class EmptyImmutableListMultimap extends ImmutableListMultimap { static final EmptyImmutableListMultimap INSTANCE = new EmptyImmutableListMultimap(); diff --git a/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java b/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java index 087112e10a51..1633fa7a406a 100644 --- a/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java +++ b/guava/src/com/google/common/collect/EmptyImmutableSetMultimap.java @@ -25,7 +25,6 @@ * @author Mike Ward */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault class EmptyImmutableSetMultimap extends ImmutableSetMultimap { static final EmptyImmutableSetMultimap INSTANCE = new EmptyImmutableSetMultimap(); diff --git a/guava/src/com/google/common/collect/EnumBiMap.java b/guava/src/com/google/common/collect/EnumBiMap.java index b7d297272d60..fcb99ac46d55 100644 --- a/guava/src/com/google/common/collect/EnumBiMap.java +++ b/guava/src/com/google/common/collect/EnumBiMap.java @@ -42,7 +42,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class EnumBiMap, V extends Enum> extends AbstractBiMap { /* * J2CL's EnumMap does not need the Class instance, so we can use Object.class instead. (Or we diff --git a/guava/src/com/google/common/collect/EnumHashBiMap.java b/guava/src/com/google/common/collect/EnumHashBiMap.java index c7432d404608..65afe41e9fa6 100644 --- a/guava/src/com/google/common/collect/EnumHashBiMap.java +++ b/guava/src/com/google/common/collect/EnumHashBiMap.java @@ -45,7 +45,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class EnumHashBiMap, V extends @Nullable Object> extends AbstractBiMap { transient Class keyTypeOrObjectUnderJ2cl; diff --git a/guava/src/com/google/common/collect/EnumMultiset.java b/guava/src/com/google/common/collect/EnumMultiset.java index 5e3b2fb84646..c7b741459427 100644 --- a/guava/src/com/google/common/collect/EnumMultiset.java +++ b/guava/src/com/google/common/collect/EnumMultiset.java @@ -47,7 +47,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class EnumMultiset> extends AbstractMultiset implements Serializable { /** Creates an empty {@code EnumMultiset}. */ diff --git a/guava/src/com/google/common/collect/EvictingQueue.java b/guava/src/com/google/common/collect/EvictingQueue.java index 71770b72ae11..3edcd03632ce 100644 --- a/guava/src/com/google/common/collect/EvictingQueue.java +++ b/guava/src/com/google/common/collect/EvictingQueue.java @@ -44,7 +44,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class EvictingQueue extends ForwardingQueue implements Serializable { private final Queue delegate; diff --git a/guava/src/com/google/common/collect/ExplicitOrdering.java b/guava/src/com/google/common/collect/ExplicitOrdering.java index 383318af5bb4..ddccb85bc2a8 100644 --- a/guava/src/com/google/common/collect/ExplicitOrdering.java +++ b/guava/src/com/google/common/collect/ExplicitOrdering.java @@ -23,7 +23,6 @@ /** An ordering that compares objects according to a given order. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ExplicitOrdering extends Ordering implements Serializable { final ImmutableMap rankMap; diff --git a/guava/src/com/google/common/collect/FilteredEntryMultimap.java b/guava/src/com/google/common/collect/FilteredEntryMultimap.java index 8146cdb675c1..e7121d7b9df4 100644 --- a/guava/src/com/google/common/collect/FilteredEntryMultimap.java +++ b/guava/src/com/google/common/collect/FilteredEntryMultimap.java @@ -46,7 +46,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault class FilteredEntryMultimap extends AbstractMultimap implements FilteredMultimap { final Multimap unfiltered; diff --git a/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java b/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java index 20413f8c4096..ed2b05f17b78 100644 --- a/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java +++ b/guava/src/com/google/common/collect/FilteredEntrySetMultimap.java @@ -29,7 +29,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredEntrySetMultimap extends FilteredEntryMultimap implements FilteredSetMultimap { diff --git a/guava/src/com/google/common/collect/FilteredKeyListMultimap.java b/guava/src/com/google/common/collect/FilteredKeyListMultimap.java index c82c8daf770d..f1c499f74d7c 100644 --- a/guava/src/com/google/common/collect/FilteredKeyListMultimap.java +++ b/guava/src/com/google/common/collect/FilteredKeyListMultimap.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredKeyListMultimap extends FilteredKeyMultimap implements ListMultimap { FilteredKeyListMultimap(ListMultimap unfiltered, Predicate keyPredicate) { diff --git a/guava/src/com/google/common/collect/FilteredKeyMultimap.java b/guava/src/com/google/common/collect/FilteredKeyMultimap.java index 8b699d48ba7c..7e9b5505955a 100644 --- a/guava/src/com/google/common/collect/FilteredKeyMultimap.java +++ b/guava/src/com/google/common/collect/FilteredKeyMultimap.java @@ -38,7 +38,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault class FilteredKeyMultimap extends AbstractMultimap implements FilteredMultimap { final Multimap unfiltered; diff --git a/guava/src/com/google/common/collect/FilteredKeySetMultimap.java b/guava/src/com/google/common/collect/FilteredKeySetMultimap.java index e492a5c1dea9..ac56459b9448 100644 --- a/guava/src/com/google/common/collect/FilteredKeySetMultimap.java +++ b/guava/src/com/google/common/collect/FilteredKeySetMultimap.java @@ -29,7 +29,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredKeySetMultimap extends FilteredKeyMultimap implements FilteredSetMultimap { diff --git a/guava/src/com/google/common/collect/FilteredMultimap.java b/guava/src/com/google/common/collect/FilteredMultimap.java index 4e1fa066f80b..29b4dd1fd7e5 100644 --- a/guava/src/com/google/common/collect/FilteredMultimap.java +++ b/guava/src/com/google/common/collect/FilteredMultimap.java @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface FilteredMultimap extends Multimap { Multimap unfiltered(); diff --git a/guava/src/com/google/common/collect/FilteredMultimapValues.java b/guava/src/com/google/common/collect/FilteredMultimapValues.java index 63009b032869..cb1659f8aa59 100644 --- a/guava/src/com/google/common/collect/FilteredMultimapValues.java +++ b/guava/src/com/google/common/collect/FilteredMultimapValues.java @@ -35,7 +35,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class FilteredMultimapValues extends AbstractCollection { @Weak private final FilteredMultimap multimap; diff --git a/guava/src/com/google/common/collect/FilteredSetMultimap.java b/guava/src/com/google/common/collect/FilteredSetMultimap.java index 8e2ff7c0c1a6..f858af50bc3c 100644 --- a/guava/src/com/google/common/collect/FilteredSetMultimap.java +++ b/guava/src/com/google/common/collect/FilteredSetMultimap.java @@ -25,7 +25,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface FilteredSetMultimap extends FilteredMultimap, SetMultimap { @Override diff --git a/guava/src/com/google/common/collect/FluentIterable.java b/guava/src/com/google/common/collect/FluentIterable.java index f5d7050ba86b..d8906e96e85c 100644 --- a/guava/src/com/google/common/collect/FluentIterable.java +++ b/guava/src/com/google/common/collect/FluentIterable.java @@ -109,7 +109,6 @@ * @since 12.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class FluentIterable implements Iterable { // We store 'iterable' and use it instead of 'this' to allow Iterables to perform instanceof // checks on the _original_ iterable when FluentIterable.from is used. diff --git a/guava/src/com/google/common/collect/ForwardingBlockingDeque.java b/guava/src/com/google/common/collect/ForwardingBlockingDeque.java index 13b5b236e3fb..5ed05134cf66 100644 --- a/guava/src/com/google/common/collect/ForwardingBlockingDeque.java +++ b/guava/src/com/google/common/collect/ForwardingBlockingDeque.java @@ -49,7 +49,6 @@ @Deprecated @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingBlockingDeque extends ForwardingDeque implements BlockingDeque { diff --git a/guava/src/com/google/common/collect/ForwardingCollection.java b/guava/src/com/google/common/collect/ForwardingCollection.java index ca1edc118303..e03f1ceebb82 100644 --- a/guava/src/com/google/common/collect/ForwardingCollection.java +++ b/guava/src/com/google/common/collect/ForwardingCollection.java @@ -47,7 +47,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingCollection extends ForwardingObject implements Collection { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/guava/src/com/google/common/collect/ForwardingConcurrentMap.java b/guava/src/com/google/common/collect/ForwardingConcurrentMap.java index b662b0774a0f..6552cc45bab6 100644 --- a/guava/src/com/google/common/collect/ForwardingConcurrentMap.java +++ b/guava/src/com/google/common/collect/ForwardingConcurrentMap.java @@ -37,7 +37,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingConcurrentMap extends ForwardingMap implements ConcurrentMap { diff --git a/guava/src/com/google/common/collect/ForwardingDeque.java b/guava/src/com/google/common/collect/ForwardingDeque.java index 2730dad0ee8b..2caae14d7f35 100644 --- a/guava/src/com/google/common/collect/ForwardingDeque.java +++ b/guava/src/com/google/common/collect/ForwardingDeque.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingDeque extends ForwardingQueue implements Deque { diff --git a/guava/src/com/google/common/collect/ForwardingImmutableCollection.java b/guava/src/com/google/common/collect/ForwardingImmutableCollection.java index 043fe5863593..c0b9c5e54d74 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableCollection.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableCollection.java @@ -24,7 +24,6 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault class ForwardingImmutableCollection { private ForwardingImmutableCollection() {} } diff --git a/guava/src/com/google/common/collect/ForwardingImmutableList.java b/guava/src/com/google/common/collect/ForwardingImmutableList.java index bd5480d589c4..2b9092ea4c93 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableList.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableList.java @@ -24,7 +24,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ForwardingImmutableList { private ForwardingImmutableList() {} } diff --git a/guava/src/com/google/common/collect/ForwardingImmutableMap.java b/guava/src/com/google/common/collect/ForwardingImmutableMap.java index 22cc9ff8711c..a36715743f0a 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableMap.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableMap.java @@ -24,7 +24,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ForwardingImmutableMap { private ForwardingImmutableMap() {} } diff --git a/guava/src/com/google/common/collect/ForwardingImmutableSet.java b/guava/src/com/google/common/collect/ForwardingImmutableSet.java index 047d5fd32216..c7d7bf6d778b 100644 --- a/guava/src/com/google/common/collect/ForwardingImmutableSet.java +++ b/guava/src/com/google/common/collect/ForwardingImmutableSet.java @@ -24,7 +24,6 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ForwardingImmutableSet { private ForwardingImmutableSet() {} } diff --git a/guava/src/com/google/common/collect/ForwardingIterator.java b/guava/src/com/google/common/collect/ForwardingIterator.java index 1f5a8f110eaf..0924bbdfe293 100644 --- a/guava/src/com/google/common/collect/ForwardingIterator.java +++ b/guava/src/com/google/common/collect/ForwardingIterator.java @@ -37,7 +37,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingIterator extends ForwardingObject implements Iterator { diff --git a/guava/src/com/google/common/collect/ForwardingList.java b/guava/src/com/google/common/collect/ForwardingList.java index e9b4d8e35b6d..2b013f1908a4 100644 --- a/guava/src/com/google/common/collect/ForwardingList.java +++ b/guava/src/com/google/common/collect/ForwardingList.java @@ -51,7 +51,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingList extends ForwardingCollection implements List { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/guava/src/com/google/common/collect/ForwardingListIterator.java b/guava/src/com/google/common/collect/ForwardingListIterator.java index a2ac32b6fad9..2fdc88570542 100644 --- a/guava/src/com/google/common/collect/ForwardingListIterator.java +++ b/guava/src/com/google/common/collect/ForwardingListIterator.java @@ -37,7 +37,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListIterator extends ForwardingIterator implements ListIterator { diff --git a/guava/src/com/google/common/collect/ForwardingListMultimap.java b/guava/src/com/google/common/collect/ForwardingListMultimap.java index 11779c0bb826..ae1cdcfd551a 100644 --- a/guava/src/com/google/common/collect/ForwardingListMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingListMultimap.java @@ -35,7 +35,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListMultimap extends ForwardingMultimap implements ListMultimap { diff --git a/guava/src/com/google/common/collect/ForwardingMap.java b/guava/src/com/google/common/collect/ForwardingMap.java index 24c40f23c9d8..b3756a55350b 100644 --- a/guava/src/com/google/common/collect/ForwardingMap.java +++ b/guava/src/com/google/common/collect/ForwardingMap.java @@ -55,7 +55,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMap extends ForwardingObject implements Map { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/guava/src/com/google/common/collect/ForwardingMapEntry.java b/guava/src/com/google/common/collect/ForwardingMapEntry.java index 7fe1386aa32f..5af9221f3906 100644 --- a/guava/src/com/google/common/collect/ForwardingMapEntry.java +++ b/guava/src/com/google/common/collect/ForwardingMapEntry.java @@ -48,7 +48,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMapEntry extends ForwardingObject implements Map.Entry { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/guava/src/com/google/common/collect/ForwardingMultimap.java b/guava/src/com/google/common/collect/ForwardingMultimap.java index a3db0618ed80..f50cd8982d30 100644 --- a/guava/src/com/google/common/collect/ForwardingMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingMultimap.java @@ -38,7 +38,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMultimap extends ForwardingObject implements Multimap { diff --git a/guava/src/com/google/common/collect/ForwardingMultiset.java b/guava/src/com/google/common/collect/ForwardingMultiset.java index d1187d4c5b63..7407fabb5df2 100644 --- a/guava/src/com/google/common/collect/ForwardingMultiset.java +++ b/guava/src/com/google/common/collect/ForwardingMultiset.java @@ -48,7 +48,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingMultiset extends ForwardingCollection implements Multiset { diff --git a/guava/src/com/google/common/collect/ForwardingNavigableMap.java b/guava/src/com/google/common/collect/ForwardingNavigableMap.java index 292f4573b6b4..d07d7043b768 100644 --- a/guava/src/com/google/common/collect/ForwardingNavigableMap.java +++ b/guava/src/com/google/common/collect/ForwardingNavigableMap.java @@ -55,7 +55,6 @@ * @since 12.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingNavigableMap extends ForwardingSortedMap implements NavigableMap { diff --git a/guava/src/com/google/common/collect/ForwardingNavigableSet.java b/guava/src/com/google/common/collect/ForwardingNavigableSet.java index 97f137a593d6..71954fab110b 100644 --- a/guava/src/com/google/common/collect/ForwardingNavigableSet.java +++ b/guava/src/com/google/common/collect/ForwardingNavigableSet.java @@ -50,7 +50,6 @@ * @since 12.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingNavigableSet extends ForwardingSortedSet implements NavigableSet { diff --git a/guava/src/com/google/common/collect/ForwardingObject.java b/guava/src/com/google/common/collect/ForwardingObject.java index 64af9082d224..712b14fa1343 100644 --- a/guava/src/com/google/common/collect/ForwardingObject.java +++ b/guava/src/com/google/common/collect/ForwardingObject.java @@ -44,7 +44,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingObject { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/collect/ForwardingQueue.java b/guava/src/com/google/common/collect/ForwardingQueue.java index 43c2eaafb56d..fa07c242fb13 100644 --- a/guava/src/com/google/common/collect/ForwardingQueue.java +++ b/guava/src/com/google/common/collect/ForwardingQueue.java @@ -46,7 +46,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingQueue extends ForwardingCollection implements Queue { diff --git a/guava/src/com/google/common/collect/ForwardingSet.java b/guava/src/com/google/common/collect/ForwardingSet.java index bc27272b0267..9eb403629286 100644 --- a/guava/src/com/google/common/collect/ForwardingSet.java +++ b/guava/src/com/google/common/collect/ForwardingSet.java @@ -47,7 +47,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSet extends ForwardingCollection implements Set { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/guava/src/com/google/common/collect/ForwardingSetMultimap.java b/guava/src/com/google/common/collect/ForwardingSetMultimap.java index 2691fe1cbe06..4f44e9d31cf8 100644 --- a/guava/src/com/google/common/collect/ForwardingSetMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingSetMultimap.java @@ -36,7 +36,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSetMultimap extends ForwardingMultimap implements SetMultimap { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/collect/ForwardingSortedMap.java b/guava/src/com/google/common/collect/ForwardingSortedMap.java index 9779b97a785f..127e1ca73ac6 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedMap.java +++ b/guava/src/com/google/common/collect/ForwardingSortedMap.java @@ -51,7 +51,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedMap extends ForwardingMap implements SortedMap { // TODO(lowasser): identify places where thread safety is actually lost diff --git a/guava/src/com/google/common/collect/ForwardingSortedMultiset.java b/guava/src/com/google/common/collect/ForwardingSortedMultiset.java index 7777357414de..8ac7fa3de215 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedMultiset.java +++ b/guava/src/com/google/common/collect/ForwardingSortedMultiset.java @@ -44,7 +44,6 @@ * @since 15.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedMultiset extends ForwardingMultiset implements SortedMultiset { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/collect/ForwardingSortedSet.java b/guava/src/com/google/common/collect/ForwardingSortedSet.java index ad7ef12235ef..3a6af5e5b251 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedSet.java +++ b/guava/src/com/google/common/collect/ForwardingSortedSet.java @@ -54,7 +54,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedSet extends ForwardingSet implements SortedSet { diff --git a/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java b/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java index b91a68b3445a..38e1bc50ca07 100644 --- a/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java +++ b/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java @@ -35,7 +35,6 @@ * @since 3.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingSortedSetMultimap< K extends @Nullable Object, V extends @Nullable Object> extends ForwardingSetMultimap implements SortedSetMultimap { diff --git a/guava/src/com/google/common/collect/ForwardingTable.java b/guava/src/com/google/common/collect/ForwardingTable.java index 4fcb858b725f..c4060ffa6d6f 100644 --- a/guava/src/com/google/common/collect/ForwardingTable.java +++ b/guava/src/com/google/common/collect/ForwardingTable.java @@ -33,7 +33,6 @@ * @since 7.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingTable< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> extends ForwardingObject implements Table { diff --git a/guava/src/com/google/common/collect/GeneralRange.java b/guava/src/com/google/common/collect/GeneralRange.java index aff4b1bca7e1..0410355779c4 100644 --- a/guava/src/com/google/common/collect/GeneralRange.java +++ b/guava/src/com/google/common/collect/GeneralRange.java @@ -38,7 +38,6 @@ * @author Louis Wasserman */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class GeneralRange implements Serializable { /** Converts a Range to a GeneralRange. */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 diff --git a/guava/src/com/google/common/collect/GwtTransient.java b/guava/src/com/google/common/collect/GwtTransient.java index ce5ea48848c9..9c09c53c946f 100644 --- a/guava/src/com/google/common/collect/GwtTransient.java +++ b/guava/src/com/google/common/collect/GwtTransient.java @@ -33,5 +33,4 @@ @GwtCompatible @Retention(RUNTIME) @Target(FIELD) -@ElementTypesAreNonnullByDefault @interface GwtTransient {} diff --git a/guava/src/com/google/common/collect/HashBasedTable.java b/guava/src/com/google/common/collect/HashBasedTable.java index 21882e62d406..787c411d5019 100644 --- a/guava/src/com/google/common/collect/HashBasedTable.java +++ b/guava/src/com/google/common/collect/HashBasedTable.java @@ -47,7 +47,6 @@ * @since 7.0 */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault public class HashBasedTable extends StandardTable { private static class Factory implements Supplier>, Serializable { final int expectedSize; diff --git a/guava/src/com/google/common/collect/HashBiMap.java b/guava/src/com/google/common/collect/HashBiMap.java index 0660567746bb..d858cbed0709 100644 --- a/guava/src/com/google/common/collect/HashBiMap.java +++ b/guava/src/com/google/common/collect/HashBiMap.java @@ -59,7 +59,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class HashBiMap extends IteratorBasedAbstractMap implements BiMap, Serializable { diff --git a/guava/src/com/google/common/collect/HashMultimap.java b/guava/src/com/google/common/collect/HashMultimap.java index 34861180c989..5183823a3307 100644 --- a/guava/src/com/google/common/collect/HashMultimap.java +++ b/guava/src/com/google/common/collect/HashMultimap.java @@ -50,7 +50,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class HashMultimap extends HashMultimapGwtSerializationDependencies { private static final int DEFAULT_VALUES_PER_KEY = 2; diff --git a/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java b/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java index 0922c3839080..e46fa7ddd6b1 100644 --- a/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A dummy superclass to support GWT serialization of the element types of a {@link HashMultimap}. @@ -30,7 +31,9 @@ *

                            TODO(cpovirk): Consider applying this subclass approach to our other types. */ @GwtCompatible(emulated = true) -abstract class HashMultimapGwtSerializationDependencies extends AbstractSetMultimap { +abstract class HashMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> + extends AbstractSetMultimap { HashMultimapGwtSerializationDependencies(Map> map) { super(map); } diff --git a/guava/src/com/google/common/collect/HashMultiset.java b/guava/src/com/google/common/collect/HashMultiset.java index 699f8a23bcd7..f758f8049c74 100644 --- a/guava/src/com/google/common/collect/HashMultiset.java +++ b/guava/src/com/google/common/collect/HashMultiset.java @@ -33,7 +33,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class HashMultiset extends AbstractMapBasedMultiset { /** Creates a new, empty {@code HashMultiset} using the default initial capacity. */ diff --git a/guava/src/com/google/common/collect/Hashing.java b/guava/src/com/google/common/collect/Hashing.java index ee4376d7078d..6ce9398f7ff8 100644 --- a/guava/src/com/google/common/collect/Hashing.java +++ b/guava/src/com/google/common/collect/Hashing.java @@ -30,7 +30,6 @@ * @author Austin Appleby */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Hashing { private Hashing() {} diff --git a/guava/src/com/google/common/collect/IgnoreJRERequirement.java b/guava/src/com/google/common/collect/IgnoreJRERequirement.java index 2a1006831267..a5e2448cdd32 100644 --- a/guava/src/com/google/common/collect/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/collect/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                            Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/collect/ImmutableAsList.java b/guava/src/com/google/common/collect/ImmutableAsList.java index b7c585cc2f1a..a65456476033 100644 --- a/guava/src/com/google/common/collect/ImmutableAsList.java +++ b/guava/src/com/google/common/collect/ImmutableAsList.java @@ -33,7 +33,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") -@ElementTypesAreNonnullByDefault abstract class ImmutableAsList extends ImmutableList { abstract ImmutableCollection delegateCollection(); diff --git a/guava/src/com/google/common/collect/ImmutableBiMap.java b/guava/src/com/google/common/collect/ImmutableBiMap.java index d3705231e543..a5c8e33af244 100644 --- a/guava/src/com/google/common/collect/ImmutableBiMap.java +++ b/guava/src/com/google/common/collect/ImmutableBiMap.java @@ -46,7 +46,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public abstract class ImmutableBiMap extends ImmutableMap implements BiMap { /** diff --git a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java index 160cce078fbc..7c979bf74a7d 100644 --- a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java +++ b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java @@ -37,7 +37,6 @@ */ @Immutable(containerOf = "B") @GwtIncompatible -@ElementTypesAreNonnullByDefault // TODO(b/278589132): Remove the redundant "@NonNull" on B once it's no longer required by J2KT. public final class ImmutableClassToInstanceMap extends ForwardingMap, B> diff --git a/guava/src/com/google/common/collect/ImmutableCollection.java b/guava/src/com/google/common/collect/ImmutableCollection.java index 7de929a232c0..865c85346ece 100644 --- a/guava/src/com/google/common/collect/ImmutableCollection.java +++ b/guava/src/com/google/common/collect/ImmutableCollection.java @@ -167,7 +167,6 @@ @DoNotMock("Use ImmutableList.of or another implementation") @GwtCompatible(emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault // TODO(kevinb): I think we should push everything down to "BaseImmutableCollection" or something, // just to do everything we can to emphasize the "practically an interface" nature of this class. public abstract class ImmutableCollection extends AbstractCollection implements Serializable { diff --git a/guava/src/com/google/common/collect/ImmutableEntry.java b/guava/src/com/google/common/collect/ImmutableEntry.java index f88fcc1c6a3f..4685f2a8375c 100644 --- a/guava/src/com/google/common/collect/ImmutableEntry.java +++ b/guava/src/com/google/common/collect/ImmutableEntry.java @@ -26,7 +26,6 @@ * common.collect} as a superclass. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault class ImmutableEntry extends AbstractMapEntry implements Serializable { @ParametricNullness final K key; diff --git a/guava/src/com/google/common/collect/ImmutableEnumMap.java b/guava/src/com/google/common/collect/ImmutableEnumMap.java index 803d4f50675c..3d1bbebddb4e 100644 --- a/guava/src/com/google/common/collect/ImmutableEnumMap.java +++ b/guava/src/com/google/common/collect/ImmutableEnumMap.java @@ -37,7 +37,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault final class ImmutableEnumMap, V> extends IteratorBasedImmutableMap { static , V> ImmutableMap asImmutable(EnumMap map) { switch (map.size()) { diff --git a/guava/src/com/google/common/collect/ImmutableEnumSet.java b/guava/src/com/google/common/collect/ImmutableEnumSet.java index 46c72ab7d587..4e77361457b1 100644 --- a/guava/src/com/google/common/collect/ImmutableEnumSet.java +++ b/guava/src/com/google/common/collect/ImmutableEnumSet.java @@ -37,7 +37,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault final class ImmutableEnumSet> extends ImmutableSet { static > ImmutableSet asImmutable(EnumSet set) { switch (set.size()) { diff --git a/guava/src/com/google/common/collect/ImmutableList.java b/guava/src/com/google/common/collect/ImmutableList.java index 3937ce90853d..dea442d6c911 100644 --- a/guava/src/com/google/common/collect/ImmutableList.java +++ b/guava/src/com/google/common/collect/ImmutableList.java @@ -63,7 +63,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableList extends ImmutableCollection implements List, RandomAccess { diff --git a/guava/src/com/google/common/collect/ImmutableListMultimap.java b/guava/src/com/google/common/collect/ImmutableListMultimap.java index a8741d46d412..4e16b570ca44 100644 --- a/guava/src/com/google/common/collect/ImmutableListMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableListMultimap.java @@ -51,7 +51,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class ImmutableListMultimap extends ImmutableMultimap implements ListMultimap { /** diff --git a/guava/src/com/google/common/collect/ImmutableMap.java b/guava/src/com/google/common/collect/ImmutableMap.java index 7abfb5379a98..81b3eed3adc8 100644 --- a/guava/src/com/google/common/collect/ImmutableMap.java +++ b/guava/src/com/google/common/collect/ImmutableMap.java @@ -72,7 +72,6 @@ @DoNotMock("Use ImmutableMap.of or another implementation") @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableMap implements Map, Serializable { /** diff --git a/guava/src/com/google/common/collect/ImmutableMapEntry.java b/guava/src/com/google/common/collect/ImmutableMapEntry.java index e44ffaa5d50e..bf7e0d79c720 100644 --- a/guava/src/com/google/common/collect/ImmutableMapEntry.java +++ b/guava/src/com/google/common/collect/ImmutableMapEntry.java @@ -33,7 +33,6 @@ * @author Louis Wasserman */ @GwtIncompatible // unnecessary -@ElementTypesAreNonnullByDefault class ImmutableMapEntry extends ImmutableEntry { /** * Creates an {@code ImmutableMapEntry} array to hold parameterized entries. The result must never diff --git a/guava/src/com/google/common/collect/ImmutableMapEntrySet.java b/guava/src/com/google/common/collect/ImmutableMapEntrySet.java index 19f75cbbb99d..38c8da1d643b 100644 --- a/guava/src/com/google/common/collect/ImmutableMapEntrySet.java +++ b/guava/src/com/google/common/collect/ImmutableMapEntrySet.java @@ -35,7 +35,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ImmutableMapEntrySet extends ImmutableSet.CachingAsList> { static final class RegularEntrySet extends ImmutableMapEntrySet { private final transient ImmutableMap map; diff --git a/guava/src/com/google/common/collect/ImmutableMapKeySet.java b/guava/src/com/google/common/collect/ImmutableMapKeySet.java index fb2661f478fb..c243f4ccacb9 100644 --- a/guava/src/com/google/common/collect/ImmutableMapKeySet.java +++ b/guava/src/com/google/common/collect/ImmutableMapKeySet.java @@ -33,7 +33,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class ImmutableMapKeySet extends IndexedImmutableSet { private final ImmutableMap map; diff --git a/guava/src/com/google/common/collect/ImmutableMapValues.java b/guava/src/com/google/common/collect/ImmutableMapValues.java index 83136459943d..9fb30a596b70 100644 --- a/guava/src/com/google/common/collect/ImmutableMapValues.java +++ b/guava/src/com/google/common/collect/ImmutableMapValues.java @@ -34,7 +34,6 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class ImmutableMapValues extends ImmutableCollection { private final ImmutableMap map; diff --git a/guava/src/com/google/common/collect/ImmutableMultimap.java b/guava/src/com/google/common/collect/ImmutableMultimap.java index 42f55d2b0ba6..9060c86c9ea7 100644 --- a/guava/src/com/google/common/collect/ImmutableMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableMultimap.java @@ -74,7 +74,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class ImmutableMultimap extends BaseImmutableMultimap implements Serializable { diff --git a/guava/src/com/google/common/collect/ImmutableMultiset.java b/guava/src/com/google/common/collect/ImmutableMultiset.java index 34951c5fb1c2..d878836d3ee9 100644 --- a/guava/src/com/google/common/collect/ImmutableMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableMultiset.java @@ -58,7 +58,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableMultiset extends ImmutableMultisetGwtSerializationDependencies implements Multiset { diff --git a/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java b/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java index 2469a188a2a6..a8b1899d280c 100644 --- a/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java @@ -37,5 +37,4 @@ * and make types non-final. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ImmutableMultisetGwtSerializationDependencies extends ImmutableCollection {} diff --git a/guava/src/com/google/common/collect/ImmutableRangeMap.java b/guava/src/com/google/common/collect/ImmutableRangeMap.java index b885e1fd1505..18fe3ddea237 100644 --- a/guava/src/com/google/common/collect/ImmutableRangeMap.java +++ b/guava/src/com/google/common/collect/ImmutableRangeMap.java @@ -48,7 +48,6 @@ * @since 14.0 */ @GwtIncompatible // NavigableMap -@ElementTypesAreNonnullByDefault public class ImmutableRangeMap, V> implements RangeMap, Serializable { private static final ImmutableRangeMap, Object> EMPTY = diff --git a/guava/src/com/google/common/collect/ImmutableRangeSet.java b/guava/src/com/google/common/collect/ImmutableRangeSet.java index 8ac39124def9..141ea13fe267 100644 --- a/guava/src/com/google/common/collect/ImmutableRangeSet.java +++ b/guava/src/com/google/common/collect/ImmutableRangeSet.java @@ -53,7 +53,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ImmutableRangeSet extends AbstractRangeSet implements Serializable { diff --git a/guava/src/com/google/common/collect/ImmutableSet.java b/guava/src/com/google/common/collect/ImmutableSet.java index 186df3c9c78b..faf41416704e 100644 --- a/guava/src/com/google/common/collect/ImmutableSet.java +++ b/guava/src/com/google/common/collect/ImmutableSet.java @@ -57,7 +57,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableSet extends ImmutableCollection implements Set { static final int SPLITERATOR_CHARACTERISTICS = ImmutableCollection.SPLITERATOR_CHARACTERISTICS | Spliterator.DISTINCT; diff --git a/guava/src/com/google/common/collect/ImmutableSetMultimap.java b/guava/src/com/google/common/collect/ImmutableSetMultimap.java index 7736f6310c17..8409f900aba6 100644 --- a/guava/src/com/google/common/collect/ImmutableSetMultimap.java +++ b/guava/src/com/google/common/collect/ImmutableSetMultimap.java @@ -61,7 +61,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class ImmutableSetMultimap extends ImmutableMultimap implements SetMultimap { /** diff --git a/guava/src/com/google/common/collect/ImmutableSortedAsList.java b/guava/src/com/google/common/collect/ImmutableSortedAsList.java index 1736f2b8e1eb..19d08eef0f71 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedAsList.java +++ b/guava/src/com/google/common/collect/ImmutableSortedAsList.java @@ -29,7 +29,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("serial") -@ElementTypesAreNonnullByDefault final class ImmutableSortedAsList extends RegularImmutableAsList implements SortedIterable { ImmutableSortedAsList(ImmutableSortedSet backingSet, ImmutableList backingList) { diff --git a/guava/src/com/google/common/collect/ImmutableSortedMap.java b/guava/src/com/google/common/collect/ImmutableSortedMap.java index 613bada22c85..57e7f8d34d20 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMap.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMap.java @@ -64,7 +64,6 @@ * @since 2.0 (implements {@code NavigableMap} since 12.0) */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class ImmutableSortedMap extends ImmutableMap implements NavigableMap { /** diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java index c68478b42897..ba23dd43b353 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java @@ -54,7 +54,6 @@ * @since 12.0 */ @GwtIncompatible // hasn't been tested yet -@ElementTypesAreNonnullByDefault public abstract class ImmutableSortedMultiset extends ImmutableMultiset implements SortedMultiset { // TODO(lowasser): GWT compatibility diff --git a/guava/src/com/google/common/collect/ImmutableSortedSet.java b/guava/src/com/google/common/collect/ImmutableSortedSet.java index 23f8bdd848f4..4611cfb39cea 100644 --- a/guava/src/com/google/common/collect/ImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/ImmutableSortedSet.java @@ -65,7 +65,6 @@ // TODO(benyu): benchmark and optimize all creation paths, which are a mess now @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // we're overriding default serialization -@ElementTypesAreNonnullByDefault public abstract class ImmutableSortedSet extends ImmutableSet.CachingAsList implements NavigableSet, SortedIterable { static final int SPLITERATOR_CHARACTERISTICS = diff --git a/guava/src/com/google/common/collect/ImmutableTable.java b/guava/src/com/google/common/collect/ImmutableTable.java index 1b43f393525b..4ae0b47bc20f 100644 --- a/guava/src/com/google/common/collect/ImmutableTable.java +++ b/guava/src/com/google/common/collect/ImmutableTable.java @@ -52,7 +52,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ImmutableTable extends AbstractTable implements Serializable { diff --git a/guava/src/com/google/common/collect/IndexedImmutableSet.java b/guava/src/com/google/common/collect/IndexedImmutableSet.java index 396ce6b0fcf6..6572876d2759 100644 --- a/guava/src/com/google/common/collect/IndexedImmutableSet.java +++ b/guava/src/com/google/common/collect/IndexedImmutableSet.java @@ -26,7 +26,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class IndexedImmutableSet extends ImmutableSet.CachingAsList { abstract E get(int index); diff --git a/guava/src/com/google/common/collect/Interner.java b/guava/src/com/google/common/collect/Interner.java index 8b48fcded9ef..e8a9002d5cd5 100644 --- a/guava/src/com/google/common/collect/Interner.java +++ b/guava/src/com/google/common/collect/Interner.java @@ -34,7 +34,6 @@ @DoNotMock("Use Interners.new*Interner") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface Interner { /** * Chooses and returns the representative instance for any of a collection of instances that are diff --git a/guava/src/com/google/common/collect/Interners.java b/guava/src/com/google/common/collect/Interners.java index 449806b439dd..b30e8c47978d 100644 --- a/guava/src/com/google/common/collect/Interners.java +++ b/guava/src/com/google/common/collect/Interners.java @@ -33,7 +33,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Interners { private Interners() {} diff --git a/guava/src/com/google/common/collect/Iterables.java b/guava/src/com/google/common/collect/Iterables.java index 5df71c5c637f..c02028c33d64 100644 --- a/guava/src/com/google/common/collect/Iterables.java +++ b/guava/src/com/google/common/collect/Iterables.java @@ -65,7 +65,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Iterables { private Iterables() {} diff --git a/guava/src/com/google/common/collect/Iterators.java b/guava/src/com/google/common/collect/Iterators.java index b610262a4fc7..2d6460ecc225 100644 --- a/guava/src/com/google/common/collect/Iterators.java +++ b/guava/src/com/google/common/collect/Iterators.java @@ -69,7 +69,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Iterators { private Iterators() {} diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java index fbcd3df845c2..8dc946c0ff97 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java @@ -33,7 +33,6 @@ * protecting against hash flooding. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class JdkBackedImmutableBiMap extends ImmutableBiMap { static ImmutableBiMap create(int n, @Nullable Entry[] entryArray) { Map forwardDelegate = Maps.newHashMapWithExpectedSize(n); diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java index 0dd791923c88..1beca3dd7e77 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java @@ -34,7 +34,6 @@ * hash flooding. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class JdkBackedImmutableMap extends ImmutableMap { /** * Creates an {@code ImmutableMap} backed by a JDK HashMap. Used when probable hash flooding is diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java b/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java index e18bb5774593..0a561128331e 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableMultiset.java @@ -32,7 +32,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class JdkBackedImmutableMultiset extends ImmutableMultiset { private final Map delegateMap; private final ImmutableList> entries; diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableSet.java b/guava/src/com/google/common/collect/JdkBackedImmutableSet.java index bee7076fab23..7178b6f9f45c 100644 --- a/guava/src/com/google/common/collect/JdkBackedImmutableSet.java +++ b/guava/src/com/google/common/collect/JdkBackedImmutableSet.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class JdkBackedImmutableSet extends IndexedImmutableSet { private final Set delegate; private final ImmutableList delegateList; diff --git a/guava/src/com/google/common/collect/LexicographicalOrdering.java b/guava/src/com/google/common/collect/LexicographicalOrdering.java index 91fc7bf7241c..c7c3a9f9b5aa 100644 --- a/guava/src/com/google/common/collect/LexicographicalOrdering.java +++ b/guava/src/com/google/common/collect/LexicographicalOrdering.java @@ -25,7 +25,6 @@ /** An ordering which sorts iterables by comparing corresponding elements pairwise. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class LexicographicalOrdering extends Ordering> implements Serializable { final Comparator elementOrder; diff --git a/guava/src/com/google/common/collect/LinkedHashMultimap.java b/guava/src/com/google/common/collect/LinkedHashMultimap.java index 93f02eadad6b..f742cf194338 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultimap.java +++ b/guava/src/com/google/common/collect/LinkedHashMultimap.java @@ -84,7 +84,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class LinkedHashMultimap extends LinkedHashMultimapGwtSerializationDependencies { diff --git a/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java b/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java index bb4a2e490e45..75e76024e2de 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java +++ b/guava/src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; import java.util.Map; +import org.checkerframework.checker.nullness.qual.Nullable; /** * A dummy superclass to support GWT serialization of the element types of a {@link @@ -30,7 +31,8 @@ *

                            TODO(cpovirk): Consider applying this subclass approach to our other types. */ @GwtCompatible(emulated = true) -abstract class LinkedHashMultimapGwtSerializationDependencies +abstract class LinkedHashMultimapGwtSerializationDependencies< + K extends @Nullable Object, V extends @Nullable Object> extends AbstractSetMultimap { LinkedHashMultimapGwtSerializationDependencies(Map> map) { super(map); diff --git a/guava/src/com/google/common/collect/LinkedHashMultiset.java b/guava/src/com/google/common/collect/LinkedHashMultiset.java index 9fda467eee4e..76a5f27a0be7 100644 --- a/guava/src/com/google/common/collect/LinkedHashMultiset.java +++ b/guava/src/com/google/common/collect/LinkedHashMultiset.java @@ -40,7 +40,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public final class LinkedHashMultiset extends AbstractMapBasedMultiset { diff --git a/guava/src/com/google/common/collect/LinkedListMultimap.java b/guava/src/com/google/common/collect/LinkedListMultimap.java index d5edcb8ce040..062e15271177 100644 --- a/guava/src/com/google/common/collect/LinkedListMultimap.java +++ b/guava/src/com/google/common/collect/LinkedListMultimap.java @@ -97,7 +97,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class LinkedListMultimap extends AbstractMultimap implements ListMultimap, Serializable { /* diff --git a/guava/src/com/google/common/collect/ListMultimap.java b/guava/src/com/google/common/collect/ListMultimap.java index 29e58077cdaa..6aa92c09f2cf 100644 --- a/guava/src/com/google/common/collect/ListMultimap.java +++ b/guava/src/com/google/common/collect/ListMultimap.java @@ -40,7 +40,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface ListMultimap extends Multimap { /** diff --git a/guava/src/com/google/common/collect/Lists.java b/guava/src/com/google/common/collect/Lists.java index b354b39993a8..9ffc47b7c3a1 100644 --- a/guava/src/com/google/common/collect/Lists.java +++ b/guava/src/com/google/common/collect/Lists.java @@ -67,7 +67,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Lists { private Lists() {} diff --git a/guava/src/com/google/common/collect/MapDifference.java b/guava/src/com/google/common/collect/MapDifference.java index 5000e4b527c1..c073871f377d 100644 --- a/guava/src/com/google/common/collect/MapDifference.java +++ b/guava/src/com/google/common/collect/MapDifference.java @@ -30,7 +30,6 @@ */ @DoNotMock("Use Maps.difference") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface MapDifference { /** * Returns {@code true} if there are no differences between the two maps; that is, if the maps are diff --git a/guava/src/com/google/common/collect/MapMaker.java b/guava/src/com/google/common/collect/MapMaker.java index 4fb4ec8242cf..69a964bf3c28 100644 --- a/guava/src/com/google/common/collect/MapMaker.java +++ b/guava/src/com/google/common/collect/MapMaker.java @@ -88,7 +88,6 @@ */ @J2ktIncompatible @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class MapMaker { private static final int DEFAULT_INITIAL_CAPACITY = 16; private static final int DEFAULT_CONCURRENCY_LEVEL = 4; diff --git a/guava/src/com/google/common/collect/MapMakerInternalMap.java b/guava/src/com/google/common/collect/MapMakerInternalMap.java index 44e64ebc2629..fbdae74af5a7 100644 --- a/guava/src/com/google/common/collect/MapMakerInternalMap.java +++ b/guava/src/com/google/common/collect/MapMakerInternalMap.java @@ -51,6 +51,7 @@ import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.locks.ReentrantLock; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullUnmarked; /** * The concurrent hash map implementation built by {@link MapMaker}. @@ -73,7 +74,7 @@ "GuardedBy", // TODO(b/35466881): Fix or suppress. "nullness", // too much trouble for the payoff }) -// TODO(cpovirk): Annotate for nullness. +@NullUnmarked // TODO(cpovirk): Annotate for nullness. class MapMakerInternalMap< K, V, diff --git a/guava/src/com/google/common/collect/Maps.java b/guava/src/com/google/common/collect/Maps.java index 345fc180579c..bbab0db02bbf 100644 --- a/guava/src/com/google/common/collect/Maps.java +++ b/guava/src/com/google/common/collect/Maps.java @@ -94,7 +94,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Maps { private Maps() {} diff --git a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java index dc9a28f2737f..b05bbb4d9b5f 100644 --- a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java +++ b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java @@ -102,7 +102,6 @@ * @since 8.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class MinMaxPriorityQueue extends AbstractQueue { /** diff --git a/guava/src/com/google/common/collect/MoreCollectors.java b/guava/src/com/google/common/collect/MoreCollectors.java index 3c57ea0a9388..90e0269eeb78 100644 --- a/guava/src/com/google/common/collect/MoreCollectors.java +++ b/guava/src/com/google/common/collect/MoreCollectors.java @@ -36,7 +36,6 @@ * @since 21.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class MoreCollectors { /* diff --git a/guava/src/com/google/common/collect/Multimap.java b/guava/src/com/google/common/collect/Multimap.java index 45b15db51e40..f525f155451c 100644 --- a/guava/src/com/google/common/collect/Multimap.java +++ b/guava/src/com/google/common/collect/Multimap.java @@ -164,7 +164,6 @@ */ @DoNotMock("Use ImmutableMultimap, HashMultimap, or another implementation") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Multimap { // Query Operations diff --git a/guava/src/com/google/common/collect/MultimapBuilder.java b/guava/src/com/google/common/collect/MultimapBuilder.java index 96aacfb3205e..0104cf4f8cb6 100644 --- a/guava/src/com/google/common/collect/MultimapBuilder.java +++ b/guava/src/com/google/common/collect/MultimapBuilder.java @@ -59,7 +59,6 @@ * @since 16.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class MultimapBuilder { /* * Leaving K and V as upper bounds rather than the actual key and value types allows type diff --git a/guava/src/com/google/common/collect/Multimaps.java b/guava/src/com/google/common/collect/Multimaps.java index c0aaa2cba375..a42854ccd9ca 100644 --- a/guava/src/com/google/common/collect/Multimaps.java +++ b/guava/src/com/google/common/collect/Multimaps.java @@ -73,7 +73,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Multimaps { private Multimaps() {} diff --git a/guava/src/com/google/common/collect/Multiset.java b/guava/src/com/google/common/collect/Multiset.java index 997c467ff7f4..f7e867b76e78 100644 --- a/guava/src/com/google/common/collect/Multiset.java +++ b/guava/src/com/google/common/collect/Multiset.java @@ -94,7 +94,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Multiset extends Collection { // Query Operations diff --git a/guava/src/com/google/common/collect/Multisets.java b/guava/src/com/google/common/collect/Multisets.java index 50a450d55fef..2eb8c8bc95d3 100644 --- a/guava/src/com/google/common/collect/Multisets.java +++ b/guava/src/com/google/common/collect/Multisets.java @@ -63,7 +63,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Multisets { private Multisets() {} diff --git a/guava/src/com/google/common/collect/MutableClassToInstanceMap.java b/guava/src/com/google/common/collect/MutableClassToInstanceMap.java index 1759eb6c3f2c..bd32c897670b 100644 --- a/guava/src/com/google/common/collect/MutableClassToInstanceMap.java +++ b/guava/src/com/google/common/collect/MutableClassToInstanceMap.java @@ -49,7 +49,6 @@ @J2ktIncompatible @GwtIncompatible @SuppressWarnings("serial") // using writeReplace instead of standard serialization -@ElementTypesAreNonnullByDefault public final class MutableClassToInstanceMap extends ForwardingMap, B> implements ClassToInstanceMap, Serializable { diff --git a/guava/src/com/google/common/collect/NaturalOrdering.java b/guava/src/com/google/common/collect/NaturalOrdering.java index dae531270173..6a25165062b8 100644 --- a/guava/src/com/google/common/collect/NaturalOrdering.java +++ b/guava/src/com/google/common/collect/NaturalOrdering.java @@ -27,7 +27,6 @@ /** An ordering that uses the natural order of the values. */ @GwtCompatible(serializable = true) @SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this?? -@ElementTypesAreNonnullByDefault final class NaturalOrdering extends Ordering> implements Serializable { static final NaturalOrdering INSTANCE = new NaturalOrdering(); diff --git a/guava/src/com/google/common/collect/NullnessCasts.java b/guava/src/com/google/common/collect/NullnessCasts.java index 4f894dbd3139..23ebbb1e1808 100644 --- a/guava/src/com/google/common/collect/NullnessCasts.java +++ b/guava/src/com/google/common/collect/NullnessCasts.java @@ -20,7 +20,6 @@ /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class NullnessCasts { /** * Accepts a {@code @Nullable T} and returns a plain {@code T}, without performing any check that diff --git a/guava/src/com/google/common/collect/NullsFirstOrdering.java b/guava/src/com/google/common/collect/NullsFirstOrdering.java index c451ea8c0aed..59848f5d57b8 100644 --- a/guava/src/com/google/common/collect/NullsFirstOrdering.java +++ b/guava/src/com/google/common/collect/NullsFirstOrdering.java @@ -24,7 +24,6 @@ /** An ordering that treats {@code null} as less than all other values. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class NullsFirstOrdering extends Ordering<@Nullable T> implements Serializable { final Ordering ordering; diff --git a/guava/src/com/google/common/collect/NullsLastOrdering.java b/guava/src/com/google/common/collect/NullsLastOrdering.java index 88917852e67d..74e329375fc2 100644 --- a/guava/src/com/google/common/collect/NullsLastOrdering.java +++ b/guava/src/com/google/common/collect/NullsLastOrdering.java @@ -24,7 +24,6 @@ /** An ordering that treats {@code null} as greater than all other values. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class NullsLastOrdering extends Ordering<@Nullable T> implements Serializable { final Ordering ordering; diff --git a/guava/src/com/google/common/collect/ObjectArrays.java b/guava/src/com/google/common/collect/ObjectArrays.java index b4f6c20302c9..c25ebc40bbb0 100644 --- a/guava/src/com/google/common/collect/ObjectArrays.java +++ b/guava/src/com/google/common/collect/ObjectArrays.java @@ -35,7 +35,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault @SuppressWarnings("AvoidObjectArrays") public final class ObjectArrays { diff --git a/guava/src/com/google/common/collect/Ordering.java b/guava/src/com/google/common/collect/Ordering.java index 342f2013bf74..1696240a47c3 100644 --- a/guava/src/com/google/common/collect/Ordering.java +++ b/guava/src/com/google/common/collect/Ordering.java @@ -151,7 +151,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class Ordering implements Comparator { // Natural order diff --git a/guava/src/com/google/common/collect/ParametricNullness.java b/guava/src/com/google/common/collect/ParametricNullness.java index 207c05262e41..8074de5d5689 100644 --- a/guava/src/com/google/common/collect/ParametricNullness.java +++ b/guava/src/com/google/common/collect/ParametricNullness.java @@ -56,8 +56,8 @@ *

                              *
                            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/collect/PeekingIterator.java b/guava/src/com/google/common/collect/PeekingIterator.java index 8524ed7514dc..bf1e10d9bdde 100644 --- a/guava/src/com/google/common/collect/PeekingIterator.java +++ b/guava/src/com/google/common/collect/PeekingIterator.java @@ -35,7 +35,6 @@ */ @DoNotMock("Use Iterators.peekingIterator") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface PeekingIterator extends Iterator { /** * Returns the next element in the iteration, without advancing the iteration. diff --git a/guava/src/com/google/common/collect/Platform.java b/guava/src/com/google/common/collect/Platform.java index 7422e28910e5..e87a4fee1fa2 100644 --- a/guava/src/com/google/common/collect/Platform.java +++ b/guava/src/com/google/common/collect/Platform.java @@ -30,7 +30,6 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { /** Returns the platform preferred implementation of a map based on a hash table. */ diff --git a/guava/src/com/google/common/collect/Queues.java b/guava/src/com/google/common/collect/Queues.java index 7c4af7df9d50..b5631d75f3bf 100644 --- a/guava/src/com/google/common/collect/Queues.java +++ b/guava/src/com/google/common/collect/Queues.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Queues { private Queues() {} diff --git a/guava/src/com/google/common/collect/Range.java b/guava/src/com/google/common/collect/Range.java index baf6bf55be40..2ee4a8d1351d 100644 --- a/guava/src/com/google/common/collect/Range.java +++ b/guava/src/com/google/common/collect/Range.java @@ -120,7 +120,6 @@ @GwtCompatible @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @Immutable(containerOf = "C") -@ElementTypesAreNonnullByDefault public final class Range extends RangeGwtSerializationDependencies implements Predicate, Serializable { @SuppressWarnings("unchecked") diff --git a/guava/src/com/google/common/collect/RangeMap.java b/guava/src/com/google/common/collect/RangeMap.java index 039c8bd62661..d8a93c552154 100644 --- a/guava/src/com/google/common/collect/RangeMap.java +++ b/guava/src/com/google/common/collect/RangeMap.java @@ -39,7 +39,6 @@ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @DoNotMock("Use ImmutableRangeMap or TreeRangeMap") @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface RangeMap { /* * TODO(cpovirk): These docs sometimes say "map" and sometimes say "range map." Pick one, or at diff --git a/guava/src/com/google/common/collect/RangeSet.java b/guava/src/com/google/common/collect/RangeSet.java index 293c343d7559..fc561b4dd31b 100644 --- a/guava/src/com/google/common/collect/RangeSet.java +++ b/guava/src/com/google/common/collect/RangeSet.java @@ -51,7 +51,6 @@ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @DoNotMock("Use ImmutableRangeSet or TreeRangeSet") @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface RangeSet { // TODO(lowasser): consider adding default implementations of some of these methods diff --git a/guava/src/com/google/common/collect/RegularContiguousSet.java b/guava/src/com/google/common/collect/RegularContiguousSet.java index f4804620fd92..1fa71acb0a20 100644 --- a/guava/src/com/google/common/collect/RegularContiguousSet.java +++ b/guava/src/com/google/common/collect/RegularContiguousSet.java @@ -36,7 +36,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 -@ElementTypesAreNonnullByDefault final class RegularContiguousSet extends ContiguousSet { private final Range range; diff --git a/guava/src/com/google/common/collect/RegularImmutableAsList.java b/guava/src/com/google/common/collect/RegularImmutableAsList.java index bc4d8ae5d36e..e2dd3c2f2872 100644 --- a/guava/src/com/google/common/collect/RegularImmutableAsList.java +++ b/guava/src/com/google/common/collect/RegularImmutableAsList.java @@ -31,7 +31,6 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("serial") // uses writeReplace, not default serialization -@ElementTypesAreNonnullByDefault class RegularImmutableAsList extends ImmutableAsList { private final ImmutableCollection delegate; private final ImmutableList delegateList; diff --git a/guava/src/com/google/common/collect/RegularImmutableBiMap.java b/guava/src/com/google/common/collect/RegularImmutableBiMap.java index 9fb6236fb3c0..ed36b072941e 100644 --- a/guava/src/com/google/common/collect/RegularImmutableBiMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableBiMap.java @@ -48,7 +48,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault class RegularImmutableBiMap extends ImmutableBiMap { @SuppressWarnings("unchecked") // TODO(cpovirk): Consider storing Entry[] instead. static final RegularImmutableBiMap EMPTY = diff --git a/guava/src/com/google/common/collect/RegularImmutableList.java b/guava/src/com/google/common/collect/RegularImmutableList.java index 92f2d5e9fbe9..ada9a09aa60e 100644 --- a/guava/src/com/google/common/collect/RegularImmutableList.java +++ b/guava/src/com/google/common/collect/RegularImmutableList.java @@ -33,7 +33,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault class RegularImmutableList extends ImmutableList { static final ImmutableList EMPTY = new RegularImmutableList<>(new Object[0]); diff --git a/guava/src/com/google/common/collect/RegularImmutableMap.java b/guava/src/com/google/common/collect/RegularImmutableMap.java index 9565dca82107..97702778b97c 100644 --- a/guava/src/com/google/common/collect/RegularImmutableMap.java +++ b/guava/src/com/google/common/collect/RegularImmutableMap.java @@ -45,7 +45,6 @@ * @author Gregory Kick */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault final class RegularImmutableMap extends ImmutableMap { @SuppressWarnings("unchecked") static final ImmutableMap EMPTY = diff --git a/guava/src/com/google/common/collect/RegularImmutableMultiset.java b/guava/src/com/google/common/collect/RegularImmutableMultiset.java index 2c88df437492..8524a69a4572 100644 --- a/guava/src/com/google/common/collect/RegularImmutableMultiset.java +++ b/guava/src/com/google/common/collect/RegularImmutableMultiset.java @@ -37,7 +37,6 @@ */ @GwtCompatible(emulated = true, serializable = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault class RegularImmutableMultiset extends ImmutableMultiset { private static final ImmutableEntry[] EMPTY_ARRAY = new ImmutableEntry[0]; static final ImmutableMultiset EMPTY = create(ImmutableList.>of()); diff --git a/guava/src/com/google/common/collect/RegularImmutableSet.java b/guava/src/com/google/common/collect/RegularImmutableSet.java index 8ece4b61e1fc..a6ce92e17097 100644 --- a/guava/src/com/google/common/collect/RegularImmutableSet.java +++ b/guava/src/com/google/common/collect/RegularImmutableSet.java @@ -34,7 +34,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault final class RegularImmutableSet extends ImmutableSet.CachingAsList { private static final Object[] EMPTY_ARRAY = new Object[0]; static final RegularImmutableSet EMPTY = diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java index 832508e1d4b5..9acda0bd2d38 100644 --- a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java +++ b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java @@ -33,7 +33,6 @@ */ @SuppressWarnings("serial") // uses writeReplace, not default serialization @GwtIncompatible -@ElementTypesAreNonnullByDefault final class RegularImmutableSortedMultiset extends ImmutableSortedMultiset { private static final long[] ZERO_CUMULATIVE_COUNTS = {0}; diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java index 8fb5e6f69444..cac60cb2126a 100644 --- a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java +++ b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java @@ -41,7 +41,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings({"serial", "rawtypes"}) -@ElementTypesAreNonnullByDefault final class RegularImmutableSortedSet extends ImmutableSortedSet { static final RegularImmutableSortedSet NATURAL_EMPTY_SET = new RegularImmutableSortedSet<>(ImmutableList.of(), Ordering.natural()); diff --git a/guava/src/com/google/common/collect/RegularImmutableTable.java b/guava/src/com/google/common/collect/RegularImmutableTable.java index 97be4c13bc9f..deae2187fd33 100644 --- a/guava/src/com/google/common/collect/RegularImmutableTable.java +++ b/guava/src/com/google/common/collect/RegularImmutableTable.java @@ -34,7 +34,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class RegularImmutableTable extends ImmutableTable { RegularImmutableTable() {} diff --git a/guava/src/com/google/common/collect/ReverseNaturalOrdering.java b/guava/src/com/google/common/collect/ReverseNaturalOrdering.java index f0c40cb61262..a91cd9c82cb0 100644 --- a/guava/src/com/google/common/collect/ReverseNaturalOrdering.java +++ b/guava/src/com/google/common/collect/ReverseNaturalOrdering.java @@ -25,7 +25,6 @@ /** An ordering that uses the reverse of the natural order of the values. */ @GwtCompatible(serializable = true) @SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this?? -@ElementTypesAreNonnullByDefault final class ReverseNaturalOrdering extends Ordering> implements Serializable { static final ReverseNaturalOrdering INSTANCE = new ReverseNaturalOrdering(); diff --git a/guava/src/com/google/common/collect/ReverseOrdering.java b/guava/src/com/google/common/collect/ReverseOrdering.java index 6c1e74dd73d5..89271576597c 100644 --- a/guava/src/com/google/common/collect/ReverseOrdering.java +++ b/guava/src/com/google/common/collect/ReverseOrdering.java @@ -26,7 +26,6 @@ /** An ordering that uses the reverse of a given order. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class ReverseOrdering extends Ordering implements Serializable { final Ordering forwardOrder; diff --git a/guava/src/com/google/common/collect/RowSortedTable.java b/guava/src/com/google/common/collect/RowSortedTable.java index 2c2d773f78db..0bd724a82d26 100644 --- a/guava/src/com/google/common/collect/RowSortedTable.java +++ b/guava/src/com/google/common/collect/RowSortedTable.java @@ -34,7 +34,6 @@ * @since 8.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface RowSortedTable< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> extends Table { diff --git a/guava/src/com/google/common/collect/Serialization.java b/guava/src/com/google/common/collect/Serialization.java index e12e84cd2b2a..d9a11b612267 100644 --- a/guava/src/com/google/common/collect/Serialization.java +++ b/guava/src/com/google/common/collect/Serialization.java @@ -36,7 +36,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault final class Serialization { private Serialization() {} diff --git a/guava/src/com/google/common/collect/SetMultimap.java b/guava/src/com/google/common/collect/SetMultimap.java index b7a54570a496..4b398859030b 100644 --- a/guava/src/com/google/common/collect/SetMultimap.java +++ b/guava/src/com/google/common/collect/SetMultimap.java @@ -52,7 +52,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface SetMultimap extends Multimap { /** diff --git a/guava/src/com/google/common/collect/Sets.java b/guava/src/com/google/common/collect/Sets.java index cb48838fe922..8da69e7fa8a0 100644 --- a/guava/src/com/google/common/collect/Sets.java +++ b/guava/src/com/google/common/collect/Sets.java @@ -72,7 +72,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Sets { private Sets() {} diff --git a/guava/src/com/google/common/collect/SingletonImmutableBiMap.java b/guava/src/com/google/common/collect/SingletonImmutableBiMap.java index dd7a0586ffe5..b2f401f591b0 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableBiMap.java +++ b/guava/src/com/google/common/collect/SingletonImmutableBiMap.java @@ -36,7 +36,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault final class SingletonImmutableBiMap extends ImmutableBiMap { final transient K singleKey; diff --git a/guava/src/com/google/common/collect/SingletonImmutableList.java b/guava/src/com/google/common/collect/SingletonImmutableList.java index c9f4d501a576..cb0ad5c15c8e 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableList.java +++ b/guava/src/com/google/common/collect/SingletonImmutableList.java @@ -33,7 +33,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault final class SingletonImmutableList extends ImmutableList { final transient E element; diff --git a/guava/src/com/google/common/collect/SingletonImmutableSet.java b/guava/src/com/google/common/collect/SingletonImmutableSet.java index 08b978240386..c527cdad4036 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableSet.java +++ b/guava/src/com/google/common/collect/SingletonImmutableSet.java @@ -33,7 +33,6 @@ */ @GwtCompatible(serializable = true, emulated = true) @SuppressWarnings("serial") // uses writeReplace(), not default serialization -@ElementTypesAreNonnullByDefault final class SingletonImmutableSet extends ImmutableSet { // We deliberately avoid caching the asList and hashCode here, to ensure that with // compressed oops, a SingletonImmutableSet packs all the way down to the optimal 16 bytes. diff --git a/guava/src/com/google/common/collect/SingletonImmutableTable.java b/guava/src/com/google/common/collect/SingletonImmutableTable.java index 6f839ceb4ca1..5e4975ce2895 100644 --- a/guava/src/com/google/common/collect/SingletonImmutableTable.java +++ b/guava/src/com/google/common/collect/SingletonImmutableTable.java @@ -29,7 +29,6 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault class SingletonImmutableTable extends ImmutableTable { final R singleRowKey; final C singleColumnKey; diff --git a/guava/src/com/google/common/collect/SortedIterable.java b/guava/src/com/google/common/collect/SortedIterable.java index 64ec08ef315b..515fd207ddb8 100644 --- a/guava/src/com/google/common/collect/SortedIterable.java +++ b/guava/src/com/google/common/collect/SortedIterable.java @@ -26,7 +26,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault interface SortedIterable extends Iterable { /** * Returns the {@code Comparator} by which the elements of this iterable are ordered, or {@code diff --git a/guava/src/com/google/common/collect/SortedIterables.java b/guava/src/com/google/common/collect/SortedIterables.java index 68b231a381e5..5b61bc9b643e 100644 --- a/guava/src/com/google/common/collect/SortedIterables.java +++ b/guava/src/com/google/common/collect/SortedIterables.java @@ -27,7 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class SortedIterables { private SortedIterables() {} diff --git a/guava/src/com/google/common/collect/SortedLists.java b/guava/src/com/google/common/collect/SortedLists.java index 9525fb2f4415..45e93772b4a1 100644 --- a/guava/src/com/google/common/collect/SortedLists.java +++ b/guava/src/com/google/common/collect/SortedLists.java @@ -36,7 +36,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class SortedLists { private SortedLists() {} diff --git a/guava/src/com/google/common/collect/SortedMapDifference.java b/guava/src/com/google/common/collect/SortedMapDifference.java index 46cac8a3da54..7019378e99ec 100644 --- a/guava/src/com/google/common/collect/SortedMapDifference.java +++ b/guava/src/com/google/common/collect/SortedMapDifference.java @@ -27,7 +27,6 @@ * @since 8.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface SortedMapDifference extends MapDifference { diff --git a/guava/src/com/google/common/collect/SortedMultiset.java b/guava/src/com/google/common/collect/SortedMultiset.java index 87969b52c0d9..c3c627199f54 100644 --- a/guava/src/com/google/common/collect/SortedMultiset.java +++ b/guava/src/com/google/common/collect/SortedMultiset.java @@ -43,7 +43,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public interface SortedMultiset extends SortedMultisetBridge, SortedIterable { /** diff --git a/guava/src/com/google/common/collect/SortedMultisetBridge.java b/guava/src/com/google/common/collect/SortedMultisetBridge.java index 72d50beb692f..336f59957e94 100644 --- a/guava/src/com/google/common/collect/SortedMultisetBridge.java +++ b/guava/src/com/google/common/collect/SortedMultisetBridge.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault interface SortedMultisetBridge extends Multiset { @Override SortedSet elementSet(); diff --git a/guava/src/com/google/common/collect/SortedMultisets.java b/guava/src/com/google/common/collect/SortedMultisets.java index f602a42a1145..e868bcdaeb3c 100644 --- a/guava/src/com/google/common/collect/SortedMultisets.java +++ b/guava/src/com/google/common/collect/SortedMultisets.java @@ -37,7 +37,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class SortedMultisets { private SortedMultisets() {} diff --git a/guava/src/com/google/common/collect/SortedSetMultimap.java b/guava/src/com/google/common/collect/SortedSetMultimap.java index 8454aeccb60e..8a4af8eb0515 100644 --- a/guava/src/com/google/common/collect/SortedSetMultimap.java +++ b/guava/src/com/google/common/collect/SortedSetMultimap.java @@ -49,7 +49,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface SortedSetMultimap extends SetMultimap { // Following Javadoc copied from Multimap. diff --git a/guava/src/com/google/common/collect/SparseImmutableTable.java b/guava/src/com/google/common/collect/SparseImmutableTable.java index f7222b120e00..f6ab2c94c45a 100644 --- a/guava/src/com/google/common/collect/SparseImmutableTable.java +++ b/guava/src/com/google/common/collect/SparseImmutableTable.java @@ -27,7 +27,6 @@ /** A {@code RegularImmutableTable} optimized for sparse data. */ @GwtCompatible @Immutable(containerOf = {"R", "C", "V"}) -@ElementTypesAreNonnullByDefault final class SparseImmutableTable extends RegularImmutableTable { static final ImmutableTable EMPTY = new SparseImmutableTable<>( diff --git a/guava/src/com/google/common/collect/StandardRowSortedTable.java b/guava/src/com/google/common/collect/StandardRowSortedTable.java index bea5b7bb3a86..a7739ad6db2e 100644 --- a/guava/src/com/google/common/collect/StandardRowSortedTable.java +++ b/guava/src/com/google/common/collect/StandardRowSortedTable.java @@ -46,7 +46,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault class StandardRowSortedTable extends StandardTable implements RowSortedTable { /* diff --git a/guava/src/com/google/common/collect/StandardTable.java b/guava/src/com/google/common/collect/StandardTable.java index e24e4539e26e..f54ce16ab92e 100644 --- a/guava/src/com/google/common/collect/StandardTable.java +++ b/guava/src/com/google/common/collect/StandardTable.java @@ -70,7 +70,6 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault class StandardTable extends AbstractTable implements Serializable { @GwtTransient final Map> backingMap; @GwtTransient final Supplier> factory; diff --git a/guava/src/com/google/common/collect/Streams.java b/guava/src/com/google/common/collect/Streams.java index 4038937ce675..2067ef205ea1 100644 --- a/guava/src/com/google/common/collect/Streams.java +++ b/guava/src/com/google/common/collect/Streams.java @@ -58,7 +58,6 @@ * @since 21.0 (but only since 33.4.0 in the Android flavor) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Streams { /** * Returns a sequential {@link Stream} of the contents of {@code iterable}, delegating to {@link diff --git a/guava/src/com/google/common/collect/Synchronized.java b/guava/src/com/google/common/collect/Synchronized.java index 98dba274f6c6..a9a2f2d8020a 100644 --- a/guava/src/com/google/common/collect/Synchronized.java +++ b/guava/src/com/google/common/collect/Synchronized.java @@ -67,7 +67,6 @@ */ @J2ktIncompatible @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault /* * I have decided not to bother adding @ParametricNullness annotations in this class. Adding them is * a lot of busy work, and the annotation matters only when the APIs to be annotated are visible to diff --git a/guava/src/com/google/common/collect/Table.java b/guava/src/com/google/common/collect/Table.java index 05ceb1af8f0e..51afcf2eb4c8 100644 --- a/guava/src/com/google/common/collect/Table.java +++ b/guava/src/com/google/common/collect/Table.java @@ -66,7 +66,6 @@ */ @DoNotMock("Use ImmutableTable, HashBasedTable, or another implementation") @GwtCompatible -@ElementTypesAreNonnullByDefault public interface Table< R extends @Nullable Object, C extends @Nullable Object, V extends @Nullable Object> { // TODO(jlevy): Consider adding methods similar to ConcurrentMap methods. diff --git a/guava/src/com/google/common/collect/TableCollectors.java b/guava/src/com/google/common/collect/TableCollectors.java index b052f3157729..acbb534b3bce 100644 --- a/guava/src/com/google/common/collect/TableCollectors.java +++ b/guava/src/com/google/common/collect/TableCollectors.java @@ -30,7 +30,6 @@ /** Collectors utilities for {@code common.collect.Table} internals. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class TableCollectors { static diff --git a/guava/src/com/google/common/collect/Tables.java b/guava/src/com/google/common/collect/Tables.java index a55d691014f3..b969984c81ab 100644 --- a/guava/src/com/google/common/collect/Tables.java +++ b/guava/src/com/google/common/collect/Tables.java @@ -51,7 +51,6 @@ * @since 7.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Tables { private Tables() {} diff --git a/guava/src/com/google/common/collect/TopKSelector.java b/guava/src/com/google/common/collect/TopKSelector.java index d860b3766732..84da38815f65 100644 --- a/guava/src/com/google/common/collect/TopKSelector.java +++ b/guava/src/com/google/common/collect/TopKSelector.java @@ -57,7 +57,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class TopKSelector< T extends @Nullable Object> { diff --git a/guava/src/com/google/common/collect/TransformedIterator.java b/guava/src/com/google/common/collect/TransformedIterator.java index 2456cecde991..a866c7c05061 100644 --- a/guava/src/com/google/common/collect/TransformedIterator.java +++ b/guava/src/com/google/common/collect/TransformedIterator.java @@ -29,7 +29,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class TransformedIterator implements Iterator { final Iterator backingIterator; diff --git a/guava/src/com/google/common/collect/TransformedListIterator.java b/guava/src/com/google/common/collect/TransformedListIterator.java index 22b4b7c42db2..0ebe3acacc8a 100644 --- a/guava/src/com/google/common/collect/TransformedListIterator.java +++ b/guava/src/com/google/common/collect/TransformedListIterator.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault abstract class TransformedListIterator extends TransformedIterator implements ListIterator { TransformedListIterator(ListIterator backingIterator) { diff --git a/guava/src/com/google/common/collect/TreeBasedTable.java b/guava/src/com/google/common/collect/TreeBasedTable.java index f3e1ded4c0f3..3837bc38c09f 100644 --- a/guava/src/com/google/common/collect/TreeBasedTable.java +++ b/guava/src/com/google/common/collect/TreeBasedTable.java @@ -68,7 +68,6 @@ * @since 7.0 */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault public class TreeBasedTable extends StandardRowSortedTable { private final Comparator columnComparator; diff --git a/guava/src/com/google/common/collect/TreeMultimap.java b/guava/src/com/google/common/collect/TreeMultimap.java index 289ea54f67b2..d7b14a9930dc 100644 --- a/guava/src/com/google/common/collect/TreeMultimap.java +++ b/guava/src/com/google/common/collect/TreeMultimap.java @@ -73,7 +73,6 @@ * @since 2.0 */ @GwtCompatible(serializable = true, emulated = true) -@ElementTypesAreNonnullByDefault public class TreeMultimap extends AbstractSortedKeySortedSetMultimap { private transient Comparator keyComparator; diff --git a/guava/src/com/google/common/collect/TreeMultiset.java b/guava/src/com/google/common/collect/TreeMultiset.java index 428371c4cae9..727c14f6e1ce 100644 --- a/guava/src/com/google/common/collect/TreeMultiset.java +++ b/guava/src/com/google/common/collect/TreeMultiset.java @@ -60,7 +60,6 @@ * @since 2.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class TreeMultiset extends AbstractSortedMultiset implements Serializable { diff --git a/guava/src/com/google/common/collect/TreeRangeMap.java b/guava/src/com/google/common/collect/TreeRangeMap.java index dba7189bce0a..39941863ade4 100644 --- a/guava/src/com/google/common/collect/TreeRangeMap.java +++ b/guava/src/com/google/common/collect/TreeRangeMap.java @@ -54,7 +54,6 @@ */ @SuppressWarnings("rawtypes") // https://github.com/google/guava/issues/989 @GwtIncompatible // NavigableMap -@ElementTypesAreNonnullByDefault public final class TreeRangeMap implements RangeMap { private final NavigableMap, RangeMapEntry> entriesByLowerBound; diff --git a/guava/src/com/google/common/collect/TreeRangeSet.java b/guava/src/com/google/common/collect/TreeRangeSet.java index 65dad64b3d01..6a623b387843 100644 --- a/guava/src/com/google/common/collect/TreeRangeSet.java +++ b/guava/src/com/google/common/collect/TreeRangeSet.java @@ -41,7 +41,6 @@ * @since 14.0 */ @GwtIncompatible // uses NavigableMap -@ElementTypesAreNonnullByDefault public class TreeRangeSet> extends AbstractRangeSet implements Serializable { diff --git a/guava/src/com/google/common/collect/TreeTraverser.java b/guava/src/com/google/common/collect/TreeTraverser.java index 1c4dda904882..b0f72b7e3585 100644 --- a/guava/src/com/google/common/collect/TreeTraverser.java +++ b/guava/src/com/google/common/collect/TreeTraverser.java @@ -76,7 +76,6 @@ @Deprecated @Beta @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class TreeTraverser { /** Constructor for use by subclasses. */ public TreeTraverser() {} diff --git a/guava/src/com/google/common/collect/UnmodifiableIterator.java b/guava/src/com/google/common/collect/UnmodifiableIterator.java index 03e52aa2037d..d66e6fcbcab0 100644 --- a/guava/src/com/google/common/collect/UnmodifiableIterator.java +++ b/guava/src/com/google/common/collect/UnmodifiableIterator.java @@ -32,7 +32,6 @@ * @since 2.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class UnmodifiableIterator implements Iterator { /** Constructor for use by subclasses. */ protected UnmodifiableIterator() {} diff --git a/guava/src/com/google/common/collect/UnmodifiableListIterator.java b/guava/src/com/google/common/collect/UnmodifiableListIterator.java index f3d3b921b7dc..f58a4f414ec2 100644 --- a/guava/src/com/google/common/collect/UnmodifiableListIterator.java +++ b/guava/src/com/google/common/collect/UnmodifiableListIterator.java @@ -28,7 +28,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class UnmodifiableListIterator extends UnmodifiableIterator implements ListIterator { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java index 9bf322d1f9d1..354a5e421f17 100644 --- a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java +++ b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java @@ -34,7 +34,6 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class UnmodifiableSortedMultiset extends UnmodifiableMultiset implements SortedMultiset { UnmodifiableSortedMultiset(SortedMultiset delegate) { diff --git a/guava/src/com/google/common/collect/UsingToStringOrdering.java b/guava/src/com/google/common/collect/UsingToStringOrdering.java index 3443b43e7223..3167946b1582 100644 --- a/guava/src/com/google/common/collect/UsingToStringOrdering.java +++ b/guava/src/com/google/common/collect/UsingToStringOrdering.java @@ -21,7 +21,6 @@ /** An ordering that uses the natural order of the string representation of the values. */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault final class UsingToStringOrdering extends Ordering implements Serializable { static final UsingToStringOrdering INSTANCE = new UsingToStringOrdering(); diff --git a/guava/src/com/google/common/collect/package-info.java b/guava/src/com/google/common/collect/package-info.java index ad169a6852c8..b076e568cee9 100644 --- a/guava/src/com/google/common/collect/package-info.java +++ b/guava/src/com/google/common/collect/package-info.java @@ -120,8 +120,6 @@ * */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.collect; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java b/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java index dbe6e3568035..c437f84d91af 100644 --- a/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java +++ b/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java @@ -41,7 +41,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ArrayBasedCharEscaper extends CharEscaper { // The replacement array (see ArrayBasedEscaperMap). private final char[][] replacements; diff --git a/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java b/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java index ea0b9c6772d7..d8036839d57f 100644 --- a/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java +++ b/guava/src/com/google/common/escape/ArrayBasedEscaperMap.java @@ -36,7 +36,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class ArrayBasedEscaperMap { /** * Returns a new ArrayBasedEscaperMap for creating ArrayBasedCharEscaper or diff --git a/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java b/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java index 8514390e5454..55bf685a1640 100644 --- a/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java +++ b/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java @@ -42,7 +42,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ArrayBasedUnicodeEscaper extends UnicodeEscaper { // The replacement array (see ArrayBasedEscaperMap). private final char[][] replacements; diff --git a/guava/src/com/google/common/escape/CharEscaper.java b/guava/src/com/google/common/escape/CharEscaper.java index 136240ec639e..430778321cb8 100644 --- a/guava/src/com/google/common/escape/CharEscaper.java +++ b/guava/src/com/google/common/escape/CharEscaper.java @@ -40,7 +40,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class CharEscaper extends Escaper { /** Constructor for use by subclasses. */ protected CharEscaper() {} diff --git a/guava/src/com/google/common/escape/CharEscaperBuilder.java b/guava/src/com/google/common/escape/CharEscaperBuilder.java index 97528cb569c1..45d228a3b44a 100644 --- a/guava/src/com/google/common/escape/CharEscaperBuilder.java +++ b/guava/src/com/google/common/escape/CharEscaperBuilder.java @@ -34,7 +34,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class CharEscaperBuilder { /** * Simple decorator that turns an array of replacement char[]s into a CharEscaper, this results in diff --git a/guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 992c9a3e4d84..000000000000 --- a/guava/src/com/google/common/escape/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.escape; - -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/guava/src/com/google/common/escape/Escaper.java b/guava/src/com/google/common/escape/Escaper.java index 31b7df0e64ab..16d9b6d1994c 100644 --- a/guava/src/com/google/common/escape/Escaper.java +++ b/guava/src/com/google/common/escape/Escaper.java @@ -56,7 +56,6 @@ */ @DoNotMock("Use Escapers.nullEscaper() or another methods from the *Escapers classes") @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class Escaper { // TODO(dbeaumont): evaluate custom implementations, considering package private constructor. /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/escape/Escapers.java b/guava/src/com/google/common/escape/Escapers.java index e3e50d965e28..4ad8deb60a6f 100644 --- a/guava/src/com/google/common/escape/Escapers.java +++ b/guava/src/com/google/common/escape/Escapers.java @@ -31,7 +31,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Escapers { private Escapers() {} diff --git a/guava/src/com/google/common/escape/ParametricNullness.java b/guava/src/com/google/common/escape/ParametricNullness.java index f964ca4a4f61..9ac5d62e1296 100644 --- a/guava/src/com/google/common/escape/ParametricNullness.java +++ b/guava/src/com/google/common/escape/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                *
                              • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                              • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/escape/Platform.java b/guava/src/com/google/common/escape/Platform.java index 67efe4551e5f..3480ee215e91 100644 --- a/guava/src/com/google/common/escape/Platform.java +++ b/guava/src/com/google/common/escape/Platform.java @@ -24,7 +24,6 @@ * @author Jesse Wilson */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { private Platform() {} diff --git a/guava/src/com/google/common/escape/UnicodeEscaper.java b/guava/src/com/google/common/escape/UnicodeEscaper.java index 280915c7551e..90d8cdc6aa21 100644 --- a/guava/src/com/google/common/escape/UnicodeEscaper.java +++ b/guava/src/com/google/common/escape/UnicodeEscaper.java @@ -50,7 +50,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class UnicodeEscaper extends Escaper { /** The amount of padding (chars) to use when growing the escape buffer. */ private static final int DEST_PAD = 32; diff --git a/guava/src/com/google/common/escape/package-info.java b/guava/src/com/google/common/escape/package-info.java index 4c525386e6f6..e70f41ddbfc8 100644 --- a/guava/src/com/google/common/escape/package-info.java +++ b/guava/src/com/google/common/escape/package-info.java @@ -25,8 +25,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.escape; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java b/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java index 28bc4b23e0c3..652e5e50bc6a 100644 --- a/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java +++ b/guava/src/com/google/common/eventbus/AllowConcurrentEvents.java @@ -30,5 +30,4 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) -@ElementTypesAreNonnullByDefault public @interface AllowConcurrentEvents {} diff --git a/guava/src/com/google/common/eventbus/AsyncEventBus.java b/guava/src/com/google/common/eventbus/AsyncEventBus.java index 4f387a712841..a6dac17f2289 100644 --- a/guava/src/com/google/common/eventbus/AsyncEventBus.java +++ b/guava/src/com/google/common/eventbus/AsyncEventBus.java @@ -23,7 +23,6 @@ * @author Cliff Biffle * @since 10.0 */ -@ElementTypesAreNonnullByDefault public class AsyncEventBus extends EventBus { /** diff --git a/guava/src/com/google/common/eventbus/DeadEvent.java b/guava/src/com/google/common/eventbus/DeadEvent.java index 2cdb23f712d7..90910b9b0805 100644 --- a/guava/src/com/google/common/eventbus/DeadEvent.java +++ b/guava/src/com/google/common/eventbus/DeadEvent.java @@ -27,7 +27,6 @@ * @author Cliff Biffle * @since 10.0 */ -@ElementTypesAreNonnullByDefault public class DeadEvent { private final Object source; diff --git a/guava/src/com/google/common/eventbus/Dispatcher.java b/guava/src/com/google/common/eventbus/Dispatcher.java index 44f7c46ba0cd..c941a04a11a6 100644 --- a/guava/src/com/google/common/eventbus/Dispatcher.java +++ b/guava/src/com/google/common/eventbus/Dispatcher.java @@ -32,7 +32,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault abstract class Dispatcher { /** diff --git a/guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index e8542bba63ec..000000000000 --- a/guava/src/com/google/common/eventbus/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.eventbus; - -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/guava/src/com/google/common/eventbus/EventBus.java b/guava/src/com/google/common/eventbus/EventBus.java index 268175f8face..603f5505249c 100644 --- a/guava/src/com/google/common/eventbus/EventBus.java +++ b/guava/src/com/google/common/eventbus/EventBus.java @@ -150,7 +150,6 @@ * @author Cliff Biffle * @since 10.0 */ -@ElementTypesAreNonnullByDefault public class EventBus { private static final Logger logger = Logger.getLogger(EventBus.class.getName()); diff --git a/guava/src/com/google/common/eventbus/ParametricNullness.java b/guava/src/com/google/common/eventbus/ParametricNullness.java index 47c7d8d4d063..fd07ef09cb60 100644 --- a/guava/src/com/google/common/eventbus/ParametricNullness.java +++ b/guava/src/com/google/common/eventbus/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                  *
                                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/eventbus/Subscribe.java b/guava/src/com/google/common/eventbus/Subscribe.java index 88477f1bae75..0449efe2e113 100644 --- a/guava/src/com/google/common/eventbus/Subscribe.java +++ b/guava/src/com/google/common/eventbus/Subscribe.java @@ -35,5 +35,4 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) -@ElementTypesAreNonnullByDefault public @interface Subscribe {} diff --git a/guava/src/com/google/common/eventbus/Subscriber.java b/guava/src/com/google/common/eventbus/Subscriber.java index 71ee197c9b25..98c09f5c8d98 100644 --- a/guava/src/com/google/common/eventbus/Subscriber.java +++ b/guava/src/com/google/common/eventbus/Subscriber.java @@ -32,7 +32,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault class Subscriber { /** Creates a {@code Subscriber} for {@code method} on {@code listener}. */ diff --git a/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java b/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java index 63c7d557fec9..c7a755b09407 100644 --- a/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java +++ b/guava/src/com/google/common/eventbus/SubscriberExceptionContext.java @@ -23,7 +23,6 @@ * * @since 16.0 */ -@ElementTypesAreNonnullByDefault public class SubscriberExceptionContext { private final EventBus eventBus; private final Object event; diff --git a/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java b/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java index 1c2fbb109adb..47b6f014dbf4 100644 --- a/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java +++ b/guava/src/com/google/common/eventbus/SubscriberExceptionHandler.java @@ -20,7 +20,6 @@ * * @since 16.0 */ -@ElementTypesAreNonnullByDefault public interface SubscriberExceptionHandler { /** Handles exceptions thrown by subscribers. */ void handleException(Throwable exception, SubscriberExceptionContext context); diff --git a/guava/src/com/google/common/eventbus/SubscriberRegistry.java b/guava/src/com/google/common/eventbus/SubscriberRegistry.java index 345aeee333ef..ae96474eb285 100644 --- a/guava/src/com/google/common/eventbus/SubscriberRegistry.java +++ b/guava/src/com/google/common/eventbus/SubscriberRegistry.java @@ -51,7 +51,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault final class SubscriberRegistry { /** diff --git a/guava/src/com/google/common/eventbus/package-info.java b/guava/src/com/google/common/eventbus/package-info.java index bd675415c15b..d722c08a0aab 100644 --- a/guava/src/com/google/common/eventbus/package-info.java +++ b/guava/src/com/google/common/eventbus/package-info.java @@ -20,8 +20,6 @@ * href="https://github.com/google/guava/wiki/EventBusExplained">{@code EventBus}. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.eventbus; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/graph/AbstractBaseGraph.java b/guava/src/com/google/common/graph/AbstractBaseGraph.java index 16cbdde7eec6..11986e9ec5ca 100644 --- a/guava/src/com/google/common/graph/AbstractBaseGraph.java +++ b/guava/src/com/google/common/graph/AbstractBaseGraph.java @@ -42,7 +42,6 @@ * @author James Sexton * @param Node parameter type */ -@ElementTypesAreNonnullByDefault abstract class AbstractBaseGraph implements BaseGraph { /** diff --git a/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java b/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java index ac452d4d610a..66a7404e26d5 100644 --- a/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java @@ -40,7 +40,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault abstract class AbstractDirectedNetworkConnections implements NetworkConnections { /** Keys are edges incoming to the origin node, values are the source node. */ final Map inEdgeMap; diff --git a/guava/src/com/google/common/graph/AbstractGraph.java b/guava/src/com/google/common/graph/AbstractGraph.java index 1dc245300694..e3d27ab95fcd 100644 --- a/guava/src/com/google/common/graph/AbstractGraph.java +++ b/guava/src/com/google/common/graph/AbstractGraph.java @@ -28,7 +28,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public abstract class AbstractGraph extends AbstractBaseGraph implements Graph { /** Constructor for use by subclasses. */ public AbstractGraph() {} diff --git a/guava/src/com/google/common/graph/AbstractGraphBuilder.java b/guava/src/com/google/common/graph/AbstractGraphBuilder.java index a4e1543f1d63..84e461a46c37 100644 --- a/guava/src/com/google/common/graph/AbstractGraphBuilder.java +++ b/guava/src/com/google/common/graph/AbstractGraphBuilder.java @@ -23,7 +23,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault abstract class AbstractGraphBuilder { final boolean directed; boolean allowsSelfLoops = false; diff --git a/guava/src/com/google/common/graph/AbstractNetwork.java b/guava/src/com/google/common/graph/AbstractNetwork.java index 4efe2c258469..4e29ddd266ce 100644 --- a/guava/src/com/google/common/graph/AbstractNetwork.java +++ b/guava/src/com/google/common/graph/AbstractNetwork.java @@ -52,7 +52,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public abstract class AbstractNetwork implements Network { /** Constructor for use by subclasses. */ public AbstractNetwork() {} diff --git a/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java b/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java index 8f736d7baa23..6622b5cf7e11 100644 --- a/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java @@ -32,7 +32,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault abstract class AbstractUndirectedNetworkConnections implements NetworkConnections { /** Keys are edges incident to the origin node, values are the node at the other end. */ final Map incidentEdgeMap; diff --git a/guava/src/com/google/common/graph/AbstractValueGraph.java b/guava/src/com/google/common/graph/AbstractValueGraph.java index 4f8551aed14e..954e60e8011f 100644 --- a/guava/src/com/google/common/graph/AbstractValueGraph.java +++ b/guava/src/com/google/common/graph/AbstractValueGraph.java @@ -38,7 +38,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public abstract class AbstractValueGraph extends AbstractBaseGraph implements ValueGraph { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/graph/BaseGraph.java b/guava/src/com/google/common/graph/BaseGraph.java index 0fa83e3ad146..a451989e712b 100644 --- a/guava/src/com/google/common/graph/BaseGraph.java +++ b/guava/src/com/google/common/graph/BaseGraph.java @@ -24,7 +24,6 @@ * @author James Sexton * @param Node parameter type */ -@ElementTypesAreNonnullByDefault interface BaseGraph extends SuccessorsFunction, PredecessorsFunction { // // Graph-level accessors diff --git a/guava/src/com/google/common/graph/DirectedGraphConnections.java b/guava/src/com/google/common/graph/DirectedGraphConnections.java index 76c214de61bd..05cc2c488d1e 100644 --- a/guava/src/com/google/common/graph/DirectedGraphConnections.java +++ b/guava/src/com/google/common/graph/DirectedGraphConnections.java @@ -50,7 +50,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault final class DirectedGraphConnections implements GraphConnections { /** * A wrapper class to indicate a node is both a predecessor and successor while still providing diff --git a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java index bd0e546f26e3..ad4defffe1d8 100644 --- a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java @@ -39,7 +39,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class DirectedMultiNetworkConnections extends AbstractDirectedNetworkConnections { private DirectedMultiNetworkConnections( diff --git a/guava/src/com/google/common/graph/DirectedNetworkConnections.java b/guava/src/com/google/common/graph/DirectedNetworkConnections.java index e1db65708eb0..c866a252c254 100644 --- a/guava/src/com/google/common/graph/DirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/DirectedNetworkConnections.java @@ -32,7 +32,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class DirectedNetworkConnections extends AbstractDirectedNetworkConnections { DirectedNetworkConnections(Map inEdgeMap, Map outEdgeMap, int selfLoopCount) { diff --git a/guava/src/com/google/common/graph/EdgesConnecting.java b/guava/src/com/google/common/graph/EdgesConnecting.java index 797970ba29c1..56cedca2ba57 100644 --- a/guava/src/com/google/common/graph/EdgesConnecting.java +++ b/guava/src/com/google/common/graph/EdgesConnecting.java @@ -34,7 +34,6 @@ * @author James Sexton * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class EdgesConnecting extends AbstractSet { private final Map nodeToOutEdge; diff --git a/guava/src/com/google/common/graph/ElementOrder.java b/guava/src/com/google/common/graph/ElementOrder.java index fc2abbb59f9a..650c44538b8b 100644 --- a/guava/src/com/google/common/graph/ElementOrder.java +++ b/guava/src/com/google/common/graph/ElementOrder.java @@ -46,7 +46,6 @@ */ @Beta @Immutable -@ElementTypesAreNonnullByDefault public final class ElementOrder { private final Type type; diff --git a/guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 0798de0c9883..000000000000 --- a/guava/src/com/google/common/graph/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.graph; - -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/guava/src/com/google/common/graph/EndpointPair.java b/guava/src/com/google/common/graph/EndpointPair.java index fe2397c6b97b..fec21aec7006 100644 --- a/guava/src/com/google/common/graph/EndpointPair.java +++ b/guava/src/com/google/common/graph/EndpointPair.java @@ -39,7 +39,6 @@ */ @Beta @Immutable(containerOf = {"N"}) -@ElementTypesAreNonnullByDefault public abstract class EndpointPair implements Iterable { private final N nodeU; private final N nodeV; diff --git a/guava/src/com/google/common/graph/EndpointPairIterator.java b/guava/src/com/google/common/graph/EndpointPairIterator.java index 7096dbe3da2a..c7755f34a488 100644 --- a/guava/src/com/google/common/graph/EndpointPairIterator.java +++ b/guava/src/com/google/common/graph/EndpointPairIterator.java @@ -32,7 +32,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault abstract class EndpointPairIterator extends AbstractIterator> { private final BaseGraph graph; private final Iterator nodeIterator; diff --git a/guava/src/com/google/common/graph/ForwardingGraph.java b/guava/src/com/google/common/graph/ForwardingGraph.java index f4ddf425db29..99faf4c999aa 100644 --- a/guava/src/com/google/common/graph/ForwardingGraph.java +++ b/guava/src/com/google/common/graph/ForwardingGraph.java @@ -24,7 +24,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault abstract class ForwardingGraph extends AbstractGraph { abstract BaseGraph delegate(); diff --git a/guava/src/com/google/common/graph/ForwardingNetwork.java b/guava/src/com/google/common/graph/ForwardingNetwork.java index 9f1c6e7702e8..95110dd568ce 100644 --- a/guava/src/com/google/common/graph/ForwardingNetwork.java +++ b/guava/src/com/google/common/graph/ForwardingNetwork.java @@ -27,7 +27,6 @@ * @author James Sexton * @author Joshua O'Madadhain */ -@ElementTypesAreNonnullByDefault abstract class ForwardingNetwork extends AbstractNetwork { abstract Network delegate(); diff --git a/guava/src/com/google/common/graph/ForwardingValueGraph.java b/guava/src/com/google/common/graph/ForwardingValueGraph.java index fcd5d28bc394..d5cf08e2f32a 100644 --- a/guava/src/com/google/common/graph/ForwardingValueGraph.java +++ b/guava/src/com/google/common/graph/ForwardingValueGraph.java @@ -27,7 +27,6 @@ * @author James Sexton * @author Joshua O'Madadhain */ -@ElementTypesAreNonnullByDefault abstract class ForwardingValueGraph extends AbstractValueGraph { abstract ValueGraph delegate(); diff --git a/guava/src/com/google/common/graph/Graph.java b/guava/src/com/google/common/graph/Graph.java index b765dabcbbdc..8ee14f51d9cc 100644 --- a/guava/src/com/google/common/graph/Graph.java +++ b/guava/src/com/google/common/graph/Graph.java @@ -103,7 +103,6 @@ */ @Beta @DoNotMock("Use GraphBuilder to create a real instance") -@ElementTypesAreNonnullByDefault public interface Graph extends BaseGraph { // // Graph-level accessors diff --git a/guava/src/com/google/common/graph/GraphBuilder.java b/guava/src/com/google/common/graph/GraphBuilder.java index e275c43a5958..8d25db4ad646 100644 --- a/guava/src/com/google/common/graph/GraphBuilder.java +++ b/guava/src/com/google/common/graph/GraphBuilder.java @@ -71,7 +71,6 @@ */ @Beta @DoNotMock -@ElementTypesAreNonnullByDefault public final class GraphBuilder extends AbstractGraphBuilder { /** Creates a new instance with the specified edge directionality. */ diff --git a/guava/src/com/google/common/graph/GraphConnections.java b/guava/src/com/google/common/graph/GraphConnections.java index 7d4f8f0cf02b..0ac3eb3d73c2 100644 --- a/guava/src/com/google/common/graph/GraphConnections.java +++ b/guava/src/com/google/common/graph/GraphConnections.java @@ -29,7 +29,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault interface GraphConnections { Set adjacentNodes(); diff --git a/guava/src/com/google/common/graph/GraphConstants.java b/guava/src/com/google/common/graph/GraphConstants.java index 263d6fd40617..f0e9013444cb 100644 --- a/guava/src/com/google/common/graph/GraphConstants.java +++ b/guava/src/com/google/common/graph/GraphConstants.java @@ -18,7 +18,6 @@ /** A utility class to hold various constants used by the Guava Graph library. */ -@ElementTypesAreNonnullByDefault final class GraphConstants { private GraphConstants() {} diff --git a/guava/src/com/google/common/graph/Graphs.java b/guava/src/com/google/common/graph/Graphs.java index 3099279c46f6..6b13e9e9ab2f 100644 --- a/guava/src/com/google/common/graph/Graphs.java +++ b/guava/src/com/google/common/graph/Graphs.java @@ -46,7 +46,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class Graphs extends GraphsBridgeMethods { private Graphs() {} diff --git a/guava/src/com/google/common/graph/GraphsBridgeMethods.java b/guava/src/com/google/common/graph/GraphsBridgeMethods.java index fd89a67d81aa..5cbb790bfabf 100644 --- a/guava/src/com/google/common/graph/GraphsBridgeMethods.java +++ b/guava/src/com/google/common/graph/GraphsBridgeMethods.java @@ -8,7 +8,6 @@ * changed. This provides binary compatibility for users who compiled against the old signatures. */ @Beta -@ElementTypesAreNonnullByDefault abstract class GraphsBridgeMethods { @SuppressWarnings("PreferredInterfaceType") diff --git a/guava/src/com/google/common/graph/ImmutableGraph.java b/guava/src/com/google/common/graph/ImmutableGraph.java index f829e9699993..e2d77374522f 100644 --- a/guava/src/com/google/common/graph/ImmutableGraph.java +++ b/guava/src/com/google/common/graph/ImmutableGraph.java @@ -45,7 +45,6 @@ */ @Beta @Immutable(containerOf = {"N"}) -@ElementTypesAreNonnullByDefault public class ImmutableGraph extends ForwardingGraph { @SuppressWarnings("Immutable") // The backing graph must be immutable. private final BaseGraph backingGraph; diff --git a/guava/src/com/google/common/graph/ImmutableNetwork.java b/guava/src/com/google/common/graph/ImmutableNetwork.java index c29f8a392813..42bdf8fb1645 100644 --- a/guava/src/com/google/common/graph/ImmutableNetwork.java +++ b/guava/src/com/google/common/graph/ImmutableNetwork.java @@ -46,7 +46,6 @@ @Beta @Immutable(containerOf = {"N", "E"}) @SuppressWarnings("Immutable") // Extends StandardNetwork but uses ImmutableMaps. -@ElementTypesAreNonnullByDefault public final class ImmutableNetwork extends StandardNetwork { private ImmutableNetwork(Network network) { diff --git a/guava/src/com/google/common/graph/ImmutableValueGraph.java b/guava/src/com/google/common/graph/ImmutableValueGraph.java index eb17067fca43..ed0b100777bc 100644 --- a/guava/src/com/google/common/graph/ImmutableValueGraph.java +++ b/guava/src/com/google/common/graph/ImmutableValueGraph.java @@ -44,7 +44,6 @@ @Beta @Immutable(containerOf = {"N", "V"}) @SuppressWarnings("Immutable") // Extends StandardValueGraph but uses ImmutableMaps. -@ElementTypesAreNonnullByDefault public final class ImmutableValueGraph extends StandardValueGraph { private ImmutableValueGraph(ValueGraph graph) { diff --git a/guava/src/com/google/common/graph/IncidentEdgeSet.java b/guava/src/com/google/common/graph/IncidentEdgeSet.java index ac94b65779d4..99dbd8913691 100644 --- a/guava/src/com/google/common/graph/IncidentEdgeSet.java +++ b/guava/src/com/google/common/graph/IncidentEdgeSet.java @@ -24,7 +24,6 @@ * Abstract base class for an incident edges set that allows different implementations of {@link * AbstractSet#iterator()}. */ -@ElementTypesAreNonnullByDefault abstract class IncidentEdgeSet extends AbstractSet> { final N node; final BaseGraph graph; diff --git a/guava/src/com/google/common/graph/InvalidatableSet.java b/guava/src/com/google/common/graph/InvalidatableSet.java index f8834b589ae9..f261cc09cbde 100644 --- a/guava/src/com/google/common/graph/InvalidatableSet.java +++ b/guava/src/com/google/common/graph/InvalidatableSet.java @@ -10,7 +10,6 @@ * A subclass of `ForwardingSet` that throws `IllegalStateException` on invocation of any method * (except `hashCode` and `equals`) if the provided `Supplier` returns false. */ -@ElementTypesAreNonnullByDefault final class InvalidatableSet extends ForwardingSet { private final Supplier validator; private final Set delegate; diff --git a/guava/src/com/google/common/graph/MapIteratorCache.java b/guava/src/com/google/common/graph/MapIteratorCache.java index 05cdde8c3f12..973d95f4c057 100644 --- a/guava/src/com/google/common/graph/MapIteratorCache.java +++ b/guava/src/com/google/common/graph/MapIteratorCache.java @@ -41,7 +41,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault class MapIteratorCache { private final Map backingMap; diff --git a/guava/src/com/google/common/graph/MapRetrievalCache.java b/guava/src/com/google/common/graph/MapRetrievalCache.java index ada78f28414d..d6d80f485061 100644 --- a/guava/src/com/google/common/graph/MapRetrievalCache.java +++ b/guava/src/com/google/common/graph/MapRetrievalCache.java @@ -27,7 +27,6 @@ * * @author James Sexton */ -@ElementTypesAreNonnullByDefault final class MapRetrievalCache extends MapIteratorCache { // See the note about volatile in the superclass. @CheckForNull private transient volatile CacheEntry cacheEntry1; diff --git a/guava/src/com/google/common/graph/MultiEdgesConnecting.java b/guava/src/com/google/common/graph/MultiEdgesConnecting.java index 620f986a555a..7fcbccc7ff5a 100644 --- a/guava/src/com/google/common/graph/MultiEdgesConnecting.java +++ b/guava/src/com/google/common/graph/MultiEdgesConnecting.java @@ -35,7 +35,6 @@ * @author James Sexton * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault abstract class MultiEdgesConnecting extends AbstractSet { private final Map outEdgeToNode; diff --git a/guava/src/com/google/common/graph/MutableGraph.java b/guava/src/com/google/common/graph/MutableGraph.java index b1f3359cab58..8324079f6c08 100644 --- a/guava/src/com/google/common/graph/MutableGraph.java +++ b/guava/src/com/google/common/graph/MutableGraph.java @@ -29,7 +29,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface MutableGraph extends Graph { /** diff --git a/guava/src/com/google/common/graph/MutableNetwork.java b/guava/src/com/google/common/graph/MutableNetwork.java index 64acb13162af..d702903604cf 100644 --- a/guava/src/com/google/common/graph/MutableNetwork.java +++ b/guava/src/com/google/common/graph/MutableNetwork.java @@ -30,7 +30,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface MutableNetwork extends Network { /** diff --git a/guava/src/com/google/common/graph/MutableValueGraph.java b/guava/src/com/google/common/graph/MutableValueGraph.java index f32d2ee7a38c..a376917fd743 100644 --- a/guava/src/com/google/common/graph/MutableValueGraph.java +++ b/guava/src/com/google/common/graph/MutableValueGraph.java @@ -30,7 +30,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface MutableValueGraph extends ValueGraph { /** diff --git a/guava/src/com/google/common/graph/Network.java b/guava/src/com/google/common/graph/Network.java index 2dc4773eba7a..322e6b2c34ed 100644 --- a/guava/src/com/google/common/graph/Network.java +++ b/guava/src/com/google/common/graph/Network.java @@ -104,7 +104,6 @@ */ @Beta @DoNotMock("Use NetworkBuilder to create a real instance") -@ElementTypesAreNonnullByDefault public interface Network extends SuccessorsFunction, PredecessorsFunction { // // Network-level accessors diff --git a/guava/src/com/google/common/graph/NetworkBuilder.java b/guava/src/com/google/common/graph/NetworkBuilder.java index c1f37147b8bd..9af9acc74e3f 100644 --- a/guava/src/com/google/common/graph/NetworkBuilder.java +++ b/guava/src/com/google/common/graph/NetworkBuilder.java @@ -73,7 +73,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class NetworkBuilder extends AbstractGraphBuilder { boolean allowsParallelEdges = false; ElementOrder edgeOrder = ElementOrder.insertion(); diff --git a/guava/src/com/google/common/graph/NetworkConnections.java b/guava/src/com/google/common/graph/NetworkConnections.java index 94d1780d3135..2a03d7910fce 100644 --- a/guava/src/com/google/common/graph/NetworkConnections.java +++ b/guava/src/com/google/common/graph/NetworkConnections.java @@ -28,7 +28,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault interface NetworkConnections { Set adjacentNodes(); diff --git a/guava/src/com/google/common/graph/ParametricNullness.java b/guava/src/com/google/common/graph/ParametricNullness.java index 32fd5ee7ecaa..634ee0e19782 100644 --- a/guava/src/com/google/common/graph/ParametricNullness.java +++ b/guava/src/com/google/common/graph/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                    *
                                  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                  • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/graph/PredecessorsFunction.java b/guava/src/com/google/common/graph/PredecessorsFunction.java index 750a8acd603b..f9ca48ae77b9 100644 --- a/guava/src/com/google/common/graph/PredecessorsFunction.java +++ b/guava/src/com/google/common/graph/PredecessorsFunction.java @@ -80,7 +80,6 @@ */ @Beta @DoNotMock("Implement with a lambda, or use GraphBuilder to build a Graph with the desired edges") -@ElementTypesAreNonnullByDefault public interface PredecessorsFunction { /** diff --git a/guava/src/com/google/common/graph/StandardMutableGraph.java b/guava/src/com/google/common/graph/StandardMutableGraph.java index 1be9640f419e..840dd5e095a5 100644 --- a/guava/src/com/google/common/graph/StandardMutableGraph.java +++ b/guava/src/com/google/common/graph/StandardMutableGraph.java @@ -28,7 +28,6 @@ * @author James Sexton * @param Node parameter type */ -@ElementTypesAreNonnullByDefault final class StandardMutableGraph extends ForwardingGraph implements MutableGraph { private final MutableValueGraph backingValueGraph; diff --git a/guava/src/com/google/common/graph/StandardMutableNetwork.java b/guava/src/com/google/common/graph/StandardMutableNetwork.java index c58b6d39093e..23512b6f97d5 100644 --- a/guava/src/com/google/common/graph/StandardMutableNetwork.java +++ b/guava/src/com/google/common/graph/StandardMutableNetwork.java @@ -40,7 +40,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class StandardMutableNetwork extends StandardNetwork implements MutableNetwork { diff --git a/guava/src/com/google/common/graph/StandardMutableValueGraph.java b/guava/src/com/google/common/graph/StandardMutableValueGraph.java index 1ad474083610..162480bccbab 100644 --- a/guava/src/com/google/common/graph/StandardMutableValueGraph.java +++ b/guava/src/com/google/common/graph/StandardMutableValueGraph.java @@ -41,7 +41,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault final class StandardMutableValueGraph extends StandardValueGraph implements MutableValueGraph { diff --git a/guava/src/com/google/common/graph/StandardNetwork.java b/guava/src/com/google/common/graph/StandardNetwork.java index 9c3cfd5a01b2..19f9e47887ff 100644 --- a/guava/src/com/google/common/graph/StandardNetwork.java +++ b/guava/src/com/google/common/graph/StandardNetwork.java @@ -48,7 +48,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault class StandardNetwork extends AbstractNetwork { private final boolean isDirected; private final boolean allowsParallelEdges; diff --git a/guava/src/com/google/common/graph/StandardValueGraph.java b/guava/src/com/google/common/graph/StandardValueGraph.java index a5f3553087d9..a99dce96300b 100644 --- a/guava/src/com/google/common/graph/StandardValueGraph.java +++ b/guava/src/com/google/common/graph/StandardValueGraph.java @@ -43,7 +43,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault class StandardValueGraph extends AbstractValueGraph { private final boolean isDirected; private final boolean allowsSelfLoops; diff --git a/guava/src/com/google/common/graph/SuccessorsFunction.java b/guava/src/com/google/common/graph/SuccessorsFunction.java index c29bb4b94360..f74f437c2937 100644 --- a/guava/src/com/google/common/graph/SuccessorsFunction.java +++ b/guava/src/com/google/common/graph/SuccessorsFunction.java @@ -80,7 +80,6 @@ */ @Beta @DoNotMock("Implement with a lambda, or use GraphBuilder to build a Graph with the desired edges") -@ElementTypesAreNonnullByDefault public interface SuccessorsFunction { /** diff --git a/guava/src/com/google/common/graph/Traverser.java b/guava/src/com/google/common/graph/Traverser.java index 3eca88e12529..0c54486343df 100644 --- a/guava/src/com/google/common/graph/Traverser.java +++ b/guava/src/com/google/common/graph/Traverser.java @@ -64,7 +64,6 @@ @DoNotMock( "Call forGraph or forTree, passing a lambda or a Graph with the desired edges (built with" + " GraphBuilder)") -@ElementTypesAreNonnullByDefault public abstract class Traverser { private final SuccessorsFunction successorFunction; diff --git a/guava/src/com/google/common/graph/UndirectedGraphConnections.java b/guava/src/com/google/common/graph/UndirectedGraphConnections.java index 4eeb2328fe0e..e50cb5523eb8 100644 --- a/guava/src/com/google/common/graph/UndirectedGraphConnections.java +++ b/guava/src/com/google/common/graph/UndirectedGraphConnections.java @@ -37,7 +37,6 @@ * @param Node parameter type * @param Value parameter type */ -@ElementTypesAreNonnullByDefault final class UndirectedGraphConnections implements GraphConnections { private final Map adjacentNodeValues; diff --git a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java index 6caac3b715dd..04ae1094ef68 100644 --- a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java +++ b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java @@ -39,7 +39,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class UndirectedMultiNetworkConnections extends AbstractUndirectedNetworkConnections { diff --git a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java index 190897f8825d..5d3473c20ece 100644 --- a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java +++ b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java @@ -32,7 +32,6 @@ * @param Node parameter type * @param Edge parameter type */ -@ElementTypesAreNonnullByDefault final class UndirectedNetworkConnections extends AbstractUndirectedNetworkConnections { UndirectedNetworkConnections(Map incidentEdgeMap) { diff --git a/guava/src/com/google/common/graph/ValueGraph.java b/guava/src/com/google/common/graph/ValueGraph.java index b990551ff186..612825aefb13 100644 --- a/guava/src/com/google/common/graph/ValueGraph.java +++ b/guava/src/com/google/common/graph/ValueGraph.java @@ -107,7 +107,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface ValueGraph extends BaseGraph { // // ValueGraph-level accessors diff --git a/guava/src/com/google/common/graph/ValueGraphBuilder.java b/guava/src/com/google/common/graph/ValueGraphBuilder.java index a4014606d656..65658b951355 100644 --- a/guava/src/com/google/common/graph/ValueGraphBuilder.java +++ b/guava/src/com/google/common/graph/ValueGraphBuilder.java @@ -73,7 +73,6 @@ * @since 20.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class ValueGraphBuilder extends AbstractGraphBuilder { /** Creates a new instance with the specified edge directionality. */ diff --git a/guava/src/com/google/common/graph/package-info.java b/guava/src/com/google/common/graph/package-info.java index 32d8b0157bb3..45036904dd5c 100644 --- a/guava/src/com/google/common/graph/package-info.java +++ b/guava/src/com/google/common/graph/package-info.java @@ -22,8 +22,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.graph; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/hash/AbstractByteHasher.java b/guava/src/com/google/common/hash/AbstractByteHasher.java index 2c8682575a74..bd96e8aead3f 100644 --- a/guava/src/com/google/common/hash/AbstractByteHasher.java +++ b/guava/src/com/google/common/hash/AbstractByteHasher.java @@ -31,7 +31,6 @@ * * @author Colin Decker */ -@ElementTypesAreNonnullByDefault abstract class AbstractByteHasher extends AbstractHasher { private final ByteBuffer scratch = ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN); diff --git a/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java b/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java index 820fe963bf84..257e566c2564 100644 --- a/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java +++ b/guava/src/com/google/common/hash/AbstractCompositeHashFunction.java @@ -30,7 +30,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault abstract class AbstractCompositeHashFunction extends AbstractHashFunction { @SuppressWarnings("Immutable") // array not modified after creation diff --git a/guava/src/com/google/common/hash/AbstractHashFunction.java b/guava/src/com/google/common/hash/AbstractHashFunction.java index 73085560024f..d6f91bf83d5a 100644 --- a/guava/src/com/google/common/hash/AbstractHashFunction.java +++ b/guava/src/com/google/common/hash/AbstractHashFunction.java @@ -28,7 +28,6 @@ *

                                    TODO(lowasser): make public */ @Immutable -@ElementTypesAreNonnullByDefault abstract class AbstractHashFunction implements HashFunction { @Override public HashCode hashObject( diff --git a/guava/src/com/google/common/hash/AbstractHasher.java b/guava/src/com/google/common/hash/AbstractHasher.java index 905a425c934a..4b26aa2356eb 100644 --- a/guava/src/com/google/common/hash/AbstractHasher.java +++ b/guava/src/com/google/common/hash/AbstractHasher.java @@ -26,7 +26,6 @@ * * @author Dimitris Andreou */ -@ElementTypesAreNonnullByDefault abstract class AbstractHasher implements Hasher { @Override @CanIgnoreReturnValue diff --git a/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java b/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java index 4969e35b22ba..54c76de19564 100644 --- a/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java +++ b/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java @@ -30,7 +30,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault abstract class AbstractNonStreamingHashFunction extends AbstractHashFunction { @Override public Hasher newHasher() { diff --git a/guava/src/com/google/common/hash/AbstractStreamingHasher.java b/guava/src/com/google/common/hash/AbstractStreamingHasher.java index 875bc6ec493b..e28520d12701 100644 --- a/guava/src/com/google/common/hash/AbstractStreamingHasher.java +++ b/guava/src/com/google/common/hash/AbstractStreamingHasher.java @@ -28,7 +28,6 @@ * @author Dimitris Andreou */ // TODO(kevinb): this class still needs some design-and-document-for-inheritance love -@ElementTypesAreNonnullByDefault abstract class AbstractStreamingHasher extends AbstractHasher { /** Buffer via which we pass data to the hash algorithm (the implementor) */ private final ByteBuffer buffer; diff --git a/guava/src/com/google/common/hash/BloomFilter.java b/guava/src/com/google/common/hash/BloomFilter.java index 2be424f46bf7..e398c364ba51 100644 --- a/guava/src/com/google/common/hash/BloomFilter.java +++ b/guava/src/com/google/common/hash/BloomFilter.java @@ -69,7 +69,6 @@ * @since 11.0 (thread-safe since 23.0) */ @Beta -@ElementTypesAreNonnullByDefault public final class BloomFilter implements Predicate, Serializable { /** * A strategy to translate T instances, to {@code numHashFunctions} bit indexes. diff --git a/guava/src/com/google/common/hash/BloomFilterStrategies.java b/guava/src/com/google/common/hash/BloomFilterStrategies.java index 7c5650b2d531..3cbe543a1d9d 100644 --- a/guava/src/com/google/common/hash/BloomFilterStrategies.java +++ b/guava/src/com/google/common/hash/BloomFilterStrategies.java @@ -37,7 +37,6 @@ * @author Dimitris Andreou * @author Kurt Alfred Kluever */ -@ElementTypesAreNonnullByDefault enum BloomFilterStrategies implements BloomFilter.Strategy { /** * See "Less Hashing, Same Performance: Building a Better Bloom Filter" by Adam Kirsch and Michael diff --git a/guava/src/com/google/common/hash/ChecksumHashFunction.java b/guava/src/com/google/common/hash/ChecksumHashFunction.java index b5ee5245a75a..f5f5dee54828 100644 --- a/guava/src/com/google/common/hash/ChecksumHashFunction.java +++ b/guava/src/com/google/common/hash/ChecksumHashFunction.java @@ -35,7 +35,6 @@ * @author Colin Decker */ @Immutable -@ElementTypesAreNonnullByDefault final class ChecksumHashFunction extends AbstractHashFunction implements Serializable { private final ImmutableSupplier checksumSupplier; private final int bits; diff --git a/guava/src/com/google/common/hash/Crc32cHashFunction.java b/guava/src/com/google/common/hash/Crc32cHashFunction.java index 8e17e6538c21..f965178dddef 100644 --- a/guava/src/com/google/common/hash/Crc32cHashFunction.java +++ b/guava/src/com/google/common/hash/Crc32cHashFunction.java @@ -24,7 +24,6 @@ * @author Kurt Alfred Kluever */ @Immutable -@ElementTypesAreNonnullByDefault final class Crc32cHashFunction extends AbstractHashFunction { static final HashFunction CRC_32_C = new Crc32cHashFunction(); diff --git a/guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a2382b3514cc..000000000000 --- a/guava/src/com/google/common/hash/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.hash; - -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/guava/src/com/google/common/hash/FarmHashFingerprint64.java b/guava/src/com/google/common/hash/FarmHashFingerprint64.java index 329a981c48eb..3785093f0924 100644 --- a/guava/src/com/google/common/hash/FarmHashFingerprint64.java +++ b/guava/src/com/google/common/hash/FarmHashFingerprint64.java @@ -38,7 +38,6 @@ * @author Kyle Maddison * @author Geoff Pike */ -@ElementTypesAreNonnullByDefault final class FarmHashFingerprint64 extends AbstractNonStreamingHashFunction { static final HashFunction FARMHASH_FINGERPRINT_64 = new FarmHashFingerprint64(); diff --git a/guava/src/com/google/common/hash/Fingerprint2011.java b/guava/src/com/google/common/hash/Fingerprint2011.java index 1b01e0092418..f54232bc482f 100644 --- a/guava/src/com/google/common/hash/Fingerprint2011.java +++ b/guava/src/com/google/common/hash/Fingerprint2011.java @@ -28,7 +28,6 @@ * @author kylemaddison@google.com (Kyle Maddison) * @author gpike@google.com (Geoff Pike) */ -@ElementTypesAreNonnullByDefault final class Fingerprint2011 extends AbstractNonStreamingHashFunction { static final HashFunction FINGERPRINT_2011 = new Fingerprint2011(); diff --git a/guava/src/com/google/common/hash/Funnel.java b/guava/src/com/google/common/hash/Funnel.java index 9d80dabcf6ed..02f9fd8baa6b 100644 --- a/guava/src/com/google/common/hash/Funnel.java +++ b/guava/src/com/google/common/hash/Funnel.java @@ -44,7 +44,6 @@ */ @Beta @DoNotMock("Implement with a lambda") -@ElementTypesAreNonnullByDefault public interface Funnel extends Serializable { /** diff --git a/guava/src/com/google/common/hash/Funnels.java b/guava/src/com/google/common/hash/Funnels.java index 1d1d0a49948c..81f1bb957cef 100644 --- a/guava/src/com/google/common/hash/Funnels.java +++ b/guava/src/com/google/common/hash/Funnels.java @@ -31,7 +31,6 @@ * @since 11.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class Funnels { private Funnels() {} diff --git a/guava/src/com/google/common/hash/HashCode.java b/guava/src/com/google/common/hash/HashCode.java index 9c31454b7145..166b87ac505d 100644 --- a/guava/src/com/google/common/hash/HashCode.java +++ b/guava/src/com/google/common/hash/HashCode.java @@ -32,7 +32,6 @@ * @author Kurt Alfred Kluever * @since 11.0 */ -@ElementTypesAreNonnullByDefault public abstract class HashCode { HashCode() {} diff --git a/guava/src/com/google/common/hash/HashFunction.java b/guava/src/com/google/common/hash/HashFunction.java index d4b7f8a01fcc..2d0783fc74b9 100644 --- a/guava/src/com/google/common/hash/HashFunction.java +++ b/guava/src/com/google/common/hash/HashFunction.java @@ -116,7 +116,6 @@ * @since 11.0 */ @Immutable -@ElementTypesAreNonnullByDefault public interface HashFunction { /** * Begins a new hash code computation by returning an initialized, stateful {@code Hasher} diff --git a/guava/src/com/google/common/hash/Hasher.java b/guava/src/com/google/common/hash/Hasher.java index f9a74c046aa2..dc29c642875d 100644 --- a/guava/src/com/google/common/hash/Hasher.java +++ b/guava/src/com/google/common/hash/Hasher.java @@ -54,7 +54,6 @@ * @since 11.0 */ @Beta -@ElementTypesAreNonnullByDefault public interface Hasher extends PrimitiveSink { @CanIgnoreReturnValue @Override diff --git a/guava/src/com/google/common/hash/Hashing.java b/guava/src/com/google/common/hash/Hashing.java index 91e61b7fab3f..e53c7d8c9142 100644 --- a/guava/src/com/google/common/hash/Hashing.java +++ b/guava/src/com/google/common/hash/Hashing.java @@ -48,7 +48,6 @@ * @author Kurt Alfred Kluever * @since 11.0 */ -@ElementTypesAreNonnullByDefault public final class Hashing { /** * Returns a general-purpose, temporary-use, non-cryptographic hash function. The algorithm diff --git a/guava/src/com/google/common/hash/HashingInputStream.java b/guava/src/com/google/common/hash/HashingInputStream.java index bf9464ce5573..f49dfd62daa5 100644 --- a/guava/src/com/google/common/hash/HashingInputStream.java +++ b/guava/src/com/google/common/hash/HashingInputStream.java @@ -29,7 +29,6 @@ * @since 16.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class HashingInputStream extends FilterInputStream { private final Hasher hasher; diff --git a/guava/src/com/google/common/hash/HashingOutputStream.java b/guava/src/com/google/common/hash/HashingOutputStream.java index e106202ecc68..20f1316a558c 100644 --- a/guava/src/com/google/common/hash/HashingOutputStream.java +++ b/guava/src/com/google/common/hash/HashingOutputStream.java @@ -28,7 +28,6 @@ * @since 16.0 */ @Beta -@ElementTypesAreNonnullByDefault public final class HashingOutputStream extends FilterOutputStream { private final Hasher hasher; diff --git a/guava/src/com/google/common/hash/IgnoreJRERequirement.java b/guava/src/com/google/common/hash/IgnoreJRERequirement.java index 0de7c9a92439..8799c56dd850 100644 --- a/guava/src/com/google/common/hash/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/hash/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                                    Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/hash/ImmutableSupplier.java b/guava/src/com/google/common/hash/ImmutableSupplier.java index 24f711a313fa..b6a74a77b719 100644 --- a/guava/src/com/google/common/hash/ImmutableSupplier.java +++ b/guava/src/com/google/common/hash/ImmutableSupplier.java @@ -23,5 +23,4 @@ */ // TODO(cpovirk): Should we just use ChecksumType directly instead of defining this type? @Immutable -@ElementTypesAreNonnullByDefault interface ImmutableSupplier extends Supplier {} diff --git a/guava/src/com/google/common/hash/Java8Compatibility.java b/guava/src/com/google/common/hash/Java8Compatibility.java index c15f2b3cc575..52f71e788558 100644 --- a/guava/src/com/google/common/hash/Java8Compatibility.java +++ b/guava/src/com/google/common/hash/Java8Compatibility.java @@ -22,7 +22,6 @@ * https://github.com/google/guava/issues/3990 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class Java8Compatibility { static void clear(Buffer b) { b.clear(); diff --git a/guava/src/com/google/common/hash/LittleEndianByteArray.java b/guava/src/com/google/common/hash/LittleEndianByteArray.java index 3951529f2c51..2d197df46a9b 100644 --- a/guava/src/com/google/common/hash/LittleEndianByteArray.java +++ b/guava/src/com/google/common/hash/LittleEndianByteArray.java @@ -30,7 +30,6 @@ * @author Kevin Damm * @author Kyle Maddison */ -@ElementTypesAreNonnullByDefault final class LittleEndianByteArray { /** The instance that actually does the work; delegates to Unsafe or a pure-Java fallback. */ diff --git a/guava/src/com/google/common/hash/LongAddable.java b/guava/src/com/google/common/hash/LongAddable.java index 5c6a7f0c7db8..75e64335c1b0 100644 --- a/guava/src/com/google/common/hash/LongAddable.java +++ b/guava/src/com/google/common/hash/LongAddable.java @@ -20,7 +20,6 @@ * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault interface LongAddable { void increment(); diff --git a/guava/src/com/google/common/hash/LongAddables.java b/guava/src/com/google/common/hash/LongAddables.java index 7c371ec88fdc..5ae9ba0b138b 100644 --- a/guava/src/com/google/common/hash/LongAddables.java +++ b/guava/src/com/google/common/hash/LongAddables.java @@ -22,7 +22,6 @@ * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault final class LongAddables { private static final Supplier SUPPLIER; diff --git a/guava/src/com/google/common/hash/LongAdder.java b/guava/src/com/google/common/hash/LongAdder.java index dc864aa9a417..bd08428ff3a4 100644 --- a/guava/src/com/google/common/hash/LongAdder.java +++ b/guava/src/com/google/common/hash/LongAdder.java @@ -38,7 +38,6 @@ * @since 1.8 * @author Doug Lea */ -@ElementTypesAreNonnullByDefault final class LongAdder extends Striped64 implements Serializable, LongAddable { private static final long serialVersionUID = 7249069246863182397L; diff --git a/guava/src/com/google/common/hash/MacHashFunction.java b/guava/src/com/google/common/hash/MacHashFunction.java index 6d53a54c39e2..390b49c30234 100644 --- a/guava/src/com/google/common/hash/MacHashFunction.java +++ b/guava/src/com/google/common/hash/MacHashFunction.java @@ -30,7 +30,6 @@ * @author Kurt Alfred Kluever */ @Immutable -@ElementTypesAreNonnullByDefault final class MacHashFunction extends AbstractHashFunction { @SuppressWarnings("Immutable") // cloned before each use diff --git a/guava/src/com/google/common/hash/MessageDigestHashFunction.java b/guava/src/com/google/common/hash/MessageDigestHashFunction.java index 0fe3347eae48..9a435b9edc13 100644 --- a/guava/src/com/google/common/hash/MessageDigestHashFunction.java +++ b/guava/src/com/google/common/hash/MessageDigestHashFunction.java @@ -34,7 +34,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault final class MessageDigestHashFunction extends AbstractHashFunction implements Serializable { @SuppressWarnings("Immutable") // cloned before each use diff --git a/guava/src/com/google/common/hash/Murmur3_128HashFunction.java b/guava/src/com/google/common/hash/Murmur3_128HashFunction.java index d1304f8273c5..813272d47803 100644 --- a/guava/src/com/google/common/hash/Murmur3_128HashFunction.java +++ b/guava/src/com/google/common/hash/Murmur3_128HashFunction.java @@ -41,7 +41,6 @@ * @author Dimitris Andreou */ @Immutable -@ElementTypesAreNonnullByDefault final class Murmur3_128HashFunction extends AbstractHashFunction implements Serializable { static final HashFunction MURMUR3_128 = new Murmur3_128HashFunction(0); diff --git a/guava/src/com/google/common/hash/Murmur3_32HashFunction.java b/guava/src/com/google/common/hash/Murmur3_32HashFunction.java index 083158fc57fa..11dbd2a41b98 100644 --- a/guava/src/com/google/common/hash/Murmur3_32HashFunction.java +++ b/guava/src/com/google/common/hash/Murmur3_32HashFunction.java @@ -51,7 +51,6 @@ * @author Kurt Alfred Kluever */ @Immutable -@ElementTypesAreNonnullByDefault final class Murmur3_32HashFunction extends AbstractHashFunction implements Serializable { static final HashFunction MURMUR3_32 = new Murmur3_32HashFunction(0, /* supplementaryPlaneFix= */ false); diff --git a/guava/src/com/google/common/hash/ParametricNullness.java b/guava/src/com/google/common/hash/ParametricNullness.java index 4ebc40bb741e..f5a8614a8762 100644 --- a/guava/src/com/google/common/hash/ParametricNullness.java +++ b/guava/src/com/google/common/hash/ParametricNullness.java @@ -56,8 +56,8 @@ *

                                      *
                                    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/hash/PrimitiveSink.java b/guava/src/com/google/common/hash/PrimitiveSink.java index ecd6a32c8379..71c5eceb7bff 100644 --- a/guava/src/com/google/common/hash/PrimitiveSink.java +++ b/guava/src/com/google/common/hash/PrimitiveSink.java @@ -26,7 +26,6 @@ * @since 12.0 (in 11.0 as {@code Sink}) */ @Beta -@ElementTypesAreNonnullByDefault public interface PrimitiveSink { /** * Puts a byte into this sink. diff --git a/guava/src/com/google/common/hash/SipHashFunction.java b/guava/src/com/google/common/hash/SipHashFunction.java index a226b61a50b9..977e7af038da 100644 --- a/guava/src/com/google/common/hash/SipHashFunction.java +++ b/guava/src/com/google/common/hash/SipHashFunction.java @@ -34,7 +34,6 @@ * @author Daniel J. Bernstein */ @Immutable -@ElementTypesAreNonnullByDefault final class SipHashFunction extends AbstractHashFunction implements Serializable { static final HashFunction SIP_HASH_24 = new SipHashFunction(2, 4, 0x0706050403020100L, 0x0f0e0d0c0b0a0908L); diff --git a/guava/src/com/google/common/hash/Striped64.java b/guava/src/com/google/common/hash/Striped64.java index 6cbbd7f5aa80..9592f9f218b0 100644 --- a/guava/src/com/google/common/hash/Striped64.java +++ b/guava/src/com/google/common/hash/Striped64.java @@ -27,7 +27,6 @@ * so. */ @GwtIncompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings({"SunApi", "removal"}) // b/345822163 abstract class Striped64 extends Number { /* diff --git a/guava/src/com/google/common/hash/package-info.java b/guava/src/com/google/common/hash/package-info.java index d210f7ef7b46..5cfe6c89cdd4 100644 --- a/guava/src/com/google/common/hash/package-info.java +++ b/guava/src/com/google/common/hash/package-info.java @@ -20,8 +20,6 @@ * href="https://github.com/google/guava/wiki/HashingExplained">hashing. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.hash; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a28b716632d4..000000000000 --- a/guava/src/com/google/common/html/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.html; - -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/guava/src/com/google/common/html/HtmlEscapers.java b/guava/src/com/google/common/html/HtmlEscapers.java index 51e70e92a7db..6da547570bdc 100644 --- a/guava/src/com/google/common/html/HtmlEscapers.java +++ b/guava/src/com/google/common/html/HtmlEscapers.java @@ -36,7 +36,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class HtmlEscapers { /** * Returns an {@link Escaper} instance that escapes HTML metacharacters as specified by *
                                    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/html/package-info.java b/guava/src/com/google/common/html/package-info.java index 1a97bccd1ab1..6aee2f46084e 100644 --- a/guava/src/com/google/common/html/package-info.java +++ b/guava/src/com/google/common/html/package-info.java @@ -21,8 +21,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.html; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/io/AppendableWriter.java b/guava/src/com/google/common/io/AppendableWriter.java index 8566569a96d1..ccf3df01427c 100644 --- a/guava/src/com/google/common/io/AppendableWriter.java +++ b/guava/src/com/google/common/io/AppendableWriter.java @@ -34,7 +34,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault class AppendableWriter extends Writer { private final Appendable target; private boolean closed; diff --git a/guava/src/com/google/common/io/BaseEncoding.java b/guava/src/com/google/common/io/BaseEncoding.java index 52da773485f0..da7df1605049 100644 --- a/guava/src/com/google/common/io/BaseEncoding.java +++ b/guava/src/com/google/common/io/BaseEncoding.java @@ -126,7 +126,6 @@ * @since 14.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class BaseEncoding { // TODO(lowasser): consider making encodeTo(Appendable, byte[], int, int) public. diff --git a/guava/src/com/google/common/io/ByteArrayDataInput.java b/guava/src/com/google/common/io/ByteArrayDataInput.java index 9fa295904d48..758c51ebfa85 100644 --- a/guava/src/com/google/common/io/ByteArrayDataInput.java +++ b/guava/src/com/google/common/io/ByteArrayDataInput.java @@ -35,7 +35,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ByteArrayDataInput extends DataInput { @Override void readFully(byte b[]); diff --git a/guava/src/com/google/common/io/ByteArrayDataOutput.java b/guava/src/com/google/common/io/ByteArrayDataOutput.java index 487783531601..8366a5790a8c 100644 --- a/guava/src/com/google/common/io/ByteArrayDataOutput.java +++ b/guava/src/com/google/common/io/ByteArrayDataOutput.java @@ -28,7 +28,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ByteArrayDataOutput extends DataOutput { @Override void write(int b); diff --git a/guava/src/com/google/common/io/ByteProcessor.java b/guava/src/com/google/common/io/ByteProcessor.java index cfb531c5a7f9..5947de3ab58c 100644 --- a/guava/src/com/google/common/io/ByteProcessor.java +++ b/guava/src/com/google/common/io/ByteProcessor.java @@ -33,7 +33,6 @@ @DoNotMock("Implement it normally") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ByteProcessor { /** * This method will be called for each chunk of bytes in an input stream. The implementation diff --git a/guava/src/com/google/common/io/ByteSink.java b/guava/src/com/google/common/io/ByteSink.java index f6727a987a2d..d3013cb1ffb3 100644 --- a/guava/src/com/google/common/io/ByteSink.java +++ b/guava/src/com/google/common/io/ByteSink.java @@ -48,7 +48,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ByteSink { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/io/ByteSource.java b/guava/src/com/google/common/io/ByteSource.java index 8da642c1b57e..a4da540bd27e 100644 --- a/guava/src/com/google/common/io/ByteSource.java +++ b/guava/src/com/google/common/io/ByteSource.java @@ -76,7 +76,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ByteSource { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/io/ByteStreams.java b/guava/src/com/google/common/io/ByteStreams.java index f869fe9cfaa8..cb4ad5cbc3c3 100644 --- a/guava/src/com/google/common/io/ByteStreams.java +++ b/guava/src/com/google/common/io/ByteStreams.java @@ -55,7 +55,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ByteStreams { private static final int BUFFER_SIZE = 8192; diff --git a/guava/src/com/google/common/io/CharSequenceReader.java b/guava/src/com/google/common/io/CharSequenceReader.java index a5614041f0f1..38e1be1b1cb6 100644 --- a/guava/src/com/google/common/io/CharSequenceReader.java +++ b/guava/src/com/google/common/io/CharSequenceReader.java @@ -36,7 +36,6 @@ // TODO(cgdecker): make this public? as a type, or a method in CharStreams? @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class CharSequenceReader extends Reader { @CheckForNull private CharSequence seq; diff --git a/guava/src/com/google/common/io/CharSink.java b/guava/src/com/google/common/io/CharSink.java index be1777536789..734b305357a8 100644 --- a/guava/src/com/google/common/io/CharSink.java +++ b/guava/src/com/google/common/io/CharSink.java @@ -53,7 +53,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class CharSink { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/io/CharSource.java b/guava/src/com/google/common/io/CharSource.java index e2a016080ea9..5f10a0b42140 100644 --- a/guava/src/com/google/common/io/CharSource.java +++ b/guava/src/com/google/common/io/CharSource.java @@ -84,7 +84,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class CharSource { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/io/CharStreams.java b/guava/src/com/google/common/io/CharStreams.java index 877de824de79..d518caf19957 100644 --- a/guava/src/com/google/common/io/CharStreams.java +++ b/guava/src/com/google/common/io/CharStreams.java @@ -45,7 +45,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CharStreams { // 2K chars (4K bytes) diff --git a/guava/src/com/google/common/io/Closeables.java b/guava/src/com/google/common/io/Closeables.java index aca51a996fb9..363e12d7c1f4 100644 --- a/guava/src/com/google/common/io/Closeables.java +++ b/guava/src/com/google/common/io/Closeables.java @@ -33,7 +33,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Closeables { @VisibleForTesting static final Logger logger = Logger.getLogger(Closeables.class.getName()); diff --git a/guava/src/com/google/common/io/Closer.java b/guava/src/com/google/common/io/Closer.java index b947cd0994f8..3169e56a173a 100644 --- a/guava/src/com/google/common/io/Closer.java +++ b/guava/src/com/google/common/io/Closer.java @@ -81,7 +81,6 @@ // Coffee's for {@link Closer closers} only. @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Closer implements Closeable { /** Creates a new {@link Closer}. */ public static Closer create() { diff --git a/guava/src/com/google/common/io/CountingInputStream.java b/guava/src/com/google/common/io/CountingInputStream.java index bc481dd7433b..c2f73f5ff114 100644 --- a/guava/src/com/google/common/io/CountingInputStream.java +++ b/guava/src/com/google/common/io/CountingInputStream.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CountingInputStream extends FilterInputStream { private long count; diff --git a/guava/src/com/google/common/io/CountingOutputStream.java b/guava/src/com/google/common/io/CountingOutputStream.java index 1cbfe081fdfb..c2273f8c5e3f 100644 --- a/guava/src/com/google/common/io/CountingOutputStream.java +++ b/guava/src/com/google/common/io/CountingOutputStream.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class CountingOutputStream extends FilterOutputStream { private long count; diff --git a/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 48bc10f192a1..000000000000 --- a/guava/src/com/google/common/io/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.io; - -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/guava/src/com/google/common/io/FileBackedOutputStream.java b/guava/src/com/google/common/io/FileBackedOutputStream.java index 954ab70adee0..ab0629d1d1d0 100644 --- a/guava/src/com/google/common/io/FileBackedOutputStream.java +++ b/guava/src/com/google/common/io/FileBackedOutputStream.java @@ -65,7 +65,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible -@ElementTypesAreNonnullByDefault public final class FileBackedOutputStream extends OutputStream { private final int fileThreshold; private final boolean resetOnFinalize; diff --git a/guava/src/com/google/common/io/FileWriteMode.java b/guava/src/com/google/common/io/FileWriteMode.java index 47cf251e76eb..c253b00afe1f 100644 --- a/guava/src/com/google/common/io/FileWriteMode.java +++ b/guava/src/com/google/common/io/FileWriteMode.java @@ -25,7 +25,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public enum FileWriteMode { /** Specifies that writes to the opened file should append to the end of the file. */ APPEND diff --git a/guava/src/com/google/common/io/Files.java b/guava/src/com/google/common/io/Files.java index a8d83e39cc7a..11c49d63e5c3 100644 --- a/guava/src/com/google/common/io/Files.java +++ b/guava/src/com/google/common/io/Files.java @@ -70,7 +70,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Files { private Files() {} diff --git a/guava/src/com/google/common/io/Flushables.java b/guava/src/com/google/common/io/Flushables.java index 4a42e4a407a8..412a09bbfe82 100644 --- a/guava/src/com/google/common/io/Flushables.java +++ b/guava/src/com/google/common/io/Flushables.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Flushables { private static final Logger logger = Logger.getLogger(Flushables.class.getName()); diff --git a/guava/src/com/google/common/io/IgnoreJRERequirement.java b/guava/src/com/google/common/io/IgnoreJRERequirement.java index b1b8e1032cc0..383163d4977c 100644 --- a/guava/src/com/google/common/io/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/io/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                                      Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java b/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java index 601ee9a8d739..ed2cab220511 100644 --- a/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java +++ b/guava/src/com/google/common/io/InsecureRecursiveDeleteException.java @@ -38,7 +38,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible // java.nio.file -@ElementTypesAreNonnullByDefault public final class InsecureRecursiveDeleteException extends FileSystemException { public InsecureRecursiveDeleteException(@CheckForNull String file) { diff --git a/guava/src/com/google/common/io/Java8Compatibility.java b/guava/src/com/google/common/io/Java8Compatibility.java index bd3e6e055339..f1cd446ed330 100644 --- a/guava/src/com/google/common/io/Java8Compatibility.java +++ b/guava/src/com/google/common/io/Java8Compatibility.java @@ -24,7 +24,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class Java8Compatibility { static void clear(Buffer b) { b.clear(); diff --git a/guava/src/com/google/common/io/LineBuffer.java b/guava/src/com/google/common/io/LineBuffer.java index 201dfd61617d..83029d5183f3 100644 --- a/guava/src/com/google/common/io/LineBuffer.java +++ b/guava/src/com/google/common/io/LineBuffer.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class LineBuffer { /** Holds partial line contents. */ private StringBuilder line = new StringBuilder(); diff --git a/guava/src/com/google/common/io/LineProcessor.java b/guava/src/com/google/common/io/LineProcessor.java index c0e08fa119f0..5f45f941f0c8 100644 --- a/guava/src/com/google/common/io/LineProcessor.java +++ b/guava/src/com/google/common/io/LineProcessor.java @@ -31,7 +31,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface LineProcessor { /** diff --git a/guava/src/com/google/common/io/LineReader.java b/guava/src/com/google/common/io/LineReader.java index 54bf04c7caad..9afcf288088c 100644 --- a/guava/src/com/google/common/io/LineReader.java +++ b/guava/src/com/google/common/io/LineReader.java @@ -37,7 +37,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class LineReader { private final Readable readable; @CheckForNull private final Reader reader; diff --git a/guava/src/com/google/common/io/LittleEndianDataInputStream.java b/guava/src/com/google/common/io/LittleEndianDataInputStream.java index 54b1b14e87fa..ad9cf179ee3c 100644 --- a/guava/src/com/google/common/io/LittleEndianDataInputStream.java +++ b/guava/src/com/google/common/io/LittleEndianDataInputStream.java @@ -41,7 +41,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class LittleEndianDataInputStream extends FilterInputStream implements DataInput { /** diff --git a/guava/src/com/google/common/io/LittleEndianDataOutputStream.java b/guava/src/com/google/common/io/LittleEndianDataOutputStream.java index dbb7e8eef7b7..dd3746cc6781 100644 --- a/guava/src/com/google/common/io/LittleEndianDataOutputStream.java +++ b/guava/src/com/google/common/io/LittleEndianDataOutputStream.java @@ -36,7 +36,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class LittleEndianDataOutputStream extends FilterOutputStream implements DataOutput { /** diff --git a/guava/src/com/google/common/io/MoreFiles.java b/guava/src/com/google/common/io/MoreFiles.java index 4c09f58e6603..b6cf3d8cc08b 100644 --- a/guava/src/com/google/common/io/MoreFiles.java +++ b/guava/src/com/google/common/io/MoreFiles.java @@ -69,7 +69,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible // java.nio.file -@ElementTypesAreNonnullByDefault public final class MoreFiles { private MoreFiles() {} diff --git a/guava/src/com/google/common/io/MultiInputStream.java b/guava/src/com/google/common/io/MultiInputStream.java index 068baf679010..92540f438bef 100644 --- a/guava/src/com/google/common/io/MultiInputStream.java +++ b/guava/src/com/google/common/io/MultiInputStream.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class MultiInputStream extends InputStream { private Iterator it; diff --git a/guava/src/com/google/common/io/MultiReader.java b/guava/src/com/google/common/io/MultiReader.java index 9e3a7eccbb9e..de5d3b55e208 100644 --- a/guava/src/com/google/common/io/MultiReader.java +++ b/guava/src/com/google/common/io/MultiReader.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault class MultiReader extends Reader { private final Iterator it; @CheckForNull private Reader current; diff --git a/guava/src/com/google/common/io/ParametricNullness.java b/guava/src/com/google/common/io/ParametricNullness.java index 881c07d49804..32eee700e1c6 100644 --- a/guava/src/com/google/common/io/ParametricNullness.java +++ b/guava/src/com/google/common/io/ParametricNullness.java @@ -56,8 +56,8 @@ *

                                        *
                                      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/io/PatternFilenameFilter.java b/guava/src/com/google/common/io/PatternFilenameFilter.java index ee0a0bda20f4..e92eb66528c6 100644 --- a/guava/src/com/google/common/io/PatternFilenameFilter.java +++ b/guava/src/com/google/common/io/PatternFilenameFilter.java @@ -31,7 +31,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class PatternFilenameFilter implements FilenameFilter { private final Pattern pattern; diff --git a/guava/src/com/google/common/io/ReaderInputStream.java b/guava/src/com/google/common/io/ReaderInputStream.java index 9f09ac0894cb..3a804b170de8 100644 --- a/guava/src/com/google/common/io/ReaderInputStream.java +++ b/guava/src/com/google/common/io/ReaderInputStream.java @@ -47,7 +47,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class ReaderInputStream extends InputStream { private final Reader reader; private final CharsetEncoder encoder; diff --git a/guava/src/com/google/common/io/RecursiveDeleteOption.java b/guava/src/com/google/common/io/RecursiveDeleteOption.java index 9b47181f0141..20782a4e27ea 100644 --- a/guava/src/com/google/common/io/RecursiveDeleteOption.java +++ b/guava/src/com/google/common/io/RecursiveDeleteOption.java @@ -31,7 +31,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible // java.nio.file -@ElementTypesAreNonnullByDefault public enum RecursiveDeleteOption { /** * Specifies that the recursive delete should not throw an exception when it can't be guaranteed diff --git a/guava/src/com/google/common/io/Resources.java b/guava/src/com/google/common/io/Resources.java index ea9daea96a6c..e953c7944e9a 100644 --- a/guava/src/com/google/common/io/Resources.java +++ b/guava/src/com/google/common/io/Resources.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Resources { private Resources() {} diff --git a/guava/src/com/google/common/io/TempFileCreator.java b/guava/src/com/google/common/io/TempFileCreator.java index 769761280b27..6a65e39d2572 100644 --- a/guava/src/com/google/common/io/TempFileCreator.java +++ b/guava/src/com/google/common/io/TempFileCreator.java @@ -51,7 +51,6 @@ @J2ktIncompatible @GwtIncompatible @J2ObjCIncompatible -@ElementTypesAreNonnullByDefault abstract class TempFileCreator { static final TempFileCreator INSTANCE = pickSecureCreator(); diff --git a/guava/src/com/google/common/io/package-info.java b/guava/src/com/google/common/io/package-info.java index e4eebbd0d798..83eb21439117 100644 --- a/guava/src/com/google/common/io/package-info.java +++ b/guava/src/com/google/common/io/package-info.java @@ -28,8 +28,6 @@ * @author Chris Nokleberg */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.io; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/math/BigDecimalMath.java b/guava/src/com/google/common/math/BigDecimalMath.java index d7094047999f..e1a7a10d4b98 100644 --- a/guava/src/com/google/common/math/BigDecimalMath.java +++ b/guava/src/com/google/common/math/BigDecimalMath.java @@ -27,7 +27,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class BigDecimalMath { private BigDecimalMath() {} diff --git a/guava/src/com/google/common/math/BigIntegerMath.java b/guava/src/com/google/common/math/BigIntegerMath.java index ada0f0f57c80..204ac38874d9 100644 --- a/guava/src/com/google/common/math/BigIntegerMath.java +++ b/guava/src/com/google/common/math/BigIntegerMath.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class BigIntegerMath { /** * Returns the smallest power of two greater than or equal to {@code x}. This is equivalent to diff --git a/guava/src/com/google/common/math/DoubleMath.java b/guava/src/com/google/common/math/DoubleMath.java index 531334cf4d5a..5729f829826f 100644 --- a/guava/src/com/google/common/math/DoubleMath.java +++ b/guava/src/com/google/common/math/DoubleMath.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class DoubleMath { /* * This method returns a value y such that rounding y DOWN (towards zero) gives the same result as diff --git a/guava/src/com/google/common/math/DoubleUtils.java b/guava/src/com/google/common/math/DoubleUtils.java index f10367cf7cc5..e2331a71c624 100644 --- a/guava/src/com/google/common/math/DoubleUtils.java +++ b/guava/src/com/google/common/math/DoubleUtils.java @@ -34,7 +34,6 @@ * @author Louis Wasserman */ @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DoubleUtils { private DoubleUtils() {} diff --git a/guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 84999ea49499..000000000000 --- a/guava/src/com/google/common/math/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.math; - -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/guava/src/com/google/common/math/IgnoreJRERequirement.java b/guava/src/com/google/common/math/IgnoreJRERequirement.java index 264757baf15b..4d9e99fd0df0 100644 --- a/guava/src/com/google/common/math/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/math/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                                        Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/math/IntMath.java b/guava/src/com/google/common/math/IntMath.java index 74b6de68a681..44c7d67accf6 100644 --- a/guava/src/com/google/common/math/IntMath.java +++ b/guava/src/com/google/common/math/IntMath.java @@ -47,7 +47,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class IntMath { @VisibleForTesting static final int MAX_SIGNED_POWER_OF_TWO = 1 << (Integer.SIZE - 2); diff --git a/guava/src/com/google/common/math/LinearTransformation.java b/guava/src/com/google/common/math/LinearTransformation.java index 463e8f9b8a35..f4d1885a02bb 100644 --- a/guava/src/com/google/common/math/LinearTransformation.java +++ b/guava/src/com/google/common/math/LinearTransformation.java @@ -36,7 +36,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class LinearTransformation { /** * Constructor for use by subclasses inside Guava. diff --git a/guava/src/com/google/common/math/LongMath.java b/guava/src/com/google/common/math/LongMath.java index 16e0248d99e4..facc7810f278 100644 --- a/guava/src/com/google/common/math/LongMath.java +++ b/guava/src/com/google/common/math/LongMath.java @@ -47,7 +47,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class LongMath { @VisibleForTesting static final long MAX_SIGNED_POWER_OF_TWO = 1L << (Long.SIZE - 2); diff --git a/guava/src/com/google/common/math/MathPreconditions.java b/guava/src/com/google/common/math/MathPreconditions.java index d8b7b10bf4cd..33e142d0b7e3 100644 --- a/guava/src/com/google/common/math/MathPreconditions.java +++ b/guava/src/com/google/common/math/MathPreconditions.java @@ -25,7 +25,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class MathPreconditions { @CanIgnoreReturnValue static int checkPositive(String role, int x) { diff --git a/guava/src/com/google/common/math/PairedStats.java b/guava/src/com/google/common/math/PairedStats.java index c60a62b0aee3..dc42cf11f5a4 100644 --- a/guava/src/com/google/common/math/PairedStats.java +++ b/guava/src/com/google/common/math/PairedStats.java @@ -39,7 +39,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class PairedStats implements Serializable { private final Stats xStats; diff --git a/guava/src/com/google/common/math/PairedStatsAccumulator.java b/guava/src/com/google/common/math/PairedStatsAccumulator.java index 0eeebb0ffbbd..e8a772e9539b 100644 --- a/guava/src/com/google/common/math/PairedStatsAccumulator.java +++ b/guava/src/com/google/common/math/PairedStatsAccumulator.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class PairedStatsAccumulator { /** Creates a new accumulator. */ public PairedStatsAccumulator() {} diff --git a/guava/src/com/google/common/math/ParametricNullness.java b/guava/src/com/google/common/math/ParametricNullness.java index 612fa934a6d5..a18ba9348f9a 100644 --- a/guava/src/com/google/common/math/ParametricNullness.java +++ b/guava/src/com/google/common/math/ParametricNullness.java @@ -56,8 +56,8 @@ *

                                          *
                                        • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                        • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/math/Quantiles.java b/guava/src/com/google/common/math/Quantiles.java index e02b26db57ce..37ba5a93f68b 100644 --- a/guava/src/com/google/common/math/Quantiles.java +++ b/guava/src/com/google/common/math/Quantiles.java @@ -128,7 +128,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Quantiles { /** * Constructor for a type that is not meant to be instantiated. diff --git a/guava/src/com/google/common/math/Stats.java b/guava/src/com/google/common/math/Stats.java index a89b1082ea38..b2e7015a5b06 100644 --- a/guava/src/com/google/common/math/Stats.java +++ b/guava/src/com/google/common/math/Stats.java @@ -64,7 +64,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Stats implements Serializable { private final long count; diff --git a/guava/src/com/google/common/math/StatsAccumulator.java b/guava/src/com/google/common/math/StatsAccumulator.java index 55a25503281b..dafaf9af26ec 100644 --- a/guava/src/com/google/common/math/StatsAccumulator.java +++ b/guava/src/com/google/common/math/StatsAccumulator.java @@ -37,7 +37,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class StatsAccumulator { /** Creates a new accumulator. */ public StatsAccumulator() {} diff --git a/guava/src/com/google/common/math/ToDoubleRounder.java b/guava/src/com/google/common/math/ToDoubleRounder.java index 2e7e7fae0944..7525e3f990f1 100644 --- a/guava/src/com/google/common/math/ToDoubleRounder.java +++ b/guava/src/com/google/common/math/ToDoubleRounder.java @@ -25,7 +25,6 @@ * a {@link RoundingMode}. */ @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class ToDoubleRounder> { /** * Returns x rounded to either the greatest double less than or equal to the precise value of x, diff --git a/guava/src/com/google/common/math/package-info.java b/guava/src/com/google/common/math/package-info.java index 02580e1a4220..23b73a7be7b4 100644 --- a/guava/src/com/google/common/math/package-info.java +++ b/guava/src/com/google/common/math/package-info.java @@ -22,9 +22,7 @@ *

                                          See the Guava User Guide article on math utilities. */ -@ParametersAreNonnullByDefault @CheckReturnValue package com.google.common.math; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index d8cfd7377d0e..000000000000 --- a/guava/src/com/google/common/net/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.net; - -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/guava/src/com/google/common/net/HostAndPort.java b/guava/src/com/google/common/net/HostAndPort.java index 2a4011cf0e8c..4a4546b384ab 100644 --- a/guava/src/com/google/common/net/HostAndPort.java +++ b/guava/src/com/google/common/net/HostAndPort.java @@ -62,7 +62,6 @@ */ @Immutable @GwtCompatible -@ElementTypesAreNonnullByDefault public final class HostAndPort implements Serializable { /** Magic value indicating the absence of a port number. */ private static final int NO_PORT = -1; diff --git a/guava/src/com/google/common/net/HostSpecifier.java b/guava/src/com/google/common/net/HostSpecifier.java index 65194112ebb8..80ab799aa110 100644 --- a/guava/src/com/google/common/net/HostSpecifier.java +++ b/guava/src/com/google/common/net/HostSpecifier.java @@ -44,7 +44,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class HostSpecifier { private final String canonicalForm; diff --git a/guava/src/com/google/common/net/HttpHeaders.java b/guava/src/com/google/common/net/HttpHeaders.java index c45303be7308..df6ac99c39c8 100644 --- a/guava/src/com/google/common/net/HttpHeaders.java +++ b/guava/src/com/google/common/net/HttpHeaders.java @@ -31,7 +31,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class HttpHeaders { private HttpHeaders() {} diff --git a/guava/src/com/google/common/net/InetAddresses.java b/guava/src/com/google/common/net/InetAddresses.java index 0371bec7dc39..f9fcf8cca60b 100644 --- a/guava/src/com/google/common/net/InetAddresses.java +++ b/guava/src/com/google/common/net/InetAddresses.java @@ -103,7 +103,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class InetAddresses { private static final int IPV4_PART_COUNT = 4; private static final int IPV6_PART_COUNT = 8; diff --git a/guava/src/com/google/common/net/InternetDomainName.java b/guava/src/com/google/common/net/InternetDomainName.java index 7f75203eb0b0..51827074669f 100644 --- a/guava/src/com/google/common/net/InternetDomainName.java +++ b/guava/src/com/google/common/net/InternetDomainName.java @@ -74,7 +74,6 @@ */ @GwtCompatible(emulated = true) @Immutable -@ElementTypesAreNonnullByDefault public final class InternetDomainName { private static final CharMatcher DOTS_MATCHER = CharMatcher.anyOf(".\u3002\uFF0E\uFF61"); diff --git a/guava/src/com/google/common/net/MediaType.java b/guava/src/com/google/common/net/MediaType.java index 6a2e3017f2e8..2fb8d5028d19 100644 --- a/guava/src/com/google/common/net/MediaType.java +++ b/guava/src/com/google/common/net/MediaType.java @@ -72,7 +72,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class MediaType { private static final String CHARSET_ATTRIBUTE = "charset"; private static final ImmutableListMultimap UTF_8_CONSTANT_PARAMETERS = diff --git a/guava/src/com/google/common/net/ParametricNullness.java b/guava/src/com/google/common/net/ParametricNullness.java index 83b9eb6fa6a3..5b3af1736ee1 100644 --- a/guava/src/com/google/common/net/ParametricNullness.java +++ b/guava/src/com/google/common/net/ParametricNullness.java @@ -56,8 +56,8 @@ *

                                            *
                                          • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                          • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/net/PercentEscaper.java b/guava/src/com/google/common/net/PercentEscaper.java index fa023bdf0c60..d8cd8454e6c3 100644 --- a/guava/src/com/google/common/net/PercentEscaper.java +++ b/guava/src/com/google/common/net/PercentEscaper.java @@ -51,7 +51,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class PercentEscaper extends UnicodeEscaper { // In some escapers spaces are escaped to '+' diff --git a/guava/src/com/google/common/net/UrlEscapers.java b/guava/src/com/google/common/net/UrlEscapers.java index 68cbd01e34bc..60fadbfea894 100644 --- a/guava/src/com/google/common/net/UrlEscapers.java +++ b/guava/src/com/google/common/net/UrlEscapers.java @@ -29,7 +29,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class UrlEscapers { private UrlEscapers() {} diff --git a/guava/src/com/google/common/net/package-info.java b/guava/src/com/google/common/net/package-info.java index 6a74ecee4918..a6673a108739 100644 --- a/guava/src/com/google/common/net/package-info.java +++ b/guava/src/com/google/common/net/package-info.java @@ -21,8 +21,6 @@ * @author Craig Berry */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.net; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/primitives/Booleans.java b/guava/src/com/google/common/primitives/Booleans.java index c282266b08a0..55814db536ef 100644 --- a/guava/src/com/google/common/primitives/Booleans.java +++ b/guava/src/com/google/common/primitives/Booleans.java @@ -43,7 +43,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Booleans { private Booleans() {} diff --git a/guava/src/com/google/common/primitives/Bytes.java b/guava/src/com/google/common/primitives/Bytes.java index 7b2354efeb7b..0df032121a23 100644 --- a/guava/src/com/google/common/primitives/Bytes.java +++ b/guava/src/com/google/common/primitives/Bytes.java @@ -44,7 +44,6 @@ // TODO(kevinb): how to prevent warning on UnsignedBytes when building GWT // javadoc? @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Bytes { private Bytes() {} diff --git a/guava/src/com/google/common/primitives/Chars.java b/guava/src/com/google/common/primitives/Chars.java index bf1547f45f53..05347bdd6688 100644 --- a/guava/src/com/google/common/primitives/Chars.java +++ b/guava/src/com/google/common/primitives/Chars.java @@ -46,7 +46,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Chars { private Chars() {} diff --git a/guava/src/com/google/common/primitives/Doubles.java b/guava/src/com/google/common/primitives/Doubles.java index 28d34be811f2..9162a52630e3 100644 --- a/guava/src/com/google/common/primitives/Doubles.java +++ b/guava/src/com/google/common/primitives/Doubles.java @@ -49,7 +49,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Doubles extends DoublesMethodsForWeb { private Doubles() {} diff --git a/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java b/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java index 949cbe0f5a6b..04d96512211d 100644 --- a/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java +++ b/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class DoublesMethodsForWeb {} diff --git a/guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 44f6869c7cda..000000000000 --- a/guava/src/com/google/common/primitives/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.primitives; - -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/guava/src/com/google/common/primitives/Floats.java b/guava/src/com/google/common/primitives/Floats.java index ff3cd4637ba3..2f9bcc82b3d3 100644 --- a/guava/src/com/google/common/primitives/Floats.java +++ b/guava/src/com/google/common/primitives/Floats.java @@ -47,7 +47,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Floats extends FloatsMethodsForWeb { private Floats() {} diff --git a/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java b/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java index 801e2f3ef110..acdb42f275b1 100644 --- a/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java +++ b/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class FloatsMethodsForWeb {} diff --git a/guava/src/com/google/common/primitives/IgnoreJRERequirement.java b/guava/src/com/google/common/primitives/IgnoreJRERequirement.java index a5afd04818dc..0013432f9912 100644 --- a/guava/src/com/google/common/primitives/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/primitives/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                                            Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/primitives/ImmutableDoubleArray.java b/guava/src/com/google/common/primitives/ImmutableDoubleArray.java index e3f1c215805f..936525b89b93 100644 --- a/guava/src/com/google/common/primitives/ImmutableDoubleArray.java +++ b/guava/src/com/google/common/primitives/ImmutableDoubleArray.java @@ -85,7 +85,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class ImmutableDoubleArray implements Serializable { private static final ImmutableDoubleArray EMPTY = new ImmutableDoubleArray(new double[0]); diff --git a/guava/src/com/google/common/primitives/ImmutableIntArray.java b/guava/src/com/google/common/primitives/ImmutableIntArray.java index 7badc6f2914f..6f07a2301296 100644 --- a/guava/src/com/google/common/primitives/ImmutableIntArray.java +++ b/guava/src/com/google/common/primitives/ImmutableIntArray.java @@ -85,7 +85,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class ImmutableIntArray implements Serializable { private static final ImmutableIntArray EMPTY = new ImmutableIntArray(new int[0]); diff --git a/guava/src/com/google/common/primitives/ImmutableLongArray.java b/guava/src/com/google/common/primitives/ImmutableLongArray.java index cac27093dcd9..81a79c8cbea6 100644 --- a/guava/src/com/google/common/primitives/ImmutableLongArray.java +++ b/guava/src/com/google/common/primitives/ImmutableLongArray.java @@ -85,7 +85,6 @@ */ @GwtCompatible @Immutable -@ElementTypesAreNonnullByDefault public final class ImmutableLongArray implements Serializable { private static final ImmutableLongArray EMPTY = new ImmutableLongArray(new long[0]); diff --git a/guava/src/com/google/common/primitives/Ints.java b/guava/src/com/google/common/primitives/Ints.java index 33707bd9efc1..8b57662b7d85 100644 --- a/guava/src/com/google/common/primitives/Ints.java +++ b/guava/src/com/google/common/primitives/Ints.java @@ -46,7 +46,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Ints extends IntsMethodsForWeb { private Ints() {} diff --git a/guava/src/com/google/common/primitives/IntsMethodsForWeb.java b/guava/src/com/google/common/primitives/IntsMethodsForWeb.java index c59c6b05862d..cb87bd2929f8 100644 --- a/guava/src/com/google/common/primitives/IntsMethodsForWeb.java +++ b/guava/src/com/google/common/primitives/IntsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class IntsMethodsForWeb {} diff --git a/guava/src/com/google/common/primitives/Longs.java b/guava/src/com/google/common/primitives/Longs.java index 0729d5da54e1..cc5ddde07767 100644 --- a/guava/src/com/google/common/primitives/Longs.java +++ b/guava/src/com/google/common/primitives/Longs.java @@ -45,7 +45,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Longs { private Longs() {} diff --git a/guava/src/com/google/common/primitives/ParametricNullness.java b/guava/src/com/google/common/primitives/ParametricNullness.java index c40ea499d4ce..9af83702c0b1 100644 --- a/guava/src/com/google/common/primitives/ParametricNullness.java +++ b/guava/src/com/google/common/primitives/ParametricNullness.java @@ -56,8 +56,8 @@ *

                                              *
                                            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/primitives/ParseRequest.java b/guava/src/com/google/common/primitives/ParseRequest.java index a102d69b06e1..97b0f1b57abc 100644 --- a/guava/src/com/google/common/primitives/ParseRequest.java +++ b/guava/src/com/google/common/primitives/ParseRequest.java @@ -18,7 +18,6 @@ /** A string to be parsed as a number and the radix to interpret it in. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class ParseRequest { final String rawValue; final int radix; diff --git a/guava/src/com/google/common/primitives/Primitives.java b/guava/src/com/google/common/primitives/Primitives.java index cfd1eac46d11..364f72eef27c 100644 --- a/guava/src/com/google/common/primitives/Primitives.java +++ b/guava/src/com/google/common/primitives/Primitives.java @@ -30,7 +30,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Primitives { private Primitives() {} diff --git a/guava/src/com/google/common/primitives/Shorts.java b/guava/src/com/google/common/primitives/Shorts.java index 43730a2823b3..3d80d90f5cc1 100644 --- a/guava/src/com/google/common/primitives/Shorts.java +++ b/guava/src/com/google/common/primitives/Shorts.java @@ -44,7 +44,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Shorts extends ShortsMethodsForWeb { private Shorts() {} diff --git a/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java b/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java index bb0ff103ce2f..c36276838cc6 100644 --- a/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java +++ b/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java @@ -21,5 +21,4 @@ * version. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class ShortsMethodsForWeb {} diff --git a/guava/src/com/google/common/primitives/SignedBytes.java b/guava/src/com/google/common/primitives/SignedBytes.java index 549adca8dc84..0204de6dcb59 100644 --- a/guava/src/com/google/common/primitives/SignedBytes.java +++ b/guava/src/com/google/common/primitives/SignedBytes.java @@ -36,7 +36,6 @@ // TODO(kevinb): how to prevent warning on UnsignedBytes when building GWT // javadoc? @GwtCompatible -@ElementTypesAreNonnullByDefault public final class SignedBytes { private SignedBytes() {} diff --git a/guava/src/com/google/common/primitives/UnsignedBytes.java b/guava/src/com/google/common/primitives/UnsignedBytes.java index 25410827e438..377c2d61bebb 100644 --- a/guava/src/com/google/common/primitives/UnsignedBytes.java +++ b/guava/src/com/google/common/primitives/UnsignedBytes.java @@ -49,7 +49,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class UnsignedBytes { private UnsignedBytes() {} diff --git a/guava/src/com/google/common/primitives/UnsignedInteger.java b/guava/src/com/google/common/primitives/UnsignedInteger.java index b0c7588774b5..e739e440076a 100644 --- a/guava/src/com/google/common/primitives/UnsignedInteger.java +++ b/guava/src/com/google/common/primitives/UnsignedInteger.java @@ -40,7 +40,6 @@ * @since 11.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class UnsignedInteger extends Number implements Comparable { public static final UnsignedInteger ZERO = fromIntBits(0); public static final UnsignedInteger ONE = fromIntBits(1); diff --git a/guava/src/com/google/common/primitives/UnsignedInts.java b/guava/src/com/google/common/primitives/UnsignedInts.java index 4909b68b94ac..513a633d425b 100644 --- a/guava/src/com/google/common/primitives/UnsignedInts.java +++ b/guava/src/com/google/common/primitives/UnsignedInts.java @@ -45,7 +45,6 @@ * @since 11.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class UnsignedInts { static final long INT_MASK = 0xffffffffL; diff --git a/guava/src/com/google/common/primitives/UnsignedLong.java b/guava/src/com/google/common/primitives/UnsignedLong.java index d803634f4946..04af18937005 100644 --- a/guava/src/com/google/common/primitives/UnsignedLong.java +++ b/guava/src/com/google/common/primitives/UnsignedLong.java @@ -38,7 +38,6 @@ * @since 11.0 */ @GwtCompatible(serializable = true) -@ElementTypesAreNonnullByDefault public final class UnsignedLong extends Number implements Comparable, Serializable { private static final long UNSIGNED_MASK = 0x7fffffffffffffffL; diff --git a/guava/src/com/google/common/primitives/UnsignedLongs.java b/guava/src/com/google/common/primitives/UnsignedLongs.java index 724d6dc59e0f..96f4628d4d76 100644 --- a/guava/src/com/google/common/primitives/UnsignedLongs.java +++ b/guava/src/com/google/common/primitives/UnsignedLongs.java @@ -48,7 +48,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class UnsignedLongs { private UnsignedLongs() {} diff --git a/guava/src/com/google/common/primitives/package-info.java b/guava/src/com/google/common/primitives/package-info.java index ad38c111393c..d714422528d9 100644 --- a/guava/src/com/google/common/primitives/package-info.java +++ b/guava/src/com/google/common/primitives/package-info.java @@ -63,9 +63,7 @@ *
                                            • {@link Primitives} *
                                            */ -@ParametersAreNonnullByDefault @CheckReturnValue package com.google.common.primitives; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java index 1c0318aa9519..75ef93a41b68 100644 --- a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java +++ b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java @@ -38,7 +38,6 @@ * @author Ben Yu * @since 12.0 */ -@ElementTypesAreNonnullByDefault public abstract class AbstractInvocationHandler implements InvocationHandler { /** Constructor for use by subclasses. */ public AbstractInvocationHandler() {} diff --git a/guava/src/com/google/common/reflect/ClassPath.java b/guava/src/com/google/common/reflect/ClassPath.java index d15bb5055d33..9541f4e83981 100644 --- a/guava/src/com/google/common/reflect/ClassPath.java +++ b/guava/src/com/google/common/reflect/ClassPath.java @@ -90,7 +90,6 @@ * @author Ben Yu * @since 14.0 */ -@ElementTypesAreNonnullByDefault public final class ClassPath { private static final Logger logger = Logger.getLogger(ClassPath.class.getName()); diff --git a/guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 0e8ef3cb7bcb..000000000000 --- a/guava/src/com/google/common/reflect/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.reflect; - -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/guava/src/com/google/common/reflect/IgnoreJRERequirement.java b/guava/src/com/google/common/reflect/IgnoreJRERequirement.java index 8b03ca33209b..a56902603307 100644 --- a/guava/src/com/google/common/reflect/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/reflect/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                                            Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java index 6273704a1072..5b8db7020f0a 100644 --- a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java @@ -28,7 +28,6 @@ * @author Ben Yu * @since 13.0 */ -@ElementTypesAreNonnullByDefault public final class ImmutableTypeToInstanceMap extends ForwardingMap, B> implements TypeToInstanceMap { diff --git a/guava/src/com/google/common/reflect/Invokable.java b/guava/src/com/google/common/reflect/Invokable.java index 2e2c04193bbf..85e40a86b221 100644 --- a/guava/src/com/google/common/reflect/Invokable.java +++ b/guava/src/com/google/common/reflect/Invokable.java @@ -62,7 +62,6 @@ * @since 14.0 (no longer implements {@link AccessibleObject} or {@code GenericDeclaration} since * 31.0) */ -@ElementTypesAreNonnullByDefault public abstract class Invokable implements AnnotatedElement, Member { private final AccessibleObject accessibleObject; private final Member member; diff --git a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java index 0ac86f54bcd7..645153040972 100644 --- a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java @@ -36,7 +36,6 @@ * @author Ben Yu * @since 13.0 */ -@ElementTypesAreNonnullByDefault public final class MutableTypeToInstanceMap extends ForwardingMap, B> implements TypeToInstanceMap { /** Creates a new map. */ diff --git a/guava/src/com/google/common/reflect/Parameter.java b/guava/src/com/google/common/reflect/Parameter.java index e0e244b05ca2..02e103d1910f 100644 --- a/guava/src/com/google/common/reflect/Parameter.java +++ b/guava/src/com/google/common/reflect/Parameter.java @@ -31,7 +31,6 @@ * @author Ben Yu * @since 14.0 */ -@ElementTypesAreNonnullByDefault public final class Parameter implements AnnotatedElement { private final Invokable declaration; diff --git a/guava/src/com/google/common/reflect/ParametricNullness.java b/guava/src/com/google/common/reflect/ParametricNullness.java index 372a53bb616f..4cc7fd284847 100644 --- a/guava/src/com/google/common/reflect/ParametricNullness.java +++ b/guava/src/com/google/common/reflect/ParametricNullness.java @@ -56,8 +56,8 @@ *

                                              *
                                            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/reflect/Reflection.java b/guava/src/com/google/common/reflect/Reflection.java index 09e966d12bd0..3cc06250c344 100644 --- a/guava/src/com/google/common/reflect/Reflection.java +++ b/guava/src/com/google/common/reflect/Reflection.java @@ -25,7 +25,6 @@ * * @since 12.0 */ -@ElementTypesAreNonnullByDefault public final class Reflection { /** diff --git a/guava/src/com/google/common/reflect/TypeCapture.java b/guava/src/com/google/common/reflect/TypeCapture.java index 2be7b4fddad1..effb382b2826 100644 --- a/guava/src/com/google/common/reflect/TypeCapture.java +++ b/guava/src/com/google/common/reflect/TypeCapture.java @@ -24,7 +24,6 @@ * * @author Ben Yu */ -@ElementTypesAreNonnullByDefault abstract class TypeCapture { /** Returns the captured type. */ diff --git a/guava/src/com/google/common/reflect/TypeParameter.java b/guava/src/com/google/common/reflect/TypeParameter.java index 69cd8291a909..347806bca518 100644 --- a/guava/src/com/google/common/reflect/TypeParameter.java +++ b/guava/src/com/google/common/reflect/TypeParameter.java @@ -33,7 +33,6 @@ * @author Ben Yu * @since 12.0 */ -@ElementTypesAreNonnullByDefault /* * A nullable bound would let users create a TypeParameter instance for a parameter with a nullable * bound. However, it would also let them create `new TypeParameter<@Nullable T>() {}`, which diff --git a/guava/src/com/google/common/reflect/TypeResolver.java b/guava/src/com/google/common/reflect/TypeResolver.java index e9c3a1d19de3..73a077f03957 100644 --- a/guava/src/com/google/common/reflect/TypeResolver.java +++ b/guava/src/com/google/common/reflect/TypeResolver.java @@ -50,7 +50,6 @@ * @author Ben Yu * @since 15.0 */ -@ElementTypesAreNonnullByDefault public final class TypeResolver { private final TypeTable typeTable; diff --git a/guava/src/com/google/common/reflect/TypeToInstanceMap.java b/guava/src/com/google/common/reflect/TypeToInstanceMap.java index fe61a2cc510b..efc273056354 100644 --- a/guava/src/com/google/common/reflect/TypeToInstanceMap.java +++ b/guava/src/com/google/common/reflect/TypeToInstanceMap.java @@ -41,7 +41,6 @@ * @since 13.0 */ @DoNotMock("Use ImmutableTypeToInstanceMap or MutableTypeToInstanceMap") -@ElementTypesAreNonnullByDefault public interface TypeToInstanceMap extends Map, B> { diff --git a/guava/src/com/google/common/reflect/TypeToken.java b/guava/src/com/google/common/reflect/TypeToken.java index f1b97a9692b3..d8ecc414f1cd 100644 --- a/guava/src/com/google/common/reflect/TypeToken.java +++ b/guava/src/com/google/common/reflect/TypeToken.java @@ -99,7 +99,6 @@ * @since 12.0 */ @SuppressWarnings("serial") // SimpleTypeToken is the serialized form. -@ElementTypesAreNonnullByDefault public abstract class TypeToken extends TypeCapture implements Serializable { private final Type runtimeType; diff --git a/guava/src/com/google/common/reflect/TypeVisitor.java b/guava/src/com/google/common/reflect/TypeVisitor.java index 416397bc77d6..db3d4a71b527 100644 --- a/guava/src/com/google/common/reflect/TypeVisitor.java +++ b/guava/src/com/google/common/reflect/TypeVisitor.java @@ -54,7 +54,6 @@ * * @author Ben Yu */ -@ElementTypesAreNonnullByDefault abstract class TypeVisitor { private final Set visited = Sets.newHashSet(); diff --git a/guava/src/com/google/common/reflect/Types.java b/guava/src/com/google/common/reflect/Types.java index d608027d4ef3..2378c2df1d9d 100644 --- a/guava/src/com/google/common/reflect/Types.java +++ b/guava/src/com/google/common/reflect/Types.java @@ -52,7 +52,6 @@ * * @author Ben Yu */ -@ElementTypesAreNonnullByDefault final class Types { /** Class#toString without the "class " and "interface " prefixes */ diff --git a/guava/src/com/google/common/reflect/package-info.java b/guava/src/com/google/common/reflect/package-info.java index 1fc793e2ad86..58de94042167 100644 --- a/guava/src/com/google/common/reflect/package-info.java +++ b/guava/src/com/google/common/reflect/package-info.java @@ -17,8 +17,6 @@ * href="https://github.com/google/guava">Guava library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.reflect; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java b/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java index 635c92be2d90..4452dd68bfc5 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java @@ -35,7 +35,6 @@ /** Implementations of {@code Futures.catching*}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings({ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || "ShortCircuitBoolean", diff --git a/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java b/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java index fd4667436309..7e011b9d909a 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractExecutionThreadService.java @@ -34,7 +34,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractExecutionThreadService implements Service { /* use AbstractService for state management */ private final Service delegate = diff --git a/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/guava/src/com/google/common/util/concurrent/AbstractFuture.java index d57d586fda7f..c81c968f0a2d 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractFuture.java @@ -76,7 +76,6 @@ }) @GwtCompatible(emulated = true) @ReflectionSupport(value = ReflectionSupport.Level.FULL) -@ElementTypesAreNonnullByDefault public abstract class AbstractFuture extends InternalFutureFailureAccess implements ListenableFuture { static final boolean GENERATE_CANCELLATION_CAUSES; diff --git a/guava/src/com/google/common/util/concurrent/AbstractIdleService.java b/guava/src/com/google/common/util/concurrent/AbstractIdleService.java index c1d32eefe374..ae25c4acb3ed 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractIdleService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractIdleService.java @@ -36,7 +36,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractIdleService implements Service { /* Thread names will look like {@code "MyService STARTING"}. */ diff --git a/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java b/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java index 192c07e4c153..98ccc2bf122d 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractListeningExecutorService.java @@ -37,7 +37,6 @@ @CheckReturnValue @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractListeningExecutorService extends AbstractExecutorService implements ListeningExecutorService { /** Constructor for use by subclasses. */ @@ -70,6 +69,7 @@ public ListenableFuture submit(Runnable task) { @CanIgnoreReturnValue // TODO(kak): consider removing this @Override + @SuppressWarnings("nullness") // some kind of checker bug public ListenableFuture submit( Runnable task, @ParametricNullness T result) { return (ListenableFuture) super.submit(task, result); diff --git a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java index 8d77e8755ec3..347547da3cb1 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java @@ -102,7 +102,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractScheduledService implements Service { private static final LazyLogger logger = new LazyLogger(AbstractScheduledService.class); diff --git a/guava/src/com/google/common/util/concurrent/AbstractService.java b/guava/src/com/google/common/util/concurrent/AbstractService.java index 424206ef548c..5fd0097072f9 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractService.java +++ b/guava/src/com/google/common/util/concurrent/AbstractService.java @@ -52,7 +52,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public abstract class AbstractService implements Service { private static final ListenerCallQueue.Event STARTING_EVENT = new ListenerCallQueue.Event() { diff --git a/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java b/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java index d57b526aa886..98dc67ed8e18 100644 --- a/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java +++ b/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java @@ -32,7 +32,6 @@ /** Implementations of {@code Futures.transform*}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings({ // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || "ShortCircuitBoolean", diff --git a/guava/src/com/google/common/util/concurrent/AggregateFuture.java b/guava/src/com/google/common/util/concurrent/AggregateFuture.java index c2409debd289..8b77af98e732 100644 --- a/guava/src/com/google/common/util/concurrent/AggregateFuture.java +++ b/guava/src/com/google/common/util/concurrent/AggregateFuture.java @@ -42,7 +42,6 @@ * @param the type of the output (i.e. this) future */ @GwtCompatible -@ElementTypesAreNonnullByDefault @SuppressWarnings( // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, || "ShortCircuitBoolean") diff --git a/guava/src/com/google/common/util/concurrent/AggregateFutureState.java b/guava/src/com/google/common/util/concurrent/AggregateFutureState.java index 45a9551834ec..4de212d41d6b 100644 --- a/guava/src/com/google/common/util/concurrent/AggregateFutureState.java +++ b/guava/src/com/google/common/util/concurrent/AggregateFutureState.java @@ -39,7 +39,6 @@ */ @GwtCompatible(emulated = true) @ReflectionSupport(value = ReflectionSupport.Level.FULL) -@ElementTypesAreNonnullByDefault abstract class AggregateFutureState extends AbstractFuture.TrustedFuture { // Lazily initialized the first time we see an exception; not released until all the input futures diff --git a/guava/src/com/google/common/util/concurrent/AsyncCallable.java b/guava/src/com/google/common/util/concurrent/AsyncCallable.java index c3cbb78a9fae..f6798cdf5b60 100644 --- a/guava/src/com/google/common/util/concurrent/AsyncCallable.java +++ b/guava/src/com/google/common/util/concurrent/AsyncCallable.java @@ -29,7 +29,6 @@ */ @FunctionalInterface @GwtCompatible -@ElementTypesAreNonnullByDefault public interface AsyncCallable { /** * Computes a result {@code Future}. The output {@code Future} need not be {@linkplain diff --git a/guava/src/com/google/common/util/concurrent/AsyncFunction.java b/guava/src/com/google/common/util/concurrent/AsyncFunction.java index 3a19db4a5e20..7ffa1b5af695 100644 --- a/guava/src/com/google/common/util/concurrent/AsyncFunction.java +++ b/guava/src/com/google/common/util/concurrent/AsyncFunction.java @@ -27,7 +27,6 @@ */ @GwtCompatible @FunctionalInterface -@ElementTypesAreNonnullByDefault public interface AsyncFunction { /** * Returns an output {@code Future} to use in place of the given {@code input}. The output {@code diff --git a/guava/src/com/google/common/util/concurrent/AtomicDouble.java b/guava/src/com/google/common/util/concurrent/AtomicDouble.java index 0565da7b8560..0251cedd5da7 100644 --- a/guava/src/com/google/common/util/concurrent/AtomicDouble.java +++ b/guava/src/com/google/common/util/concurrent/AtomicDouble.java @@ -62,7 +62,6 @@ @GwtIncompatible @J2ktIncompatible @ReflectionSupport(value = ReflectionSupport.Level.FULL) -@ElementTypesAreNonnullByDefault public class AtomicDouble extends Number implements Serializable { private static final long serialVersionUID = 0L; diff --git a/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java b/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java index 3f67671de770..a9eee194c8dd 100644 --- a/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java +++ b/guava/src/com/google/common/util/concurrent/AtomicDoubleArray.java @@ -53,7 +53,6 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public class AtomicDoubleArray implements Serializable { private static final long serialVersionUID = 0L; diff --git a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java index eaed5145e16d..c7a6aa19014a 100644 --- a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java +++ b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java @@ -60,7 +60,6 @@ */ @GwtCompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault public final class AtomicLongMap implements Serializable { private final ConcurrentHashMap map; diff --git a/guava/src/com/google/common/util/concurrent/Atomics.java b/guava/src/com/google/common/util/concurrent/Atomics.java index c1b6964ec23c..e49b0c1e7f1c 100644 --- a/guava/src/com/google/common/util/concurrent/Atomics.java +++ b/guava/src/com/google/common/util/concurrent/Atomics.java @@ -26,7 +26,6 @@ * @since 10.0 */ @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class Atomics { private Atomics() {} diff --git a/guava/src/com/google/common/util/concurrent/Callables.java b/guava/src/com/google/common/util/concurrent/Callables.java index 6a586bb2ee8b..a022a23a085c 100644 --- a/guava/src/com/google/common/util/concurrent/Callables.java +++ b/guava/src/com/google/common/util/concurrent/Callables.java @@ -30,7 +30,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Callables { private Callables() {} diff --git a/guava/src/com/google/common/util/concurrent/ClosingFuture.java b/guava/src/com/google/common/util/concurrent/ClosingFuture.java index 747b3c6302e1..71f819b4960e 100644 --- a/guava/src/com/google/common/util/concurrent/ClosingFuture.java +++ b/guava/src/com/google/common/util/concurrent/ClosingFuture.java @@ -191,7 +191,6 @@ // TODO(dpb): Consider reusing one CloseableList for the entire pipeline, modulo combinations. @DoNotMock("Use ClosingFuture.from(Futures.immediate*Future)") @J2ktIncompatible -@ElementTypesAreNonnullByDefault // TODO(dpb): GWT compatibility. public final class ClosingFuture { diff --git a/guava/src/com/google/common/util/concurrent/CollectionFuture.java b/guava/src/com/google/common/util/concurrent/CollectionFuture.java index 080904a9f6a8..c31571151c33 100644 --- a/guava/src/com/google/common/util/concurrent/CollectionFuture.java +++ b/guava/src/com/google/common/util/concurrent/CollectionFuture.java @@ -29,7 +29,6 @@ /** Aggregate future that collects (stores) results of each future. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault abstract class CollectionFuture extends AggregateFuture { /* diff --git a/guava/src/com/google/common/util/concurrent/CombinedFuture.java b/guava/src/com/google/common/util/concurrent/CombinedFuture.java index 9495eeb63723..453e351178a0 100644 --- a/guava/src/com/google/common/util/concurrent/CombinedFuture.java +++ b/guava/src/com/google/common/util/concurrent/CombinedFuture.java @@ -32,7 +32,6 @@ /** Aggregate future that computes its value by calling a callable. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class CombinedFuture extends AggregateFuture<@Nullable Object, V> { @CheckForNull @LazyInit private CombinedFutureInterruptibleTask task; diff --git a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java index 6e2ae47a3c73..eb12adb296ac 100644 --- a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java +++ b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java @@ -160,7 +160,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class CycleDetectingLockFactory { /** diff --git a/guava/src/com/google/common/util/concurrent/DirectExecutor.java b/guava/src/com/google/common/util/concurrent/DirectExecutor.java index 0c3a46b703c3..30229714c638 100644 --- a/guava/src/com/google/common/util/concurrent/DirectExecutor.java +++ b/guava/src/com/google/common/util/concurrent/DirectExecutor.java @@ -22,7 +22,6 @@ * execute}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault enum DirectExecutor implements Executor { INSTANCE; diff --git a/guava/src/com/google/common/util/concurrent/DirectExecutorService.java b/guava/src/com/google/common/util/concurrent/DirectExecutorService.java index 41811cfc6a85..8ccd000b50f1 100644 --- a/guava/src/com/google/common/util/concurrent/DirectExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/DirectExecutorService.java @@ -27,7 +27,6 @@ /** See newDirectExecutorService javadoc for behavioral notes. */ @J2ktIncompatible // Emulated @GwtIncompatible -@ElementTypesAreNonnullByDefault final class DirectExecutorService extends AbstractListeningExecutorService { /** Lock used whenever accessing the state variables (runningTasks, shutdown) of the executor */ diff --git a/guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index 34871255e812..000000000000 --- a/guava/src/com/google/common/util/concurrent/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.util.concurrent; - -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/guava/src/com/google/common/util/concurrent/ExecutionError.java b/guava/src/com/google/common/util/concurrent/ExecutionError.java index a5a2a1a3aae9..37034845ea06 100644 --- a/guava/src/com/google/common/util/concurrent/ExecutionError.java +++ b/guava/src/com/google/common/util/concurrent/ExecutionError.java @@ -28,7 +28,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class ExecutionError extends Error { /* * Ideally, this class would have exposed only constructors that require a non-null cause. See diff --git a/guava/src/com/google/common/util/concurrent/ExecutionList.java b/guava/src/com/google/common/util/concurrent/ExecutionList.java index fa8020fbcc71..7a3efb0ff89c 100644 --- a/guava/src/com/google/common/util/concurrent/ExecutionList.java +++ b/guava/src/com/google/common/util/concurrent/ExecutionList.java @@ -41,7 +41,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ExecutionList { /** Logger to log exceptions caught when running runnables. */ private static final LazyLogger log = new LazyLogger(ExecutionList.class); diff --git a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java index 4e13a9d0b315..3ab2c0d354be 100644 --- a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java +++ b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java @@ -85,7 +85,6 @@ * * @since 26.0 */ -@ElementTypesAreNonnullByDefault @J2ktIncompatible public final class ExecutionSequencer { diff --git a/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java b/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java index 6761493b16b6..3cbb80cf7bbe 100644 --- a/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/FakeTimeLimiter.java @@ -37,7 +37,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class FakeTimeLimiter implements TimeLimiter { /** Creates a new {@link FakeTimeLimiter}. */ public FakeTimeLimiter() {} diff --git a/guava/src/com/google/common/util/concurrent/FluentFuture.java b/guava/src/com/google/common/util/concurrent/FluentFuture.java index 2229276048fb..44c8de3c4f40 100644 --- a/guava/src/com/google/common/util/concurrent/FluentFuture.java +++ b/guava/src/com/google/common/util/concurrent/FluentFuture.java @@ -74,7 +74,6 @@ */ @DoNotMock("Use FluentFuture.from(Futures.immediate*Future) or SettableFuture") @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public abstract class FluentFuture extends GwtFluentFutureCatchingSpecialization { diff --git a/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java b/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java index 13aa80b5129b..a1a255f243d2 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java @@ -47,7 +47,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingBlockingDeque extends ForwardingDeque implements BlockingDeque { diff --git a/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java b/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java index 79ec94a1e5db..76d2c0fd9bbb 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java @@ -39,7 +39,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingBlockingQueue extends ForwardingQueue implements BlockingQueue { diff --git a/guava/src/com/google/common/util/concurrent/ForwardingCondition.java b/guava/src/com/google/common/util/concurrent/ForwardingCondition.java index 885cca7fcd3a..5393dbdb615c 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingCondition.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingCondition.java @@ -21,7 +21,6 @@ /** Forwarding wrapper around a {@code Condition}. */ @J2ktIncompatible -@ElementTypesAreNonnullByDefault abstract class ForwardingCondition implements Condition { abstract Condition delegate(); diff --git a/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java b/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java index 986278dafa02..6a6919343466 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingExecutorService.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingExecutorService extends ForwardingObject implements ExecutorService { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java b/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java index cb779c34ed4b..3fdb360faa09 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingFluentFuture.java @@ -34,7 +34,6 @@ * forwards to that future and adds the desired methods. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class ForwardingFluentFuture extends FluentFuture { private final ListenableFuture delegate; diff --git a/guava/src/com/google/common/util/concurrent/ForwardingFuture.java b/guava/src/com/google/common/util/concurrent/ForwardingFuture.java index 635c4f6eb14a..980363487087 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingFuture.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingFuture.java @@ -35,7 +35,6 @@ * @since 1.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingFuture extends ForwardingObject implements Future { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java b/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java index ccd2dd7b13f3..216c25c153fa 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java @@ -30,7 +30,6 @@ * @since 4.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListenableFuture extends ForwardingFuture implements ListenableFuture { diff --git a/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java b/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java index 25dbf0de76f5..fdd205957a36 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java @@ -34,7 +34,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class ForwardingListeningExecutorService extends ForwardingExecutorService implements ListeningExecutorService { /** Constructor for use by subclasses. */ diff --git a/guava/src/com/google/common/util/concurrent/ForwardingLock.java b/guava/src/com/google/common/util/concurrent/ForwardingLock.java index 558b6e3decc0..7ff05340ebc0 100644 --- a/guava/src/com/google/common/util/concurrent/ForwardingLock.java +++ b/guava/src/com/google/common/util/concurrent/ForwardingLock.java @@ -21,7 +21,6 @@ /** Forwarding wrapper around a {@code Lock}. */ @J2ktIncompatible -@ElementTypesAreNonnullByDefault abstract class ForwardingLock implements Lock { abstract Lock delegate(); diff --git a/guava/src/com/google/common/util/concurrent/FutureCallback.java b/guava/src/com/google/common/util/concurrent/FutureCallback.java index f5684e7c907a..3af949526eb0 100644 --- a/guava/src/com/google/common/util/concurrent/FutureCallback.java +++ b/guava/src/com/google/common/util/concurrent/FutureCallback.java @@ -29,7 +29,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface FutureCallback { /** Invoked with the result of the {@code Future} computation when it is successful. */ void onSuccess(@ParametricNullness V result); diff --git a/guava/src/com/google/common/util/concurrent/Futures.java b/guava/src/com/google/common/util/concurrent/Futures.java index 0abec429ca89..9db29ab2500a 100644 --- a/guava/src/com/google/common/util/concurrent/Futures.java +++ b/guava/src/com/google/common/util/concurrent/Futures.java @@ -77,7 +77,6 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Futures extends GwtFuturesCatchingSpecialization { // A note on memory visibility. diff --git a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java index cd10f4827dfb..2fd393986d98 100644 --- a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java +++ b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java @@ -41,7 +41,6 @@ /** Static methods used to implement {@link Futures#getChecked(Future, Class)}. */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class FuturesGetChecked { @CanIgnoreReturnValue @ParametricNullness diff --git a/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java b/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java index fdbe50909a7d..863d97f9de8f 100644 --- a/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java +++ b/guava/src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java @@ -25,7 +25,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible // Super-sourced -@ElementTypesAreNonnullByDefault abstract class GwtFluentFutureCatchingSpecialization extends AbstractFuture { /* diff --git a/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java b/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java index 35adfdb67201..f6b210ca3466 100644 --- a/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java +++ b/guava/src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java @@ -25,7 +25,6 @@ */ @GwtCompatible(emulated = true) @J2ktIncompatible // Super-sourced -@ElementTypesAreNonnullByDefault abstract class GwtFuturesCatchingSpecialization { /* * This server copy of the class is empty. The corresponding GWT copy contains alternative diff --git a/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java b/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java index 082aa64fb44e..b7cababe8921 100644 --- a/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java +++ b/guava/src/com/google/common/util/concurrent/IgnoreJRERequirement.java @@ -26,5 +26,4 @@ *

                                              Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault @interface IgnoreJRERequirement {} diff --git a/guava/src/com/google/common/util/concurrent/ImmediateFuture.java b/guava/src/com/google/common/util/concurrent/ImmediateFuture.java index 62ae63eaaa4c..fbec44e10c5e 100644 --- a/guava/src/com/google/common/util/concurrent/ImmediateFuture.java +++ b/guava/src/com/google/common/util/concurrent/ImmediateFuture.java @@ -27,7 +27,6 @@ /** Implementation of {@link Futures#immediateFuture}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault // TODO(cpovirk): Make this final (but that may break Mockito spy calls). class ImmediateFuture implements ListenableFuture { static final ListenableFuture NULL = new ImmediateFuture<@Nullable Object>(null); diff --git a/guava/src/com/google/common/util/concurrent/Internal.java b/guava/src/com/google/common/util/concurrent/Internal.java index 1fc3f4f8c464..a9effa77ebeb 100644 --- a/guava/src/com/google/common/util/concurrent/Internal.java +++ b/guava/src/com/google/common/util/concurrent/Internal.java @@ -21,7 +21,6 @@ /** This class is for {@code com.google.common.util.concurrent} use only! */ @J2ktIncompatible @GwtIncompatible // java.time.Duration -@ElementTypesAreNonnullByDefault final class Internal { /** diff --git a/guava/src/com/google/common/util/concurrent/InterruptibleTask.java b/guava/src/com/google/common/util/concurrent/InterruptibleTask.java index 6ca5e9ff6f2d..cce2cc42257e 100644 --- a/guava/src/com/google/common/util/concurrent/InterruptibleTask.java +++ b/guava/src/com/google/common/util/concurrent/InterruptibleTask.java @@ -28,7 +28,6 @@ @GwtCompatible(emulated = true) @ReflectionSupport(value = ReflectionSupport.Level.FULL) -@ElementTypesAreNonnullByDefault // Some Android 5.0.x Samsung devices have bugs in JDK reflection APIs that cause // getDeclaredField to throw a NoSuchFieldException when the field is definitely there. // Since this class only needs CAS on one field, we can avoid this bug by extending AtomicReference diff --git a/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java b/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java index eb3a24707270..6d3557636fe6 100644 --- a/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java +++ b/guava/src/com/google/common/util/concurrent/JdkFutureAdapters.java @@ -39,7 +39,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class JdkFutureAdapters { /** * Assigns a thread to the given {@link Future} to provide {@link ListenableFuture} functionality. diff --git a/guava/src/com/google/common/util/concurrent/LazyLogger.java b/guava/src/com/google/common/util/concurrent/LazyLogger.java index 61fefe804a64..e0f2100139d7 100644 --- a/guava/src/com/google/common/util/concurrent/LazyLogger.java +++ b/guava/src/com/google/common/util/concurrent/LazyLogger.java @@ -20,7 +20,6 @@ /** A holder for a {@link Logger} that is initialized only when requested. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class LazyLogger { private final Object lock = new Object(); diff --git a/guava/src/com/google/common/util/concurrent/ListenableFuture.java b/guava/src/com/google/common/util/concurrent/ListenableFuture.java index cdc2ee110b99..9f077dd9507f 100644 --- a/guava/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/guava/src/com/google/common/util/concurrent/ListenableFuture.java @@ -102,22 +102,20 @@ * @since 1.0 */ /* - * Some of the annotations below were added after we released our separate + * The annotation below was added after we released our separate * com.google.guava:listenablefuture:1.0 artifact. (For more on that artifact, see * https://github.com/google/guava/releases/tag/v27.0) This means that the copy of ListenableFuture * in com.google.guava:guava differs from the "frozen" copy in the listenablefuture artifact. This - * could in principle cause problems for some users. Still, we expect that the benefits of the - * nullness annotations in particular will outweigh the costs. (And it's worth noting that we have - * released multiple ListenableFuture.class files that are not byte-for-byte compatible even from - * the beginning, thanks to using different `-source -target` values for compiling our `-jre` and - * `-android` "flavors.") + * could in principle cause problems for some users. Still, we expect that the benefits will + * outweigh the costs. (And it's worth noting that we have released multiple ListenableFuture.class + * files that are not byte-for-byte compatible even from the beginning, thanks to using different + * `-source -target` values for compiling our `-jre` and `-android` "flavors.") * * (We could consider releasing a listenablefuture:1.0.1 someday. But we would want to look into how * that affects users, especially users of the Android Gradle Plugin, since the plugin developers * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -@ElementTypesAreNonnullByDefault public interface ListenableFuture extends Future { /** * Registers a listener to be {@linkplain Executor#execute(Runnable) run} on the given executor. diff --git a/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java b/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java index 161fa895f416..6b31f9ea887f 100644 --- a/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java +++ b/guava/src/com/google/common/util/concurrent/ListenableFutureTask.java @@ -43,7 +43,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class ListenableFutureTask extends FutureTask implements ListenableFuture { // TODO(cpovirk): explore ways of making ListenableFutureTask final. There are some valid reasons diff --git a/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java b/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java index f6e5d9f9e1ec..cadf87910af3 100644 --- a/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java +++ b/guava/src/com/google/common/util/concurrent/ListenableScheduledFuture.java @@ -25,6 +25,5 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public interface ListenableScheduledFuture extends ScheduledFuture, ListenableFuture {} diff --git a/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java b/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java index e6284e1c7ded..4370bf23b767 100644 --- a/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java +++ b/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java @@ -54,7 +54,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class ListenerCallQueue { // TODO(cpovirk): consider using the logger associated with listener.getClass(). private static final LazyLogger logger = new LazyLogger(ListenerCallQueue.class); diff --git a/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java b/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java index b870e34fef59..7899800ee93d 100644 --- a/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/ListeningExecutorService.java @@ -43,7 +43,6 @@ "Use TestingExecutors.sameThreadScheduledExecutor, or wrap a real Executor from " + "java.util.concurrent.Executors with MoreExecutors.listeningDecorator") @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ListeningExecutorService extends ExecutorService { /** * @return a {@code ListenableFuture} representing pending completion of the task diff --git a/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java b/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java index 19f9a8c327ae..e785a5842910 100644 --- a/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java @@ -35,7 +35,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface ListeningScheduledExecutorService extends ScheduledExecutorService, ListeningExecutorService { diff --git a/guava/src/com/google/common/util/concurrent/Monitor.java b/guava/src/com/google/common/util/concurrent/Monitor.java index d3f008e790ae..6218b5dbca35 100644 --- a/guava/src/com/google/common/util/concurrent/Monitor.java +++ b/guava/src/com/google/common/util/concurrent/Monitor.java @@ -203,7 +203,6 @@ @J2ktIncompatible @GwtIncompatible @SuppressWarnings("GuardedBy") // TODO(b/35466881): Fix or suppress. -@ElementTypesAreNonnullByDefault public final class Monitor { // TODO(user): Use raw LockSupport or AbstractQueuedSynchronizer instead of ReentrantLock. // TODO(user): "Port" jsr166 tests for ReentrantLock. diff --git a/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/guava/src/com/google/common/util/concurrent/MoreExecutors.java index 9bbca7e6d919..f03de34c5e3e 100644 --- a/guava/src/com/google/common/util/concurrent/MoreExecutors.java +++ b/guava/src/com/google/common/util/concurrent/MoreExecutors.java @@ -63,7 +63,6 @@ * @since 3.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class MoreExecutors { private MoreExecutors() {} diff --git a/guava/src/com/google/common/util/concurrent/NullnessCasts.java b/guava/src/com/google/common/util/concurrent/NullnessCasts.java index a3a914e8970a..ad6f03f83a26 100644 --- a/guava/src/com/google/common/util/concurrent/NullnessCasts.java +++ b/guava/src/com/google/common/util/concurrent/NullnessCasts.java @@ -20,7 +20,6 @@ /** A utility method to perform unchecked casts to suppress errors produced by nullness analyses. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class NullnessCasts { /** * Accepts a {@code @Nullable T} and returns a plain {@code T}, without performing any check that diff --git a/guava/src/com/google/common/util/concurrent/OverflowAvoidingLockSupport.java b/guava/src/com/google/common/util/concurrent/OverflowAvoidingLockSupport.java index 905726597fcb..b9e0bb05d189 100644 --- a/guava/src/com/google/common/util/concurrent/OverflowAvoidingLockSupport.java +++ b/guava/src/com/google/common/util/concurrent/OverflowAvoidingLockSupport.java @@ -25,7 +25,6 @@ * signal on 32 bit devices running Android Q. */ @J2ktIncompatible -@ElementTypesAreNonnullByDefault final class OverflowAvoidingLockSupport { // Represents the max nanoseconds representable on a linux timespec with a 32 bit tv_sec static final long MAX_NANOSECONDS_THRESHOLD = (1L + Integer.MAX_VALUE) * 1_000_000_000L - 1L; diff --git a/guava/src/com/google/common/util/concurrent/ParametricNullness.java b/guava/src/com/google/common/util/concurrent/ParametricNullness.java index e8fcce6ee681..f12f1133e6df 100644 --- a/guava/src/com/google/common/util/concurrent/ParametricNullness.java +++ b/guava/src/com/google/common/util/concurrent/ParametricNullness.java @@ -56,8 +56,8 @@ *

                                                *
                                              • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                              • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/util/concurrent/Partially.java b/guava/src/com/google/common/util/concurrent/Partially.java index 7aa16e776fd5..c40ab4e007ee 100644 --- a/guava/src/com/google/common/util/concurrent/Partially.java +++ b/guava/src/com/google/common/util/concurrent/Partially.java @@ -32,7 +32,6 @@ * version. */ @GwtCompatible -@ElementTypesAreNonnullByDefault final class Partially { /** * The presence of this annotation on an API indicates that the method may be used with the diff --git a/guava/src/com/google/common/util/concurrent/Platform.java b/guava/src/com/google/common/util/concurrent/Platform.java index 92d2d12db4b5..faff16140724 100644 --- a/guava/src/com/google/common/util/concurrent/Platform.java +++ b/guava/src/com/google/common/util/concurrent/Platform.java @@ -22,7 +22,6 @@ /** Methods factored out so that they can be emulated differently in GWT. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault final class Platform { static boolean isInstanceOfThrowableClass( @CheckForNull Throwable t, Class expectedClass) { diff --git a/guava/src/com/google/common/util/concurrent/RateLimiter.java b/guava/src/com/google/common/util/concurrent/RateLimiter.java index a90213d190f8..254b1f8941be 100644 --- a/guava/src/com/google/common/util/concurrent/RateLimiter.java +++ b/guava/src/com/google/common/util/concurrent/RateLimiter.java @@ -96,7 +96,6 @@ @Beta @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class RateLimiter { /** * Creates a {@code RateLimiter} with the specified stable throughput, given as "permits per diff --git a/guava/src/com/google/common/util/concurrent/Runnables.java b/guava/src/com/google/common/util/concurrent/Runnables.java index f5b27f8afe9d..13c85b019a9d 100644 --- a/guava/src/com/google/common/util/concurrent/Runnables.java +++ b/guava/src/com/google/common/util/concurrent/Runnables.java @@ -22,7 +22,6 @@ * @since 16.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class Runnables { private static final Runnable EMPTY_RUNNABLE = diff --git a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java index 2fcddadbcab4..daed275556ef 100644 --- a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java +++ b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java @@ -50,7 +50,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class SequentialExecutor implements Executor { private static final LazyLogger log = new LazyLogger(SequentialExecutor.class); diff --git a/guava/src/com/google/common/util/concurrent/Service.java b/guava/src/com/google/common/util/concurrent/Service.java index a7735b8e227d..89ad59c19b1a 100644 --- a/guava/src/com/google/common/util/concurrent/Service.java +++ b/guava/src/com/google/common/util/concurrent/Service.java @@ -58,7 +58,6 @@ @DoNotMock("Create an AbstractIdleService") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface Service { /** * If the service state is {@link State#NEW}, this initiates service startup and returns diff --git a/guava/src/com/google/common/util/concurrent/ServiceManager.java b/guava/src/com/google/common/util/concurrent/ServiceManager.java index 20925c28a2fd..4b9e195a5a49 100644 --- a/guava/src/com/google/common/util/concurrent/ServiceManager.java +++ b/guava/src/com/google/common/util/concurrent/ServiceManager.java @@ -122,7 +122,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ServiceManager implements ServiceManagerBridge { private static final LazyLogger logger = new LazyLogger(ServiceManager.class); private static final ListenerCallQueue.Event HEALTHY_EVENT = diff --git a/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java b/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java index 71fe01c0bb63..5f959acceb37 100644 --- a/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java +++ b/guava/src/com/google/common/util/concurrent/ServiceManagerBridge.java @@ -28,7 +28,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault interface ServiceManagerBridge { ImmutableMultimap servicesByState(); } diff --git a/guava/src/com/google/common/util/concurrent/SettableFuture.java b/guava/src/com/google/common/util/concurrent/SettableFuture.java index 0a9e194657f8..f4c9d4bbb2d1 100644 --- a/guava/src/com/google/common/util/concurrent/SettableFuture.java +++ b/guava/src/com/google/common/util/concurrent/SettableFuture.java @@ -33,7 +33,6 @@ * @since 9.0 (in 1.0 as {@code ValueFuture}) */ @GwtCompatible -@ElementTypesAreNonnullByDefault public final class SettableFuture extends AbstractFuture.TrustedFuture { /** diff --git a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java index 5d2713204bc4..4ad31785b1e4 100644 --- a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java @@ -48,7 +48,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault // TODO: b/227335009 - Maybe change interruption behavior, but it requires thought. @SuppressWarnings("Interruption") public final class SimpleTimeLimiter implements TimeLimiter { diff --git a/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java b/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java index 6f21ab6a3364..6d1bdbdd7b4f 100644 --- a/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java +++ b/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java @@ -24,7 +24,6 @@ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class SmoothRateLimiter extends RateLimiter { /* * How is the RateLimiter designed, and why? diff --git a/guava/src/com/google/common/util/concurrent/Striped.java b/guava/src/com/google/common/util/concurrent/Striped.java index 74684cec8fa2..1ff9b90287e5 100644 --- a/guava/src/com/google/common/util/concurrent/Striped.java +++ b/guava/src/com/google/common/util/concurrent/Striped.java @@ -84,7 +84,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public abstract class Striped { /** * If there are at least this many stripes, we assume the memory usage of a ConcurrentMap will be diff --git a/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java b/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java index 327dd555b37c..36ec3fff1e36 100644 --- a/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java +++ b/guava/src/com/google/common/util/concurrent/ThreadFactoryBuilder.java @@ -51,7 +51,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class ThreadFactoryBuilder { @CheckForNull private String nameFormat = null; @CheckForNull private Boolean daemon = null; diff --git a/guava/src/com/google/common/util/concurrent/TimeLimiter.java b/guava/src/com/google/common/util/concurrent/TimeLimiter.java index babb6343146f..761f700b6be8 100644 --- a/guava/src/com/google/common/util/concurrent/TimeLimiter.java +++ b/guava/src/com/google/common/util/concurrent/TimeLimiter.java @@ -37,7 +37,6 @@ @DoNotMock("Use FakeTimeLimiter") @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public interface TimeLimiter { /** diff --git a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java index e067a62e4515..c1e66ffde014 100644 --- a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java +++ b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java @@ -40,7 +40,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault final class TimeoutFuture extends FluentFuture.TrustedFuture { static ListenableFuture create( ListenableFuture delegate, diff --git a/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java b/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java index 929c9fb1ea23..68f0bead1cd0 100644 --- a/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java +++ b/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java @@ -31,7 +31,6 @@ * performance reasons. */ @GwtCompatible -@ElementTypesAreNonnullByDefault class TrustedListenableFutureTask extends FluentFuture.TrustedFuture implements RunnableFuture { diff --git a/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java b/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java index 9890c89d6786..604dcd22feb2 100644 --- a/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java +++ b/guava/src/com/google/common/util/concurrent/UncaughtExceptionHandlers.java @@ -30,7 +30,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public final class UncaughtExceptionHandlers { private UncaughtExceptionHandlers() {} diff --git a/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java b/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java index bb6f5e04d054..051c51f38b57 100644 --- a/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java +++ b/guava/src/com/google/common/util/concurrent/UncheckedExecutionException.java @@ -33,7 +33,6 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class UncheckedExecutionException extends RuntimeException { /* * Ideally, this class would have exposed only constructors that require a non-null cause. See diff --git a/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java b/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java index 181de101f3ba..55f09ad08ef5 100644 --- a/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java +++ b/guava/src/com/google/common/util/concurrent/UncheckedTimeoutException.java @@ -26,7 +26,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault public class UncheckedTimeoutException extends RuntimeException { public UncheckedTimeoutException() {} diff --git a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java index c2bdaa0a6597..67465d0ef814 100644 --- a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java +++ b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java @@ -46,7 +46,6 @@ * @since 10.0 */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault public final class Uninterruptibles { // Implementation Note: As of 3-7-11, the logic for each blocking/timeout diff --git a/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java b/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java index d6684b80980b..a48d7423330a 100644 --- a/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/WrappingExecutorService.java @@ -45,7 +45,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class WrappingExecutorService implements ExecutorService { private final ExecutorService delegate; diff --git a/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java b/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java index d533fc632bd0..a403e98022e9 100644 --- a/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java +++ b/guava/src/com/google/common/util/concurrent/WrappingScheduledExecutorService.java @@ -32,7 +32,6 @@ */ @J2ktIncompatible @GwtIncompatible -@ElementTypesAreNonnullByDefault abstract class WrappingScheduledExecutorService extends WrappingExecutorService implements ScheduledExecutorService { final ScheduledExecutorService delegate; diff --git a/guava/src/com/google/common/util/concurrent/package-info.java b/guava/src/com/google/common/util/concurrent/package-info.java index 7df382a54e82..f82cf6e621dc 100644 --- a/guava/src/com/google/common/util/concurrent/package-info.java +++ b/guava/src/com/google/common/util/concurrent/package-info.java @@ -25,8 +25,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.util.concurrent; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index b4fb4e3fe470..000000000000 --- a/guava/src/com/google/common/xml/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.xml; - -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/guava/src/com/google/common/xml/ParametricNullness.java b/guava/src/com/google/common/xml/ParametricNullness.java index 439707a2edb1..0d989c7cefa6 100644 --- a/guava/src/com/google/common/xml/ParametricNullness.java +++ b/guava/src/com/google/common/xml/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                                  *
                                                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/xml/XmlEscapers.java b/guava/src/com/google/common/xml/XmlEscapers.java index 33241f3f3299..de62e2edd9a3 100644 --- a/guava/src/com/google/common/xml/XmlEscapers.java +++ b/guava/src/com/google/common/xml/XmlEscapers.java @@ -38,7 +38,6 @@ * @since 15.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault public class XmlEscapers { private XmlEscapers() {} diff --git a/guava/src/com/google/common/xml/package-info.java b/guava/src/com/google/common/xml/package-info.java index 8693276272ef..9ff4ea7aeb7d 100644 --- a/guava/src/com/google/common/xml/package-info.java +++ b/guava/src/com/google/common/xml/package-info.java @@ -21,8 +21,6 @@ * library. */ @CheckReturnValue -@ParametersAreNonnullByDefault package com.google.common.xml; import com.google.errorprone.annotations.CheckReturnValue; -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/pom.xml b/pom.xml index ab2fa84833b9..b93ab187e34d 100644 --- a/pom.xml +++ b/pom.xml @@ -412,6 +412,11 @@ + + org.jspecify + jspecify + 1.0.0 + com.google.code.findbugs jsr305