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 f281cd83414b..33a3a83746b8 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTester.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Collection; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -32,7 +33,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractCollectionTester extends AbstractContainerTester, E> { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java index 56163a6f6740..92e6f5a1ec94 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractContainerTester extends AbstractTester> { protected SampleElements samples; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java index 36ea3614d5d0..417e67dc2c2e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java @@ -34,6 +34,7 @@ import java.util.NoSuchElementException; import java.util.Set; import java.util.Stack; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * @author Chris Povirk */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractIteratorTester> { private Stimulus[] stimuli; private final Iterator elementsToInsert; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java index f85b01fbbc7e..fc8cbdd9c545 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java @@ -26,6 +26,7 @@ import java.util.ListIterator; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -43,7 +44,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMapTester extends AbstractContainerTester, Entry> { protected Map getMap() { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java b/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java index 5ffe110e7dbe..4ae6fc9f87a6 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/AbstractTester.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author George van den Driessche */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractTester extends TestCase { private G subjectGenerator; private String suiteName; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java index 6312a67bc66a..b13345794c57 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java @@ -33,6 +33,7 @@ import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class DerivedCollectionGenerators { public static class MapEntrySetGenerator implements TestSetGenerator>, DerivedGenerator { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java index a9e7ac04d84a..360793345a0a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/Helpers.java @@ -44,10 +44,11 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class Helpers { // Clone of Objects.equal static boolean equal(@Nullable Object a, @Nullable Object b) { diff --git a/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java b/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java index 7bc6548bcab2..ac9e70cac1dc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/IgnoreJRERequirement.java @@ -19,6 +19,7 @@ import static java.lang.annotation.ElementType.TYPE; import java.lang.annotation.Target; +import org.jspecify.annotations.NullMarked; /** * Disables Animal Sniffer's checking of compatibility with older versions of Java/Android. @@ -26,5 +27,5 @@ *

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

Each package's copy of this annotation needs to be listed in our {@code pom.xml}. */ @Target({METHOD, CONSTRUCTOR, TYPE}) -@ElementTypesAreNonnullByDefault +@NullMarked @interface IgnoreJRERequirement {} diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java index c1566abac2b9..472e1f50abf7 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 94c2136ec975..9b1a11f6863a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -54,7 +55,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class MapPutAllTester extends AbstractMapTester { private List> containsNullKey; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java index b014de3146e4..a9dc1191dfc2 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java b/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java index a8cda429574a..6e94a3ad886a 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/testers/SortedSetNavigationTester.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.NoSuchElementException; import java.util.SortedSet; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; import org.junit.Ignore; @@ -42,7 +43,7 @@ @Ignore("test runners must not instantiate and run this directly, only via suites we build") // @Ignore affects the Android test runner, which respects JUnit 4 annotations on JUnit 3 tests. @SuppressWarnings("JUnit4ClassUsedInJUnit3") -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedSetNavigationTester extends AbstractSetTester { private SortedSet sortedSet; diff --git a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java index 565f5d1f74d4..8ee0cd94f6ea 100644 --- a/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java +++ b/android/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java @@ -145,6 +145,7 @@ import java.util.regex.MatchResult; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -171,7 +172,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ArbitraryInstances { private static final Ordering BY_FIELD_NAME = diff --git a/android/guava-testlib/src/com/google/common/testing/ClusterException.java b/android/guava-testlib/src/com/google/common/testing/ClusterException.java index 2b8d4eb77e72..47232e8dd63b 100644 --- a/android/guava-testlib/src/com/google/common/testing/ClusterException.java +++ b/android/guava-testlib/src/com/google/common/testing/ClusterException.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import org.jspecify.annotations.NullMarked; /** * An {@link ClusterException} is a data structure that allows for some code to "throw multiple @@ -59,7 +60,7 @@ * @author Luiz-Otavio Zorzella */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class ClusterException extends RuntimeException { final Collection exceptions; diff --git a/android/guava-testlib/src/com/google/common/testing/DummyProxy.java b/android/guava-testlib/src/com/google/common/testing/DummyProxy.java index 3494a66bb2c0..4515963f4613 100644 --- a/android/guava-testlib/src/com/google/common/testing/DummyProxy.java +++ b/android/guava-testlib/src/com/google/common/testing/DummyProxy.java @@ -31,6 +31,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class DummyProxy { /** diff --git a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java index 5f02dba84855..9d311d3fa360 100644 --- a/android/guava-testlib/src/com/google/common/testing/EqualsTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EqualsTester.java @@ -27,6 +27,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.ArrayList; import java.util.List; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -76,7 +77,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EqualsTester { private static final int REPETITIONS = 3; diff --git a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java index ec34752c57ab..bf16785bc5f1 100644 --- a/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java +++ b/android/guava-testlib/src/com/google/common/testing/EquivalenceTester.java @@ -27,6 +27,7 @@ import com.google.common.testing.RelationshipTester.ItemReporter; import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; +import org.jspecify.annotations.NullMarked; /** * Tester for {@link Equivalence} relationships between groups of objects. @@ -50,7 +51,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class EquivalenceTester { private static final int REPETITIONS = 3; diff --git a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java index ffa0e87aff50..66ae972ca4d9 100644 --- a/android/guava-testlib/src/com/google/common/testing/FakeTicker.java +++ b/android/guava-testlib/src/com/google/common/testing/FakeTicker.java @@ -28,6 +28,7 @@ import java.time.Duration; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import org.jspecify.annotations.NullMarked; /** * A Ticker whose value can be advanced programmatically in test. @@ -40,7 +41,7 @@ * @author Jige Yu * @since 10.0 */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible public class FakeTicker extends Ticker { diff --git a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java index 0d38191f5ede..ca57703d9fc5 100644 --- a/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java +++ b/android/guava-testlib/src/com/google/common/testing/ForwardingWrapperTester.java @@ -36,6 +36,7 @@ import java.lang.reflect.Modifier; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -57,7 +58,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class ForwardingWrapperTester { private boolean testsEquals = false; diff --git a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java index fb0facf24fd8..c883dd7916ce 100644 --- a/android/guava-testlib/src/com/google/common/testing/GcFinalization.java +++ b/android/guava-testlib/src/com/google/common/testing/GcFinalization.java @@ -30,6 +30,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeoutException; +import org.jspecify.annotations.NullMarked; /** * Testing utilities relating to garbage collection finalization. @@ -107,7 +108,7 @@ @GwtIncompatible @J2ktIncompatible @J2ObjCIncompatible // gc -@ElementTypesAreNonnullByDefault +@NullMarked public final class GcFinalization { private GcFinalization() {} diff --git a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java index 31d1938a5d54..ba140359d1f8 100644 --- a/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java +++ b/android/guava-testlib/src/com/google/common/testing/NullPointerTester.java @@ -46,6 +46,7 @@ import java.util.List; import java.util.concurrent.ConcurrentMap; import junit.framework.Assert; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -67,7 +68,7 @@ */ @GwtIncompatible @J2ktIncompatible -@ElementTypesAreNonnullByDefault +@NullMarked public final class NullPointerTester { private final ClassToInstanceMap defaults = MutableClassToInstanceMap.create(); diff --git a/android/guava-testlib/src/com/google/common/testing/Platform.java b/android/guava-testlib/src/com/google/common/testing/Platform.java index 9726d2de0eb1..0352b5aa9ee5 100644 --- a/android/guava-testlib/src/com/google/common/testing/Platform.java +++ b/android/guava-testlib/src/com/google/common/testing/Platform.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; +import org.jspecify.annotations.NullMarked; /** * Methods factored out so that they can be emulated differently in GWT. @@ -32,7 +33,7 @@ * @author Chris Povirk */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class Platform { /** Serializes and deserializes the specified object. */ @SuppressWarnings("unchecked") diff --git a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java index d1caedd4e8d1..fdfa23242daf 100644 --- a/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java +++ b/android/guava-testlib/src/com/google/common/testing/RelationshipTester.java @@ -25,6 +25,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.List; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Implementation helper for {@link EqualsTester} and {@link EquivalenceTester} that tests for @@ -33,7 +34,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked final class RelationshipTester { static class ItemReporter { diff --git a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java index c2f8cc169b0b..7be2f47586e3 100644 --- a/android/guava-testlib/src/com/google/common/testing/SerializableTester.java +++ b/android/guava-testlib/src/com/google/common/testing/SerializableTester.java @@ -20,6 +20,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import junit.framework.Assert; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; /** * Tests serialization and deserialization of an object, optionally asserting that the resulting @@ -33,7 +34,7 @@ * @since 10.0 */ @GwtCompatible // but no-op! -@ElementTypesAreNonnullByDefault +@NullMarked public final class SerializableTester { private SerializableTester() {} diff --git a/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java b/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java index 10d9dc04ecd4..1790499ca801 100644 --- a/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/SloppyTearDown.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * Simple utility for when you want to create a {@link TearDown} that may throw an exception but @@ -30,7 +31,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class SloppyTearDown implements TearDown { private static final Logger logger = Logger.getLogger(SloppyTearDown.class.getName()); diff --git a/android/guava-testlib/src/com/google/common/testing/TearDown.java b/android/guava-testlib/src/com/google/common/testing/TearDown.java index 45aebe2a2448..dbd04e2090ca 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDown.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDown.java @@ -17,6 +17,7 @@ package com.google.common.testing; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; /** * An object that can perform a {@link #tearDown} operation. @@ -25,7 +26,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TearDown { /** * Performs a single tear-down operation. See test-libraries-for-java's {@code diff --git a/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java b/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java index ec4319bab550..ed514d2d4b1b 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownAccepter.java @@ -18,6 +18,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.DoNotMock; +import org.jspecify.annotations.NullMarked; /** * Any object which can accept registrations of {@link TearDown} instances. @@ -27,7 +28,7 @@ */ @DoNotMock("Implement with a lambda") @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public interface TearDownAccepter { /** * Registers a TearDown implementor which will be run after the test proper. diff --git a/android/guava-testlib/src/com/google/common/testing/TearDownStack.java b/android/guava-testlib/src/com/google/common/testing/TearDownStack.java index b16869865907..f0c8dbd2ede8 100644 --- a/android/guava-testlib/src/com/google/common/testing/TearDownStack.java +++ b/android/guava-testlib/src/com/google/common/testing/TearDownStack.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import org.jspecify.annotations.NullMarked; /** * A {@code TearDownStack} contains a stack of {@link TearDown} instances. @@ -37,7 +38,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TearDownStack implements TearDownAccepter { private static final Logger logger = Logger.getLogger(TearDownStack.class.getName()); diff --git a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java index aba2131935bb..ec01f81b5f81 100644 --- a/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java +++ b/android/guava-testlib/src/com/google/common/testing/TestLogHandler.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.logging.Handler; import java.util.logging.LogRecord; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -53,7 +54,7 @@ * @since 10.0 */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TestLogHandler extends Handler { private final Object lock = new Object(); diff --git a/android/guava-testlib/src/com/google/common/testing/package-info.java b/android/guava-testlib/src/com/google/common/testing/package-info.java index 300835adc441..138d074788a6 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 ca07ffae0fbd..05ff429bbdf5 100644 --- a/android/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java +++ b/android/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/base/CharMatcherTest.java b/android/guava-tests/test/com/google/common/base/CharMatcherTest.java index 67e83a7fb030..1d47a3dc8a85 100644 --- a/android/guava-tests/test/com/google/common/base/CharMatcherTest.java +++ b/android/guava-tests/test/com/google/common/base/CharMatcherTest.java @@ -37,6 +37,7 @@ import java.util.Set; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link CharMatcher}. @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class CharMatcherTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/base/EquivalenceTest.java b/android/guava-tests/test/com/google/common/base/EquivalenceTest.java index 9bc96b0d24e7..8b5db3ab2ae2 100644 --- a/android/guava-tests/test/com/google/common/base/EquivalenceTest.java +++ b/android/guava-tests/test/com/google/common/base/EquivalenceTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.NullPointerTester; import com.google.common.testing.SerializableTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * * @author Jige Yu */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class EquivalenceTest extends TestCase { public void testPairwiseEquivalent() { diff --git a/android/guava-tests/test/com/google/common/base/FunctionsTest.java b/android/guava-tests/test/com/google/common/base/FunctionsTest.java index 1241200daafa..54380fe53d3b 100644 --- a/android/guava-tests/test/com/google/common/base/FunctionsTest.java +++ b/android/guava-tests/test/com/google/common/base/FunctionsTest.java @@ -30,6 +30,7 @@ import java.io.Serializable; import java.util.Map; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ * @author Vlad Patryshev */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class FunctionsTest extends TestCase { public void testIdentity_same() { diff --git a/android/guava-tests/test/com/google/common/base/JoinerTest.java b/android/guava-tests/test/com/google/common/base/JoinerTest.java index c02127e9d55d..5d427dd7a5d6 100644 --- a/android/guava-tests/test/com/google/common/base/JoinerTest.java +++ b/android/guava-tests/test/com/google/common/base/JoinerTest.java @@ -36,6 +36,7 @@ import java.util.Map.Entry; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class JoinerTest extends TestCase { private static final Joiner J = Joiner.on("-"); diff --git a/android/guava-tests/test/com/google/common/base/OptionalTest.java b/android/guava-tests/test/com/google/common/base/OptionalTest.java index ec197f5c2b82..3c6e2e9f072b 100644 --- a/android/guava-tests/test/com/google/common/base/OptionalTest.java +++ b/android/guava-tests/test/com/google/common/base/OptionalTest.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * * @author Kurt Alfred Kluever */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public final class OptionalTest extends TestCase { @SuppressWarnings("NullOptional") diff --git a/android/guava-tests/test/com/google/common/base/PreconditionsTest.java b/android/guava-tests/test/com/google/common/base/PreconditionsTest.java index 71845c8e5892..10ee1296bd13 100644 --- a/android/guava-tests/test/com/google/common/base/PreconditionsTest.java +++ b/android/guava-tests/test/com/google/common/base/PreconditionsTest.java @@ -39,6 +39,7 @@ import java.util.List; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -47,7 +48,7 @@ * @author Kevin Bourrillion * @author Jared Levy */ -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("LenientFormatStringValidation") // Intentional for testing @GwtCompatible(emulated = true) public class PreconditionsTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/base/PredicatesTest.java b/android/guava-tests/test/com/google/common/base/PredicatesTest.java index f1918c6d8c42..6fc9660f4bd7 100644 --- a/android/guava-tests/test/com/google/common/base/PredicatesTest.java +++ b/android/guava-tests/test/com/google/common/base/PredicatesTest.java @@ -38,6 +38,7 @@ import java.util.regex.Pattern; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class PredicatesTest extends TestCase { private static final Predicate<@Nullable Integer> TRUE = Predicates.alwaysTrue(); diff --git a/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java index e8f98fdd542e..2315bae34bc6 100644 --- a/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java @@ -33,11 +33,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/base/SplitterTest.java b/android/guava-tests/test/com/google/common/base/SplitterTest.java index 71a37a5f08e0..d5b5a9aeb373 100644 --- a/android/guava-tests/test/com/google/common/base/SplitterTest.java +++ b/android/guava-tests/test/com/google/common/base/SplitterTest.java @@ -31,11 +31,12 @@ import java.util.Map; import java.util.regex.Pattern; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author Julien Silland */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SplitterTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/base/StringsTest.java b/android/guava-tests/test/com/google/common/base/StringsTest.java index 494f321c208d..79fd2651cd24 100644 --- a/android/guava-tests/test/com/google/common/base/StringsTest.java +++ b/android/guava-tests/test/com/google/common/base/StringsTest.java @@ -24,13 +24,14 @@ import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.NullPointerTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link Strings}. * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class StringsTest extends TestCase { public void testNullToEmpty() { diff --git a/android/guava-tests/test/com/google/common/base/SuppliersTest.java b/android/guava-tests/test/com/google/common/base/SuppliersTest.java index 9a1150a0fc02..5971816134e7 100644 --- a/android/guava-tests/test/com/google/common/base/SuppliersTest.java +++ b/android/guava-tests/test/com/google/common/base/SuppliersTest.java @@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @author Laurence Gonsalves * @author Harry Heymann */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SuppliersTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java index 0fa5fdbdb7b4..c496603719d7 100644 --- a/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java @@ -33,11 +33,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java b/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java index 9dfa3fde21f6..21c7b8bde46c 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java @@ -24,10 +24,11 @@ import java.util.Map; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractFilteredMapTest extends TestCase { private static final Predicate<@Nullable String> NOT_LENGTH_3 = input -> input == null || input.length() != 3; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java b/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java index e7f0f65200b6..58f5fbc10cbe 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractImmutableSetTest extends TestCase { protected abstract > Set of(); diff --git a/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java index 45f877a17ecf..6f1b6f7e8c6b 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests {@link ImmutableTable} @@ -27,7 +28,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractImmutableTableTest extends TestCase { abstract Iterable> getTestInstances(); diff --git a/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java b/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java index 1b6d6656483e..c935a962b9fe 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractIteratorTest extends TestCase { public void testDefaultBehaviorOfNextAndHasNext() { diff --git a/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java b/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java index a0f25ca5c29a..80c9526665f4 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -29,7 +30,7 @@ * @author Mike Bostock */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractMapEntryTest extends TestCase { private static final @Nullable String NK = null; private static final @Nullable Integer NV = null; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java index 1a86566d0cfc..6808c3cf13fa 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ * @author Isaac Shum */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractMapsTransformValuesTest extends MapInterfaceTest { public AbstractMapsTransformValuesTest() { super(false, true, false, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java index 84b920902557..682f16d54d5a 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an arbitrary multimap with {@link MapInterfaceTest}. @@ -30,7 +31,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMultimapAsMapImplementsMapTest extends MapInterfaceTest> { diff --git a/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java b/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java index b1f64347ee53..e93736a6b89f 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java @@ -28,11 +28,12 @@ import java.util.NoSuchElementException; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Tests for {@link AbstractSequentialIterator}. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractSequentialIteratorTest extends TestCase { @GwtIncompatible // Too slow public void testDoublerExhaustive() { diff --git a/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java b/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java index 5eada001250c..2d6a94d28e67 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.EqualsTester; import com.google.common.testing.NullPointerTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractTableReadTest extends TestCase { protected Table table; diff --git a/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java b/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java index 264bb06f0a80..4f479f49d9be 100644 --- a/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/AbstractTableTest.java @@ -22,6 +22,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractTableTest extends AbstractTableReadTest { diff --git a/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java b/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java index bc18b493baa4..37f513ae3b29 100644 --- a/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java @@ -35,6 +35,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code ArrayListMultimap}. @@ -42,7 +43,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayListMultimapTest extends TestCase { @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java b/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java index 9755891f9d62..a0399d3cf49f 100644 --- a/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/ArrayTableTest.java @@ -31,6 +31,7 @@ import com.google.common.testing.SerializableTester; import java.util.Arrays; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayTableTest extends AbstractTableTest<@Nullable Character> { @Override diff --git a/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java b/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java index 44815e122dfa..16c98c5cae61 100644 --- a/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java +++ b/android/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java @@ -27,10 +27,11 @@ import java.util.stream.IntStream; import java.util.stream.LongStream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** Tests for {@code CollectSpliterators}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class CollectSpliteratorsTest extends TestCase { public void testMap() { SpliteratorTester.of( diff --git a/android/guava-tests/test/com/google/common/collect/Collections2Test.java b/android/guava-tests/test/com/google/common/collect/Collections2Test.java index b14550a4719d..69adcaeb6fe5 100644 --- a/android/guava-tests/test/com/google/common/collect/Collections2Test.java +++ b/android/guava-tests/test/com/google/common/collect/Collections2Test.java @@ -40,6 +40,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class Collections2Test extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java b/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java index 963f22ada1f0..8710c49fafed 100644 --- a/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java +++ b/android/guava-tests/test/com/google/common/collect/ComparatorsTest.java @@ -36,6 +36,7 @@ import java.util.Comparator; import java.util.Optional; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ComparatorsTest extends TestCase { public void testLexicographical() { Comparator comparator = Ordering.natural(); diff --git a/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java b/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java index c599a02aa3e7..1f3e422b6077 100644 --- a/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java +++ b/android/guava-tests/test/com/google/common/collect/ComparisonChainTest.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link ComparisonChain}. @@ -28,7 +29,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ComparisonChainTest extends TestCase { private static final DontCompareMe DONT_COMPARE_ME = new DontCompareMe(); diff --git a/android/guava-tests/test/com/google/common/collect/CountTest.java b/android/guava-tests/test/com/google/common/collect/CountTest.java index a6f6019b7901..86323cc8f728 100644 --- a/android/guava-tests/test/com/google/common/collect/CountTest.java +++ b/android/guava-tests/test/com/google/common/collect/CountTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code Count}. @@ -23,7 +24,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class CountTest extends TestCase { public void testGet() { assertEquals(20, new Count(20).get()); diff --git a/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java index 1c928638a96e..163688c867bc 100644 --- a/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.testing.EqualsTester; +import org.jspecify.annotations.NullMarked; /** * Tests {@link EmptyImmutableTable} @@ -26,7 +27,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EmptyImmutableTableTest extends AbstractImmutableTableTest { private static final ImmutableTable INSTANCE = ImmutableTable.of(); diff --git a/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java b/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java index 31eab3bc14db..4f5cea264617 100644 --- a/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/EnumBiMapTest.java @@ -42,6 +42,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code EnumBiMap}. @@ -51,7 +52,7 @@ */ @J2ktIncompatible // EnumBimap @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EnumBiMapTest extends TestCase { private enum Currency { DOLLAR, diff --git a/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java b/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java index 7ba7923aed5c..1d8cdd383907 100644 --- a/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java +++ b/android/guava-tests/test/com/google/common/collect/EvictingQueueTest.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link EvictingQueue}. @@ -34,7 +35,7 @@ * @author Kurt Alfred Kluever */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EvictingQueueTest extends TestCase { public void testCreateWithNegativeSize() throws Exception { diff --git a/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java b/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java index 652a23045e50..78d4e958ccc3 100644 --- a/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java @@ -17,9 +17,10 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredBiMapTest extends AbstractFilteredMapTest { @Override BiMap createUnfiltered() { diff --git a/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java b/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java index 049e28645723..70e561443e70 100644 --- a/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/FilteredMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredMapTest extends AbstractFilteredMapTest { @Override Map createUnfiltered() { diff --git a/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java b/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java index c4015cb72701..7fb754300d59 100644 --- a/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredSortedMapTest extends AbstractFilteredMapTest { @Override SortedMap createUnfiltered() { diff --git a/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java index 3cabcda48d17..b09fc124a98d 100644 --- a/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for a {@link Multimaps#forMap} multimap with {@link @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ForMapMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { public ForMapMultimapAsMapImplementsMapTest() { diff --git a/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java index b021a0de47f0..a2f6c8739265 100644 --- a/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.SortedMapInterfaceTest; import java.util.SortedMap; import java.util.TreeMap; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link ForwardingSortedMap} using {@link MapInterfaceTest}. @@ -29,7 +30,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ForwardingSortedMapImplementsMapTest extends SortedMapInterfaceTest { private static class SimpleForwardingSortedMap extends ForwardingSortedMap { diff --git a/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java b/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java index e85aa2787640..b9dbffcd501c 100644 --- a/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java +++ b/android/guava-tests/test/com/google/common/collect/GeneralRangeTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class GeneralRangeTest extends TestCase { private static final Ordering<@Nullable Integer> ORDERING = Ordering.natural().nullsFirst(); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java index dc77b8cac28c..16657ccc4799 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableColumnMapTest extends ColumnMapTests { public HashBasedTableColumnMapTest() { super(false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java index 48d0d4785122..238c04bba9d6 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableColumnTest extends ColumnTests { public HashBasedTableColumnTest() { super(false, true, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java index e007fe077b2f..923ffe197faa 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableRowMapTest extends RowMapTests { public HashBasedTableRowMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java index 265e2983d0e1..1b6f4a44a97f 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableRowTest extends RowTests { public HashBasedTableRowTest() { super(false, true, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java b/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java index d5ed5751ad52..a6a23beaaf30 100644 --- a/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashBasedTableTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.NullPointerTester; import com.google.common.testing.SerializableTester; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableTest extends AbstractTableTest { @Override diff --git a/android/guava-tests/test/com/google/common/collect/HashBiMapTest.java b/android/guava-tests/test/com/google/common/collect/HashBiMapTest.java index 06669ee30c10..d000fdc5cfac 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 0fa8ac353c9a..e4decb57c2c8 100644 --- a/android/guava-tests/test/com/google/common/collect/HashMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashMultimapTest.java @@ -30,6 +30,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link HashMultimap}. @@ -37,7 +38,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashMultimapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java b/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java index 24ad901b5501..421ab58e3713 100644 --- a/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashMultisetTest.java @@ -31,6 +31,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link HashMultiset}. @@ -39,7 +40,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/HashingTest.java b/android/guava-tests/test/com/google/common/collect/HashingTest.java index c68d2c2bd731..07162702e118 100644 --- a/android/guava-tests/test/com/google/common/collect/HashingTest.java +++ b/android/guava-tests/test/com/google/common/collect/HashingTest.java @@ -18,10 +18,11 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** Tests for {@code Hashing}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashingTest extends TestCase { public void testSmear() { assertEquals(1459320713, smear(754102528)); diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java index 34d186439883..6e3803df599f 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java @@ -44,6 +44,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -52,7 +53,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableBiMapTest extends TestCase { // TODO: Reduce duplication of ImmutableMapTest code diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java index 8510a5130b30..b6e583163f02 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 79218b03214a..b85c43168618 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 b4e969c34c9d..158965501622 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableListTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableListTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -62,7 +63,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableListTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java index 620b53c134c6..9a65525d7ea0 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMapTest.java @@ -61,6 +61,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -71,7 +72,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java index f216745044e3..0d7889408235 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an {@link ImmutableMultimap} with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java index d1219082014a..7d8860a873dd 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java @@ -32,6 +32,7 @@ import com.google.common.testing.NullPointerTester; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultimapTest extends TestCase { @SuppressWarnings("JUnitIncompatibleType") diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java index 535071e9d005..c381b1f3702e 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java @@ -49,6 +49,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -57,7 +58,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java index 317644e1421d..f8dfc39a2990 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an {@link ImmutableSetMultimap} with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Mike Ward */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java index 91f7cc02566a..4faa55b20174 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 ddde4bfacd1a..8df4e5facca0 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSetTest.java @@ -42,6 +42,7 @@ import java.util.Set; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link ImmutableSet}. @@ -51,7 +52,7 @@ * @author Nick Kralevich */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java index cb3402ade3b5..c9321c40be6a 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java @@ -50,6 +50,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -61,7 +62,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedMapTest extends TestCase { // TODO: Avoid duplicating code in ImmutableMapTest diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java index d3c2a0227729..8d45a44e8d5d 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java @@ -55,6 +55,7 @@ import java.util.TreeSet; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link ImmutableSortedSet}. @@ -62,7 +63,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java index 8fb5dfa63593..aef92ea1bc75 100644 --- a/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/ImmutableTableTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.SerializableTester; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableTableTest extends AbstractTableReadTest { @Override protected Table create(@Nullable Object... data) { diff --git a/android/guava-tests/test/com/google/common/collect/IterablesTest.java b/android/guava-tests/test/com/google/common/collect/IterablesTest.java index 78e2ef710673..ccca7a71067f 100644 --- a/android/guava-tests/test/com/google/common/collect/IterablesTest.java +++ b/android/guava-tests/test/com/google/common/collect/IterablesTest.java @@ -65,6 +65,7 @@ import java.util.SortedSet; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -74,7 +75,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class IterablesTest extends TestCase { public void testSize0() { diff --git a/android/guava-tests/test/com/google/common/collect/IteratorsTest.java b/android/guava-tests/test/com/google/common/collect/IteratorsTest.java index dcab9733a34d..c940e7490157 100644 --- a/android/guava-tests/test/com/google/common/collect/IteratorsTest.java +++ b/android/guava-tests/test/com/google/common/collect/IteratorsTest.java @@ -74,6 +74,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -82,7 +83,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class IteratorsTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/LegacyComparable.java b/android/guava-tests/test/com/google/common/collect/LegacyComparable.java index 93c92aa82cf8..c7285a92d912 100644 --- a/android/guava-tests/test/com/google/common/collect/LegacyComparable.java +++ b/android/guava-tests/test/com/google/common/collect/LegacyComparable.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ */ @SuppressWarnings({"ComparableType", "rawtypes"}) // https://github.com/google/guava/issues/989 @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked class LegacyComparable implements Comparable, Serializable { static final LegacyComparable X = new LegacyComparable("x"); static final LegacyComparable Y = new LegacyComparable("y"); diff --git a/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java b/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java index 2b0208031910..cf1ed0f76f36 100644 --- a/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java @@ -46,6 +46,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -54,7 +55,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedHashMultimapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java b/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java index 739748a6a902..34d888b72361 100644 --- a/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java @@ -31,6 +31,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link LinkedHashMultiset}. @@ -38,7 +39,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedHashMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java b/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java index b0f2f618dd74..2c942644628b 100644 --- a/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java +++ b/android/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java @@ -51,6 +51,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -59,7 +60,7 @@ * @author Mike Bostock */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedListMultimapTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/ListsImplTest.java b/android/guava-tests/test/com/google/common/collect/ListsImplTest.java index b99d65fcda5a..68ce8362d7f3 100644 --- a/android/guava-tests/test/com/google/common/collect/ListsImplTest.java +++ b/android/guava-tests/test/com/google/common/collect/ListsImplTest.java @@ -34,11 +34,12 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Tests the package level *impl methods directly using various types of lists. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ListsImplTest extends TestCase { /** Describes how a list is modifiable */ diff --git a/android/guava-tests/test/com/google/common/collect/ListsTest.java b/android/guava-tests/test/com/google/common/collect/ListsTest.java index 844b9f449e8b..f881b2c8c65b 100644 --- a/android/guava-tests/test/com/google/common/collect/ListsTest.java +++ b/android/guava-tests/test/com/google/common/collect/ListsTest.java @@ -61,6 +61,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@code Lists}. @@ -70,7 +71,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ListsTest extends TestCase { private static final Collection SOME_COLLECTION = asList(0, 1, 1); diff --git a/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java index de190d423ce9..b6580f68c66a 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java @@ -22,6 +22,7 @@ import com.google.common.base.Function; import com.google.common.base.Functions; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Maps#transformValues(SortedMap, Function)}. @@ -29,7 +30,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsSortedTransformValuesTest extends AbstractMapsTransformValuesTest { @Override protected SortedMap makeEmptyMap() { diff --git a/android/guava-tests/test/com/google/common/collect/MapsTest.java b/android/guava-tests/test/com/google/common/collect/MapsTest.java index ac501a51e096..b468f78bb595 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTest.java @@ -66,6 +66,7 @@ import java.util.TreeMap; import java.util.concurrent.ConcurrentMap; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -76,7 +77,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("JUnitIncompatibleType") // Many intentional violations here. public class MapsTest extends TestCase { diff --git a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java index 55f3ac66348f..e1cafc86b964 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java @@ -22,6 +22,7 @@ import com.google.common.base.Function; import com.google.common.base.Functions; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Maps#transformValues(Map, Function)}. @@ -29,7 +30,7 @@ * @author Isaac Shum */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsTransformValuesTest extends AbstractMapsTransformValuesTest { @Override protected Map makeEmptyMap() { diff --git a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java index 343ebcf77056..def9d6847706 100644 --- a/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsTransformValuesUnmodifiableIteratorTest extends MapInterfaceTest { // TODO(jlevy): Move shared code of this class and MapsTransformValuesTest // to a superclass. diff --git a/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java b/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java index a94904e19441..2ba38f132a0b 100644 --- a/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java +++ b/android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -61,7 +62,7 @@ * @author Sverre Sundsdal */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MinMaxPriorityQueueTest extends TestCase { private static final Ordering SOME_COMPARATOR = Ordering.natural().reverse(); diff --git a/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java b/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java index 034b3e3d1ae0..97857ffdeb0a 100644 --- a/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java @@ -29,6 +29,7 @@ import java.util.SortedMap; import java.util.SortedSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapBuilderTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/MultimapsTest.java b/android/guava-tests/test/com/google/common/collect/MultimapsTest.java index 372e8276d571..448988bece58 100644 --- a/android/guava-tests/test/com/google/common/collect/MultimapsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultimapsTest.java @@ -66,6 +66,7 @@ import java.util.SortedSet; import java.util.TreeSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -74,7 +75,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapsTest extends TestCase { private static final Comparator INT_COMPARATOR = diff --git a/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java b/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java index 78494be1b4d5..d68c9829ec44 100644 --- a/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.base.Functions; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Tests for Multimaps.transformValues().asMap(). @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapsTransformValuesAsMapTest extends AbstractMultimapAsMapImplementsMapTest { public MultimapsTransformValuesAsMapTest() { diff --git a/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java b/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java index 85afc4728191..a442aa814691 100644 --- a/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java @@ -22,6 +22,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Multiset.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author Mike Bostock */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetsImmutableEntryTest extends TestCase { private static final @Nullable String NE = null; diff --git a/android/guava-tests/test/com/google/common/collect/MultisetsTest.java b/android/guava-tests/test/com/google/common/collect/MultisetsTest.java index 13da822e65cd..0921dc79dea3 100644 --- a/android/guava-tests/test/com/google/common/collect/MultisetsTest.java +++ b/android/guava-tests/test/com/google/common/collect/MultisetsTest.java @@ -32,6 +32,7 @@ import java.util.Collections; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Multisets}. @@ -41,7 +42,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetsTest extends TestCase { /* See MultisetsImmutableEntryTest for immutableEntry() tests. */ diff --git a/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java b/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java index 8d2b2bd96987..d8ff7eda0633 100644 --- a/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/NewCustomTableTest.java @@ -23,6 +23,7 @@ import com.google.common.base.Supplier; import java.util.Map; import java.util.TreeMap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class NewCustomTableTest extends AbstractTableTest { @Override diff --git a/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java b/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java index 01c121f48cdb..6afb08a509e4 100644 --- a/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java +++ b/android/guava-tests/test/com/google/common/collect/ObjectArraysTest.java @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ObjectArraysTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/OrderingTest.java b/android/guava-tests/test/com/google/common/collect/OrderingTest.java index 95043fc0db01..e52589461ab2 100644 --- a/android/guava-tests/test/com/google/common/collect/OrderingTest.java +++ b/android/guava-tests/test/com/google/common/collect/OrderingTest.java @@ -50,6 +50,7 @@ import java.util.RandomAccess; import junit.framework.TestCase; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -58,7 +59,7 @@ * @author Jesse Wilson */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class OrderingTest extends TestCase { // TODO(cpovirk): some of these are inexplicably slow (20-30s) under GWT diff --git a/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java b/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java index ad260ef65186..76f3b50df872 100644 --- a/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class PeekingIteratorTest extends TestCase { /** diff --git a/android/guava-tests/test/com/google/common/collect/RangeTest.java b/android/guava-tests/test/com/google/common/collect/RangeTest.java index d735749f948d..e1431f09d76e 100644 --- a/android/guava-tests/test/com/google/common/collect/RangeTest.java +++ b/android/guava-tests/test/com/google/common/collect/RangeTest.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class RangeTest extends TestCase { public void testOpen() { Range range = Range.open(4, 8); diff --git a/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java index 72e31b0e0186..308e25eb0c3b 100644 --- a/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java b/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java index 3f1f75d78ac5..74f719efe374 100644 --- a/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java +++ b/android/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -24,7 +25,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class RegularImmutableAsListTest extends TestCase { /** * RegularImmutableAsList should assume its input is null-free without checking, because it only diff --git a/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java index 1e697c95bbc2..86d67d5ad1e2 100644 --- a/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java @@ -21,12 +21,13 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Table.Cell; +import org.jspecify.annotations.NullMarked; /** * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class RegularImmutableTableTest extends AbstractImmutableTableTest { private static final ImmutableSet> CELLS = ImmutableSet.of( diff --git a/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java b/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java index fa7cb0c4b7f3..f17d0ee3b37e 100644 --- a/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SetOperationsTest.java @@ -32,6 +32,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link Sets#union}, {@link Sets#intersection} and {@link Sets#difference}. @@ -39,7 +40,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetOperationsTest extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/SetsTest.java b/android/guava-tests/test/com/google/common/collect/SetsTest.java index 8fcde29bfd5c..2e12936c81e6 100644 --- a/android/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SetsTest.java @@ -80,6 +80,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -89,7 +90,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetsTest extends TestCase { private static final IteratorTester.KnownOrder KNOWN_ORDER = diff --git a/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java b/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java index 7dd66df559da..6ffa66df4d77 100644 --- a/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java @@ -33,6 +33,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SimpleAbstractMultisetTest extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java b/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java index 42b239aa0ff8..2dded744ce1d 100644 --- a/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java @@ -23,6 +23,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Objects; import com.google.common.testing.EqualsTester; +import org.jspecify.annotations.NullMarked; /** * Tests {@link SingletonImmutableTable}. @@ -30,7 +31,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SingletonImmutableTableTest extends AbstractImmutableTableTest { private final ImmutableTable testTable = new SingletonImmutableTable<>('a', 1, "blah"); diff --git a/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java b/android/guava-tests/test/com/google/common/collect/SortedIterablesTest.java index c918b1dba809..9b1d04bba477 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 95d2e16933e4..797f9dc6251d 100644 --- a/android/guava-tests/test/com/google/common/collect/SortedListsTest.java +++ b/android/guava-tests/test/com/google/common/collect/SortedListsTest.java @@ -22,6 +22,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for SortedLists. @@ -29,7 +30,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedListsTest extends TestCase { private static final ImmutableList LIST_WITH_DUPS = ImmutableList.of(1, 1, 2, 4, 4, 4, 8); diff --git a/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java index f53b8b3038f0..f97c6e792ecc 100644 --- a/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@code TreeMultimap.asMap().subMap()} with {@link MapInterfaceTest}. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SubMapMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { public SubMapMultimapAsMapImplementsMapTest() { diff --git a/android/guava-tests/test/com/google/common/collect/TableCollectionTest.java b/android/guava-tests/test/com/google/common/collect/TableCollectionTest.java index 9425722c141c..82b46b12a463 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 0a2b6472e4f6..57505ef2bfa0 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTest.java @@ -24,6 +24,7 @@ import com.google.common.testing.EqualsTester; import com.google.common.testing.SerializableTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTest extends TestCase { @GwtIncompatible // SerializableTester diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java index d25c2358dfbf..e5887875d742 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java @@ -22,9 +22,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesColumnMapTest extends ColumnMapTests { public TablesTransformValuesColumnMapTest() { super(false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java index 9647a6f70ccd..c1a140092acc 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java @@ -22,9 +22,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesColumnTest extends ColumnTests { public TablesTransformValuesColumnTest() { super(false, false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java index 77cfd4142c1d..0a3918b39ef6 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesRowMapTest extends RowMapTests { public TablesTransformValuesRowMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java index 95d58a58fbfc..de34b485640d 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesRowTest extends RowTests { public TablesTransformValuesRowTest() { super(false, false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java index 452c70a93d14..e06865dbc263 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.base.Function; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesTest extends AbstractTableTest { private static final Function<@Nullable String, @Nullable Character> FIRST_CHARACTER = diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java index ee813e358ff4..f8e67f990829 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java @@ -20,9 +20,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransposeColumnTest extends ColumnTests { public TablesTransposeColumnTest() { super(false, true, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java b/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java index 25f1bcfa37ce..524ed112d70a 100644 --- a/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java @@ -20,9 +20,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransposeRowTest extends RowTests { public TablesTransposeRowTest() { super(false, true, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java b/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java index 6c87b99efecb..736c8ff4518d 100644 --- a/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/TransposedTableTest.java @@ -19,6 +19,7 @@ import static com.google.common.collect.Tables.transpose; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TransposedTableTest extends AbstractTableTest { @Override diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java index 4fa7b5aaeca6..f27017d6cfa2 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableColumnMapTest extends ColumnMapTests { public TreeBasedTableColumnMapTest() { super(false, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java index 48049bc5913e..b4e6008e38cd 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableColumnTest extends ColumnTests { public TreeBasedTableColumnTest() { super(false, true, true, true, false); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java index 274594166764..59ba288793de 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapHeadMapTest extends RowMapTests { public TreeBasedTableRowMapHeadMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java index ba4235d7748a..d9c5ba1e457a 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapSubMapTest extends RowMapTests { public TreeBasedTableRowMapSubMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java index 862d78c7d1b2..cf25c9d5972d 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapTailMapTest extends RowMapTests { public TreeBasedTableRowMapTailMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java index 46a925a58f63..e9c891fa24ef 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapTest extends RowMapTests { public TreeBasedTableRowMapTest() { super(false, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java index 7884b61104f4..990732ee3c67 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowTest extends RowTests { public TreeBasedTableRowTest() { super(false, true, true, true, true); diff --git a/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java b/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java index e663ff280ae1..aedd2e5d7422 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java @@ -37,6 +37,7 @@ import java.util.SortedMap; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableTest extends AbstractTableTest { @J2ktIncompatible @GwtIncompatible // suite diff --git a/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java b/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java index f69c54a15fcb..cb85a7bfb017 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java @@ -30,6 +30,7 @@ import java.util.Map.Entry; import java.util.SortedSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultimapExplicitTest extends TestCase { /** diff --git a/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java b/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java index f50a512446d6..bd4f2b945a28 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code TreeMultimap} with natural ordering. @@ -59,7 +60,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultimapNaturalTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java b/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java index 8cd6cbd57574..38149fc57386 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeMultisetTest.java @@ -41,6 +41,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Neal Kanodia */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultisetTest extends TestCase { @J2ktIncompatible diff --git a/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java b/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java index a9c3d094d084..3b1b45cf2146 100644 --- a/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java +++ b/android/guava-tests/test/com/google/common/collect/TreeTraverserTest.java @@ -24,6 +24,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code TreeTraverser}. @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeTraverserTest extends TestCase { private static class Node { final char value; diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java index fad660a0c6f6..452e513a9430 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link UnmodifiableIterator}. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableIteratorTest extends TestCase { @SuppressWarnings("DoNotCall") diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java index 02cf78e2baa7..e1d159ae73cc 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java @@ -23,6 +23,7 @@ import java.util.ListIterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for UnmodifiableListIterator. @@ -30,7 +31,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableListIteratorTest extends TestCase { @SuppressWarnings("DoNotCall") public void testRemove() { diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java index f485b8bb0e5e..6296f494b9ea 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an unmodifiable multimap with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java index f9713c752bd5..dcd19b050459 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableColumnMapTest extends ColumnMapTests { public UnmodifiableRowSortedTableColumnMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java index c98dd1449b51..a18944d4141d 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableColumnTest extends ColumnTests { public UnmodifiableRowSortedTableColumnTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java index 7c1cc0c2850f..5fa5c14c9884 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java @@ -22,9 +22,10 @@ import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableRowMapTest extends RowMapTests { public UnmodifiableRowSortedTableRowMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java index 67c011107e0b..511eb2afb34b 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableRowTest extends RowTests { public UnmodifiableRowSortedTableRowTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java index 05d69df2e45f..a75a0437ee25 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableColumnMapTest extends ColumnMapTests { public UnmodifiableTableColumnMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java index 3296aedd9d57..70a8a7347fbc 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableColumnTest extends ColumnTests { public UnmodifiableTableColumnTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java index 69fa02cc008c..904e6a8482b6 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableRowMapTest extends RowMapTests { public UnmodifiableTableRowMapTest() { super(false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java index 973995a5af2a..e01db0878541 100644 --- a/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java +++ b/android/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableRowTest extends RowTests { public UnmodifiableTableRowTest() { super(false, false, false, false, false); diff --git a/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java b/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java index c82d23b517f1..85c754c75892 100644 --- a/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java +++ b/android/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java @@ -21,12 +21,13 @@ import com.google.common.escape.testing.EscaperAsserts; import java.io.IOException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author David Beaumont */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayBasedCharEscaperTest extends TestCase { private static final ImmutableMap NO_REPLACEMENTS = ImmutableMap.of(); private static final ImmutableMap SIMPLE_REPLACEMENTS = diff --git a/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java b/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java index 125749470a0d..c7ad03ad4193 100644 --- a/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java +++ b/android/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java @@ -23,12 +23,13 @@ import com.google.common.escape.testing.EscaperAsserts; import java.io.IOException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author David Beaumont */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayBasedUnicodeEscaperTest extends TestCase { private static final ImmutableMap NO_REPLACEMENTS = ImmutableMap.of(); private static final ImmutableMap SIMPLE_REPLACEMENTS = diff --git a/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java index 5f27927038c7..f03f7b6e57ac 100644 --- a/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java index 444185d69ff0..dda6301ade7d 100644 --- a/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java b/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java index 98454b458e96..e60cf683dfbc 100644 --- a/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java +++ b/android/guava-tests/test/com/google/common/math/BigIntegerMathTest.java @@ -52,13 +52,14 @@ import java.util.EnumSet; import java.util.Map; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for BigIntegerMath. * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class BigIntegerMathTest extends TestCase { public void testCeilingPowerOfTwo() { diff --git a/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java index a0be002dd995..3c7c363b3264 100644 --- a/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java index 693a6565a8a4..86e8f9903637 100644 --- a/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/primitives/BooleansTest.java b/android/guava-tests/test/com/google/common/primitives/BooleansTest.java index 15c80b41ffb0..67ab066c41dc 100644 --- a/android/guava-tests/test/com/google/common/primitives/BooleansTest.java +++ b/android/guava-tests/test/com/google/common/primitives/BooleansTest.java @@ -32,6 +32,7 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class BooleansTest extends TestCase { private static final boolean[] EMPTY = {}; private static final boolean[] ARRAY_FALSE = {false}; diff --git a/android/guava-tests/test/com/google/common/primitives/BytesTest.java b/android/guava-tests/test/com/google/common/primitives/BytesTest.java index b395a204aac0..6c56ad0e1d7f 100644 --- a/android/guava-tests/test/com/google/common/primitives/BytesTest.java +++ b/android/guava-tests/test/com/google/common/primitives/BytesTest.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class BytesTest extends TestCase { private static final byte[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/CharsTest.java b/android/guava-tests/test/com/google/common/primitives/CharsTest.java index 6da8be85115c..5645a0f14cc7 100644 --- a/android/guava-tests/test/com/google/common/primitives/CharsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/CharsTest.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Locale; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class CharsTest extends TestCase { private static final char[] EMPTY = {}; private static final char[] ARRAY1 = {(char) 1}; diff --git a/android/guava-tests/test/com/google/common/primitives/DoublesTest.java b/android/guava-tests/test/com/google/common/primitives/DoublesTest.java index bf0d211ebd7e..fa7aa36cbf2d 100644 --- a/android/guava-tests/test/com/google/common/primitives/DoublesTest.java +++ b/android/guava-tests/test/com/google/common/primitives/DoublesTest.java @@ -38,6 +38,7 @@ import java.util.List; import java.util.regex.Pattern; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class DoublesTest extends TestCase { private static final double[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/FloatsTest.java b/android/guava-tests/test/com/google/common/primitives/FloatsTest.java index c35cbc4799d4..6522be8bff55 100644 --- a/android/guava-tests/test/com/google/common/primitives/FloatsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/FloatsTest.java @@ -37,6 +37,7 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FloatsTest extends TestCase { private static final float[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/IntsTest.java b/android/guava-tests/test/com/google/common/primitives/IntsTest.java index a64cf2642c7f..2c5aa1913727 100644 --- a/android/guava-tests/test/com/google/common/primitives/IntsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/IntsTest.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("cast") // redundant casts are intentional and harmless public class IntsTest extends TestCase { private static final int[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/LongsTest.java b/android/guava-tests/test/com/google/common/primitives/LongsTest.java index b84972e53716..0bfa4dd5d82d 100644 --- a/android/guava-tests/test/com/google/common/primitives/LongsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/LongsTest.java @@ -39,6 +39,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class LongsTest extends TestCase { private static final long[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java index 2c903ac7acdb..67654ea330ef 100644 --- a/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/primitives/ShortsTest.java b/android/guava-tests/test/com/google/common/primitives/ShortsTest.java index 9f40936dd7eb..60d8670c4be9 100644 --- a/android/guava-tests/test/com/google/common/primitives/ShortsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/ShortsTest.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class ShortsTest extends TestCase { private static final short[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java b/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java index d2770657fd99..e186066e4b63 100644 --- a/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java +++ b/android/guava-tests/test/com/google/common/primitives/SignedBytesTest.java @@ -32,13 +32,14 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link SignedBytes}. * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SignedBytesTest extends TestCase { private static final byte[] EMPTY = {}; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java index 309b0029abd3..3339f08877d5 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java @@ -34,12 +34,13 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeoutException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link FluentFuture}. The tests cover only the basics for the API. The actual logic is * tested in {@link FuturesTest}. */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FluentFutureTest extends TestCase { public void testFromFluentFuture() { diff --git a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java index ade301520edc..1fc69011f37b 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java @@ -94,6 +94,7 @@ import java.util.logging.Logger; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -101,7 +102,7 @@ * * @author Nishant Thakkar */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FuturesTest extends TestCase { private static final Logger aggregateFutureLogger = diff --git a/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java b/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java index 7c2b29bd6ca8..a0f455ec170c 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java b/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 17357b525a03..969357713648 100644 --- a/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java +++ b/android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java @@ -35,10 +35,11 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Test case for {@link TrustedListenableFutureTask}. */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class TrustedListenableFutureTaskTest extends TestCase { diff --git a/android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java b/android/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a0adb0236c89..000000000000 --- 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 0bcc65dc2eb5..3fadb315554a 100644 --- a/android/guava/src/com/google/common/base/ParametricNullness.java +++ b/android/guava/src/com/google/common/base/ParametricNullness.java @@ -56,8 +56,8 @@ *
    *
  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
  • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/base/package-info.java b/android/guava/src/com/google/common/base/package-info.java index 8cdbdca4c236..c73391c3b4e4 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 51431fe419ea..000000000000 --- 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 eaf194d4ab1c..8892bb45267d 100644 --- a/android/guava/src/com/google/common/cache/ParametricNullness.java +++ b/android/guava/src/com/google/common/cache/ParametricNullness.java @@ -56,8 +56,8 @@ *
      *
    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/cache/package-info.java b/android/guava/src/com/google/common/cache/package-info.java index e494d931f42b..e7c453dd8d0e 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 8fe0fb375643..000000000000 --- 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 29d5bcde4039..5d952cf8f6ba 100644 --- a/android/guava/src/com/google/common/collect/ObjectCountHashMap.java +++ b/android/guava/src/com/google/common/collect/ObjectCountHashMap.java @@ -29,6 +29,7 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue; import java.util.Arrays; import javax.annotation.CheckForNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ *

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

        *
      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/collect/package-info.java b/android/guava/src/com/google/common/collect/package-info.java index 048b7d8d72f1..d9f2331e1a64 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 93130cb88176..000000000000 --- 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 f964ca4a4f61..9ac5d62e1296 100644 --- a/android/guava/src/com/google/common/escape/ParametricNullness.java +++ b/android/guava/src/com/google/common/escape/ParametricNullness.java @@ -56,8 +56,8 @@ *
        *
      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/escape/package-info.java b/android/guava/src/com/google/common/escape/package-info.java index 80c42464e1bb..173f811a3aae 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 8ef823148266..000000000000 --- 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 47c7d8d4d063..fd07ef09cb60 100644 --- a/android/guava/src/com/google/common/eventbus/ParametricNullness.java +++ b/android/guava/src/com/google/common/eventbus/ParametricNullness.java @@ -56,8 +56,8 @@ *
          *
        • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
        • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/eventbus/package-info.java b/android/guava/src/com/google/common/eventbus/package-info.java index 3808bde9a221..b387bc234010 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 0821642f52d4..000000000000 --- 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 32fd5ee7ecaa..634ee0e19782 100644 --- a/android/guava/src/com/google/common/graph/ParametricNullness.java +++ b/android/guava/src/com/google/common/graph/ParametricNullness.java @@ -56,8 +56,8 @@ *
            *
          • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
          • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/graph/package-info.java b/android/guava/src/com/google/common/graph/package-info.java index bed41eefec3a..7e97756afabf 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 ab3aa88d9d7a..000000000000 --- 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 4ebc40bb741e..f5a8614a8762 100644 --- a/android/guava/src/com/google/common/hash/ParametricNullness.java +++ b/android/guava/src/com/google/common/hash/ParametricNullness.java @@ -56,8 +56,8 @@ *
              *
            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/hash/package-info.java b/android/guava/src/com/google/common/hash/package-info.java index 9dbbbaac3438..b5405d48129c 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 5e471bdbbce9..000000000000 --- 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 50a64c781c90..a43cc22a06b0 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 03f51fdb04c3..ccfd5b5693f9 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 321b5826baa6..000000000000 --- 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 881c07d49804..32eee700e1c6 100644 --- a/android/guava/src/com/google/common/io/ParametricNullness.java +++ b/android/guava/src/com/google/common/io/ParametricNullness.java @@ -56,8 +56,8 @@ *
                  *
                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/io/package-info.java b/android/guava/src/com/google/common/io/package-info.java index c29b61a74d97..30cff81d2fd2 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 d314278a8076..000000000000 --- 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 612fa934a6d5..a18ba9348f9a 100644 --- a/android/guava/src/com/google/common/math/ParametricNullness.java +++ b/android/guava/src/com/google/common/math/ParametricNullness.java @@ -56,8 +56,8 @@ *
                    *
                  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                  • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/math/package-info.java b/android/guava/src/com/google/common/math/package-info.java index da2392a6a5a5..663d3bced554 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 3c8b9f4225f8..000000000000 --- 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 83b9eb6fa6a3..5b3af1736ee1 100644 --- a/android/guava/src/com/google/common/net/ParametricNullness.java +++ b/android/guava/src/com/google/common/net/ParametricNullness.java @@ -56,8 +56,8 @@ *
                      *
                    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/net/package-info.java b/android/guava/src/com/google/common/net/package-info.java index 1fa33a1ad434..562bb10e4f99 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 1240d1075a28..000000000000 --- 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 c40ea499d4ce..9af83702c0b1 100644 --- a/android/guava/src/com/google/common/primitives/ParametricNullness.java +++ b/android/guava/src/com/google/common/primitives/ParametricNullness.java @@ -56,8 +56,8 @@ *
                        *
                      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/primitives/package-info.java b/android/guava/src/com/google/common/primitives/package-info.java index 2fdf789228e7..67e87ac3d65a 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 594c4c394bf6..000000000000 --- 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 372a53bb616f..4cc7fd284847 100644 --- a/android/guava/src/com/google/common/reflect/ParametricNullness.java +++ b/android/guava/src/com/google/common/reflect/ParametricNullness.java @@ -56,8 +56,8 @@ *
                        *
                      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/reflect/package-info.java b/android/guava/src/com/google/common/reflect/package-info.java index 71583d47498e..7a3f435e530b 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 4dc5c72362d4..000000000000 --- 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 cdc2ee110b99..ba5c58820023 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 e8fcce6ee681..f12f1133e6df 100644 --- a/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java +++ b/android/guava/src/com/google/common/util/concurrent/ParametricNullness.java @@ -56,8 +56,8 @@ *
                          *
                        • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                        • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/util/concurrent/package-info.java b/android/guava/src/com/google/common/util/concurrent/package-info.java index 41af41c0d3ab..c5b199b07292 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 4a6bee38582a..000000000000 --- 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 439707a2edb1..0d989c7cefa6 100644 --- a/android/guava/src/com/google/common/xml/ParametricNullness.java +++ b/android/guava/src/com/google/common/xml/ParametricNullness.java @@ -56,8 +56,8 @@ *
                            *
                          • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                          • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/android/guava/src/com/google/common/xml/package-info.java b/android/guava/src/com/google/common/xml/package-info.java index c06e1b5702f9..a263f55f44c8 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 cdc2ee110b99..ba5c58820023 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 afe4fa0bc461..ce79b45f3693 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 f281cd83414b..33a3a83746b8 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 56163a6f6740..92e6f5a1ec94 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 8ed255891105..4464acf0f3fa 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 f85b01fbbc7e..fc8cbdd9c545 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 5ffe110e7dbe..4ae6fc9f87a6 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 6312a67bc66a..b13345794c57 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 a9e7ac04d84a..360793345a0a 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 7bc6548bcab2..ac9e70cac1dc 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 01409884607a..fcd39baeac99 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 a781d0ab0266..3a9404e66772 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 8c3fdeadccb1..38864047f9e8 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 67b7cdb485e4..d09b8afc4f03 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 971e69a2436b..b78a5ce21597 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 faeee278d0d9..7625463adf75 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 9cb5a87e79e6..72fbf0224eac 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 9f32428f8732..6e0431b1319e 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 e1606a19d977..153d68467712 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 131cbf814db5..62540b94ec46 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 07b465bb889a..acf6ec52e5ab 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 63c35be86abc..5f336be4ce95 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 b26a6a5832f9..836f4bf971e7 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 c6792bfdf519..08d2e31f43a5 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 b4b97c601339..a6f1c610faf1 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 307fc1533fab..2ddd283db418 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 633329c1e626..b8e8b595d846 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 73b44b616f1d..576e870c3ebe 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 34117f898874..886bb105bb74 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 57376d4987e1..eb62f12b5d8c 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 efc85fc5563b..86b79469b1f1 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 c5b093b1880d..e0aebf66919d 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 2ed582aa7a36..83fd9075de46 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 107a8e76cea7..ae462fe31f00 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 10abd8b4d171..dc9e94222006 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 081e9eaddd26..c637c223dafc 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 fe1de2eb2450..9b2bddec9305 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 0900629a55c8..2edf70fff26d 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 1102c3456bd0..1d2d3f4af55a 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 2949e4aca819..d8a517f6c991 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 8a8f758290d6..7f2738c2236f 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 e83dd74ac1c5..d83fc9d4ab73 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 431e7e8103d7..978fa683d8c8 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 d4d772b81e1d..94719ef52a0a 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 660dd86d3bdf..6c1fb6451598 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 99d4aa4c7039..553fbb8f5423 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 32749e4e21a3..5134c913e0e0 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 a48e4940662f..5ffeefccbfb1 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 bacd16155b88..634a1a424c03 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 3dbb5cd9e89c..11eb5d910ca1 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 e5dd65c4b6d1..fe7229ff8159 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 12e31fbd383b..afea133492f0 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 d460372f944f..28f55ca53034 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 a5d80d9d9de5..95fd02dd767c 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 0d04d181123d..6cf7607f2fa9 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 b3bc461a932c..950290116e84 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 50c3d367c59a..970d5139ffac 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 a9704ce4739b..a4a37259a178 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 908b733338be..137a3bc432ed 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 456d566a0bfd..961dc4f24f56 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 49b73296018c..d82fd9ab6bd0 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 5194e50c603a..4f6edeb87e2c 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 96e56e38b6ae..7c699cce29dd 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 6a71573f11b6..35df19804775 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 79c6874bffbb..8f473def24ba 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 272313253dea..63a02bf0561b 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 1f59dd0beecb..ee56438dac48 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 8c9140ed44d8..790fe46b1dfe 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 b7b2558d9919..8bdef2293382 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 e03cd52d01ea..414860e414c5 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 f590df0b51a6..81b641ebfe13 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 002831ef3c13..8b52204b620b 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 8bcb6b62e000..d7621fd7494d 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 9e40e4128247..78395adbc801 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 21dd73bf0d93..2d5b1014e0c8 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 50e39d13201a..7cd1ba6693bb 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 4b55fef8def3..f65d5fb326d0 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 42976bcb76f8..cab1041e5953 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 c1566abac2b9..472e1f50abf7 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 94c2136ec975..9b1a11f6863a 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 b014de3146e4..a9dc1191dfc2 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 a8cda429574a..6e94a3ad886a 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 249731a39a21..0368e1814025 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 a178b418f60e..dd802130da9e 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 2b8d4eb77e72..47232e8dd63b 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 94f6a5a010fa..eec85c7f0ce4 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 3494a66bb2c0..4515963f4613 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 5f02dba84855..9d311d3fa360 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 ec34752c57ab..bf16785bc5f1 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 3ffc27b71b42..55a9cc5ff242 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 0d38191f5ede..ca57703d9fc5 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 fb0facf24fd8..c883dd7916ce 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 8b2ac49633c5..12ad0a9e2460 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 9726d2de0eb1..0352b5aa9ee5 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 d1caedd4e8d1..fdfa23242daf 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 c2f8cc169b0b..7be2f47586e3 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 10d9dc04ecd4..1790499ca801 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 0259a1f3ba1c..c0a1ecd33dbf 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 ec4319bab550..ed514d2d4b1b 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 b16869865907..f0c8dbd2ede8 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 aba2131935bb..ec01f81b5f81 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 300835adc441..138d074788a6 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 ca07ffae0fbd..05ff429bbdf5 100644 --- a/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java +++ b/guava-testlib/test/com/google/common/testing/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/base/CharMatcherTest.java b/guava-tests/test/com/google/common/base/CharMatcherTest.java index 67e83a7fb030..1d47a3dc8a85 100644 --- a/guava-tests/test/com/google/common/base/CharMatcherTest.java +++ b/guava-tests/test/com/google/common/base/CharMatcherTest.java @@ -37,6 +37,7 @@ import java.util.Set; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link CharMatcher}. @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class CharMatcherTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/base/EquivalenceTest.java b/guava-tests/test/com/google/common/base/EquivalenceTest.java index 9bc96b0d24e7..8b5db3ab2ae2 100644 --- a/guava-tests/test/com/google/common/base/EquivalenceTest.java +++ b/guava-tests/test/com/google/common/base/EquivalenceTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.NullPointerTester; import com.google.common.testing.SerializableTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * * @author Jige Yu */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class EquivalenceTest extends TestCase { public void testPairwiseEquivalent() { diff --git a/guava-tests/test/com/google/common/base/FunctionsTest.java b/guava-tests/test/com/google/common/base/FunctionsTest.java index 1241200daafa..54380fe53d3b 100644 --- a/guava-tests/test/com/google/common/base/FunctionsTest.java +++ b/guava-tests/test/com/google/common/base/FunctionsTest.java @@ -30,6 +30,7 @@ import java.io.Serializable; import java.util.Map; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ * @author Vlad Patryshev */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class FunctionsTest extends TestCase { public void testIdentity_same() { diff --git a/guava-tests/test/com/google/common/base/JoinerTest.java b/guava-tests/test/com/google/common/base/JoinerTest.java index c02127e9d55d..5d427dd7a5d6 100644 --- a/guava-tests/test/com/google/common/base/JoinerTest.java +++ b/guava-tests/test/com/google/common/base/JoinerTest.java @@ -36,6 +36,7 @@ import java.util.Map.Entry; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class JoinerTest extends TestCase { private static final Joiner J = Joiner.on("-"); diff --git a/guava-tests/test/com/google/common/base/OptionalTest.java b/guava-tests/test/com/google/common/base/OptionalTest.java index ec197f5c2b82..3c6e2e9f072b 100644 --- a/guava-tests/test/com/google/common/base/OptionalTest.java +++ b/guava-tests/test/com/google/common/base/OptionalTest.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * * @author Kurt Alfred Kluever */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public final class OptionalTest extends TestCase { @SuppressWarnings("NullOptional") diff --git a/guava-tests/test/com/google/common/base/PreconditionsTest.java b/guava-tests/test/com/google/common/base/PreconditionsTest.java index 71845c8e5892..10ee1296bd13 100644 --- a/guava-tests/test/com/google/common/base/PreconditionsTest.java +++ b/guava-tests/test/com/google/common/base/PreconditionsTest.java @@ -39,6 +39,7 @@ import java.util.List; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -47,7 +48,7 @@ * @author Kevin Bourrillion * @author Jared Levy */ -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("LenientFormatStringValidation") // Intentional for testing @GwtCompatible(emulated = true) public class PreconditionsTest extends TestCase { diff --git a/guava-tests/test/com/google/common/base/PredicatesTest.java b/guava-tests/test/com/google/common/base/PredicatesTest.java index f1918c6d8c42..6fc9660f4bd7 100644 --- a/guava-tests/test/com/google/common/base/PredicatesTest.java +++ b/guava-tests/test/com/google/common/base/PredicatesTest.java @@ -38,6 +38,7 @@ import java.util.regex.Pattern; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class PredicatesTest extends TestCase { private static final Predicate<@Nullable Integer> TRUE = Predicates.alwaysTrue(); diff --git a/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java index e8f98fdd542e..2315bae34bc6 100644 --- a/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/base/ReflectionFreeAssertThrows.java @@ -33,11 +33,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/base/SplitterTest.java b/guava-tests/test/com/google/common/base/SplitterTest.java index 71a37a5f08e0..d5b5a9aeb373 100644 --- a/guava-tests/test/com/google/common/base/SplitterTest.java +++ b/guava-tests/test/com/google/common/base/SplitterTest.java @@ -31,11 +31,12 @@ import java.util.Map; import java.util.regex.Pattern; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author Julien Silland */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SplitterTest extends TestCase { diff --git a/guava-tests/test/com/google/common/base/StringsTest.java b/guava-tests/test/com/google/common/base/StringsTest.java index 494f321c208d..79fd2651cd24 100644 --- a/guava-tests/test/com/google/common/base/StringsTest.java +++ b/guava-tests/test/com/google/common/base/StringsTest.java @@ -24,13 +24,14 @@ import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.NullPointerTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link Strings}. * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class StringsTest extends TestCase { public void testNullToEmpty() { diff --git a/guava-tests/test/com/google/common/base/SuppliersTest.java b/guava-tests/test/com/google/common/base/SuppliersTest.java index 9a1150a0fc02..5971816134e7 100644 --- a/guava-tests/test/com/google/common/base/SuppliersTest.java +++ b/guava-tests/test/com/google/common/base/SuppliersTest.java @@ -38,6 +38,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @author Laurence Gonsalves * @author Harry Heymann */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SuppliersTest extends TestCase { diff --git a/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java index 0fa5fdbdb7b4..c496603719d7 100644 --- a/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/cache/ReflectionFreeAssertThrows.java @@ -33,11 +33,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java b/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java index 9dfa3fde21f6..21c7b8bde46c 100644 --- a/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractFilteredMapTest.java @@ -24,10 +24,11 @@ import java.util.Map; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractFilteredMapTest extends TestCase { private static final Predicate<@Nullable String> NOT_LENGTH_3 = input -> input == null || input.length() != 3; diff --git a/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java b/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java index e7f0f65200b6..58f5fbc10cbe 100644 --- a/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractImmutableSetTest.java @@ -40,6 +40,7 @@ import java.util.List; import java.util.Set; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractImmutableSetTest extends TestCase { protected abstract > Set of(); diff --git a/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java b/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java index 45f877a17ecf..6f1b6f7e8c6b 100644 --- a/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractImmutableTableTest.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests {@link ImmutableTable} @@ -27,7 +28,7 @@ * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractImmutableTableTest extends TestCase { abstract Iterable> getTestInstances(); diff --git a/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java b/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java index 1b6d6656483e..c935a962b9fe 100644 --- a/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractIteratorTest.java @@ -28,6 +28,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractIteratorTest extends TestCase { public void testDefaultBehaviorOfNextAndHasNext() { diff --git a/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java b/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java index a0f25ca5c29a..80c9526665f4 100644 --- a/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractMapEntryTest.java @@ -21,6 +21,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -29,7 +30,7 @@ * @author Mike Bostock */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractMapEntryTest extends TestCase { private static final @Nullable String NK = null; private static final @Nullable Integer NV = null; diff --git a/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java b/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java index 1a86566d0cfc..6808c3cf13fa 100644 --- a/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractMapsTransformValuesTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ * @author Isaac Shum */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked abstract class AbstractMapsTransformValuesTest extends MapInterfaceTest { public AbstractMapsTransformValuesTest() { super(false, true, false, true, true); diff --git a/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java index 84b920902557..682f16d54d5a 100644 --- a/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractMultimapAsMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an arbitrary multimap with {@link MapInterfaceTest}. @@ -30,7 +31,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractMultimapAsMapImplementsMapTest extends MapInterfaceTest> { diff --git a/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java b/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java index b1f64347ee53..e93736a6b89f 100644 --- a/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractSequentialIteratorTest.java @@ -28,11 +28,12 @@ import java.util.NoSuchElementException; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Tests for {@link AbstractSequentialIterator}. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class AbstractSequentialIteratorTest extends TestCase { @GwtIncompatible // Too slow public void testDoublerExhaustive() { diff --git a/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java b/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java index 5eada001250c..2d6a94d28e67 100644 --- a/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractTableReadTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.EqualsTester; import com.google.common.testing.NullPointerTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractTableReadTest extends TestCase { protected Table table; diff --git a/guava-tests/test/com/google/common/collect/AbstractTableTest.java b/guava-tests/test/com/google/common/collect/AbstractTableTest.java index 264bb06f0a80..4f479f49d9be 100644 --- a/guava-tests/test/com/google/common/collect/AbstractTableTest.java +++ b/guava-tests/test/com/google/common/collect/AbstractTableTest.java @@ -22,6 +22,7 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public abstract class AbstractTableTest extends AbstractTableReadTest { diff --git a/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java b/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java index bc18b493baa4..37f513ae3b29 100644 --- a/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/ArrayListMultimapTest.java @@ -35,6 +35,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code ArrayListMultimap}. @@ -42,7 +43,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayListMultimapTest extends TestCase { @GwtIncompatible // suite diff --git a/guava-tests/test/com/google/common/collect/ArrayTableTest.java b/guava-tests/test/com/google/common/collect/ArrayTableTest.java index 9755891f9d62..a0399d3cf49f 100644 --- a/guava-tests/test/com/google/common/collect/ArrayTableTest.java +++ b/guava-tests/test/com/google/common/collect/ArrayTableTest.java @@ -31,6 +31,7 @@ import com.google.common.testing.SerializableTester; import java.util.Arrays; import java.util.Map; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -39,7 +40,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayTableTest extends AbstractTableTest<@Nullable Character> { @Override diff --git a/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java b/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java index 44815e122dfa..16c98c5cae61 100644 --- a/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java +++ b/guava-tests/test/com/google/common/collect/CollectSpliteratorsTest.java @@ -27,10 +27,11 @@ import java.util.stream.IntStream; import java.util.stream.LongStream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** Tests for {@code CollectSpliterators}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class CollectSpliteratorsTest extends TestCase { public void testMap() { SpliteratorTester.of( diff --git a/guava-tests/test/com/google/common/collect/Collections2Test.java b/guava-tests/test/com/google/common/collect/Collections2Test.java index b14550a4719d..69adcaeb6fe5 100644 --- a/guava-tests/test/com/google/common/collect/Collections2Test.java +++ b/guava-tests/test/com/google/common/collect/Collections2Test.java @@ -40,6 +40,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class Collections2Test extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/guava-tests/test/com/google/common/collect/ComparatorsTest.java b/guava-tests/test/com/google/common/collect/ComparatorsTest.java index 963f22ada1f0..8710c49fafed 100644 --- a/guava-tests/test/com/google/common/collect/ComparatorsTest.java +++ b/guava-tests/test/com/google/common/collect/ComparatorsTest.java @@ -36,6 +36,7 @@ import java.util.Comparator; import java.util.Optional; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ComparatorsTest extends TestCase { public void testLexicographical() { Comparator comparator = Ordering.natural(); diff --git a/guava-tests/test/com/google/common/collect/ComparisonChainTest.java b/guava-tests/test/com/google/common/collect/ComparisonChainTest.java index 689d7711c446..8bb8ddf99ee3 100644 --- a/guava-tests/test/com/google/common/collect/ComparisonChainTest.java +++ b/guava-tests/test/com/google/common/collect/ComparisonChainTest.java @@ -30,6 +30,7 @@ import java.util.Comparator; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Kevin Bourrillion */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ComparisonChainTest extends TestCase { private static final DontCompareMe DONT_COMPARE_ME = new DontCompareMe(); diff --git a/guava-tests/test/com/google/common/collect/CountTest.java b/guava-tests/test/com/google/common/collect/CountTest.java index a6f6019b7901..86323cc8f728 100644 --- a/guava-tests/test/com/google/common/collect/CountTest.java +++ b/guava-tests/test/com/google/common/collect/CountTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code Count}. @@ -23,7 +24,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class CountTest extends TestCase { public void testGet() { assertEquals(20, new Count(20).get()); diff --git a/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java b/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java index 1c928638a96e..163688c867bc 100644 --- a/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java +++ b/guava-tests/test/com/google/common/collect/EmptyImmutableTableTest.java @@ -19,6 +19,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.testing.EqualsTester; +import org.jspecify.annotations.NullMarked; /** * Tests {@link EmptyImmutableTable} @@ -26,7 +27,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EmptyImmutableTableTest extends AbstractImmutableTableTest { private static final ImmutableTable INSTANCE = ImmutableTable.of(); diff --git a/guava-tests/test/com/google/common/collect/EnumBiMapTest.java b/guava-tests/test/com/google/common/collect/EnumBiMapTest.java index 31eab3bc14db..4f5cea264617 100644 --- a/guava-tests/test/com/google/common/collect/EnumBiMapTest.java +++ b/guava-tests/test/com/google/common/collect/EnumBiMapTest.java @@ -42,6 +42,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code EnumBiMap}. @@ -51,7 +52,7 @@ */ @J2ktIncompatible // EnumBimap @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EnumBiMapTest extends TestCase { private enum Currency { DOLLAR, diff --git a/guava-tests/test/com/google/common/collect/EvictingQueueTest.java b/guava-tests/test/com/google/common/collect/EvictingQueueTest.java index 7ba7923aed5c..1d8cdd383907 100644 --- a/guava-tests/test/com/google/common/collect/EvictingQueueTest.java +++ b/guava-tests/test/com/google/common/collect/EvictingQueueTest.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link EvictingQueue}. @@ -34,7 +35,7 @@ * @author Kurt Alfred Kluever */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class EvictingQueueTest extends TestCase { public void testCreateWithNegativeSize() throws Exception { diff --git a/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java b/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java index 652a23045e50..78d4e958ccc3 100644 --- a/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java +++ b/guava-tests/test/com/google/common/collect/FilteredBiMapTest.java @@ -17,9 +17,10 @@ package com.google.common.collect; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredBiMapTest extends AbstractFilteredMapTest { @Override BiMap createUnfiltered() { diff --git a/guava-tests/test/com/google/common/collect/FilteredMapTest.java b/guava-tests/test/com/google/common/collect/FilteredMapTest.java index 049e28645723..70e561443e70 100644 --- a/guava-tests/test/com/google/common/collect/FilteredMapTest.java +++ b/guava-tests/test/com/google/common/collect/FilteredMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredMapTest extends AbstractFilteredMapTest { @Override Map createUnfiltered() { diff --git a/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java b/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java index c4015cb72701..7fb754300d59 100644 --- a/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java +++ b/guava-tests/test/com/google/common/collect/FilteredSortedMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class FilteredSortedMapTest extends AbstractFilteredMapTest { @Override SortedMap createUnfiltered() { diff --git a/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java index 3cabcda48d17..b09fc124a98d 100644 --- a/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java +++ b/guava-tests/test/com/google/common/collect/ForMapMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for a {@link Multimaps#forMap} multimap with {@link @@ -28,7 +29,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ForMapMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { public ForMapMultimapAsMapImplementsMapTest() { diff --git a/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java index b021a0de47f0..a2f6c8739265 100644 --- a/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java +++ b/guava-tests/test/com/google/common/collect/ForwardingSortedMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.SortedMapInterfaceTest; import java.util.SortedMap; import java.util.TreeMap; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link ForwardingSortedMap} using {@link MapInterfaceTest}. @@ -29,7 +30,7 @@ * @author George van den Driessche */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ForwardingSortedMapImplementsMapTest extends SortedMapInterfaceTest { private static class SimpleForwardingSortedMap extends ForwardingSortedMap { diff --git a/guava-tests/test/com/google/common/collect/GeneralRangeTest.java b/guava-tests/test/com/google/common/collect/GeneralRangeTest.java index e85aa2787640..b9dbffcd501c 100644 --- a/guava-tests/test/com/google/common/collect/GeneralRangeTest.java +++ b/guava-tests/test/com/google/common/collect/GeneralRangeTest.java @@ -26,6 +26,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -34,7 +35,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class GeneralRangeTest extends TestCase { private static final Ordering<@Nullable Integer> ORDERING = Ordering.natural().nullsFirst(); diff --git a/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java index dc77b8cac28c..16657ccc4799 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java +++ b/guava-tests/test/com/google/common/collect/HashBasedTableColumnMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableColumnMapTest extends ColumnMapTests { public HashBasedTableColumnMapTest() { super(false, true, true, false); diff --git a/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java index 48d0d4785122..238c04bba9d6 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java +++ b/guava-tests/test/com/google/common/collect/HashBasedTableColumnTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableColumnTest extends ColumnTests { public HashBasedTableColumnTest() { super(false, true, true, true, false); diff --git a/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java index e007fe077b2f..923ffe197faa 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java +++ b/guava-tests/test/com/google/common/collect/HashBasedTableRowMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableRowMapTest extends RowMapTests { public HashBasedTableRowMapTest() { super(false, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java index 265e2983d0e1..1b6f4a44a97f 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java +++ b/guava-tests/test/com/google/common/collect/HashBasedTableRowTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableRowTest extends RowTests { public HashBasedTableRowTest() { super(false, true, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/HashBasedTableTest.java b/guava-tests/test/com/google/common/collect/HashBasedTableTest.java index d5ed5751ad52..a6a23beaaf30 100644 --- a/guava-tests/test/com/google/common/collect/HashBasedTableTest.java +++ b/guava-tests/test/com/google/common/collect/HashBasedTableTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.J2ktIncompatible; import com.google.common.testing.NullPointerTester; import com.google.common.testing.SerializableTester; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashBasedTableTest extends AbstractTableTest { @Override diff --git a/guava-tests/test/com/google/common/collect/HashBiMapTest.java b/guava-tests/test/com/google/common/collect/HashBiMapTest.java index 06669ee30c10..d000fdc5cfac 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 0fa8ac353c9a..e4decb57c2c8 100644 --- a/guava-tests/test/com/google/common/collect/HashMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/HashMultimapTest.java @@ -30,6 +30,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link HashMultimap}. @@ -37,7 +38,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashMultimapTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/HashMultisetTest.java b/guava-tests/test/com/google/common/collect/HashMultisetTest.java index 24ad901b5501..421ab58e3713 100644 --- a/guava-tests/test/com/google/common/collect/HashMultisetTest.java +++ b/guava-tests/test/com/google/common/collect/HashMultisetTest.java @@ -31,6 +31,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link HashMultiset}. @@ -39,7 +40,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class HashMultisetTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/HashingTest.java b/guava-tests/test/com/google/common/collect/HashingTest.java index c68d2c2bd731..07162702e118 100644 --- a/guava-tests/test/com/google/common/collect/HashingTest.java +++ b/guava-tests/test/com/google/common/collect/HashingTest.java @@ -18,10 +18,11 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** Tests for {@code Hashing}. */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class HashingTest extends TestCase { public void testSmear() { assertEquals(1459320713, smear(754102528)); diff --git a/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java index 72c935c8f3d0..f742f10ca78a 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableBiMapTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -60,7 +61,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableBiMapTest extends TestCase { // TODO: Reduce duplication of ImmutableMapTest code diff --git a/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableEnumMapTest.java index 254a73df63d4..37d4cefebff2 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 9693e59bacc2..ddbbb1e3dc36 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 47aace65d00d..753f26d15c9e 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableListTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableListTest.java @@ -53,6 +53,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -63,7 +64,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableListTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableMapTest.java index 7a4d1243149e..91df03876a3c 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableMapTest.java @@ -70,6 +70,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -80,7 +81,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMapTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java index f216745044e3..0d7889408235 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an {@link ImmutableMultimap} with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java b/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java index d1219082014a..7d8860a873dd 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableMultimapTest.java @@ -32,6 +32,7 @@ import com.google.common.testing.NullPointerTester; import java.util.Map.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultimapTest extends TestCase { @SuppressWarnings("JUnitIncompatibleType") diff --git a/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java b/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java index 62dfb82d037b..b1dd49d6e0bb 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableMultisetTest.java @@ -53,6 +53,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -61,7 +62,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableMultisetTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java index 317644e1421d..f8dfc39a2990 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSetMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an {@link ImmutableSetMultimap} with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Mike Ward */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java b/guava-tests/test/com/google/common/collect/ImmutableSetMultimapTest.java index abe2f9a7dd93..9d4a7d2b3abd 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 691c97dcfaa5..e072256ffdc8 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSetTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSetTest.java @@ -48,6 +48,7 @@ import java.util.stream.Collector; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -58,7 +59,7 @@ * @author Nick Kralevich */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java b/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java index 83e46ccdb8bd..83e60204c222 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSortedMapTest.java @@ -58,6 +58,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -69,7 +70,7 @@ */ @GwtCompatible(emulated = true) @SuppressWarnings("AlwaysThrows") -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedMapTest extends TestCase { // TODO: Avoid duplicating code in ImmutableMapTest diff --git a/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java b/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java index e8ac90cc6ccb..5b4ffae39e01 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableSortedSetTest.java @@ -60,6 +60,7 @@ import java.util.stream.Collector; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -68,7 +69,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableSortedSetTest extends AbstractImmutableSetTest { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ImmutableTableTest.java b/guava-tests/test/com/google/common/collect/ImmutableTableTest.java index 4428b46a78d9..4b40a94977de 100644 --- a/guava-tests/test/com/google/common/collect/ImmutableTableTest.java +++ b/guava-tests/test/com/google/common/collect/ImmutableTableTest.java @@ -28,6 +28,7 @@ import com.google.common.testing.CollectorTester; import com.google.common.testing.SerializableTester; import java.util.stream.Collector; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ImmutableTableTest extends AbstractTableReadTest { @Override protected Table create(@Nullable Object... data) { diff --git a/guava-tests/test/com/google/common/collect/IterablesTest.java b/guava-tests/test/com/google/common/collect/IterablesTest.java index 9eaeab45b3cc..822afba35109 100644 --- a/guava-tests/test/com/google/common/collect/IterablesTest.java +++ b/guava-tests/test/com/google/common/collect/IterablesTest.java @@ -65,6 +65,7 @@ import java.util.SortedSet; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -74,7 +75,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class IterablesTest extends TestCase { public void testSize0() { diff --git a/guava-tests/test/com/google/common/collect/IteratorsTest.java b/guava-tests/test/com/google/common/collect/IteratorsTest.java index 77f9fa804315..c61e04ba7df4 100644 --- a/guava-tests/test/com/google/common/collect/IteratorsTest.java +++ b/guava-tests/test/com/google/common/collect/IteratorsTest.java @@ -74,6 +74,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -82,7 +83,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class IteratorsTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/LegacyComparable.java b/guava-tests/test/com/google/common/collect/LegacyComparable.java index 93c92aa82cf8..c7285a92d912 100644 --- a/guava-tests/test/com/google/common/collect/LegacyComparable.java +++ b/guava-tests/test/com/google/common/collect/LegacyComparable.java @@ -20,6 +20,7 @@ import com.google.common.annotations.GwtCompatible; import java.io.Serializable; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ */ @SuppressWarnings({"ComparableType", "rawtypes"}) // https://github.com/google/guava/issues/989 @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked class LegacyComparable implements Comparable, Serializable { static final LegacyComparable X = new LegacyComparable("x"); static final LegacyComparable Y = new LegacyComparable("y"); diff --git a/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java b/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java index ac6ee54b10e0..451917e3c70f 100644 --- a/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/LinkedHashMultimapTest.java @@ -48,6 +48,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -56,7 +57,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedHashMultimapTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java b/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java index 739748a6a902..34d888b72361 100644 --- a/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java +++ b/guava-tests/test/com/google/common/collect/LinkedHashMultisetTest.java @@ -31,6 +31,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link LinkedHashMultiset}. @@ -38,7 +39,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedHashMultisetTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java b/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java index ed4df7f0ec42..502ac3e16289 100644 --- a/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java +++ b/guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java @@ -50,6 +50,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -58,7 +59,7 @@ * @author Mike Bostock */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class LinkedListMultimapTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/ListsImplTest.java b/guava-tests/test/com/google/common/collect/ListsImplTest.java index b99d65fcda5a..68ce8362d7f3 100644 --- a/guava-tests/test/com/google/common/collect/ListsImplTest.java +++ b/guava-tests/test/com/google/common/collect/ListsImplTest.java @@ -34,11 +34,12 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Tests the package level *impl methods directly using various types of lists. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ListsImplTest extends TestCase { /** Describes how a list is modifiable */ diff --git a/guava-tests/test/com/google/common/collect/ListsTest.java b/guava-tests/test/com/google/common/collect/ListsTest.java index 844b9f449e8b..f881b2c8c65b 100644 --- a/guava-tests/test/com/google/common/collect/ListsTest.java +++ b/guava-tests/test/com/google/common/collect/ListsTest.java @@ -61,6 +61,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@code Lists}. @@ -70,7 +71,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ListsTest extends TestCase { private static final Collection SOME_COLLECTION = asList(0, 1, 1); diff --git a/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java b/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java index de190d423ce9..b6580f68c66a 100644 --- a/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java +++ b/guava-tests/test/com/google/common/collect/MapsSortedTransformValuesTest.java @@ -22,6 +22,7 @@ import com.google.common.base.Function; import com.google.common.base.Functions; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Maps#transformValues(SortedMap, Function)}. @@ -29,7 +30,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsSortedTransformValuesTest extends AbstractMapsTransformValuesTest { @Override protected SortedMap makeEmptyMap() { diff --git a/guava-tests/test/com/google/common/collect/MapsTest.java b/guava-tests/test/com/google/common/collect/MapsTest.java index 67b8c934f6dc..40e7a73e7f73 100644 --- a/guava-tests/test/com/google/common/collect/MapsTest.java +++ b/guava-tests/test/com/google/common/collect/MapsTest.java @@ -66,6 +66,7 @@ import java.util.TreeMap; import java.util.concurrent.ConcurrentMap; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -76,7 +77,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("JUnitIncompatibleType") // Many intentional violations here. public class MapsTest extends TestCase { diff --git a/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java b/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java index 55f3ac66348f..e1cafc86b964 100644 --- a/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java +++ b/guava-tests/test/com/google/common/collect/MapsTransformValuesTest.java @@ -22,6 +22,7 @@ import com.google.common.base.Function; import com.google.common.base.Functions; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Maps#transformValues(Map, Function)}. @@ -29,7 +30,7 @@ * @author Isaac Shum */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsTransformValuesTest extends AbstractMapsTransformValuesTest { @Override protected Map makeEmptyMap() { diff --git a/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java b/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java index 343ebcf77056..def9d6847706 100644 --- a/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/MapsTransformValuesUnmodifiableIteratorTest.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MapsTransformValuesUnmodifiableIteratorTest extends MapInterfaceTest { // TODO(jlevy): Move shared code of this class and MapsTransformValuesTest // to a superclass. diff --git a/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java b/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java index a94904e19441..2ba38f132a0b 100644 --- a/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java +++ b/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -61,7 +62,7 @@ * @author Sverre Sundsdal */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MinMaxPriorityQueueTest extends TestCase { private static final Ordering SOME_COMPARATOR = Ordering.natural().reverse(); diff --git a/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java b/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java index 7b1e66b23996..acdf8eb513d1 100644 --- a/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java +++ b/guava-tests/test/com/google/common/collect/MoreCollectorsTest.java @@ -25,6 +25,7 @@ import java.util.NoSuchElementException; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MoreCollectorsTest extends TestCase { public void testToOptionalEmpty() { assertThat(Stream.empty().collect(toOptional())).isEmpty(); diff --git a/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java b/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java index 034b3e3d1ae0..97857ffdeb0a 100644 --- a/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java +++ b/guava-tests/test/com/google/common/collect/MultimapBuilderTest.java @@ -29,6 +29,7 @@ import java.util.SortedMap; import java.util.SortedSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -37,7 +38,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapBuilderTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/MultimapsTest.java b/guava-tests/test/com/google/common/collect/MultimapsTest.java index d79c3043b702..6731614f8152 100644 --- a/guava-tests/test/com/google/common/collect/MultimapsTest.java +++ b/guava-tests/test/com/google/common/collect/MultimapsTest.java @@ -76,6 +76,7 @@ import java.util.stream.Collector; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -84,7 +85,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapsTest extends TestCase { private static final Comparator INT_COMPARATOR = diff --git a/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java b/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java index 78494be1b4d5..d68c9829ec44 100644 --- a/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java +++ b/guava-tests/test/com/google/common/collect/MultimapsTransformValuesAsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.base.Functions; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Tests for Multimaps.transformValues().asMap(). @@ -27,7 +28,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MultimapsTransformValuesAsMapTest extends AbstractMultimapAsMapImplementsMapTest { public MultimapsTransformValuesAsMapTest() { diff --git a/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java b/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java index 85afc4728191..a442aa814691 100644 --- a/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java +++ b/guava-tests/test/com/google/common/collect/MultisetsImmutableEntryTest.java @@ -22,6 +22,7 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Multiset.Entry; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -30,7 +31,7 @@ * @author Mike Bostock */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetsImmutableEntryTest extends TestCase { private static final @Nullable String NE = null; diff --git a/guava-tests/test/com/google/common/collect/MultisetsTest.java b/guava-tests/test/com/google/common/collect/MultisetsTest.java index fc540ec3174c..c9581b616584 100644 --- a/guava-tests/test/com/google/common/collect/MultisetsTest.java +++ b/guava-tests/test/com/google/common/collect/MultisetsTest.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.function.BiPredicate; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link Multisets}. @@ -43,7 +44,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class MultisetsTest extends TestCase { /* See MultisetsImmutableEntryTest for immutableEntry() tests. */ diff --git a/guava-tests/test/com/google/common/collect/NewCustomTableTest.java b/guava-tests/test/com/google/common/collect/NewCustomTableTest.java index 8d2b2bd96987..d8ff7eda0633 100644 --- a/guava-tests/test/com/google/common/collect/NewCustomTableTest.java +++ b/guava-tests/test/com/google/common/collect/NewCustomTableTest.java @@ -23,6 +23,7 @@ import com.google.common.base.Supplier; import java.util.Map; import java.util.TreeMap; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -31,7 +32,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class NewCustomTableTest extends AbstractTableTest { @Override diff --git a/guava-tests/test/com/google/common/collect/ObjectArraysTest.java b/guava-tests/test/com/google/common/collect/ObjectArraysTest.java index 01c121f48cdb..6afb08a509e4 100644 --- a/guava-tests/test/com/google/common/collect/ObjectArraysTest.java +++ b/guava-tests/test/com/google/common/collect/ObjectArraysTest.java @@ -25,6 +25,7 @@ import java.util.Arrays; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -33,7 +34,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class ObjectArraysTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/OrderingTest.java b/guava-tests/test/com/google/common/collect/OrderingTest.java index 95043fc0db01..e52589461ab2 100644 --- a/guava-tests/test/com/google/common/collect/OrderingTest.java +++ b/guava-tests/test/com/google/common/collect/OrderingTest.java @@ -50,6 +50,7 @@ import java.util.RandomAccess; import junit.framework.TestCase; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -58,7 +59,7 @@ * @author Jesse Wilson */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class OrderingTest extends TestCase { // TODO(cpovirk): some of these are inexplicably slow (20-30s) under GWT diff --git a/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java b/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java index ad260ef65186..76f3b50df872 100644 --- a/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/PeekingIteratorTest.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class PeekingIteratorTest extends TestCase { /** diff --git a/guava-tests/test/com/google/common/collect/RangeTest.java b/guava-tests/test/com/google/common/collect/RangeTest.java index d735749f948d..e1431f09d76e 100644 --- a/guava-tests/test/com/google/common/collect/RangeTest.java +++ b/guava-tests/test/com/google/common/collect/RangeTest.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -41,7 +42,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class RangeTest extends TestCase { public void testOpen() { Range range = Range.open(4, 8); diff --git a/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java index 72e31b0e0186..308e25eb0c3b 100644 --- a/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/collect/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java b/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java index 3f1f75d78ac5..74f719efe374 100644 --- a/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java +++ b/guava-tests/test/com/google/common/collect/RegularImmutableAsListTest.java @@ -16,6 +16,7 @@ import com.google.common.annotations.GwtCompatible; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -24,7 +25,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class RegularImmutableAsListTest extends TestCase { /** * RegularImmutableAsList should assume its input is null-free without checking, because it only diff --git a/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java b/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java index 1e697c95bbc2..86d67d5ad1e2 100644 --- a/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java +++ b/guava-tests/test/com/google/common/collect/RegularImmutableTableTest.java @@ -21,12 +21,13 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.Table.Cell; +import org.jspecify.annotations.NullMarked; /** * @author Gregory Kick */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class RegularImmutableTableTest extends AbstractImmutableTableTest { private static final ImmutableSet> CELLS = ImmutableSet.of( diff --git a/guava-tests/test/com/google/common/collect/SetOperationsTest.java b/guava-tests/test/com/google/common/collect/SetOperationsTest.java index fa7cb0c4b7f3..f17d0ee3b37e 100644 --- a/guava-tests/test/com/google/common/collect/SetOperationsTest.java +++ b/guava-tests/test/com/google/common/collect/SetOperationsTest.java @@ -32,6 +32,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@link Sets#union}, {@link Sets#intersection} and {@link Sets#difference}. @@ -39,7 +40,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetOperationsTest extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/guava-tests/test/com/google/common/collect/SetsTest.java b/guava-tests/test/com/google/common/collect/SetsTest.java index fa467f7c58fd..de4b4cf28fd3 100644 --- a/guava-tests/test/com/google/common/collect/SetsTest.java +++ b/guava-tests/test/com/google/common/collect/SetsTest.java @@ -84,6 +84,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -93,7 +94,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SetsTest extends TestCase { private static final IteratorTester.KnownOrder KNOWN_ORDER = diff --git a/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java b/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java index 7dd66df559da..6ffa66df4d77 100644 --- a/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java +++ b/guava-tests/test/com/google/common/collect/SimpleAbstractMultisetTest.java @@ -33,6 +33,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ */ @SuppressWarnings("serial") // No serialization is used in this test @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SimpleAbstractMultisetTest extends TestCase { @J2ktIncompatible @GwtIncompatible // suite diff --git a/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java b/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java index 42b239aa0ff8..2dded744ce1d 100644 --- a/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java +++ b/guava-tests/test/com/google/common/collect/SingletonImmutableTableTest.java @@ -23,6 +23,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Objects; import com.google.common.testing.EqualsTester; +import org.jspecify.annotations.NullMarked; /** * Tests {@link SingletonImmutableTable}. @@ -30,7 +31,7 @@ * @author Gregory Kick */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SingletonImmutableTableTest extends AbstractImmutableTableTest { private final ImmutableTable testTable = new SingletonImmutableTable<>('a', 1, "blah"); diff --git a/guava-tests/test/com/google/common/collect/SortedIterablesTest.java b/guava-tests/test/com/google/common/collect/SortedIterablesTest.java index c918b1dba809..9b1d04bba477 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 95d2e16933e4..797f9dc6251d 100644 --- a/guava-tests/test/com/google/common/collect/SortedListsTest.java +++ b/guava-tests/test/com/google/common/collect/SortedListsTest.java @@ -22,6 +22,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for SortedLists. @@ -29,7 +30,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class SortedListsTest extends TestCase { private static final ImmutableList LIST_WITH_DUPS = ImmutableList.of(1, 1, 2, 4, 4, 4, 8); diff --git a/guava-tests/test/com/google/common/collect/StreamsTest.java b/guava-tests/test/com/google/common/collect/StreamsTest.java index c7087544e7ab..c1f286908bf2 100644 --- a/guava-tests/test/com/google/common/collect/StreamsTest.java +++ b/guava-tests/test/com/google/common/collect/StreamsTest.java @@ -40,11 +40,12 @@ import java.util.stream.LongStream; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Unit test for {@link Streams}. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class StreamsTest extends TestCase { /* * Full and proper black-box testing of a Stream-returning method is extremely involved, and is diff --git a/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java index f53b8b3038f0..f97c6e792ecc 100644 --- a/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java +++ b/guava-tests/test/com/google/common/collect/SubMapMultimapAsMapImplementsMapTest.java @@ -22,6 +22,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@code TreeMultimap.asMap().subMap()} with {@link MapInterfaceTest}. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class SubMapMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { public SubMapMultimapAsMapImplementsMapTest() { diff --git a/guava-tests/test/com/google/common/collect/TableCollectionTest.java b/guava-tests/test/com/google/common/collect/TableCollectionTest.java index 9425722c141c..82b46b12a463 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 15d3f9efe5fd..afdf96928515 100644 --- a/guava-tests/test/com/google/common/collect/TableCollectorsTest.java +++ b/guava-tests/test/com/google/common/collect/TableCollectorsTest.java @@ -32,11 +32,12 @@ import java.util.stream.Collector; import java.util.stream.Stream; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Unit tests for {@link TableCollectors}. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TableCollectorsTest extends TestCase { public void testToImmutableTable() { Collector, ?, ImmutableTable> collector = diff --git a/guava-tests/test/com/google/common/collect/TablesTest.java b/guava-tests/test/com/google/common/collect/TablesTest.java index 4ea911bbbb29..ebf096d3f429 100644 --- a/guava-tests/test/com/google/common/collect/TablesTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTest.java @@ -24,6 +24,7 @@ import com.google.common.testing.EqualsTester; import com.google.common.testing.SerializableTester; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTest extends TestCase { @GwtIncompatible // SerializableTester public void testImmutableEntrySerialization() { diff --git a/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java index d25c2358dfbf..e5887875d742 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnMapTest.java @@ -22,9 +22,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesColumnMapTest extends ColumnMapTests { public TablesTransformValuesColumnMapTest() { super(false, true, true, false); diff --git a/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java index 9647a6f70ccd..c1a140092acc 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTransformValuesColumnTest.java @@ -22,9 +22,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesColumnTest extends ColumnTests { public TablesTransformValuesColumnTest() { super(false, false, true, true, false); diff --git a/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java index 77cfd4142c1d..0a3918b39ef6 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTransformValuesRowMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesRowMapTest extends RowMapTests { public TablesTransformValuesRowMapTest() { super(false, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java index 95d58a58fbfc..de34b485640d 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTransformValuesRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesRowTest extends RowTests { public TablesTransformValuesRowTest() { super(false, false, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java b/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java index 452c70a93d14..e06865dbc263 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTransformValuesTest.java @@ -24,6 +24,7 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.J2ktIncompatible; import com.google.common.base.Function; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -32,7 +33,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransformValuesTest extends AbstractTableTest { private static final Function<@Nullable String, @Nullable Character> FIRST_CHARACTER = diff --git a/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java b/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java index ee813e358ff4..f8e67f990829 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTransposeColumnTest.java @@ -20,9 +20,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransposeColumnTest extends ColumnTests { public TablesTransposeColumnTest() { super(false, true, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java b/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java index 25f1bcfa37ce..524ed112d70a 100644 --- a/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java +++ b/guava-tests/test/com/google/common/collect/TablesTransposeRowTest.java @@ -20,9 +20,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TablesTransposeRowTest extends RowTests { public TablesTransposeRowTest() { super(false, true, true, true, false); diff --git a/guava-tests/test/com/google/common/collect/TransposedTableTest.java b/guava-tests/test/com/google/common/collect/TransposedTableTest.java index 6c87b99efecb..736c8ff4518d 100644 --- a/guava-tests/test/com/google/common/collect/TransposedTableTest.java +++ b/guava-tests/test/com/google/common/collect/TransposedTableTest.java @@ -19,6 +19,7 @@ import static com.google.common.collect.Tables.transpose; import com.google.common.annotations.GwtCompatible; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TransposedTableTest extends AbstractTableTest { @Override diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java index 4fa7b5aaeca6..f27017d6cfa2 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableColumnMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableColumnMapTest extends ColumnMapTests { public TreeBasedTableColumnMapTest() { super(false, true, true, false); diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java index 48049bc5913e..b4e6008e38cd 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableColumnTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableColumnTest extends ColumnTests { public TreeBasedTableColumnTest() { super(false, true, true, true, false); diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java index 274594166764..59ba288793de 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapHeadMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapHeadMapTest extends RowMapTests { public TreeBasedTableRowMapHeadMapTest() { super(false, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java index ba4235d7748a..d9c5ba1e457a 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapSubMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapSubMapTest extends RowMapTests { public TreeBasedTableRowMapSubMapTest() { super(false, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java index 862d78c7d1b2..cf25c9d5972d 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTailMapTest.java @@ -19,9 +19,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapTailMapTest extends RowMapTests { public TreeBasedTableRowMapTailMapTest() { super(false, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java index 46a925a58f63..e9c891fa24ef 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableRowMapTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowMapTest extends RowMapTests { public TreeBasedTableRowMapTest() { super(false, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java index 7884b61104f4..990732ee3c67 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableRowTest.java @@ -18,9 +18,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableRowTest extends RowTests { public TreeBasedTableRowTest() { super(false, true, true, true, true); diff --git a/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java b/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java index e663ff280ae1..aedd2e5d7422 100644 --- a/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java +++ b/guava-tests/test/com/google/common/collect/TreeBasedTableTest.java @@ -37,6 +37,7 @@ import java.util.SortedMap; import junit.framework.Test; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeBasedTableTest extends AbstractTableTest { @J2ktIncompatible @GwtIncompatible // suite diff --git a/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java b/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java index f69c54a15fcb..cb85a7bfb017 100644 --- a/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java +++ b/guava-tests/test/com/google/common/collect/TreeMultimapExplicitTest.java @@ -30,6 +30,7 @@ import java.util.Map.Entry; import java.util.SortedSet; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -38,7 +39,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultimapExplicitTest extends TestCase { /** diff --git a/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java b/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java index f50a512446d6..bd4f2b945a28 100644 --- a/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java +++ b/guava-tests/test/com/google/common/collect/TreeMultimapNaturalTest.java @@ -52,6 +52,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; /** * Unit tests for {@code TreeMultimap} with natural ordering. @@ -59,7 +60,7 @@ * @author Jared Levy */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultimapNaturalTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/TreeMultisetTest.java b/guava-tests/test/com/google/common/collect/TreeMultisetTest.java index 8cd6cbd57574..38149fc57386 100644 --- a/guava-tests/test/com/google/common/collect/TreeMultisetTest.java +++ b/guava-tests/test/com/google/common/collect/TreeMultisetTest.java @@ -41,6 +41,7 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -49,7 +50,7 @@ * @author Neal Kanodia */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeMultisetTest extends TestCase { @J2ktIncompatible diff --git a/guava-tests/test/com/google/common/collect/TreeTraverserTest.java b/guava-tests/test/com/google/common/collect/TreeTraverserTest.java index 80e8a62a14c7..2e10b37e7a4e 100644 --- a/guava-tests/test/com/google/common/collect/TreeTraverserTest.java +++ b/guava-tests/test/com/google/common/collect/TreeTraverserTest.java @@ -24,6 +24,7 @@ import com.google.common.testing.NullPointerTester; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@code TreeTraverser}. @@ -31,7 +32,7 @@ * @author Louis Wasserman */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class TreeTraverserTest extends TestCase { private static class Node { final char value; diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java index fad660a0c6f6..452e513a9430 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableIteratorTest.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link UnmodifiableIterator}. @@ -29,7 +30,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableIteratorTest extends TestCase { @SuppressWarnings("DoNotCall") diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java index 02cf78e2baa7..e1d159ae73cc 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableListIteratorTest.java @@ -23,6 +23,7 @@ import java.util.ListIterator; import java.util.NoSuchElementException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for UnmodifiableListIterator. @@ -30,7 +31,7 @@ * @author Louis Wasserman */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableListIteratorTest extends TestCase { @SuppressWarnings("DoNotCall") public void testRemove() { diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java index f485b8bb0e5e..6296f494b9ea 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableMultimapAsMapImplementsMapTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.testing.MapInterfaceTest; import java.util.Collection; import java.util.Map; +import org.jspecify.annotations.NullMarked; /** * Test {@link Multimap#asMap()} for an unmodifiable multimap with {@link MapInterfaceTest}. @@ -27,7 +28,7 @@ * @author Jared Levy */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableMultimapAsMapImplementsMapTest extends AbstractMultimapAsMapImplementsMapTest { diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java index f9713c752bd5..dcd19b050459 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableColumnMapTest extends ColumnMapTests { public UnmodifiableRowSortedTableColumnMapTest() { super(false, false, false, false); diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java index c98dd1449b51..a18944d4141d 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableColumnTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableColumnTest extends ColumnTests { public UnmodifiableRowSortedTableColumnTest() { super(false, false, false, false, false); diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java index 7c1cc0c2850f..5fa5c14c9884 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowMapTest.java @@ -22,9 +22,10 @@ import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; import java.util.SortedMap; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableRowMapTest extends RowMapTests { public UnmodifiableRowSortedTableRowMapTest() { super(false, false, false, false); diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java index 67c011107e0b..511eb2afb34b 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableRowSortedTableRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableRowSortedTableRowTest extends RowTests { public UnmodifiableRowSortedTableRowTest() { super(false, false, false, false, false); diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java index 05d69df2e45f..a75a0437ee25 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableColumnMapTest extends ColumnMapTests { public UnmodifiableTableColumnMapTest() { super(false, false, false, false); diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java index 3296aedd9d57..70a8a7347fbc 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableTableColumnTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.ColumnTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableColumnTest extends ColumnTests { public UnmodifiableTableColumnTest() { super(false, false, false, false, false); diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java index 69fa02cc008c..904e6a8482b6 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableTableRowMapTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowMapTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableRowMapTest extends RowMapTests { public UnmodifiableTableRowMapTest() { super(false, false, false, false); diff --git a/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java b/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java index 973995a5af2a..e01db0878541 100644 --- a/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java +++ b/guava-tests/test/com/google/common/collect/UnmodifiableTableRowTest.java @@ -21,9 +21,10 @@ import com.google.common.annotations.GwtCompatible; import com.google.common.collect.TableCollectionTest.RowTests; import java.util.Map; +import org.jspecify.annotations.NullMarked; @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class UnmodifiableTableRowTest extends RowTests { public UnmodifiableTableRowTest() { super(false, false, false, false, false); diff --git a/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java b/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java index c82d23b517f1..85c754c75892 100644 --- a/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java +++ b/guava-tests/test/com/google/common/escape/ArrayBasedCharEscaperTest.java @@ -21,12 +21,13 @@ import com.google.common.escape.testing.EscaperAsserts; import java.io.IOException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author David Beaumont */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayBasedCharEscaperTest extends TestCase { private static final ImmutableMap NO_REPLACEMENTS = ImmutableMap.of(); private static final ImmutableMap SIMPLE_REPLACEMENTS = diff --git a/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java b/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java index 125749470a0d..c7ad03ad4193 100644 --- a/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java +++ b/guava-tests/test/com/google/common/escape/ArrayBasedUnicodeEscaperTest.java @@ -23,12 +23,13 @@ import com.google.common.escape.testing.EscaperAsserts; import java.io.IOException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * @author David Beaumont */ @GwtCompatible -@ElementTypesAreNonnullByDefault +@NullMarked public class ArrayBasedUnicodeEscaperTest extends TestCase { private static final ImmutableMap NO_REPLACEMENTS = ImmutableMap.of(); private static final ImmutableMap SIMPLE_REPLACEMENTS = diff --git a/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java index 5f27927038c7..f03f7b6e57ac 100644 --- a/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/escape/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java index 444185d69ff0..dda6301ade7d 100644 --- a/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/io/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/math/BigIntegerMathTest.java b/guava-tests/test/com/google/common/math/BigIntegerMathTest.java index 98454b458e96..e60cf683dfbc 100644 --- a/guava-tests/test/com/google/common/math/BigIntegerMathTest.java +++ b/guava-tests/test/com/google/common/math/BigIntegerMathTest.java @@ -52,13 +52,14 @@ import java.util.EnumSet; import java.util.Map; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for BigIntegerMath. * * @author Louis Wasserman */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class BigIntegerMathTest extends TestCase { public void testCeilingPowerOfTwo() { diff --git a/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java index a0be002dd995..3c7c363b3264 100644 --- a/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/math/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java index 693a6565a8a4..86e8f9903637 100644 --- a/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/net/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/primitives/BooleansTest.java b/guava-tests/test/com/google/common/primitives/BooleansTest.java index 15c80b41ffb0..67ab066c41dc 100644 --- a/guava-tests/test/com/google/common/primitives/BooleansTest.java +++ b/guava-tests/test/com/google/common/primitives/BooleansTest.java @@ -32,6 +32,7 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -40,7 +41,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class BooleansTest extends TestCase { private static final boolean[] EMPTY = {}; private static final boolean[] ARRAY_FALSE = {false}; diff --git a/guava-tests/test/com/google/common/primitives/BytesTest.java b/guava-tests/test/com/google/common/primitives/BytesTest.java index b395a204aac0..6c56ad0e1d7f 100644 --- a/guava-tests/test/com/google/common/primitives/BytesTest.java +++ b/guava-tests/test/com/google/common/primitives/BytesTest.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -36,7 +37,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class BytesTest extends TestCase { private static final byte[] EMPTY = {}; diff --git a/guava-tests/test/com/google/common/primitives/CharsTest.java b/guava-tests/test/com/google/common/primitives/CharsTest.java index 6da8be85115c..5645a0f14cc7 100644 --- a/guava-tests/test/com/google/common/primitives/CharsTest.java +++ b/guava-tests/test/com/google/common/primitives/CharsTest.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Locale; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked public class CharsTest extends TestCase { private static final char[] EMPTY = {}; private static final char[] ARRAY1 = {(char) 1}; diff --git a/guava-tests/test/com/google/common/primitives/DoublesTest.java b/guava-tests/test/com/google/common/primitives/DoublesTest.java index bf0d211ebd7e..fa7aa36cbf2d 100644 --- a/guava-tests/test/com/google/common/primitives/DoublesTest.java +++ b/guava-tests/test/com/google/common/primitives/DoublesTest.java @@ -38,6 +38,7 @@ import java.util.List; import java.util.regex.Pattern; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -45,7 +46,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class DoublesTest extends TestCase { private static final double[] EMPTY = {}; diff --git a/guava-tests/test/com/google/common/primitives/FloatsTest.java b/guava-tests/test/com/google/common/primitives/FloatsTest.java index c35cbc4799d4..6522be8bff55 100644 --- a/guava-tests/test/com/google/common/primitives/FloatsTest.java +++ b/guava-tests/test/com/google/common/primitives/FloatsTest.java @@ -37,6 +37,7 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FloatsTest extends TestCase { private static final float[] EMPTY = {}; diff --git a/guava-tests/test/com/google/common/primitives/IntsTest.java b/guava-tests/test/com/google/common/primitives/IntsTest.java index a64cf2642c7f..2c5aa1913727 100644 --- a/guava-tests/test/com/google/common/primitives/IntsTest.java +++ b/guava-tests/test/com/google/common/primitives/IntsTest.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -44,7 +45,7 @@ * @author Kevin Bourrillion */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked @SuppressWarnings("cast") // redundant casts are intentional and harmless public class IntsTest extends TestCase { private static final int[] EMPTY = {}; diff --git a/guava-tests/test/com/google/common/primitives/LongsTest.java b/guava-tests/test/com/google/common/primitives/LongsTest.java index b84972e53716..0bfa4dd5d82d 100644 --- a/guava-tests/test/com/google/common/primitives/LongsTest.java +++ b/guava-tests/test/com/google/common/primitives/LongsTest.java @@ -39,6 +39,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -46,7 +47,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class LongsTest extends TestCase { private static final long[] EMPTY = {}; diff --git a/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java index 2c903ac7acdb..67654ea330ef 100644 --- a/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/primitives/ReflectionFreeAssertThrows.java @@ -31,11 +31,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/primitives/ShortsTest.java b/guava-tests/test/com/google/common/primitives/ShortsTest.java index 9f40936dd7eb..60d8670c4be9 100644 --- a/guava-tests/test/com/google/common/primitives/ShortsTest.java +++ b/guava-tests/test/com/google/common/primitives/ShortsTest.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Random; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -43,7 +44,7 @@ * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class ShortsTest extends TestCase { private static final short[] EMPTY = {}; diff --git a/guava-tests/test/com/google/common/primitives/SignedBytesTest.java b/guava-tests/test/com/google/common/primitives/SignedBytesTest.java index d2770657fd99..e186066e4b63 100644 --- a/guava-tests/test/com/google/common/primitives/SignedBytesTest.java +++ b/guava-tests/test/com/google/common/primitives/SignedBytesTest.java @@ -32,13 +32,14 @@ import java.util.Comparator; import java.util.List; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Unit test for {@link SignedBytes}. * * @author Kevin Bourrillion */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class SignedBytesTest extends TestCase { private static final byte[] EMPTY = {}; diff --git a/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java b/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java index 309b0029abd3..3339f08877d5 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/FluentFutureTest.java @@ -34,12 +34,13 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeoutException; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; /** * Tests for {@link FluentFuture}. The tests cover only the basics for the API. The actual logic is * tested in {@link FuturesTest}. */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FluentFutureTest extends TestCase { public void testFromFluentFuture() { diff --git a/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java b/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java index ade301520edc..1fc69011f37b 100644 --- a/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java @@ -94,6 +94,7 @@ import java.util.logging.Logger; import junit.framework.AssertionFailedError; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** @@ -101,7 +102,7 @@ * * @author Nishant Thakkar */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class FuturesTest extends TestCase { private static final Logger aggregateFutureLogger = diff --git a/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java b/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java index 7c2b29bd6ca8..a0f455ec170c 100644 --- a/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java +++ b/guava-tests/test/com/google/common/util/concurrent/ReflectionFreeAssertThrows.java @@ -35,11 +35,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import junit.framework.AssertionFailedError; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Replacements for JUnit's {@code assertThrows} that work under GWT/J2CL. */ @GwtCompatible(emulated = true) -@ElementTypesAreNonnullByDefault +@NullMarked final class ReflectionFreeAssertThrows { interface ThrowingRunnable { void run() throws Throwable; diff --git a/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java b/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java index 17357b525a03..969357713648 100644 --- a/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java +++ b/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java @@ -35,10 +35,11 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import junit.framework.TestCase; +import org.jspecify.annotations.NullMarked; import org.checkerframework.checker.nullness.qual.Nullable; /** Test case for {@link TrustedListenableFutureTask}. */ -@ElementTypesAreNonnullByDefault +@NullMarked @GwtCompatible(emulated = true) public class TrustedListenableFutureTaskTest extends TestCase { diff --git a/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java b/guava/src/com/google/common/base/ElementTypesAreNonnullByDefault.java deleted file mode 100644 index a0adb0236c89..000000000000 --- 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 0bcc65dc2eb5..3fadb315554a 100644 --- a/guava/src/com/google/common/base/ParametricNullness.java +++ b/guava/src/com/google/common/base/ParametricNullness.java @@ -56,8 +56,8 @@ *
                              *
                            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/base/package-info.java b/guava/src/com/google/common/base/package-info.java index 8cdbdca4c236..c73391c3b4e4 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 51431fe419ea..000000000000 --- 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 eaf194d4ab1c..8892bb45267d 100644 --- a/guava/src/com/google/common/cache/ParametricNullness.java +++ b/guava/src/com/google/common/cache/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                *
                              • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                              • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/cache/package-info.java b/guava/src/com/google/common/cache/package-info.java index e494d931f42b..e7c453dd8d0e 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 8fe0fb375643..000000000000 --- 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 207c05262e41..8074de5d5689 100644 --- a/guava/src/com/google/common/collect/ParametricNullness.java +++ b/guava/src/com/google/common/collect/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                  *
                                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/collect/package-info.java b/guava/src/com/google/common/collect/package-info.java index 048b7d8d72f1..d9f2331e1a64 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 93130cb88176..000000000000 --- 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 f964ca4a4f61..9ac5d62e1296 100644 --- a/guava/src/com/google/common/escape/ParametricNullness.java +++ b/guava/src/com/google/common/escape/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                  *
                                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/escape/package-info.java b/guava/src/com/google/common/escape/package-info.java index 80c42464e1bb..173f811a3aae 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 8ef823148266..000000000000 --- 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 47c7d8d4d063..fd07ef09cb60 100644 --- a/guava/src/com/google/common/eventbus/ParametricNullness.java +++ b/guava/src/com/google/common/eventbus/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                    *
                                  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                  • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/eventbus/package-info.java b/guava/src/com/google/common/eventbus/package-info.java index 3808bde9a221..b387bc234010 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 0821642f52d4..000000000000 --- 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 32fd5ee7ecaa..634ee0e19782 100644 --- a/guava/src/com/google/common/graph/ParametricNullness.java +++ b/guava/src/com/google/common/graph/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                      *
                                    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/graph/package-info.java b/guava/src/com/google/common/graph/package-info.java index bed41eefec3a..7e97756afabf 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 ab3aa88d9d7a..000000000000 --- 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 4ebc40bb741e..f5a8614a8762 100644 --- a/guava/src/com/google/common/hash/ParametricNullness.java +++ b/guava/src/com/google/common/hash/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                        *
                                      • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                      • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/hash/package-info.java b/guava/src/com/google/common/hash/package-info.java index 9dbbbaac3438..b5405d48129c 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 5e471bdbbce9..000000000000 --- 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 50a64c781c90..a43cc22a06b0 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 03f51fdb04c3..ccfd5b5693f9 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 321b5826baa6..000000000000 --- 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 881c07d49804..32eee700e1c6 100644 --- a/guava/src/com/google/common/io/ParametricNullness.java +++ b/guava/src/com/google/common/io/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                            *
                                          • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                          • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/io/package-info.java b/guava/src/com/google/common/io/package-info.java index c29b61a74d97..30cff81d2fd2 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 d314278a8076..000000000000 --- 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 612fa934a6d5..a18ba9348f9a 100644 --- a/guava/src/com/google/common/math/ParametricNullness.java +++ b/guava/src/com/google/common/math/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                              *
                                            • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                            • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/math/package-info.java b/guava/src/com/google/common/math/package-info.java index da2392a6a5a5..663d3bced554 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 3c8b9f4225f8..000000000000 --- 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 83b9eb6fa6a3..5b3af1736ee1 100644 --- a/guava/src/com/google/common/net/ParametricNullness.java +++ b/guava/src/com/google/common/net/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                                *
                                              • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                              • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/net/package-info.java b/guava/src/com/google/common/net/package-info.java index 1fa33a1ad434..562bb10e4f99 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 1240d1075a28..000000000000 --- 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 c40ea499d4ce..9af83702c0b1 100644 --- a/guava/src/com/google/common/primitives/ParametricNullness.java +++ b/guava/src/com/google/common/primitives/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                                  *
                                                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/primitives/package-info.java b/guava/src/com/google/common/primitives/package-info.java index 2fdf789228e7..67e87ac3d65a 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 594c4c394bf6..000000000000 --- 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 372a53bb616f..4cc7fd284847 100644 --- a/guava/src/com/google/common/reflect/ParametricNullness.java +++ b/guava/src/com/google/common/reflect/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                                  *
                                                • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                                • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/reflect/package-info.java b/guava/src/com/google/common/reflect/package-info.java index 71583d47498e..7a3f435e530b 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 4dc5c72362d4..000000000000 --- 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 cdc2ee110b99..ba5c58820023 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 e8fcce6ee681..f12f1133e6df 100644 --- a/guava/src/com/google/common/util/concurrent/ParametricNullness.java +++ b/guava/src/com/google/common/util/concurrent/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                                    *
                                                  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                                  • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/util/concurrent/package-info.java b/guava/src/com/google/common/util/concurrent/package-info.java index 41af41c0d3ab..c5b199b07292 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 4a6bee38582a..000000000000 --- 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 439707a2edb1..0d989c7cefa6 100644 --- a/guava/src/com/google/common/xml/ParametricNullness.java +++ b/guava/src/com/google/common/xml/ParametricNullness.java @@ -56,8 +56,8 @@ *
                                                      *
                                                    • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type * argument is non-nullable and (b) nullable when the type argument is nullable. We use this - * to "undo" {@link ElementTypesAreNonnullByDefault}. It is the best we can do for Kotlin - * under our current constraints. + * to reduce the immediate effects of {@code NullMarked} as we transition to JSpecify + * annotations. *
                                                    • NullAway, which will treat it * identically to {@code Nullable} as of version 0.9.9. To treat it that way before then, diff --git a/guava/src/com/google/common/xml/package-info.java b/guava/src/com/google/common/xml/package-info.java index c06e1b5702f9..a263f55f44c8 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;