From 1b639e147f6e9905de3804c64c61e468062fba9e Mon Sep 17 00:00:00 2001 From: cpovirk Date: Tue, 17 Dec 2024 09:35:26 -0800 Subject: [PATCH] Use `@NullMarked` instead of our custom `@ElementTypesAreNonnullByDefault` annotations. This is the next step toward [using JSpecify in Guava](https://github.com/jspecify/jspecify/issues/239#issuecomment-2204318808). At the end of that path, we'll be able to [remove our dependency on JSR-305](https://github.com/google/guava/issues/2960) (and on the Checker Framework's annotations), and we'll have one less blocker to [providing a `module-info`](https://github.com/google/guava/issues/2970). `@NullMarked` allows tools like kotlinc to produce errors for code like `ImmutableList`. (Before releasing this change, I'll conduct some further testing to more fully characterize the effects, both under Kotlin 2.1 and prior.) As we make further changes, it will allow kotlinc to detect even more nullness problems. We will make these changes in a series of incremental releases so that users can pick them up gradually, as we did inside Google. In simple cases, users may wish to pick up all the changes at once instead by upgrading straight from Guava 33.4.0 (or an earlier version) to Guava 33.4.4 (or whatever the version to make the final changes ends up being). RELNOTES=Replaced our custom `@ElementTypesAreNonnullByDefault` annotations with the JSpecify `@NullMarked` annotation. PiperOrigin-RevId: 707134516 --- .../testing/AbstractCollectionTester.java | 3 +- .../testing/AbstractContainerTester.java | 3 +- .../testing/AbstractIteratorTester.java | 3 +- .../collect/testing/AbstractMapTester.java | 3 +- .../collect/testing/AbstractTester.java | 3 +- .../testing/DerivedCollectionGenerators.java | 3 +- .../common/collect/testing/Helpers.java | 3 +- .../collect/testing/IgnoreJRERequirement.java | 3 +- .../collect/testing/IteratorTester.java | 3 +- .../collect/testing/ListIteratorTester.java | 3 +- .../collect/testing/MapInterfaceTest.java | 3 +- .../collect/testing/MinimalCollection.java | 3 +- .../common/collect/testing/MinimalSet.java | 3 +- .../collect/testing/OneSizeGenerator.java | 3 +- .../OneSizeTestContainerGenerator.java | 3 +- .../testing/ReflectionFreeAssertThrows.java | 3 +- .../collect/testing/SampleElements.java | 3 +- .../collect/testing/SpliteratorTester.java | 3 +- .../testing/TestCharacterListGenerator.java | 3 +- .../testing/TestCollectionGenerator.java | 3 +- .../testing/TestCollidingSetGenerator.java | 3 +- .../testing/TestContainerGenerator.java | 3 +- .../collect/testing/TestEnumMapGenerator.java | 3 +- .../collect/testing/TestEnumSetGenerator.java | 3 +- .../testing/TestIntegerSetGenerator.java | 3 +- .../TestIntegerSortedSetGenerator.java | 3 +- .../collect/testing/TestListGenerator.java | 3 +- .../testing/TestMapEntrySetGenerator.java | 3 +- .../collect/testing/TestMapGenerator.java | 3 +- .../collect/testing/TestQueueGenerator.java | 3 +- .../collect/testing/TestSetGenerator.java | 3 +- .../testing/TestSortedMapGenerator.java | 3 +- .../testing/TestSortedSetGenerator.java | 3 +- .../TestStringCollectionGenerator.java | 3 +- .../testing/TestStringListGenerator.java | 3 +- .../testing/TestStringMapGenerator.java | 3 +- .../testing/TestStringQueueGenerator.java | 3 +- .../testing/TestStringSetGenerator.java | 3 +- .../testing/TestStringSortedMapGenerator.java | 3 +- .../testing/TestStringSortedSetGenerator.java | 3 +- .../collect/testing/TestSubjectGenerator.java | 3 +- .../TestUnhashableCollectionGenerator.java | 3 +- .../collect/testing/features/FeatureUtil.java | 8 +++- .../testing/google/AbstractBiMapTester.java | 3 +- .../google/AbstractListMultimapTester.java | 3 +- .../google/AbstractMultimapTester.java | 3 +- .../testing/google/BiMapGenerators.java | 3 +- .../DerivedGoogleCollectionGenerators.java | 3 +- .../testing/google/ListGenerators.java | 3 +- .../google/ListMultimapAsMapTester.java | 3 +- .../collect/testing/google/MapGenerators.java | 3 +- .../testing/google/MultimapEqualsTester.java | 3 +- .../testing/google/MultimapPutTester.java | 3 +- .../testing/google/MultimapSizeTester.java | 3 +- .../google/MultisetIteratorTester.java | 3 +- .../google/ReflectionFreeAssertThrows.java | 3 +- .../collect/testing/google/SetGenerators.java | 3 +- .../google/SetMultimapAsMapTester.java | 3 +- .../testing/google/SortedMapGenerators.java | 3 +- .../testing/google/TestBiMapGenerator.java | 3 +- .../google/TestEnumMultisetGenerator.java | 3 +- .../google/TestListMultimapGenerator.java | 3 +- .../testing/google/TestMultimapGenerator.java | 3 +- .../testing/google/TestMultisetGenerator.java | 3 +- .../google/TestStringBiMapGenerator.java | 3 +- .../TestStringListMultimapGenerator.java | 3 +- .../google/TestStringMultisetGenerator.java | 3 +- .../TestStringSetMultimapGenerator.java | 3 +- .../google/UnmodifiableCollectionTests.java | 3 +- .../testing/testers/AbstractListTester.java | 3 +- .../testers/CollectionIteratorTester.java | 3 +- .../ConcurrentMapPutIfAbsentTester.java | 3 +- .../testers/ConcurrentMapRemoveTester.java | 3 +- .../ConcurrentMapReplaceEntryTester.java | 3 +- .../testers/ConcurrentMapReplaceTester.java | 3 +- .../testing/testers/IgnoreJRERequirement.java | 3 +- .../testers/ListListIteratorTester.java | 3 +- .../testing/testers/MapPutAllTester.java | 3 +- .../testers/ReflectionFreeAssertThrows.java | 3 +- .../testers/SortedSetNavigationTester.java | 3 +- .../common/testing/ArbitraryInstances.java | 3 +- .../common/testing/ClusterException.java | 3 +- .../com/google/common/testing/DummyProxy.java | 3 +- .../google/common/testing/EqualsTester.java | 3 +- .../common/testing/EquivalenceTester.java | 3 +- .../com/google/common/testing/FakeTicker.java | 3 +- .../testing/ForwardingWrapperTester.java | 3 +- .../google/common/testing/GcFinalization.java | 3 +- .../common/testing/NullPointerTester.java | 3 +- .../com/google/common/testing/Platform.java | 3 +- .../common/testing/RelationshipTester.java | 3 +- .../common/testing/SerializableTester.java | 3 +- .../google/common/testing/SloppyTearDown.java | 3 +- .../com/google/common/testing/TearDown.java | 3 +- .../common/testing/TearDownAccepter.java | 3 +- .../google/common/testing/TearDownStack.java | 3 +- .../google/common/testing/TestLogHandler.java | 3 +- .../google/common/testing/package-info.java | 3 +- .../testing/ReflectionFreeAssertThrows.java | 3 +- .../google/common/base/CharMatcherTest.java | 3 +- .../google/common/base/EquivalenceTest.java | 3 +- .../com/google/common/base/FunctionsTest.java | 3 +- .../com/google/common/base/JoinerTest.java | 3 +- .../com/google/common/base/OptionalTest.java | 3 +- .../google/common/base/PreconditionsTest.java | 3 +- .../google/common/base/PredicatesTest.java | 3 +- .../base/ReflectionFreeAssertThrows.java | 3 +- .../com/google/common/base/SplitterTest.java | 3 +- .../com/google/common/base/StringsTest.java | 3 +- .../com/google/common/base/SuppliersTest.java | 3 +- .../cache/ReflectionFreeAssertThrows.java | 3 +- .../collect/AbstractFilteredMapTest.java | 3 +- .../collect/AbstractImmutableSetTest.java | 3 +- .../collect/AbstractImmutableTableTest.java | 3 +- .../common/collect/AbstractIteratorTest.java | 3 +- .../common/collect/AbstractMapEntryTest.java | 3 +- .../AbstractMapsTransformValuesTest.java | 3 +- ...bstractMultimapAsMapImplementsMapTest.java | 3 +- .../AbstractSequentialIteratorTest.java | 3 +- .../common/collect/AbstractTableReadTest.java | 3 +- .../common/collect/AbstractTableTest.java | 3 +- .../common/collect/ArrayListMultimapTest.java | 3 +- .../google/common/collect/ArrayTableTest.java | 3 +- .../collect/CollectSpliteratorsTest.java | 3 +- .../common/collect/Collections2Test.java | 3 +- .../common/collect/ComparatorsTest.java | 3 +- .../common/collect/ComparisonChainTest.java | 3 +- .../com/google/common/collect/CountTest.java | 3 +- .../collect/EmptyImmutableTableTest.java | 3 +- .../google/common/collect/EnumBiMapTest.java | 3 +- .../common/collect/EvictingQueueTest.java | 3 +- .../common/collect/FilteredBiMapTest.java | 3 +- .../common/collect/FilteredMapTest.java | 3 +- .../common/collect/FilteredSortedMapTest.java | 3 +- .../ForMapMultimapAsMapImplementsMapTest.java | 3 +- .../ForwardingSortedMapImplementsMapTest.java | 3 +- .../common/collect/GeneralRangeTest.java | 3 +- .../collect/HashBasedTableColumnMapTest.java | 3 +- .../collect/HashBasedTableColumnTest.java | 3 +- .../collect/HashBasedTableRowMapTest.java | 3 +- .../common/collect/HashBasedTableRowTest.java | 3 +- .../common/collect/HashBasedTableTest.java | 3 +- .../google/common/collect/HashBiMapTest.java | 3 +- .../common/collect/HashMultimapTest.java | 3 +- .../common/collect/HashMultisetTest.java | 3 +- .../google/common/collect/HashingTest.java | 3 +- .../common/collect/ImmutableBiMapTest.java | 3 +- .../common/collect/ImmutableEnumMapTest.java | 3 +- .../collect/ImmutableListMultimapTest.java | 3 +- .../common/collect/ImmutableListTest.java | 3 +- .../common/collect/ImmutableMapTest.java | 3 +- ...mutableMultimapAsMapImplementsMapTest.java | 3 +- .../common/collect/ImmutableMultimapTest.java | 3 +- .../common/collect/ImmutableMultisetTest.java | 3 +- ...ableSetMultimapAsMapImplementsMapTest.java | 3 +- .../collect/ImmutableSetMultimapTest.java | 3 +- .../common/collect/ImmutableSetTest.java | 3 +- .../collect/ImmutableSortedMapTest.java | 3 +- .../collect/ImmutableSortedSetTest.java | 3 +- .../common/collect/ImmutableTableTest.java | 3 +- .../google/common/collect/IterablesTest.java | 3 +- .../google/common/collect/IteratorsTest.java | 3 +- .../common/collect/LegacyComparable.java | 3 +- .../collect/LinkedHashMultimapTest.java | 3 +- .../collect/LinkedHashMultisetTest.java | 3 +- .../collect/LinkedListMultimapTest.java | 3 +- .../google/common/collect/ListsImplTest.java | 3 +- .../com/google/common/collect/ListsTest.java | 3 +- .../MapsSortedTransformValuesTest.java | 3 +- .../com/google/common/collect/MapsTest.java | 3 +- .../collect/MapsTransformValuesTest.java | 3 +- ...ansformValuesUnmodifiableIteratorTest.java | 3 +- .../collect/MinMaxPriorityQueueTest.java | 3 +- .../common/collect/MultimapBuilderTest.java | 3 +- .../google/common/collect/MultimapsTest.java | 3 +- .../MultimapsTransformValuesAsMapTest.java | 3 +- .../collect/MultisetsImmutableEntryTest.java | 3 +- .../google/common/collect/MultisetsTest.java | 3 +- .../common/collect/NewCustomTableTest.java | 3 +- .../common/collect/ObjectArraysTest.java | 3 +- .../google/common/collect/OrderingTest.java | 3 +- .../common/collect/PeekingIteratorTest.java | 3 +- .../com/google/common/collect/RangeTest.java | 3 +- .../collect/ReflectionFreeAssertThrows.java | 3 +- .../collect/RegularImmutableAsListTest.java | 3 +- .../collect/RegularImmutableTableTest.java | 3 +- .../common/collect/SetOperationsTest.java | 3 +- .../com/google/common/collect/SetsTest.java | 3 +- .../collect/SimpleAbstractMultisetTest.java | 3 +- .../collect/SingletonImmutableTableTest.java | 3 +- .../common/collect/SortedIterablesTest.java | 3 +- .../common/collect/SortedListsTest.java | 3 +- .../SubMapMultimapAsMapImplementsMapTest.java | 3 +- .../common/collect/TableCollectionTest.java | 3 +- .../com/google/common/collect/TablesTest.java | 3 +- .../TablesTransformValuesColumnMapTest.java | 3 +- .../TablesTransformValuesColumnTest.java | 3 +- .../TablesTransformValuesRowMapTest.java | 3 +- .../collect/TablesTransformValuesRowTest.java | 3 +- .../collect/TablesTransformValuesTest.java | 3 +- .../collect/TablesTransposeColumnTest.java | 3 +- .../collect/TablesTransposeRowTest.java | 3 +- .../common/collect/TransposedTableTest.java | 3 +- .../collect/TreeBasedTableColumnMapTest.java | 3 +- .../collect/TreeBasedTableColumnTest.java | 3 +- .../TreeBasedTableRowMapHeadMapTest.java | 3 +- .../TreeBasedTableRowMapSubMapTest.java | 3 +- .../TreeBasedTableRowMapTailMapTest.java | 3 +- .../collect/TreeBasedTableRowMapTest.java | 3 +- .../common/collect/TreeBasedTableRowTest.java | 3 +- .../common/collect/TreeBasedTableTest.java | 3 +- .../collect/TreeMultimapExplicitTest.java | 3 +- .../collect/TreeMultimapNaturalTest.java | 3 +- .../common/collect/TreeMultisetTest.java | 3 +- .../common/collect/TreeTraverserTest.java | 3 +- .../collect/UnmodifiableIteratorTest.java | 3 +- .../collect/UnmodifiableListIteratorTest.java | 3 +- ...ifiableMultimapAsMapImplementsMapTest.java | 3 +- ...modifiableRowSortedTableColumnMapTest.java | 3 +- .../UnmodifiableRowSortedTableColumnTest.java | 3 +- .../UnmodifiableRowSortedTableRowMapTest.java | 3 +- .../UnmodifiableRowSortedTableRowTest.java | 3 +- .../UnmodifiableTableColumnMapTest.java | 3 +- .../collect/UnmodifiableTableColumnTest.java | 3 +- .../collect/UnmodifiableTableRowMapTest.java | 3 +- .../collect/UnmodifiableTableRowTest.java | 3 +- .../escape/ArrayBasedCharEscaperTest.java | 3 +- .../escape/ArrayBasedUnicodeEscaperTest.java | 3 +- .../escape/ReflectionFreeAssertThrows.java | 3 +- .../common/io/ReflectionFreeAssertThrows.java | 3 +- .../common/math/BigIntegerMathTest.java | 3 +- .../math/ReflectionFreeAssertThrows.java | 3 +- .../net/ReflectionFreeAssertThrows.java | 3 +- .../common/primitives/BooleansTest.java | 3 +- .../google/common/primitives/BytesTest.java | 3 +- .../google/common/primitives/CharsTest.java | 3 +- .../google/common/primitives/DoublesTest.java | 3 +- .../google/common/primitives/FloatsTest.java | 3 +- .../google/common/primitives/IntsTest.java | 3 +- .../google/common/primitives/LongsTest.java | 3 +- .../ReflectionFreeAssertThrows.java | 3 +- .../google/common/primitives/ShortsTest.java | 3 +- .../common/primitives/SignedBytesTest.java | 3 +- .../util/concurrent/FluentFutureTest.java | 3 +- .../common/util/concurrent/FuturesTest.java | 3 +- .../ReflectionFreeAssertThrows.java | 3 +- .../TrustedListenableFutureTaskTest.java | 3 +- .../base/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/base/ParametricNullness.java | 4 +- .../com/google/common/base/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/cache/ParametricNullness.java | 4 +- .../com/google/common/cache/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/collect/ObjectCountHashMap.java | 3 +- .../collect/ObjectCountLinkedHashMap.java | 3 +- .../common/collect/ParametricNullness.java | 4 +- .../google/common/collect/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/escape/ParametricNullness.java | 4 +- .../google/common/escape/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/eventbus/ParametricNullness.java | 4 +- .../google/common/eventbus/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/graph/ParametricNullness.java | 4 +- .../com/google/common/graph/package-info.java | 3 +- .../hash/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/hash/ParametricNullness.java | 4 +- .../com/google/common/hash/package-info.java | 3 +- .../html/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/html/ParametricNullness.java | 4 +- .../com/google/common/html/package-info.java | 3 +- .../io/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../google/common/io/ParametricNullness.java | 4 +- .../com/google/common/io/package-info.java | 3 +- .../math/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/math/ParametricNullness.java | 4 +- .../com/google/common/math/package-info.java | 3 +- .../net/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../google/common/net/ParametricNullness.java | 4 +- .../com/google/common/net/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/primitives/ParametricNullness.java | 4 +- .../common/primitives/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/reflect/ParametricNullness.java | 4 +- .../google/common/reflect/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../util/concurrent/ListenableFuture.java | 3 +- .../util/concurrent/ParametricNullness.java | 4 +- .../common/util/concurrent/package-info.java | 3 +- .../xml/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../google/common/xml/ParametricNullness.java | 4 +- .../com/google/common/xml/package-info.java | 3 +- .../util/concurrent/ListenableFuture.java | 3 +- guava-gwt/pom.xml | 7 +++- .../testing/AbstractCollectionTester.java | 3 +- .../testing/AbstractContainerTester.java | 3 +- .../testing/AbstractIteratorTester.java | 3 +- .../collect/testing/AbstractMapTester.java | 3 +- .../collect/testing/AbstractTester.java | 3 +- .../testing/DerivedCollectionGenerators.java | 3 +- .../common/collect/testing/Helpers.java | 3 +- .../collect/testing/IgnoreJRERequirement.java | 3 +- .../collect/testing/IteratorTester.java | 3 +- .../collect/testing/ListIteratorTester.java | 3 +- .../collect/testing/MapInterfaceTest.java | 3 +- .../collect/testing/MinimalCollection.java | 3 +- .../common/collect/testing/MinimalSet.java | 3 +- .../collect/testing/OneSizeGenerator.java | 3 +- .../OneSizeTestContainerGenerator.java | 3 +- .../testing/ReflectionFreeAssertThrows.java | 3 +- .../collect/testing/SampleElements.java | 3 +- .../collect/testing/SpliteratorTester.java | 3 +- .../testing/TestCharacterListGenerator.java | 3 +- .../testing/TestCollectionGenerator.java | 3 +- .../testing/TestCollidingSetGenerator.java | 3 +- .../testing/TestContainerGenerator.java | 3 +- .../collect/testing/TestEnumMapGenerator.java | 3 +- .../collect/testing/TestEnumSetGenerator.java | 3 +- .../testing/TestIntegerSetGenerator.java | 3 +- .../TestIntegerSortedSetGenerator.java | 3 +- .../collect/testing/TestListGenerator.java | 3 +- .../testing/TestMapEntrySetGenerator.java | 3 +- .../collect/testing/TestMapGenerator.java | 3 +- .../collect/testing/TestQueueGenerator.java | 3 +- .../collect/testing/TestSetGenerator.java | 3 +- .../testing/TestSortedMapGenerator.java | 3 +- .../testing/TestSortedSetGenerator.java | 3 +- .../TestStringCollectionGenerator.java | 3 +- .../testing/TestStringListGenerator.java | 3 +- .../testing/TestStringMapGenerator.java | 3 +- .../testing/TestStringQueueGenerator.java | 3 +- .../testing/TestStringSetGenerator.java | 3 +- .../testing/TestStringSortedMapGenerator.java | 3 +- .../testing/TestStringSortedSetGenerator.java | 3 +- .../collect/testing/TestSubjectGenerator.java | 3 +- .../TestUnhashableCollectionGenerator.java | 3 +- .../collect/testing/features/FeatureUtil.java | 8 +++- .../testing/google/AbstractBiMapTester.java | 3 +- .../google/AbstractListMultimapTester.java | 3 +- .../google/AbstractMultimapTester.java | 3 +- .../testing/google/BiMapGenerators.java | 3 +- .../DerivedGoogleCollectionGenerators.java | 3 +- .../testing/google/ListGenerators.java | 3 +- .../google/ListMultimapAsMapTester.java | 3 +- .../collect/testing/google/MapGenerators.java | 3 +- .../testing/google/MultimapEqualsTester.java | 3 +- .../testing/google/MultimapPutTester.java | 3 +- .../testing/google/MultimapSizeTester.java | 3 +- .../google/MultisetIteratorTester.java | 3 +- .../google/ReflectionFreeAssertThrows.java | 3 +- .../collect/testing/google/SetGenerators.java | 3 +- .../google/SetMultimapAsMapTester.java | 3 +- .../testing/google/SortedMapGenerators.java | 3 +- .../testing/google/TestBiMapGenerator.java | 3 +- .../google/TestEnumMultisetGenerator.java | 3 +- .../google/TestListMultimapGenerator.java | 3 +- .../testing/google/TestMultimapGenerator.java | 3 +- .../testing/google/TestMultisetGenerator.java | 3 +- .../google/TestStringBiMapGenerator.java | 3 +- .../TestStringListMultimapGenerator.java | 3 +- .../google/TestStringMultisetGenerator.java | 3 +- .../TestStringSetMultimapGenerator.java | 3 +- .../google/UnmodifiableCollectionTests.java | 3 +- .../testing/testers/AbstractListTester.java | 3 +- .../testers/CollectionIteratorTester.java | 3 +- .../ConcurrentMapPutIfAbsentTester.java | 3 +- .../testers/ConcurrentMapRemoveTester.java | 3 +- .../ConcurrentMapReplaceEntryTester.java | 3 +- .../testers/ConcurrentMapReplaceTester.java | 3 +- .../testing/testers/IgnoreJRERequirement.java | 3 +- .../testers/ListListIteratorTester.java | 3 +- .../testing/testers/MapPutAllTester.java | 3 +- .../testers/ReflectionFreeAssertThrows.java | 3 +- .../testers/SortedSetNavigationTester.java | 3 +- .../testing/AbstractPackageSanityTests.java | 3 +- .../common/testing/ArbitraryInstances.java | 3 +- .../common/testing/ClusterException.java | 3 +- .../common/testing/CollectorTester.java | 3 +- .../com/google/common/testing/DummyProxy.java | 3 +- .../google/common/testing/EqualsTester.java | 3 +- .../common/testing/EquivalenceTester.java | 3 +- .../com/google/common/testing/FakeTicker.java | 3 +- .../testing/ForwardingWrapperTester.java | 3 +- .../google/common/testing/GcFinalization.java | 3 +- .../common/testing/NullPointerTester.java | 3 +- .../com/google/common/testing/Platform.java | 3 +- .../common/testing/RelationshipTester.java | 3 +- .../common/testing/SerializableTester.java | 3 +- .../google/common/testing/SloppyTearDown.java | 3 +- .../com/google/common/testing/TearDown.java | 3 +- .../common/testing/TearDownAccepter.java | 3 +- .../google/common/testing/TearDownStack.java | 3 +- .../google/common/testing/TestLogHandler.java | 3 +- .../google/common/testing/package-info.java | 3 +- .../testing/ReflectionFreeAssertThrows.java | 3 +- .../google/common/base/CharMatcherTest.java | 3 +- .../google/common/base/EquivalenceTest.java | 3 +- .../com/google/common/base/FunctionsTest.java | 3 +- .../com/google/common/base/JoinerTest.java | 3 +- .../com/google/common/base/OptionalTest.java | 3 +- .../google/common/base/PreconditionsTest.java | 3 +- .../google/common/base/PredicatesTest.java | 3 +- .../base/ReflectionFreeAssertThrows.java | 3 +- .../com/google/common/base/SplitterTest.java | 3 +- .../com/google/common/base/StringsTest.java | 3 +- .../com/google/common/base/SuppliersTest.java | 3 +- .../cache/ReflectionFreeAssertThrows.java | 3 +- .../collect/AbstractFilteredMapTest.java | 3 +- .../collect/AbstractImmutableSetTest.java | 3 +- .../collect/AbstractImmutableTableTest.java | 3 +- .../common/collect/AbstractIteratorTest.java | 3 +- .../common/collect/AbstractMapEntryTest.java | 3 +- .../AbstractMapsTransformValuesTest.java | 3 +- ...bstractMultimapAsMapImplementsMapTest.java | 3 +- .../AbstractSequentialIteratorTest.java | 3 +- .../common/collect/AbstractTableReadTest.java | 3 +- .../common/collect/AbstractTableTest.java | 3 +- .../common/collect/ArrayListMultimapTest.java | 3 +- .../google/common/collect/ArrayTableTest.java | 3 +- .../collect/CollectSpliteratorsTest.java | 3 +- .../common/collect/Collections2Test.java | 3 +- .../common/collect/ComparatorsTest.java | 3 +- .../common/collect/ComparisonChainTest.java | 3 +- .../com/google/common/collect/CountTest.java | 3 +- .../collect/EmptyImmutableTableTest.java | 3 +- .../google/common/collect/EnumBiMapTest.java | 3 +- .../common/collect/EvictingQueueTest.java | 3 +- .../common/collect/FilteredBiMapTest.java | 3 +- .../common/collect/FilteredMapTest.java | 3 +- .../common/collect/FilteredSortedMapTest.java | 3 +- .../ForMapMultimapAsMapImplementsMapTest.java | 3 +- .../ForwardingSortedMapImplementsMapTest.java | 3 +- .../common/collect/GeneralRangeTest.java | 3 +- .../collect/HashBasedTableColumnMapTest.java | 3 +- .../collect/HashBasedTableColumnTest.java | 3 +- .../collect/HashBasedTableRowMapTest.java | 3 +- .../common/collect/HashBasedTableRowTest.java | 3 +- .../common/collect/HashBasedTableTest.java | 3 +- .../google/common/collect/HashBiMapTest.java | 3 +- .../common/collect/HashMultimapTest.java | 3 +- .../common/collect/HashMultisetTest.java | 3 +- .../google/common/collect/HashingTest.java | 3 +- .../common/collect/ImmutableBiMapTest.java | 3 +- .../common/collect/ImmutableEnumMapTest.java | 3 +- .../collect/ImmutableListMultimapTest.java | 3 +- .../common/collect/ImmutableListTest.java | 3 +- .../common/collect/ImmutableMapTest.java | 3 +- ...mutableMultimapAsMapImplementsMapTest.java | 3 +- .../common/collect/ImmutableMultimapTest.java | 3 +- .../common/collect/ImmutableMultisetTest.java | 3 +- ...ableSetMultimapAsMapImplementsMapTest.java | 3 +- .../collect/ImmutableSetMultimapTest.java | 3 +- .../common/collect/ImmutableSetTest.java | 3 +- .../collect/ImmutableSortedMapTest.java | 3 +- .../collect/ImmutableSortedSetTest.java | 3 +- .../common/collect/ImmutableTableTest.java | 3 +- .../google/common/collect/IterablesTest.java | 3 +- .../google/common/collect/IteratorsTest.java | 3 +- .../common/collect/LegacyComparable.java | 3 +- .../collect/LinkedHashMultimapTest.java | 3 +- .../collect/LinkedHashMultisetTest.java | 3 +- .../collect/LinkedListMultimapTest.java | 3 +- .../google/common/collect/ListsImplTest.java | 3 +- .../com/google/common/collect/ListsTest.java | 3 +- .../MapsSortedTransformValuesTest.java | 3 +- .../com/google/common/collect/MapsTest.java | 3 +- .../collect/MapsTransformValuesTest.java | 3 +- ...ansformValuesUnmodifiableIteratorTest.java | 3 +- .../collect/MinMaxPriorityQueueTest.java | 3 +- .../common/collect/MoreCollectorsTest.java | 3 +- .../common/collect/MultimapBuilderTest.java | 3 +- .../google/common/collect/MultimapsTest.java | 3 +- .../MultimapsTransformValuesAsMapTest.java | 3 +- .../collect/MultisetsImmutableEntryTest.java | 3 +- .../google/common/collect/MultisetsTest.java | 3 +- .../common/collect/NewCustomTableTest.java | 3 +- .../common/collect/ObjectArraysTest.java | 3 +- .../google/common/collect/OrderingTest.java | 3 +- .../common/collect/PeekingIteratorTest.java | 3 +- .../com/google/common/collect/RangeTest.java | 3 +- .../collect/ReflectionFreeAssertThrows.java | 3 +- .../collect/RegularImmutableAsListTest.java | 3 +- .../collect/RegularImmutableTableTest.java | 3 +- .../common/collect/SetOperationsTest.java | 3 +- .../com/google/common/collect/SetsTest.java | 3 +- .../collect/SimpleAbstractMultisetTest.java | 3 +- .../collect/SingletonImmutableTableTest.java | 3 +- .../common/collect/SortedIterablesTest.java | 3 +- .../common/collect/SortedListsTest.java | 3 +- .../google/common/collect/StreamsTest.java | 3 +- .../SubMapMultimapAsMapImplementsMapTest.java | 3 +- .../common/collect/TableCollectionTest.java | 3 +- .../common/collect/TableCollectorsTest.java | 3 +- .../com/google/common/collect/TablesTest.java | 3 +- .../TablesTransformValuesColumnMapTest.java | 3 +- .../TablesTransformValuesColumnTest.java | 3 +- .../TablesTransformValuesRowMapTest.java | 3 +- .../collect/TablesTransformValuesRowTest.java | 3 +- .../collect/TablesTransformValuesTest.java | 3 +- .../collect/TablesTransposeColumnTest.java | 3 +- .../collect/TablesTransposeRowTest.java | 3 +- .../common/collect/TransposedTableTest.java | 3 +- .../collect/TreeBasedTableColumnMapTest.java | 3 +- .../collect/TreeBasedTableColumnTest.java | 3 +- .../TreeBasedTableRowMapHeadMapTest.java | 3 +- .../TreeBasedTableRowMapSubMapTest.java | 3 +- .../TreeBasedTableRowMapTailMapTest.java | 3 +- .../collect/TreeBasedTableRowMapTest.java | 3 +- .../common/collect/TreeBasedTableRowTest.java | 3 +- .../common/collect/TreeBasedTableTest.java | 3 +- .../collect/TreeMultimapExplicitTest.java | 3 +- .../collect/TreeMultimapNaturalTest.java | 3 +- .../common/collect/TreeMultisetTest.java | 3 +- .../common/collect/TreeTraverserTest.java | 3 +- .../collect/UnmodifiableIteratorTest.java | 3 +- .../collect/UnmodifiableListIteratorTest.java | 3 +- ...ifiableMultimapAsMapImplementsMapTest.java | 3 +- ...modifiableRowSortedTableColumnMapTest.java | 3 +- .../UnmodifiableRowSortedTableColumnTest.java | 3 +- .../UnmodifiableRowSortedTableRowMapTest.java | 3 +- .../UnmodifiableRowSortedTableRowTest.java | 3 +- .../UnmodifiableTableColumnMapTest.java | 3 +- .../collect/UnmodifiableTableColumnTest.java | 3 +- .../collect/UnmodifiableTableRowMapTest.java | 3 +- .../collect/UnmodifiableTableRowTest.java | 3 +- .../escape/ArrayBasedCharEscaperTest.java | 3 +- .../escape/ArrayBasedUnicodeEscaperTest.java | 3 +- .../escape/ReflectionFreeAssertThrows.java | 3 +- .../common/io/ReflectionFreeAssertThrows.java | 3 +- .../common/math/BigIntegerMathTest.java | 3 +- .../math/ReflectionFreeAssertThrows.java | 3 +- .../net/ReflectionFreeAssertThrows.java | 3 +- .../common/primitives/BooleansTest.java | 3 +- .../google/common/primitives/BytesTest.java | 3 +- .../google/common/primitives/CharsTest.java | 3 +- .../google/common/primitives/DoublesTest.java | 3 +- .../google/common/primitives/FloatsTest.java | 3 +- .../google/common/primitives/IntsTest.java | 3 +- .../google/common/primitives/LongsTest.java | 3 +- .../ReflectionFreeAssertThrows.java | 3 +- .../google/common/primitives/ShortsTest.java | 3 +- .../common/primitives/SignedBytesTest.java | 3 +- .../util/concurrent/FluentFutureTest.java | 3 +- .../common/util/concurrent/FuturesTest.java | 3 +- .../ReflectionFreeAssertThrows.java | 3 +- .../TrustedListenableFutureTaskTest.java | 3 +- .../base/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/base/ParametricNullness.java | 4 +- .../com/google/common/base/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/cache/ParametricNullness.java | 4 +- .../com/google/common/cache/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/collect/ParametricNullness.java | 4 +- .../google/common/collect/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/escape/ParametricNullness.java | 4 +- .../google/common/escape/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/eventbus/ParametricNullness.java | 4 +- .../google/common/eventbus/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/graph/ParametricNullness.java | 4 +- .../com/google/common/graph/package-info.java | 3 +- .../hash/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/hash/ParametricNullness.java | 4 +- .../com/google/common/hash/package-info.java | 3 +- .../html/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/html/ParametricNullness.java | 4 +- .../com/google/common/html/package-info.java | 3 +- .../io/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../google/common/io/ParametricNullness.java | 4 +- .../com/google/common/io/package-info.java | 3 +- .../math/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/math/ParametricNullness.java | 4 +- .../com/google/common/math/package-info.java | 3 +- .../net/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../google/common/net/ParametricNullness.java | 4 +- .../com/google/common/net/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/primitives/ParametricNullness.java | 4 +- .../common/primitives/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../common/reflect/ParametricNullness.java | 4 +- .../google/common/reflect/package-info.java | 3 +- .../ElementTypesAreNonnullByDefault.java | 42 ------------------- .../util/concurrent/ListenableFuture.java | 3 +- .../util/concurrent/ParametricNullness.java | 4 +- .../common/util/concurrent/package-info.java | 3 +- .../xml/ElementTypesAreNonnullByDefault.java | 42 ------------------- .../google/common/xml/ParametricNullness.java | 4 +- .../com/google/common/xml/package-info.java | 3 +- 595 files changed, 1144 insertions(+), 1855 deletions(-) delete mode 100644 android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java delete mode 100644 android/guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java delete mode 100644 guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java 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 f281cd83414b9..33a3a83746b85 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -32,7 +33,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractCollectionTester extends AbstractContainerTester, E> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java index 56163a6f67405..92e6f5a1ec943 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractContainerTester extends AbstractTester> { protected SampleElements samples; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java index 36ea3614d5d08..417e67dc2c2e1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java @@ -34,6 +34,7 @@ import java.util.NoSuchElementException; import java.util.Set; import java.util.Stack; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractIteratorTester> { private Stimulus[] stimuli; private final Iterator elementsToInsert; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java index f85b01fbbc7e6..fc8cbdd9c5451 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java @@ -26,6 +26,7 @@ import java.util.ListIterator; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -43,7 +44,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMapTester extends AbstractContainerTester, Entry> { protected Map getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java index 5ffe110e7dbe5..4ae6fc9f87a68 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author George van den Driessche */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractTester extends TestCase { private G subjectGenerator; private String suiteName; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java index 6312a67bc66ac..b13345794c577 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java @@ -33,6 +33,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class DerivedCollectionGenerators { public static class MapEntrySetGenerator implements TestSetGenerator>, DerivedGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java index a9e7ac04d84ae..360793345a0a1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java @@ -44,10 +44,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class Helpers { // Clone of Objects.equal static boolean equal(@Nullable Object a, @Nullable Object b) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java b/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java index 7bc6548bcab21..ac9e70cac1dce 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java index 01409884607a1..fcd39baeac993 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collections; import java.util.Iterator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -85,7 +86,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class IteratorTester extends AbstractIteratorTester> { /** diff --git a/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java index a781d0ab02667..3a9404e667723 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class ListIteratorTester extends AbstractIteratorTester> { protected ListIteratorTester( diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java b/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java index 8c3fdeadccb14..38864047f9e8a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java @@ -33,6 +33,7 @@ import java.util.Map.Entry; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -48,7 +49,7 @@ // check the order if so. // TODO: Refactor to share code with SetTestBuilder etc. @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class MapInterfaceTest extends TestCase { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java b/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java index 67b7cdb485e4f..d09b8afc4f038 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.Iterator; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MinimalCollection extends AbstractCollection { // TODO: expose allow nulls parameter? diff --git a/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java b/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java index 971e69a2436b9..b78a5ce21597f 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Set; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MinimalSet extends MinimalCollection implements Set { @SuppressWarnings("unchecked") // empty Object[] as E[] diff --git a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java index faeee278d0d92..7625463adf758 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class OneSizeGenerator implements OneSizeTestContainerGenerator { private final TestContainerGenerator generator; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java index 9cb5a87e79e67..72fbf0224eac7 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.features.CollectionSize; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface OneSizeTestContainerGenerator extends TestSubjectGenerator, TestContainerGenerator { TestContainerGenerator getInnerGenerator(); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java b/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java index 9f32428f8732d..6e0431b1319e1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java b/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java index e1606a19d9770..153d684677127 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SampleElements.java @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SampleElements implements Iterable { // TODO: rename e3, e4 => missing1, missing2 private final E e0; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java index 8f04c980bac4f..45804ef22a7dc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java @@ -42,6 +42,7 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -50,7 +51,7 @@ * @since 33.4.0 (but since 21.0 in the JRE flavor) */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("Java7ApiChecker") @IgnoreJRERequirement // Users will use this only if they're already using Spliterator. public final class SpliteratorTester { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java index 07b465bb889ae..acf6ec52e5ab0 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Chars; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Generates {@code List} instances for test suites. @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestCharacterListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java index 63c35be86abc4..5f336be4ce95a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,6 +27,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestCollectionGenerator extends TestContainerGenerator, E> {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java index b26a6a5832f9a..836f4bf971e73 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Colliders; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * A generator using sample elements whose hash codes all collide badly. @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestCollidingSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java index c6792bfdf519d..08d2e31f43a56 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java @@ -20,6 +20,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestContainerGenerator { /** Returns the sample elements that this generate populates its container with. */ SampleElements samples(); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java index b4b97c6013398..a6f1c610faf15 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with enum maps. @@ -30,7 +31,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumMapGenerator implements TestMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java index 307fc1533fabe..2ddd283db4184 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.SampleElements.Enums; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * An abstract TestSetGenerator for generating sets containing enum values. @@ -29,7 +30,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java index 633329c1e6263..b8e8b595d8469 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Ints; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Create integer sets for collection tests. @@ -27,7 +28,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestIntegerSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java index 73b44b616f1d8..576e870c3ebe9 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Create integer sets for testing collections that are sorted by natural ordering. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestIntegerSortedSetGenerator extends TestIntegerSetGenerator { @Override protected abstract SortedSet create(Integer[] elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java index 34117f8988749..886bb105bb74d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestListGenerator extends TestCollectionGenerator { @Override List create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java index 57376d4987e1e..eb62f12b5d8c0 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Jesse Wilson */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestMapEntrySetGenerator< K extends @Nullable Object, V extends @Nullable Object> implements TestSetGenerator> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java index efc85fc5563bf..86b79469b1f1b 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMapGenerator extends TestContainerGenerator, Map.Entry> { K[] createKeyArray(int length); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java index c5b093b1880d9..e0aebf66919d3 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Queue; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestQueueGenerator extends TestCollectionGenerator { @Override Queue create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java index 2ed582aa7a366..83fd9075de464 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSetGenerator extends TestCollectionGenerator { @Override Set create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java index 107a8e76cea7a..ae462fe31f002 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSortedMapGenerator extends TestMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java index 10abd8b4d1715..dc9e94222006c 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSortedSetGenerator extends TestSetGenerator { @Override SortedSet create(Object... elements); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java index 081e9eaddd269..c637c223dafc3 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * String creation for testing arbitrary collections. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringCollectionGenerator implements TestCollectionGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java index fe1de2eb24500..9b2bddec93057 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * TODO: javadoc. @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java index 0900629a55c85..2edf70fff26d8 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with maps of strings. @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringMapGenerator implements TestMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java index 1102c3456bd04..1d2d3f4af55a5 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; import java.util.Queue; +import org.jspecify.annotations.NullMarked; /** * Create queue of strings for tests. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringQueueGenerator implements TestQueueGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java index 2949e4aca819c..d8a517f6c9914 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Create string sets for collection tests. @@ -27,7 +28,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java index 8a8f758290d6a..7f2738c2236f9 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with sorted maps of strings. @@ -30,7 +31,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSortedMapGenerator extends TestStringMapGenerator implements TestSortedMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java index e83dd74ac1c56..d83fc9d4ab73c 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Create string sets for testing collections that are sorted by natural ordering. @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSortedSetGenerator extends TestStringSetGenerator implements TestSortedSetGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java index 431e7e8103d7d..978fa683d8c81 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java @@ -17,6 +17,7 @@ package com.google.common.collect.testing; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSubjectGenerator { T createTestSubject(); } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java index d4d772b81e1d3..94719ef52a0ae 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Unhashables; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Creates collections containing unhashable sample elements, to be tested. @@ -27,7 +28,7 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestUnhashableCollectionGenerator> implements TestCollectionGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java b/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java index 660dd86d3bdf9..6c1fb6451598a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java @@ -34,6 +34,7 @@ import java.util.Map; import java.util.Queue; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Utilities for collecting and validating tester requirements from annotations. @@ -235,7 +236,12 @@ public static Iterable getTesterAnnotations(AnnotatedElement classOr if (annotations == null) { annotations = new ArrayList<>(); for (Annotation a : classOrMethod.getDeclaredAnnotations()) { - if (a.annotationType().isAnnotationPresent(TesterAnnotation.class)) { + /* + * We avoid reflecting on NullMarked because its @Target(..., MODULE) causes problems + * under JDK 8. + */ + if (!(a instanceof NullMarked) + && a.annotationType().isAnnotationPresent(TesterAnnotation.class)) { annotations.add(a); } } 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 99d4aa4c70396..553fbb8f54237 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractBiMapTester.java @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -34,7 +35,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractBiMapTester extends AbstractMapTester { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java index 32749e4e21a33..5134c913e0e0b 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ListMultimap; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -32,7 +33,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractListMultimapTester extends AbstractMultimapTester> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java index a48e4940662f9..5ffeefccbfb1f 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java @@ -28,6 +28,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMultimapTester< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends AbstractContainerTester> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java index bacd16155b88b..634a1a424c035 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java @@ -25,6 +25,7 @@ import com.google.common.collect.Maps; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Generators of various {@link com.google.common.collect.BiMap}s and derived collections. @@ -33,7 +34,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class BiMapGenerators { public static class ImmutableBiMapGenerator extends TestStringBiMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java index 3dbb5cd9e89c6..11eb5d910ca17 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -42,7 +43,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class DerivedGoogleCollectionGenerators { public static class MapGenerator implements TestMapGenerator, DerivedGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java index e5dd65c4b6d1e..fe7229ff8159e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java @@ -30,6 +30,7 @@ import com.google.common.primitives.Chars; import java.util.Collections; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Common generators of different types of lists. @@ -37,7 +38,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ListGenerators { private ListGenerators() {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java index 12e31fbd383bd..afea133492f04 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -47,7 +48,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ListMultimapAsMapTester extends AbstractListMultimapTester { public void testAsMapValuesImplementList() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java index d460372f944f4..28f55ca530346 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Generators of different types of map and related collections, such as keys, entries and values. @@ -47,7 +48,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapGenerators { public static class ImmutableMapGenerator extends TestStringMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java index a5d80d9d9de57..95fd02dd767ce 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -39,7 +40,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapEqualsTester extends AbstractMultimapTester> { public void testEqualsTrue() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java index 0d04d181123df..6cf7607f2fa98 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java @@ -37,6 +37,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -49,7 +50,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapPutTester extends AbstractMultimapTester> { @MapFeature.Require(absent = SUPPORTS_PUT) diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java index b3bc461a932c1..950290116e849 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java @@ -28,6 +28,7 @@ import com.google.common.collect.testing.features.MapFeature; import java.util.Collection; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapSizeTester extends AbstractMultimapTester> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java index 50c3d367c59a6..970d5139ffacf 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java @@ -29,6 +29,7 @@ import java.lang.reflect.Method; import java.util.Iterator; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetIteratorTester extends AbstractMultisetTester { @CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, KNOWN_ORDER}) public void testRemovingIteratorKnownOrder() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java b/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java index a9704ce4739b2..a4a37259a1783 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java index 908b733338be6..137a3bc432edc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java @@ -53,6 +53,7 @@ import java.util.List; import java.util.Set; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Generators of different types of sets and derived collections from sets. @@ -62,7 +63,7 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetGenerators { public static class ImmutableSetCopyOfGenerator extends TestStringSetGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java index 456d566a0bfde..961dc4f24f56f 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -47,7 +48,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class SetMultimapAsMapTester extends AbstractMultimapTester> { public void testAsMapValuesImplementSet() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java index 49b73296018c1..d82fd9ab6bd0d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Generators of sorted maps and derived collections. @@ -42,7 +43,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedMapGenerators { public static class ImmutableSortedMapGenerator extends TestStringSortedMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java index 5194e50c603a1..4f6edeb87e2cb 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.testing.TestContainerGenerator; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -28,7 +29,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestBiMapGenerator extends TestContainerGenerator, Entry> { K[] createKeyArray(int length); diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java index 96e56e38b6ae6..7c699cce29dd6 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java @@ -24,6 +24,7 @@ import com.google.common.collect.testing.SampleElements; import com.google.common.collect.testing.SampleElements.Enums; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * An abstract {@code TestMultisetGenerator} for generating multisets containing enum values. @@ -31,7 +32,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java index 6a71573f11b6a..35df198047754 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ListMultimap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,6 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestListMultimapGenerator extends TestMultimapGenerator> {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java index 79c6874bffbb0..8f473def24ba7 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.TestContainerGenerator; import java.util.Collection; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMultimapGenerator< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends TestContainerGenerator> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java index 272313253dea2..63a02bf0561bd 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Multiset; import com.google.common.collect.testing.TestCollectionGenerator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMultisetGenerator extends TestCollectionGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java index 1f59dd0beecb6..ee56438dac48d 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java @@ -23,6 +23,7 @@ import com.google.common.collect.testing.SampleElements; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestBiMapGenerator} for use with bimaps of strings. @@ -33,7 +34,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringBiMapGenerator implements TestBiMapGenerator { @Override diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java index 8c9140ed44d8b..790fe46b1dfef 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * A skeleton generator for a {@code ListMultimap} implementation. @@ -32,7 +33,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringListMultimapGenerator implements TestListMultimapGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java index b7b2558d99197..8bdef2293382f 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.collect.testing.SampleElements; import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Create multisets of strings for tests. @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java index e03cd52d01eac..414860e414c56 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * A skeleton generator for a {@code SetMultimap} implementation. @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSetMultimapGenerator implements TestSetMultimapGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java b/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java index f03e6a586560c..f118ecf7ac2be 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Robert Konigsberg */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableCollectionTests { public static void assertMapEntryIsUnmodifiable(Entry entry) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java index 002831ef3c13d..8b52204b620b1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.AbstractCollectionTester; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java index 8bcb6b62e000f..d7621fd7494d1 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java @@ -40,6 +40,7 @@ import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -53,7 +54,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class CollectionIteratorTester extends AbstractCollectionTester { public void testIterator() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java index 9e40e41282479..78395adbc8013 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java @@ -29,6 +29,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Map.Entry; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapPutIfAbsentTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java index 21dd73bf0d930..2d5b1014e0c85 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java @@ -27,6 +27,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -39,7 +40,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapRemoveTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java index 50e39d13201ae..7cd1ba6693bbd 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java @@ -27,6 +27,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapReplaceEntryTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java index 4b55fef8def3d..f65d5fb326d07 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java @@ -28,6 +28,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -41,7 +42,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapReplaceTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java index 42976bcb76f85..cab1041e59534 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java index c1566abac2b9a..472e1f50abf7e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java @@ -39,6 +39,7 @@ import java.util.ListIterator; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -53,7 +54,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ListListIteratorTester extends AbstractListTester { @CollectionFeature.Require(absent = SUPPORTS_REMOVE) @ListFeature.Require(absent = {SUPPORTS_SET, SUPPORTS_ADD_WITH_INDEX}) diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java index 94c2136ec9751..9b1a11f6863a2 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -54,7 +55,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MapPutAllTester extends AbstractMapTester { private List> containsNullKey; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java index b014de3146e49..a9dc1191dfc2e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java index a8cda429574ad..6e94a3ad886af 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedSetNavigationTester extends AbstractSetTester { private SortedSet sortedSet; diff --git a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java index 565f5d1f74d4e..8ee0cd94f6ea1 100644 --- a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -145,6 +145,7 @@ import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -171,7 +172,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ArbitraryInstances { private static final Ordering BY_FIELD_NAME = diff --git a/android/guava-testlib/src/com/google/common/testing/ClusterException.java b/android/guava-testlib/src/com/google/common/testing/ClusterException.java index 2b8d4eb77e72e..47232e8dd63bb 100644 --- a/android/guava-testlib/src/com/google/common/testing/ClusterException.java +++ b/android/guava-testlib/src/com/google/common/testing/ClusterException.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import org.jspecify.annotations.NullMarked; /** * An {@link ClusterException} is a data structure that allows for some code to "throw multiple @@ -59,7 +60,7 @@ * @author Luiz-Otavio Zorzella */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class ClusterException extends RuntimeException { final Collection exceptions; diff --git a/android/guava-testlib/src/com/google/common/testing/DummyProxy.java b/android/guava-testlib/src/com/google/common/testing/DummyProxy.java index 3494a66bb2c07..4515963f46137 100644 --- a/android/guava-testlib/src/com/google/common/testing/DummyProxy.java +++ b/android/guava-testlib/src/com/google/common/testing/DummyProxy.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class DummyProxy { /** diff --git a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java index 5f02dba848556..9d311d3fa3602 100644 --- a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -27,6 +27,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.ArrayList; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -76,7 +77,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EqualsTester { private static final int REPETITIONS = 3; diff --git a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java index ec34752c57ab0..bf16785bc5f1d 100644 --- a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -27,6 +27,7 @@ import com.google.common.testing.RelationshipTester.ItemReporter; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Tester for {@link Equivalence} relationships between groups of objects. @@ -50,7 +51,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EquivalenceTester { private static final int REPETITIONS = 3; diff --git a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java index ffa0e87aff504..66ae972ca4d9d 100644 --- a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -28,6 +28,7 @@ import java.time.Duration; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import org.jspecify.annotations.NullMarked; /** * A Ticker whose value can be advanced programmatically in test. @@ -40,7 +41,7 @@ * @author Jige Yu * @since 10.0 */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible public class FakeTicker extends Ticker { diff --git a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java index 0d38191f5ede7..ca57703d9fc51 100644 --- a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -36,6 +36,7 @@ import java.lang.reflect.Modifier; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -57,7 +58,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ForwardingWrapperTester { private boolean testsEquals = false; diff --git a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java index fb0facf24fd89..c883dd7916ce5 100644 --- a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -30,6 +30,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeoutException; +import org.jspecify.annotations.NullMarked; /** * Testing utilities relating to garbage collection finalization. @@ -107,7 +108,7 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // gc -@ElementTypesAreNonnullByDefault +@NullMarked public final class GcFinalization { private GcFinalization() {} diff --git a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java index 31d1938a5d54f..ba140359d1f86 100644 --- a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -46,6 +46,7 @@ import java.util.List; import java.util.concurrent.ConcurrentMap; import junit.framework.Assert; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -67,7 +68,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class NullPointerTester { private final ClassToInstanceMap defaults = MutableClassToInstanceMap.create(); diff --git a/android/guava-testlib/src/com/google/common/testing/Platform.java b/android/guava-testlib/src/com/google/common/testing/Platform.java index 9726d2de0eb1e..0352b5aa9ee53 100644 --- a/android/guava-testlib/src/com/google/common/testing/Platform.java +++ b/android/guava-testlib/src/com/google/common/testing/Platform.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import org.jspecify.annotations.NullMarked; /** * Methods factored out so that they can be emulated differently in GWT. @@ -32,7 +33,7 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class Platform { /** Serializes and deserializes the specified object. */ @SuppressWarnings("unchecked") diff --git a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java index d1caedd4e8d1d..fdfa23242dafc 100644 --- a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -25,6 +25,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link EqualsTester} and {@link EquivalenceTester} that tests for @@ -33,7 +34,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class RelationshipTester { static class ItemReporter { diff --git a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java index c2f8cc169b0b0..7be2f47586e3a 100644 --- a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -20,6 +20,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import junit.framework.Assert; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Tests serialization and deserialization of an object, optionally asserting that the resulting @@ -33,7 +34,7 @@ * @since 10.0 */ @GwtCompatible // but no-op! -@ElementTypesAreNonnullByDefault +@NullMarked public final class SerializableTester { private SerializableTester() {} diff --git a/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java b/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java index 10d9dc04ecd4a..1790499ca8017 100644 --- a/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * Simple utility for when you want to create a {@link TearDown} that may throw an exception but @@ -30,7 +31,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class SloppyTearDown implements TearDown { private static final Logger logger = Logger.getLogger(SloppyTearDown.class.getName()); diff --git a/android/guava-testlib/src/com/google/common/testing/TearDown.java b/android/guava-testlib/src/com/google/common/testing/TearDown.java index 45aebe2a24484..dbd04e2090cae 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDown.java @@ -17,6 +17,7 @@ package com.google.common.testing; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; /** * An object that can perform a {@link #tearDown} operation. @@ -25,7 +26,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TearDown { /** * Performs a single tear-down operation. See test-libraries-for-java's {@code diff --git a/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java b/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java index ec4319bab5503..ed514d2d4b1b1 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.DoNotMock; +import org.jspecify.annotations.NullMarked; /** * Any object which can accept registrations of {@link TearDown} instances. @@ -27,7 +28,7 @@ */ @DoNotMock("Implement with a lambda") @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TearDownAccepter { /** * Registers a TearDown implementor which will be run after the test proper. diff --git a/android/guava-testlib/src/com/google/common/testing/TearDownStack.java b/android/guava-testlib/src/com/google/common/testing/TearDownStack.java index b168698659079..f0c8dbd2ede8c 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownStack.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownStack.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * A {@code TearDownStack} contains a stack of {@link TearDown} instances. @@ -37,7 +38,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TearDownStack implements TearDownAccepter { private static final Logger logger = Logger.getLogger(TearDownStack.class.getName()); diff --git a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java index aba2131935bbd..ec01f81b5f813 100644 --- a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.logging.Handler; import java.util.logging.LogRecord; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -53,7 +54,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TestLogHandler extends Handler { private final Object lock = new Object(); diff --git a/android/guava-testlib/src/com/google/common/testing/package-info.java b/android/guava-testlib/src/com/google/common/testing/package-info.java index 300835adc4413..138d074788a6c 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,7 +19,8 @@ * href="https://github.com/google/guava">Guava library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.testing; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 ca07ffae0fbd0..05ff429bbdf58 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/test/com/google/common/base/CharMatcherTest.java b/android/guava-tests/test/com/google/common/base/CharMatcherTest.java index 67e83a7fb0301..1d47a3dc8a85e 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 9bc96b0d24e73..8b5db3ab2ae2d 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 1241200daafa4..54380fe53d3b8 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 c02127e9d55d5..5d427dd7a5d6d 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 ec197f5c2b828..3c6e2e9f072b2 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 71845c8e58926..10ee1296bd132 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 f1918c6d8c42c..6fc9660f4bd7e 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 e8f98fdd542e0..2315bae34bc6a 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 71a37a5f08e0e..d5b5a9aeb3739 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 494f321c208da..79fd2651cd24b 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 9a1150a0fc023..5971816134e75 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 0fa5fdbdb7b43..c496603719d7b 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 9dfa3fde21f6f..21c7b8bde46cb 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 e7f0f65200b6c..58f5fbc10cbe2 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 45f877a17ecfd..6f1b6f7e8c6be 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 1b6d6656483ee..c935a962b9fe2 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 a0f25ca5c29a8..80c9526665f44 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 1a86566d0cfcb..6808c3cf13fae 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 84b9209025573..682f16d54d5af 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 b1f64347ee533..e93736a6b89f4 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 5eada001250cc..2d6a94d28e673 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 264bb06f0a80b..4f479f49d9be5 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 bc18b493baa47..37f513ae3b291 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 9755891f9d62e..a0399d3cf49ff 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 44815e122dfa3..16c98c5cae619 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 b14550a4719d6..69adcaeb6fe52 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 963f22ada1f02..8710c49fafedb 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 c599a02aa3e73..1f3e422b6077d 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 a6f6019b79019..86323cc8f728b 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 1c928638a96ea..163688c867bc5 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 31eab3bc14db6..4f5cea2646171 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 7ba7923aed5c9..1d8cdd383907e 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 652a23045e50d..78d4e958ccc31 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 049e286457236..70e561443e70e 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 c4015cb727017..7fb754300d590 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 3cabcda48d170..b09fc124a98d3 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 b021a0de47f01..a2f6c87392656 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 e85aa2787640c..b9dbffcd501cf 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 dc77b8cac28c9..16657ccc47999 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 48d0d4785122e..238c04bba9d68 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 e007fe077b2fd..923ffe197faa7 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 265e2983d0e1f..1b6f4a44a97fd 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 d5ed5751ad527..a6a23beaaf303 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 06669ee30c100..d000fdc5cfac4 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 { @J2ktIncompatible 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 0fa8ac353c9a1..e4decb57c2c83 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 24ad901b5501f..421ab58e37132 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 c68d2c2bd7313..07162702e1186 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 34d186439883b..6e3803df599f2 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 8510a5130b300..b6e583163f02f 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 { @J2ktIncompatible public static class ImmutableEnumMapGenerator extends TestEnumMapGenerator { 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 79218b03214a1..b85c431686186 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 { @J2ktIncompatible public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator { 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 b4e969c34c9d9..1589655016222 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 620b53c134c63..9a65525d7ea0a 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 f216745044e32..0d78894082352 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 d1219082014a8..7d8860a873ddf 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 535071e9d0053..c381b1f3702e0 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 317644e1421d7..f8dfc39a2990b 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 91f7cc02566a9..4faa55b20174f 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 { @J2ktIncompatible private static final class ImmutableSetMultimapGenerator extends TestStringSetMultimapGenerator { 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 ddde4bfacd1aa..8df4e5facca0c 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 cb3402ade3b58..c9321c40be6a5 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 d3c2a02277299..8d45a44e8d5d8 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 8fb5dfa63593f..aef92ea1bc75b 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 78e2ef7106732..ccca7a71067fc 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 dcab9733a34d2..c940e7490157b 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 93c92aa82cf8b..c7285a92d9126 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 2b02080319104..cf1ed0f76f365 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 739748a6a9024..34d888b723611 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 b0f2f618dd744..2c942644628b3 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 b99d65fcda5a6..68ce8362d7f3e 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 844b9f449e8b5..f881b2c8c65be 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 de190d423ce9c..b6580f68c66a1 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 ac501a51e0964..b468f78bb5956 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 55f3ac66348f4..e1cafc86b9641 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 343ebcf77056d..def9d68477069 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 a94904e194411..2ba38f132a0ba 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 034b3e3d1ae06..97857ffdeb0a9 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 372e8276d5719..448988bece582 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 78494be1b4d5a..d68c9829ec444 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 85afc4728191a..a442aa8146912 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 13da822e65cdc..0921dc79dea35 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 8d2b2bd969878..d8ff7eda06334 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 01c121f48cdb7..6afb08a509e49 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 95043fc0db019..e52589461ab22 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 ad260ef651865..76f3b50df872e 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 d735749f948d5..e1431f09d76ee 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 72e31b0e0186b..308e25eb0c3b4 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 3f1f75d78ac52..74f719efe374a 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 1e697c95bbc26..86d67d5ad1e2a 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 fa7cb0c4b7f38..f17d0ee3b37e9 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 8fcde29bfd5c2..2e12936c81e62 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 7dd66df559daf..6ffa66df4d776 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 42b239aa0ff83..2dded744ce1da 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 c918b1dba8091..9b1d04bba4779 100644 --- a/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java +++ b/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code SortedIterables}. @@ -23,7 +24,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 95d2e16933e49..797f9dc6251da 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 f53b8b3038f0d..f97c6e792ecc5 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 9425722c141c9..82b46b12a463e 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 { @J2ktIncompatible 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 0a2b6472e4f61..57505ef2bfa0c 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 d25c2358dfbf7..e5887875d742d 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 9647a6f70ccd2..c1a140092acce 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 77cfd4142c1db..0a3918b39ef6a 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 95d58a58fbfc2..de34b485640d6 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 452c70a93d147..e06865dbc2639 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 ee813e358ff4d..f8e67f990829e 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 25f1bcfa37ce1..524ed112d70a1 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 6c87b99efecbd..736c8ff4518d3 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 4fa7b5aaeca6b..f27017d6cfa2f 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 48049bc5913ee..b4e6008e38cd8 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 2745941667649..59ba288793dec 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 ba4235d7748a0..d9c5ba1e457a4 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 862d78c7d1b29..cf25c9d5972db 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 46a925a58f631..e9c891fa24efe 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 7884b61104f45..990732ee3c677 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 e663ff280ae1a..aedd2e5d74223 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 f69c54a15fcbd..cb85a7bfb0171 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 f50a512446d63..bd4f2b945a286 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 8cd6cbd575746..38149fc57386d 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 a9c3d094d084d..3b1b45cf21469 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 fad660a0c6f6a..452e513a9430d 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 02cf78e2baa7a..e1d159ae73cc4 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 f485b8bb0e5ef..6296f494b9ea9 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 f9713c752bd5c..dcd19b0504594 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 c98dd1449b519..a18944d4141df 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 7c1cc0c2850f9..5fa5c14c98844 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 67c011107e0b6..511eb2afb34ba 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 05d69df2e45fb..a75a0437ee25f 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 3296aedd9d57e..70a8a7347fbc4 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 69fa02cc008c8..904e6a8482b63 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 973995a5af2a4..e01db08785415 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 c82d23b517f18..85c754c758920 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 125749470a0de..c7ad03ad41935 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 5f27927038c7a..f03f7b6e57ace 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 444185d69ff0f..dda6301ade7d8 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 98454b458e96f..e60cf683dfbc4 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 a0be002dd9958..3c7c363b3264b 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 693a6565a8a4e..86e8f9903637c 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 15c80b41ffb01..67ab066c41dce 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 b395a204aac0c..6c56ad0e1d7f2 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 6da8be85115ce..5645a0f14cc7b 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 bf0d211ebd7ea..fa7aa36cbf2dd 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 c35cbc4799d42..6522be8bff55d 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 a64cf2642c7f9..2c5aa19137272 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 b84972e537162..0bfa4dd5d82d4 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 2c903ac7acdbc..67654ea330eff 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 9f40936dd7eb0..60d8670c4be9f 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 d2770657fd993..e186066e4b63f 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 309b0029abd34..3339f08877d56 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 ade301520edcc..1fc69011f37bd 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 7c2b29bd6ca88..a0f455ec170c8 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java b/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 17357b525a03c..969357713648e 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/src/com/google/common/base/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a0adb0236c89f..0000000000000 --- a/android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/base/ParametricNullness.java b/android/guava/src/com/google/common/base/ParametricNullness.java index 0bcc65dc2eb55..3fadb315554aa 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/package-info.java b/android/guava/src/com/google/common/base/package-info.java index 8cdbdca4c2365..c73391c3b4e4e 100644 --- a/android/guava/src/com/google/common/base/package-info.java +++ b/android/guava/src/com/google/common/base/package-info.java @@ -57,7 +57,8 @@ * Defaults}), as well as a number of classes that have been superseded by additions to the JDK. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.base; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 51431fe419eac..0000000000000 --- a/android/guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/cache/ParametricNullness.java b/android/guava/src/com/google/common/cache/ParametricNullness.java index eaf194d4ab1c9..8892bb45267dd 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/package-info.java b/android/guava/src/com/google/common/cache/package-info.java index e494d931f42ba..e7c453dd8d0e5 100644 --- a/android/guava/src/com/google/common/cache/package-info.java +++ b/android/guava/src/com/google/common/cache/package-info.java @@ -29,7 +29,8 @@ * @author Charles Fry */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.cache; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 8fe0fb3756438..0000000000000 --- a/android/guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/collect/ObjectCountHashMap.java b/android/guava/src/com/google/common/collect/ObjectCountHashMap.java index 29d5bcde40395..5d952cf8f6ba8 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 266606a153fc4..71a3cd57dedff 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/ParametricNullness.java b/android/guava/src/com/google/common/collect/ParametricNullness.java index 207c05262e413..8074de5d5689b 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/package-info.java b/android/guava/src/com/google/common/collect/package-info.java index 048b7d8d72f14..d9f2331e1a648 100644 --- a/android/guava/src/com/google/common/collect/package-info.java +++ b/android/guava/src/com/google/common/collect/package-info.java @@ -120,7 +120,8 @@ *
      */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.collect; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 93130cb881768..0000000000000 --- a/android/guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/escape/ParametricNullness.java b/android/guava/src/com/google/common/escape/ParametricNullness.java index f964ca4a4f619..9ac5d62e12962 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/package-info.java b/android/guava/src/com/google/common/escape/package-info.java index 80c42464e1bbe..173f811a3aaeb 100644 --- a/android/guava/src/com/google/common/escape/package-info.java +++ b/android/guava/src/com/google/common/escape/package-info.java @@ -25,7 +25,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.escape; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 8ef823148266b..0000000000000 --- a/android/guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/eventbus/ParametricNullness.java b/android/guava/src/com/google/common/eventbus/ParametricNullness.java index 47c7d8d4d0633..fd07ef09cb609 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/package-info.java b/android/guava/src/com/google/common/eventbus/package-info.java index 3808bde9a2219..b387bc234010a 100644 --- a/android/guava/src/com/google/common/eventbus/package-info.java +++ b/android/guava/src/com/google/common/eventbus/package-info.java @@ -20,7 +20,8 @@ * href="https://github.com/google/guava/wiki/EventBusExplained">{@code EventBus}. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.eventbus; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 0821642f52d44..0000000000000 --- a/android/guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/graph/ParametricNullness.java b/android/guava/src/com/google/common/graph/ParametricNullness.java index 32fd5ee7ecaae..634ee0e197827 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/package-info.java b/android/guava/src/com/google/common/graph/package-info.java index bed41eefec3a0..7e97756afabfd 100644 --- a/android/guava/src/com/google/common/graph/package-info.java +++ b/android/guava/src/com/google/common/graph/package-info.java @@ -22,7 +22,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.graph; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 ab3aa88d9d7a4..0000000000000 --- a/android/guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/hash/ParametricNullness.java b/android/guava/src/com/google/common/hash/ParametricNullness.java index 4ebc40bb741e7..f5a8614a87623 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/package-info.java b/android/guava/src/com/google/common/hash/package-info.java index 9dbbbaac34389..b5405d48129c2 100644 --- a/android/guava/src/com/google/common/hash/package-info.java +++ b/android/guava/src/com/google/common/hash/package-info.java @@ -20,7 +20,8 @@ * href="https://github.com/google/guava/wiki/HashingExplained">hashing. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.hash; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 5e471bdbbce95..0000000000000 --- a/android/guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/html/ParametricNullness.java b/android/guava/src/com/google/common/html/ParametricNullness.java index 50a64c781c90a..a43cc22a06b01 100644 --- a/android/guava/src/com/google/common/html/ParametricNullness.java +++ b/android/guava/src/com/google/common/html/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/html/package-info.java b/android/guava/src/com/google/common/html/package-info.java index 03f51fdb04c32..ccfd5b5693f9c 100644 --- a/android/guava/src/com/google/common/html/package-info.java +++ b/android/guava/src/com/google/common/html/package-info.java @@ -21,7 +21,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.html; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 321b5826baa62..0000000000000 --- a/android/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/io/ParametricNullness.java b/android/guava/src/com/google/common/io/ParametricNullness.java index 881c07d498042..32eee700e1c66 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/package-info.java b/android/guava/src/com/google/common/io/package-info.java index c29b61a74d974..30cff81d2fd2c 100644 --- a/android/guava/src/com/google/common/io/package-info.java +++ b/android/guava/src/com/google/common/io/package-info.java @@ -28,7 +28,8 @@ * @author Chris Nokleberg */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.io; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 d314278a80768..0000000000000 --- a/android/guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/math/ParametricNullness.java b/android/guava/src/com/google/common/math/ParametricNullness.java index 612fa934a6d57..a18ba9348f9af 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/package-info.java b/android/guava/src/com/google/common/math/package-info.java index da2392a6a5a59..663d3bced554e 100644 --- a/android/guava/src/com/google/common/math/package-info.java +++ b/android/guava/src/com/google/common/math/package-info.java @@ -23,7 +23,8 @@ * href="https://github.com/google/guava/wiki/MathExplained">math utilities. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.math; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 3c8b9f4225f88..0000000000000 --- a/android/guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/net/ParametricNullness.java b/android/guava/src/com/google/common/net/ParametricNullness.java index 83b9eb6fa6a3f..5b3af1736ee1c 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/package-info.java b/android/guava/src/com/google/common/net/package-info.java index 1fa33a1ad434e..562bb10e4f993 100644 --- a/android/guava/src/com/google/common/net/package-info.java +++ b/android/guava/src/com/google/common/net/package-info.java @@ -21,7 +21,8 @@ * @author Craig Berry */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.net; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 1240d1075a28d..0000000000000 --- a/android/guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/primitives/ParametricNullness.java b/android/guava/src/com/google/common/primitives/ParametricNullness.java index c40ea499d4cee..9af83702c0b12 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/package-info.java b/android/guava/src/com/google/common/primitives/package-info.java index 2fdf789228e76..67e87ac3d65a2 100644 --- a/android/guava/src/com/google/common/primitives/package-info.java +++ b/android/guava/src/com/google/common/primitives/package-info.java @@ -64,7 +64,8 @@ *
                      */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.primitives; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 594c4c394bf6e..0000000000000 --- a/android/guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/android/guava/src/com/google/common/reflect/ParametricNullness.java b/android/guava/src/com/google/common/reflect/ParametricNullness.java index 372a53bb616fc..4cc7fd2848470 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/package-info.java b/android/guava/src/com/google/common/reflect/package-info.java index 71583d47498ef..7a3f435e530b7 100644 --- a/android/guava/src/com/google/common/reflect/package-info.java +++ b/android/guava/src/com/google/common/reflect/package-info.java @@ -17,7 +17,8 @@ * href="https://github.com/google/guava">Guava library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.reflect; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 4dc5c72362d4f..0000000000000 --- a/android/guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} 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 cdc2ee110b99e..ba5c58820023e 100644 --- a/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/android/guava/src/com/google/common/util/concurrent/ListenableFuture.java @@ -18,6 +18,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -117,7 +118,7 @@ * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -@ElementTypesAreNonnullByDefault +@NullMarked 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/ParametricNullness.java b/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java index e8fcce6ee6818..f12f1133e6dfe 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/package-info.java b/android/guava/src/com/google/common/util/concurrent/package-info.java index 41af41c0d3ab0..c5b199b072923 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,7 +25,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.util.concurrent; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 4a6bee38582a0..0000000000000 --- a/android/guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, 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 439707a2edb13..0d989c7cefa6e 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/package-info.java b/android/guava/src/com/google/common/xml/package-info.java index c06e1b5702f98..a263f55f44c86 100644 --- a/android/guava/src/com/google/common/xml/package-info.java +++ b/android/guava/src/com/google/common/xml/package-info.java @@ -21,7 +21,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.xml; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 cdc2ee110b99e..ba5c58820023e 100644 --- a/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java @@ -18,6 +18,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -117,7 +118,7 @@ * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -@ElementTypesAreNonnullByDefault +@NullMarked 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 afe4fa0bc461c..ce79b45f36937 100644 --- a/guava-gwt/pom.xml +++ b/guava-gwt/pom.xml @@ -334,7 +334,12 @@ - + + + + + + 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 f281cd83414b9..33a3a83746b85 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -32,7 +33,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractCollectionTester extends AbstractContainerTester, E> { diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java index 56163a6f67405..92e6f5a1ec943 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractContainerTester extends AbstractTester> { protected SampleElements samples; diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java index 8ed2558911055..4464acf0f3fa6 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java @@ -35,6 +35,7 @@ import java.util.NoSuchElementException; import java.util.Set; import java.util.Stack; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked 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 f85b01fbbc7e6..fc8cbdd9c5451 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java @@ -26,6 +26,7 @@ import java.util.ListIterator; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -43,7 +44,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMapTester extends AbstractContainerTester, Entry> { protected Map getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java index 5ffe110e7dbe5..4ae6fc9f87a68 100644 --- a/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author George van den Driessche */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractTester extends TestCase { private G subjectGenerator; private String suiteName; diff --git a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java index 6312a67bc66ac..b13345794c577 100644 --- a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java +++ b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java @@ -33,6 +33,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class DerivedCollectionGenerators { public static class MapEntrySetGenerator implements TestSetGenerator>, DerivedGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/guava-testlib/src/com/google/common/collect/testing/Helpers.java index a9e7ac04d84ae..360793345a0a1 100644 --- a/guava-testlib/src/com/google/common/collect/testing/Helpers.java +++ b/guava-testlib/src/com/google/common/collect/testing/Helpers.java @@ -44,10 +44,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class Helpers { // Clone of Objects.equal static boolean equal(@Nullable Object a, @Nullable Object b) { diff --git a/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java b/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java index 7bc6548bcab21..ac9e70cac1dce 100644 --- a/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java +++ b/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

                            Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java index 01409884607a1..fcd39baeac993 100644 --- a/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/IteratorTester.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collections; import java.util.Iterator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -85,7 +86,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class IteratorTester extends AbstractIteratorTester> { /** diff --git a/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java index a781d0ab02667..3a9404e667723 100644 --- a/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/ListIteratorTester.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.ListIterator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class ListIteratorTester extends AbstractIteratorTester> { protected ListIteratorTester( diff --git a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java index 8c3fdeadccb14..38864047f9e8a 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java +++ b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java @@ -33,6 +33,7 @@ import java.util.Map.Entry; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -48,7 +49,7 @@ // check the order if so. // TODO: Refactor to share code with SetTestBuilder etc. @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class MapInterfaceTest extends TestCase { diff --git a/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java b/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java index 67b7cdb485e4f..d09b8afc4f038 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java +++ b/guava-testlib/src/com/google/common/collect/testing/MinimalCollection.java @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.Iterator; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MinimalCollection extends AbstractCollection { // TODO: expose allow nulls parameter? diff --git a/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java b/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java index 971e69a2436b9..b78a5ce21597f 100644 --- a/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java +++ b/guava-testlib/src/com/google/common/collect/testing/MinimalSet.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Set; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MinimalSet extends MinimalCollection implements Set { @SuppressWarnings("unchecked") // empty Object[] as E[] diff --git a/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java b/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java index faeee278d0d92..7625463adf758 100644 --- a/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/OneSizeGenerator.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class OneSizeGenerator implements OneSizeTestContainerGenerator { private final TestContainerGenerator generator; diff --git a/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java b/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java index 9cb5a87e79e67..72fbf0224eac7 100644 --- a/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/OneSizeTestContainerGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.features.CollectionSize; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface OneSizeTestContainerGenerator extends TestSubjectGenerator, TestContainerGenerator { TestContainerGenerator getInnerGenerator(); diff --git a/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java b/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java index 9f32428f8732d..6e0431b1319e1 100644 --- a/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java +++ b/guava-testlib/src/com/google/common/collect/testing/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-testlib/src/com/google/common/collect/testing/SampleElements.java b/guava-testlib/src/com/google/common/collect/testing/SampleElements.java index e1606a19d9770..153d684677127 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SampleElements.java +++ b/guava-testlib/src/com/google/common/collect/testing/SampleElements.java @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SampleElements implements Iterable { // TODO: rename e3, e4 => missing1, missing2 private final E e0; diff --git a/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java index 131cbf814db5e..62540b94ec46e 100644 --- a/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/SpliteratorTester.java @@ -42,6 +42,7 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -50,7 +51,7 @@ * @since 21.0 (but only since 33.4.0 in the Android flavor) */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked 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 07b465bb889ae..acf6ec52e5ab0 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestCharacterListGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Chars; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Generates {@code List} instances for test suites. @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestCharacterListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java index 63c35be86abc4..5f336be4ce95a 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestCollectionGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,6 +27,6 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestCollectionGenerator extends TestContainerGenerator, E> {} diff --git a/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java index b26a6a5832f9a..836f4bf971e73 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestCollidingSetGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Colliders; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * A generator using sample elements whose hash codes all collide badly. @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestCollidingSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java index c6792bfdf519d..08d2e31f43a56 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestContainerGenerator.java @@ -20,6 +20,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestContainerGenerator { /** Returns the sample elements that this generate populates its container with. */ SampleElements samples(); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java index b4b97c6013398..a6f1c610faf15 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestEnumMapGenerator.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with enum maps. @@ -30,7 +31,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumMapGenerator implements TestMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java index 307fc1533fabe..2ddd283db4184 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestEnumSetGenerator.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.SampleElements.Enums; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * An abstract TestSetGenerator for generating sets containing enum values. @@ -29,7 +30,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java index 633329c1e6263..b8e8b595d8469 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSetGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Ints; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Create integer sets for collection tests. @@ -27,7 +28,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestIntegerSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java index 73b44b616f1d8..576e870c3ebe9 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestIntegerSortedSetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Create integer sets for testing collections that are sorted by natural ordering. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestIntegerSortedSetGenerator extends TestIntegerSetGenerator { @Override protected abstract SortedSet create(Integer[] elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java index 34117f8988749..886bb105bb74d 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestListGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestListGenerator extends TestCollectionGenerator { @Override List create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java index 57376d4987e1e..eb62f12b5d8c0 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestMapEntrySetGenerator.java @@ -23,6 +23,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Jesse Wilson */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestMapEntrySetGenerator< K extends @Nullable Object, V extends @Nullable Object> implements TestSetGenerator> { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java index efc85fc5563bf..86b79469b1f1b 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestMapGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMapGenerator extends TestContainerGenerator, Map.Entry> { K[] createKeyArray(int length); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java index c5b093b1880d9..e0aebf66919d3 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestQueueGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Queue; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestQueueGenerator extends TestCollectionGenerator { @Override Queue create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java index 2ed582aa7a366..83fd9075de464 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSetGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSetGenerator extends TestCollectionGenerator { @Override Set create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java index 107a8e76cea7a..ae462fe31f002 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSortedMapGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSortedMapGenerator extends TestMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java index 10abd8b4d1715..dc9e94222006c 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSortedSetGenerator.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,7 +27,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSortedSetGenerator extends TestSetGenerator { @Override SortedSet create(Object... elements); diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java index 081e9eaddd269..c637c223dafc3 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringCollectionGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * String creation for testing arbitrary collections. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringCollectionGenerator implements TestCollectionGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java index fe1de2eb24500..9b2bddec93057 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringListGenerator.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * TODO: javadoc. @@ -26,7 +27,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringListGenerator implements TestListGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java index 0900629a55c85..2edf70fff26d8 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringMapGenerator.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with maps of strings. @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringMapGenerator implements TestMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java index 1102c3456bd04..1d2d3f4af55a5 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringQueueGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; import java.util.Queue; +import org.jspecify.annotations.NullMarked; /** * Create queue of strings for tests. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringQueueGenerator implements TestQueueGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java index 2949e4aca819c..d8a517f6c9914 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringSetGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Create string sets for collection tests. @@ -27,7 +28,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSetGenerator implements TestSetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java index 8a8f758290d6a..7f2738c2236f9 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedMapGenerator.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestMapGenerator} for use with sorted maps of strings. @@ -30,7 +31,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSortedMapGenerator extends TestStringMapGenerator implements TestSortedMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java index e83dd74ac1c56..d83fc9d4ab73c 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestStringSortedSetGenerator.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.List; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Create string sets for testing collections that are sorted by natural ordering. @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSortedSetGenerator extends TestStringSetGenerator implements TestSortedSetGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java index 431e7e8103d7d..978fa683d8c81 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestSubjectGenerator.java @@ -17,6 +17,7 @@ package com.google.common.collect.testing; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestSubjectGenerator { T createTestSubject(); } diff --git a/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java b/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java index d4d772b81e1d3..94719ef52a0ae 100644 --- a/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java +++ b/guava-testlib/src/com/google/common/collect/testing/TestUnhashableCollectionGenerator.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.SampleElements.Unhashables; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Creates collections containing unhashable sample elements, to be tested. @@ -27,7 +28,7 @@ * @author Regina O'Dell */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestUnhashableCollectionGenerator> implements TestCollectionGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java b/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java index 660dd86d3bdf9..6c1fb6451598a 100644 --- a/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java +++ b/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java @@ -34,6 +34,7 @@ import java.util.Map; import java.util.Queue; import java.util.Set; +import org.jspecify.annotations.NullMarked; /** * Utilities for collecting and validating tester requirements from annotations. @@ -235,7 +236,12 @@ public static Iterable getTesterAnnotations(AnnotatedElement classOr if (annotations == null) { annotations = new ArrayList<>(); for (Annotation a : classOrMethod.getDeclaredAnnotations()) { - if (a.annotationType().isAnnotationPresent(TesterAnnotation.class)) { + /* + * We avoid reflecting on NullMarked because its @Target(..., MODULE) causes problems + * under JDK 8. + */ + if (!(a instanceof NullMarked) + && a.annotationType().isAnnotationPresent(TesterAnnotation.class)) { annotations.add(a); } } 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 99d4aa4c70396..553fbb8f54237 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 @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -34,7 +35,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractBiMapTester extends AbstractMapTester { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/AbstractListMultimapTester.java index 32749e4e21a33..5134c913e0e0b 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 @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ListMultimap; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -32,7 +33,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractListMultimapTester extends AbstractMultimapTester> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultimapTester.java index a48e4940662f9..5ffeefccbfb1f 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 @@ -28,6 +28,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMultimapTester< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends AbstractContainerTester> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/BiMapGenerators.java index bacd16155b88b..634a1a424c035 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 @@ -25,6 +25,7 @@ import com.google.common.collect.Maps; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Generators of various {@link com.google.common.collect.BiMap}s and derived collections. @@ -33,7 +34,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class BiMapGenerators { public static class ImmutableBiMapGenerator extends TestStringBiMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java index 3dbb5cd9e89c6..11eb5d910ca17 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 @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -42,7 +43,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class DerivedGoogleCollectionGenerators { public static class MapGenerator implements TestMapGenerator, DerivedGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java index e5dd65c4b6d1e..fe7229ff8159e 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 @@ -30,6 +30,7 @@ import com.google.common.primitives.Chars; import java.util.Collections; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Common generators of different types of lists. @@ -37,7 +38,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ListGenerators { private ListGenerators() {} diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java index 12e31fbd383bd..afea133492f04 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 @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -47,7 +48,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ListMultimapAsMapTester extends AbstractListMultimapTester { public void testAsMapValuesImplementList() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java index d460372f944f4..28f55ca530346 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 @@ -40,6 +40,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Generators of different types of map and related collections, such as keys, entries and values. @@ -47,7 +48,7 @@ * @author Hayward Chan */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapGenerators { public static class ImmutableMapGenerator extends TestStringMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapEqualsTester.java index a5d80d9d9de57..95fd02dd767ce 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 @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -39,7 +40,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapEqualsTester extends AbstractMultimapTester> { public void testEqualsTrue() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java index 0d04d181123df..6cf7607f2fa98 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 @@ -37,6 +37,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -49,7 +50,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapPutTester extends AbstractMultimapTester> { @MapFeature.Require(absent = SUPPORTS_PUT) diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapSizeTester.java index b3bc461a932c1..950290116e849 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 @@ -28,6 +28,7 @@ import com.google.common.collect.testing.features.MapFeature; import java.util.Collection; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapSizeTester extends AbstractMultimapTester> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java index 50c3d367c59a6..970d5139ffacf 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 @@ -29,6 +29,7 @@ import java.lang.reflect.Method; import java.util.Iterator; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetIteratorTester extends AbstractMultisetTester { @CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, KNOWN_ORDER}) public void testRemovingIteratorKnownOrder() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java b/guava-testlib/src/com/google/common/collect/testing/google/ReflectionFreeAssertThrows.java index a9704ce4739b2..a4a37259a1783 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 @@ -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-testlib/src/com/google/common/collect/testing/google/SetGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java index 908b733338be6..137a3bc432edc 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 @@ -53,6 +53,7 @@ import java.util.List; import java.util.Set; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; /** * Generators of different types of sets and derived collections from sets. @@ -62,7 +63,7 @@ * @author Hayward Chan */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetGenerators { public static class ImmutableSetCopyOfGenerator extends TestStringSetGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java index 456d566a0bfde..961dc4f24f56f 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 @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -47,7 +48,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class SetMultimapAsMapTester extends AbstractMultimapTester> { public void testAsMapValuesImplementSet() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java index 49b73296018c1..d82fd9ab6bd0d 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 @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Generators of sorted maps and derived collections. @@ -42,7 +43,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedMapGenerators { public static class ImmutableSortedMapGenerator extends TestStringSortedMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestBiMapGenerator.java index 5194e50c603a1..4f6edeb87e2cb 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 @@ -20,6 +20,7 @@ import com.google.common.collect.BiMap; import com.google.common.collect.testing.TestContainerGenerator; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -28,7 +29,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestBiMapGenerator extends TestContainerGenerator, Entry> { K[] createKeyArray(int length); diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestEnumMultisetGenerator.java index 96e56e38b6ae6..7c699cce29dd6 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 @@ -24,6 +24,7 @@ import com.google.common.collect.testing.SampleElements; import com.google.common.collect.testing.SampleElements.Enums; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * An abstract {@code TestMultisetGenerator} for generating multisets containing enum values. @@ -31,7 +32,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestEnumMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestListMultimapGenerator.java index 6a71573f11b6a..35df198047754 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 @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.ListMultimap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -26,6 +27,6 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestListMultimapGenerator extends TestMultimapGenerator> {} diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestMultimapGenerator.java index 79c6874bffbb0..8f473def24ba7 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 @@ -22,6 +22,7 @@ import com.google.common.collect.testing.TestContainerGenerator; import java.util.Collection; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMultimapGenerator< K extends @Nullable Object, V extends @Nullable Object, M extends Multimap> extends TestContainerGenerator> { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestMultisetGenerator.java index 272313253dea2..63a02bf0561bd 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 @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Multiset; import com.google.common.collect.testing.TestCollectionGenerator; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TestMultisetGenerator extends TestCollectionGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringBiMapGenerator.java index 1f59dd0beecb6..ee56438dac48d 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 @@ -23,6 +23,7 @@ import com.google.common.collect.testing.SampleElements; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link TestBiMapGenerator} for use with bimaps of strings. @@ -33,7 +34,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringBiMapGenerator implements TestBiMapGenerator { @Override diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringListMultimapGenerator.java index 8c9140ed44d8b..790fe46b1dfef 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 @@ -25,6 +25,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * A skeleton generator for a {@code ListMultimap} implementation. @@ -32,7 +33,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringListMultimapGenerator implements TestListMultimapGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringMultisetGenerator.java index b7b2558d99197..8bdef2293382f 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 @@ -21,6 +21,7 @@ import com.google.common.collect.testing.SampleElements; import com.google.common.collect.testing.SampleElements.Strings; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Create multisets of strings for tests. @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringMultisetGenerator implements TestMultisetGenerator { @Override public SampleElements samples() { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java b/guava-testlib/src/com/google/common/collect/testing/google/TestStringSetMultimapGenerator.java index e03cd52d01eac..414860e414c56 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 @@ -24,6 +24,7 @@ import java.util.Collection; import java.util.List; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; /** * A skeleton generator for a {@code SetMultimap} implementation. @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class TestStringSetMultimapGenerator implements TestSetMultimapGenerator { diff --git a/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java b/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java index f590df0b51a66..81b641ebfe139 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 @@ -35,6 +35,7 @@ import java.util.List; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Robert Konigsberg */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableCollectionTests { public static void assertMapEntryIsUnmodifiable(Entry entry) { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/AbstractListTester.java index 002831ef3c13d..8b52204b620b1 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 @@ -22,6 +22,7 @@ import com.google.common.collect.testing.AbstractCollectionTester; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -31,7 +32,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionIteratorTester.java index 8bcb6b62e000f..d7621fd7494d1 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 @@ -40,6 +40,7 @@ import java.util.Map.Entry; import java.util.NoSuchElementException; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -53,7 +54,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class CollectionIteratorTester extends AbstractCollectionTester { public void testIterator() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java index 9e40e41282479..78395adbc8013 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 @@ -29,6 +29,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Map.Entry; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapPutIfAbsentTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java index 21dd73bf0d930..2d5b1014e0c85 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 @@ -27,6 +27,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -39,7 +40,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapRemoveTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java index 50e39d13201ae..7cd1ba6693bbd 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 @@ -27,6 +27,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -40,7 +41,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapReplaceEntryTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java index 4b55fef8def3d..f65d5fb326d07 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 @@ -28,6 +28,7 @@ import com.google.common.collect.testing.features.CollectionSize; import com.google.common.collect.testing.features.MapFeature; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; import org.junit.Ignore; /** @@ -41,7 +42,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ConcurrentMapReplaceTester extends AbstractMapTester { @Override protected ConcurrentMap getMap() { diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java b/guava-testlib/src/com/google/common/collect/testing/testers/IgnoreJRERequirement.java index 42976bcb76f85..cab1041e59534 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 @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

                            Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java index c1566abac2b9a..472e1f50abf7e 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 @@ -39,6 +39,7 @@ import java.util.ListIterator; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -53,7 +54,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class ListListIteratorTester extends AbstractListTester { @CollectionFeature.Require(absent = SUPPORTS_REMOVE) @ListFeature.Require(absent = {SUPPORTS_SET, SUPPORTS_ADD_WITH_INDEX}) diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java index 94c2136ec9751..9b1a11f6863a2 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 @@ -40,6 +40,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -54,7 +55,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MapPutAllTester extends AbstractMapTester { private List> containsNullKey; diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java b/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java index b014de3146e49..a9dc1191dfc2e 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 @@ -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-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java index a8cda429574ad..6e94a3ad886af 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 @@ -28,6 +28,7 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedSetNavigationTester extends AbstractSetTester { private SortedSet sortedSet; diff --git a/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java b/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java index 249731a39a21e..0368e18140251 100644 --- a/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java +++ b/guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java @@ -44,6 +44,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.junit.Test; /** @@ -105,7 +106,7 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // com.google.common.reflect.ClassPath -@ElementTypesAreNonnullByDefault +@NullMarked 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 a178b418f60e4..dd802130da9e0 100644 --- a/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -150,6 +150,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Stream; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -176,7 +177,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ArbitraryInstances { private static final Ordering BY_FIELD_NAME = diff --git a/guava-testlib/src/com/google/common/testing/ClusterException.java b/guava-testlib/src/com/google/common/testing/ClusterException.java index 2b8d4eb77e72e..47232e8dd63bb 100644 --- a/guava-testlib/src/com/google/common/testing/ClusterException.java +++ b/guava-testlib/src/com/google/common/testing/ClusterException.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import org.jspecify.annotations.NullMarked; /** * An {@link ClusterException} is a data structure that allows for some code to "throw multiple @@ -59,7 +60,7 @@ * @author Luiz-Otavio Zorzella */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class ClusterException extends RuntimeException { final Collection exceptions; diff --git a/guava-testlib/src/com/google/common/testing/CollectorTester.java b/guava-testlib/src/com/google/common/testing/CollectorTester.java index 94f6a5a010faa..eec85c7f0ce46 100644 --- a/guava-testlib/src/com/google/common/testing/CollectorTester.java +++ b/guava-testlib/src/com/google/common/testing/CollectorTester.java @@ -28,6 +28,7 @@ import java.util.Objects; import java.util.function.BiPredicate; import java.util.stream.Collector; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @since 21.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked 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 3494a66bb2c07..4515963f46137 100644 --- a/guava-testlib/src/com/google/common/testing/DummyProxy.java +++ b/guava-testlib/src/com/google/common/testing/DummyProxy.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class DummyProxy { /** diff --git a/guava-testlib/src/com/google/common/testing/EqualsTester.java b/guava-testlib/src/com/google/common/testing/EqualsTester.java index 5f02dba848556..9d311d3fa3602 100644 --- a/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -27,6 +27,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.ArrayList; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -76,7 +77,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EqualsTester { private static final int REPETITIONS = 3; diff --git a/guava-testlib/src/com/google/common/testing/EquivalenceTester.java b/guava-testlib/src/com/google/common/testing/EquivalenceTester.java index ec34752c57ab0..bf16785bc5f1d 100644 --- a/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -27,6 +27,7 @@ import com.google.common.testing.RelationshipTester.ItemReporter; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Tester for {@link Equivalence} relationships between groups of objects. @@ -50,7 +51,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EquivalenceTester { private static final int REPETITIONS = 3; diff --git a/guava-testlib/src/com/google/common/testing/FakeTicker.java b/guava-testlib/src/com/google/common/testing/FakeTicker.java index 3ffc27b71b428..55a9cc5ff2424 100644 --- a/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -27,6 +27,7 @@ import java.time.Duration; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import org.jspecify.annotations.NullMarked; /** * A Ticker whose value can be advanced programmatically in test. @@ -39,7 +40,7 @@ * @author Jige Yu * @since 10.0 */ -@ElementTypesAreNonnullByDefault +@NullMarked @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 0d38191f5ede7..ca57703d9fc51 100644 --- a/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -36,6 +36,7 @@ import java.lang.reflect.Modifier; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -57,7 +58,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ForwardingWrapperTester { private boolean testsEquals = false; diff --git a/guava-testlib/src/com/google/common/testing/GcFinalization.java b/guava-testlib/src/com/google/common/testing/GcFinalization.java index fb0facf24fd89..c883dd7916ce5 100644 --- a/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -30,6 +30,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeoutException; +import org.jspecify.annotations.NullMarked; /** * Testing utilities relating to garbage collection finalization. @@ -107,7 +108,7 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // gc -@ElementTypesAreNonnullByDefault +@NullMarked public final class GcFinalization { private GcFinalization() {} diff --git a/guava-testlib/src/com/google/common/testing/NullPointerTester.java b/guava-testlib/src/com/google/common/testing/NullPointerTester.java index 8b2ac49633c51..12ad0a9e2460d 100644 --- a/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -48,6 +48,7 @@ import java.util.List; import java.util.concurrent.ConcurrentMap; import junit.framework.Assert; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -69,7 +70,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked 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 9726d2de0eb1e..0352b5aa9ee53 100644 --- a/guava-testlib/src/com/google/common/testing/Platform.java +++ b/guava-testlib/src/com/google/common/testing/Platform.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import org.jspecify.annotations.NullMarked; /** * Methods factored out so that they can be emulated differently in GWT. @@ -32,7 +33,7 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class Platform { /** Serializes and deserializes the specified object. */ @SuppressWarnings("unchecked") diff --git a/guava-testlib/src/com/google/common/testing/RelationshipTester.java b/guava-testlib/src/com/google/common/testing/RelationshipTester.java index d1caedd4e8d1d..fdfa23242dafc 100644 --- a/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -25,6 +25,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link EqualsTester} and {@link EquivalenceTester} that tests for @@ -33,7 +34,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class RelationshipTester { static class ItemReporter { diff --git a/guava-testlib/src/com/google/common/testing/SerializableTester.java b/guava-testlib/src/com/google/common/testing/SerializableTester.java index c2f8cc169b0b0..7be2f47586e3a 100644 --- a/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -20,6 +20,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import junit.framework.Assert; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Tests serialization and deserialization of an object, optionally asserting that the resulting @@ -33,7 +34,7 @@ * @since 10.0 */ @GwtCompatible // but no-op! -@ElementTypesAreNonnullByDefault +@NullMarked public final class SerializableTester { private SerializableTester() {} diff --git a/guava-testlib/src/com/google/common/testing/SloppyTearDown.java b/guava-testlib/src/com/google/common/testing/SloppyTearDown.java index 10d9dc04ecd4a..1790499ca8017 100644 --- a/guava-testlib/src/com/google/common/testing/SloppyTearDown.java +++ b/guava-testlib/src/com/google/common/testing/SloppyTearDown.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * Simple utility for when you want to create a {@link TearDown} that may throw an exception but @@ -30,7 +31,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class SloppyTearDown implements TearDown { private static final Logger logger = Logger.getLogger(SloppyTearDown.class.getName()); diff --git a/guava-testlib/src/com/google/common/testing/TearDown.java b/guava-testlib/src/com/google/common/testing/TearDown.java index 0259a1f3ba1c4..c0a1ecd33dbf0 100644 --- a/guava-testlib/src/com/google/common/testing/TearDown.java +++ b/guava-testlib/src/com/google/common/testing/TearDown.java @@ -17,6 +17,7 @@ package com.google.common.testing; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; /** * An object that can perform a {@link #tearDown} operation. @@ -26,7 +27,7 @@ */ @FunctionalInterface @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked 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 ec4319bab5503..ed514d2d4b1b1 100644 --- a/guava-testlib/src/com/google/common/testing/TearDownAccepter.java +++ b/guava-testlib/src/com/google/common/testing/TearDownAccepter.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.DoNotMock; +import org.jspecify.annotations.NullMarked; /** * Any object which can accept registrations of {@link TearDown} instances. @@ -27,7 +28,7 @@ */ @DoNotMock("Implement with a lambda") @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TearDownAccepter { /** * Registers a TearDown implementor which will be run after the test proper. diff --git a/guava-testlib/src/com/google/common/testing/TearDownStack.java b/guava-testlib/src/com/google/common/testing/TearDownStack.java index b168698659079..f0c8dbd2ede8c 100644 --- a/guava-testlib/src/com/google/common/testing/TearDownStack.java +++ b/guava-testlib/src/com/google/common/testing/TearDownStack.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * A {@code TearDownStack} contains a stack of {@link TearDown} instances. @@ -37,7 +38,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TearDownStack implements TearDownAccepter { private static final Logger logger = Logger.getLogger(TearDownStack.class.getName()); diff --git a/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/guava-testlib/src/com/google/common/testing/TestLogHandler.java index aba2131935bbd..ec01f81b5f813 100644 --- a/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.logging.Handler; import java.util.logging.LogRecord; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -53,7 +54,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TestLogHandler extends Handler { private final Object lock = new Object(); diff --git a/guava-testlib/src/com/google/common/testing/package-info.java b/guava-testlib/src/com/google/common/testing/package-info.java index 300835adc4413..138d074788a6c 100644 --- a/guava-testlib/src/com/google/common/testing/package-info.java +++ b/guava-testlib/src/com/google/common/testing/package-info.java @@ -19,7 +19,8 @@ * href="https://github.com/google/guava">Guava library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.testing; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; diff --git a/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java b/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java index ca07ffae0fbd0..05ff429bbdf58 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/test/com/google/common/base/CharMatcherTest.java b/guava-tests/test/com/google/common/base/CharMatcherTest.java index 67e83a7fb0301..1d47a3dc8a85e 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 9bc96b0d24e73..8b5db3ab2ae2d 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 1241200daafa4..54380fe53d3b8 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 c02127e9d55d5..5d427dd7a5d6d 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 ec197f5c2b828..3c6e2e9f072b2 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 71845c8e58926..10ee1296bd132 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 f1918c6d8c42c..6fc9660f4bd7e 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 e8f98fdd542e0..2315bae34bc6a 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 71a37a5f08e0e..d5b5a9aeb3739 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 494f321c208da..79fd2651cd24b 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 9a1150a0fc023..5971816134e75 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 0fa5fdbdb7b43..c496603719d7b 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 9dfa3fde21f6f..21c7b8bde46cb 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 e7f0f65200b6c..58f5fbc10cbe2 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 45f877a17ecfd..6f1b6f7e8c6be 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 1b6d6656483ee..c935a962b9fe2 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 a0f25ca5c29a8..80c9526665f44 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 1a86566d0cfcb..6808c3cf13fae 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 84b9209025573..682f16d54d5af 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 b1f64347ee533..e93736a6b89f4 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 5eada001250cc..2d6a94d28e673 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 264bb06f0a80b..4f479f49d9be5 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 bc18b493baa47..37f513ae3b291 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 9755891f9d62e..a0399d3cf49ff 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 44815e122dfa3..16c98c5cae619 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 b14550a4719d6..69adcaeb6fe52 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 963f22ada1f02..8710c49fafedb 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 689d7711c4461..8bb8ddf99ee34 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 a6f6019b79019..86323cc8f728b 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 1c928638a96ea..163688c867bc5 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 31eab3bc14db6..4f5cea2646171 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 7ba7923aed5c9..1d8cdd383907e 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 652a23045e50d..78d4e958ccc31 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 049e286457236..70e561443e70e 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 c4015cb727017..7fb754300d590 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 3cabcda48d170..b09fc124a98d3 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 b021a0de47f01..a2f6c87392656 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 e85aa2787640c..b9dbffcd501cf 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 dc77b8cac28c9..16657ccc47999 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 48d0d4785122e..238c04bba9d68 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 e007fe077b2fd..923ffe197faa7 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 265e2983d0e1f..1b6f4a44a97fd 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 d5ed5751ad527..a6a23beaaf303 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 06669ee30c100..d000fdc5cfac4 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 { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/HashMultimapTest.java b/guava-tests/test/com/google/common/collect/HashMultimapTest.java index 0fa8ac353c9a1..e4decb57c2c83 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 24ad901b5501f..421ab58e37132 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 c68d2c2bd7313..07162702e1186 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 72c935c8f3d06..f742f10ca78ae 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 254a73df63d43..37d4cefebff2d 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 { @J2ktIncompatible public static class ImmutableEnumMapGenerator extends TestEnumMapGenerator { diff --git a/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java b/guava-tests/test/com/google/common/collect/ImmutableListMultimapTest.java index 9693e59bacc24..ddbbb1e3dc360 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 { @J2ktIncompatible public static class ImmutableListMultimapGenerator extends TestStringListMultimapGenerator { diff --git a/guava-tests/test/com/google/common/collect/ImmutableListTest.java b/guava-tests/test/com/google/common/collect/ImmutableListTest.java index 47aace65d00df..753f26d15c9e7 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 7a4d1243149e0..91df03876a3cf 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 f216745044e32..0d78894082352 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 d1219082014a8..7d8860a873ddf 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 62dfb82d037bf..b1dd49d6e0bb1 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 317644e1421d7..f8dfc39a2990b 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 abe2f9a7dd937..9d4a7d2b3abd2 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 { @J2ktIncompatible private static final class ImmutableSetMultimapGenerator extends TestStringSetMultimapGenerator { diff --git a/guava-tests/test/com/google/common/collect/ImmutableSetTest.java b/guava-tests/test/com/google/common/collect/ImmutableSetTest.java index 691c97dcfaa5a..e072256ffdc85 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 83e46ccdb8bd9..83e60204c222e 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 e8ac90cc6ccbd..5b4ffae39e01b 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 4428b46a78d92..4b40a94977def 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 9eaeab45b3cc3..822afba351094 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 77f9fa804315c..c61e04ba7df49 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 93c92aa82cf8b..c7285a92d9126 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 ac6ee54b10e0f..451917e3c70f0 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 739748a6a9024..34d888b723611 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 ed4df7f0ec429..502ac3e162898 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 b99d65fcda5a6..68ce8362d7f3e 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 844b9f449e8b5..f881b2c8c65be 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 de190d423ce9c..b6580f68c66a1 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 67b8c934f6dc1..40e7a73e7f733 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 55f3ac66348f4..e1cafc86b9641 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 343ebcf77056d..def9d68477069 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 a94904e194411..2ba38f132a0ba 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 7b1e66b239967..acdf8eb513d15 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 034b3e3d1ae06..97857ffdeb0a9 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 d79c3043b7024..6731614f81528 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 78494be1b4d5a..d68c9829ec444 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 85afc4728191a..a442aa8146912 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 fc540ec3174c5..c9581b616584c 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 8d2b2bd969878..d8ff7eda06334 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 01c121f48cdb7..6afb08a509e49 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 95043fc0db019..e52589461ab22 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 ad260ef651865..76f3b50df872e 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 d735749f948d5..e1431f09d76ee 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 72e31b0e0186b..308e25eb0c3b4 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 3f1f75d78ac52..74f719efe374a 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 1e697c95bbc26..86d67d5ad1e2a 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 fa7cb0c4b7f38..f17d0ee3b37e9 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 fa467f7c58fd5..de4b4cf28fd38 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 7dd66df559daf..6ffa66df4d776 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 42b239aa0ff83..2dded744ce1da 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 c918b1dba8091..9b1d04bba4779 100644 --- a/guava-tests/test/com/google/common/collect/SortedIterablesTest.java +++ b/guava-tests/test/com/google/common/collect/SortedIterablesTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code SortedIterables}. @@ -23,7 +24,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 95d2e16933e49..797f9dc6251da 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 c7087544e7ab0..c1f286908bf2f 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 f53b8b3038f0d..f97c6e792ecc5 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 9425722c141c9..82b46b12a463e 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 { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/TableCollectorsTest.java b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java index 15d3f9efe5fd7..afdf969285154 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 4ea911bbbb290..ebf096d3f429d 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 d25c2358dfbf7..e5887875d742d 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 9647a6f70ccd2..c1a140092acce 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 77cfd4142c1db..0a3918b39ef6a 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 95d58a58fbfc2..de34b485640d6 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 452c70a93d147..e06865dbc2639 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 ee813e358ff4d..f8e67f990829e 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 25f1bcfa37ce1..524ed112d70a1 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 6c87b99efecbd..736c8ff4518d3 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 4fa7b5aaeca6b..f27017d6cfa2f 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 48049bc5913ee..b4e6008e38cd8 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 2745941667649..59ba288793dec 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 ba4235d7748a0..d9c5ba1e457a4 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 862d78c7d1b29..cf25c9d5972db 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 46a925a58f631..e9c891fa24efe 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 7884b61104f45..990732ee3c677 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 e663ff280ae1a..aedd2e5d74223 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 f69c54a15fcbd..cb85a7bfb0171 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 f50a512446d63..bd4f2b945a286 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 8cd6cbd575746..38149fc57386d 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 80e8a62a14c72..2e10b37e7a4e3 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 fad660a0c6f6a..452e513a9430d 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 02cf78e2baa7a..e1d159ae73cc4 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 f485b8bb0e5ef..6296f494b9ea9 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 f9713c752bd5c..dcd19b0504594 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 c98dd1449b519..a18944d4141df 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 7c1cc0c2850f9..5fa5c14c98844 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 67c011107e0b6..511eb2afb34ba 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 05d69df2e45fb..a75a0437ee25f 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 3296aedd9d57e..70a8a7347fbc4 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 69fa02cc008c8..904e6a8482b63 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 973995a5af2a4..e01db08785415 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 c82d23b517f18..85c754c758920 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 125749470a0de..c7ad03ad41935 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 5f27927038c7a..f03f7b6e57ace 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 444185d69ff0f..dda6301ade7d8 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 98454b458e96f..e60cf683dfbc4 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 a0be002dd9958..3c7c363b3264b 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 693a6565a8a4e..86e8f9903637c 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 15c80b41ffb01..67ab066c41dce 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 b395a204aac0c..6c56ad0e1d7f2 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 6da8be85115ce..5645a0f14cc7b 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 bf0d211ebd7ea..fa7aa36cbf2dd 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 c35cbc4799d42..6522be8bff55d 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 a64cf2642c7f9..2c5aa19137272 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 b84972e537162..0bfa4dd5d82d4 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 2c903ac7acdbc..67654ea330eff 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 9f40936dd7eb0..60d8670c4be9f 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 d2770657fd993..e186066e4b63f 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 309b0029abd34..3339f08877d56 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 ade301520edcc..1fc69011f37bd 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 7c2b29bd6ca88..a0f455ec170c8 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/TrustedListenableFutureTaskTest.java b/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 17357b525a03c..969357713648e 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/src/com/google/common/base/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a0adb0236c89f..0000000000000 --- a/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/base/ParametricNullness.java b/guava/src/com/google/common/base/ParametricNullness.java index 0bcc65dc2eb55..3fadb315554aa 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/package-info.java b/guava/src/com/google/common/base/package-info.java index 8cdbdca4c2365..c73391c3b4e4e 100644 --- a/guava/src/com/google/common/base/package-info.java +++ b/guava/src/com/google/common/base/package-info.java @@ -57,7 +57,8 @@ * Defaults}), as well as a number of classes that have been superseded by additions to the JDK. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.base; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 51431fe419eac..0000000000000 --- a/guava/src/com/google/common/cache/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/cache/ParametricNullness.java b/guava/src/com/google/common/cache/ParametricNullness.java index eaf194d4ab1c9..8892bb45267dd 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/package-info.java b/guava/src/com/google/common/cache/package-info.java index e494d931f42ba..e7c453dd8d0e5 100644 --- a/guava/src/com/google/common/cache/package-info.java +++ b/guava/src/com/google/common/cache/package-info.java @@ -29,7 +29,8 @@ * @author Charles Fry */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.cache; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 8fe0fb3756438..0000000000000 --- a/guava/src/com/google/common/collect/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/collect/ParametricNullness.java b/guava/src/com/google/common/collect/ParametricNullness.java index 207c05262e413..8074de5d5689b 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/package-info.java b/guava/src/com/google/common/collect/package-info.java index 048b7d8d72f14..d9f2331e1a648 100644 --- a/guava/src/com/google/common/collect/package-info.java +++ b/guava/src/com/google/common/collect/package-info.java @@ -120,7 +120,8 @@ *
                                */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.collect; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 93130cb881768..0000000000000 --- a/guava/src/com/google/common/escape/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/escape/ParametricNullness.java b/guava/src/com/google/common/escape/ParametricNullness.java index f964ca4a4f619..9ac5d62e12962 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/package-info.java b/guava/src/com/google/common/escape/package-info.java index 80c42464e1bbe..173f811a3aaeb 100644 --- a/guava/src/com/google/common/escape/package-info.java +++ b/guava/src/com/google/common/escape/package-info.java @@ -25,7 +25,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.escape; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 8ef823148266b..0000000000000 --- a/guava/src/com/google/common/eventbus/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/eventbus/ParametricNullness.java b/guava/src/com/google/common/eventbus/ParametricNullness.java index 47c7d8d4d0633..fd07ef09cb609 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/package-info.java b/guava/src/com/google/common/eventbus/package-info.java index 3808bde9a2219..b387bc234010a 100644 --- a/guava/src/com/google/common/eventbus/package-info.java +++ b/guava/src/com/google/common/eventbus/package-info.java @@ -20,7 +20,8 @@ * href="https://github.com/google/guava/wiki/EventBusExplained">{@code EventBus}. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.eventbus; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 0821642f52d44..0000000000000 --- a/guava/src/com/google/common/graph/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/graph/ParametricNullness.java b/guava/src/com/google/common/graph/ParametricNullness.java index 32fd5ee7ecaae..634ee0e197827 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/package-info.java b/guava/src/com/google/common/graph/package-info.java index bed41eefec3a0..7e97756afabfd 100644 --- a/guava/src/com/google/common/graph/package-info.java +++ b/guava/src/com/google/common/graph/package-info.java @@ -22,7 +22,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.graph; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 ab3aa88d9d7a4..0000000000000 --- a/guava/src/com/google/common/hash/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/hash/ParametricNullness.java b/guava/src/com/google/common/hash/ParametricNullness.java index 4ebc40bb741e7..f5a8614a87623 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/package-info.java b/guava/src/com/google/common/hash/package-info.java index 9dbbbaac34389..b5405d48129c2 100644 --- a/guava/src/com/google/common/hash/package-info.java +++ b/guava/src/com/google/common/hash/package-info.java @@ -20,7 +20,8 @@ * href="https://github.com/google/guava/wiki/HashingExplained">hashing. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.hash; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 5e471bdbbce95..0000000000000 --- a/guava/src/com/google/common/html/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/html/ParametricNullness.java b/guava/src/com/google/common/html/ParametricNullness.java index 50a64c781c90a..a43cc22a06b01 100644 --- a/guava/src/com/google/common/html/ParametricNullness.java +++ b/guava/src/com/google/common/html/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/html/package-info.java b/guava/src/com/google/common/html/package-info.java index 03f51fdb04c32..ccfd5b5693f9c 100644 --- a/guava/src/com/google/common/html/package-info.java +++ b/guava/src/com/google/common/html/package-info.java @@ -21,7 +21,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.html; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 321b5826baa62..0000000000000 --- a/guava/src/com/google/common/io/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/io/ParametricNullness.java b/guava/src/com/google/common/io/ParametricNullness.java index 881c07d498042..32eee700e1c66 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/package-info.java b/guava/src/com/google/common/io/package-info.java index c29b61a74d974..30cff81d2fd2c 100644 --- a/guava/src/com/google/common/io/package-info.java +++ b/guava/src/com/google/common/io/package-info.java @@ -28,7 +28,8 @@ * @author Chris Nokleberg */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.io; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 d314278a80768..0000000000000 --- a/guava/src/com/google/common/math/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/math/ParametricNullness.java b/guava/src/com/google/common/math/ParametricNullness.java index 612fa934a6d57..a18ba9348f9af 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/package-info.java b/guava/src/com/google/common/math/package-info.java index da2392a6a5a59..663d3bced554e 100644 --- a/guava/src/com/google/common/math/package-info.java +++ b/guava/src/com/google/common/math/package-info.java @@ -23,7 +23,8 @@ * href="https://github.com/google/guava/wiki/MathExplained">math utilities. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.math; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 3c8b9f4225f88..0000000000000 --- a/guava/src/com/google/common/net/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/net/ParametricNullness.java b/guava/src/com/google/common/net/ParametricNullness.java index 83b9eb6fa6a3f..5b3af1736ee1c 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/package-info.java b/guava/src/com/google/common/net/package-info.java index 1fa33a1ad434e..562bb10e4f993 100644 --- a/guava/src/com/google/common/net/package-info.java +++ b/guava/src/com/google/common/net/package-info.java @@ -21,7 +21,8 @@ * @author Craig Berry */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.net; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 1240d1075a28d..0000000000000 --- a/guava/src/com/google/common/primitives/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/primitives/ParametricNullness.java b/guava/src/com/google/common/primitives/ParametricNullness.java index c40ea499d4cee..9af83702c0b12 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/package-info.java b/guava/src/com/google/common/primitives/package-info.java index 2fdf789228e76..67e87ac3d65a2 100644 --- a/guava/src/com/google/common/primitives/package-info.java +++ b/guava/src/com/google/common/primitives/package-info.java @@ -64,7 +64,8 @@ *
                                                */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.primitives; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 594c4c394bf6e..0000000000000 --- a/guava/src/com/google/common/reflect/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/reflect/ParametricNullness.java b/guava/src/com/google/common/reflect/ParametricNullness.java index 372a53bb616fc..4cc7fd2848470 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/package-info.java b/guava/src/com/google/common/reflect/package-info.java index 71583d47498ef..7a3f435e530b7 100644 --- a/guava/src/com/google/common/reflect/package-info.java +++ b/guava/src/com/google/common/reflect/package-info.java @@ -17,7 +17,8 @@ * href="https://github.com/google/guava">Guava library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.reflect; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 4dc5c72362d4f..0000000000000 --- a/guava/src/com/google/common/util/concurrent/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, TYPE}) -@TypeQualifierDefault({FIELD, METHOD, PARAMETER}) -@Nonnull -@interface ElementTypesAreNonnullByDefault {} diff --git a/guava/src/com/google/common/util/concurrent/ListenableFuture.java b/guava/src/com/google/common/util/concurrent/ListenableFuture.java index cdc2ee110b99e..ba5c58820023e 100644 --- a/guava/src/com/google/common/util/concurrent/ListenableFuture.java +++ b/guava/src/com/google/common/util/concurrent/ListenableFuture.java @@ -18,6 +18,7 @@ import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -117,7 +118,7 @@ * put in a special hack for us: https://issuetracker.google.com/issues/131431257) */ @DoNotMock("Use the methods in Futures (like immediateFuture) or SettableFuture") -@ElementTypesAreNonnullByDefault +@NullMarked 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/ParametricNullness.java b/guava/src/com/google/common/util/concurrent/ParametricNullness.java index e8fcce6ee6818..f12f1133e6dfe 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/package-info.java b/guava/src/com/google/common/util/concurrent/package-info.java index 41af41c0d3ab0..c5b199b072923 100644 --- a/guava/src/com/google/common/util/concurrent/package-info.java +++ b/guava/src/com/google/common/util/concurrent/package-info.java @@ -25,7 +25,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.util.concurrent; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked; 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 4a6bee38582a0..0000000000000 --- a/guava/src/com/google/common/xml/ElementTypesAreNonnullByDefault.java +++ /dev/null @@ -1,42 +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.PACKAGE; -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({PACKAGE, 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 439707a2edb13..0d989c7cefa6e 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/package-info.java b/guava/src/com/google/common/xml/package-info.java index c06e1b5702f98..a263f55f44c86 100644 --- a/guava/src/com/google/common/xml/package-info.java +++ b/guava/src/com/google/common/xml/package-info.java @@ -21,7 +21,8 @@ * library. */ @CheckReturnValue -@ElementTypesAreNonnullByDefault +@NullMarked package com.google.common.xml; import com.google.errorprone.annotations.CheckReturnValue; +import org.jspecify.annotations.NullMarked;