Repository navigation
Releases
33.0.0
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.0.0-jre</version>
<!-- or, for Android: -->
<version>33.0.0-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
- This version of
guava-androidcontains some package-private methods whose signature includes the Java 8CollectorAPI. This is a test to identify any problems before we expose those methods publicly to users. Please report any problems that you encounter. (73dbf7e) - Changed various classes to catch
Exceptioninstead ofRuntimeExceptioneven when onlyRuntimeExceptionis theoretically possible. This can help code that throws undeclared exceptions, as some bytecode rewriters (e.g., Robolectric) and languages (e.g., Kotlin) do. (c294c23, 747924e, b2baf48) - Added an
Automatic-Module-Nametofailureaccess, Guava's one strong runtime dependency. (280b5d2) reflect: Inguava-androidonly, removedInvokable.getAnnotatedReturnType()andParameter.getAnnotatedType(). These methods never worked in an Android VM, and to reflect that, they were born@Deprecated,@Beta, and@DoNotCall. They're now preventing us from rolling out some new Android compatibility testing. This is the only binary-incompatible change in this release, and it should have no effect in practice. Still, we bump the major version number to follow Semantic Versioning. (045cd84)util.concurrent: Changed our implementations to avoid eagerly initializing loggers during class loading. This can help performance, especially under Android. (4fe1df5)
32.1.3
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.3-jre</version>
<!-- or, for Android: -->
<version>32.1.3-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
- Changed Gradle Metadata to include dependency versions directly. This may address "Could not find
some-dependency" errors that some users have reported (which might be a result of users' excludingguava-parent). (c6d35cf) collect: ChangedMultisets.unmodifiableMultiset(set).removeIf(predicate)to throw an exception always, even if nothing matchespredicate. (61dbccf)graph: Fixed the behavior ofGraph/ValueGraphviews for a node when that node is removed from the graph. (9507996)io: FixedFiles.createTempDirandFileBackedOutputStreamunder Windows services, a rare use case. (The fix actually covers only Java 9+ because Java 8 would require an additional approach. Let us know if you need support under Java 8.) (f87f68c)net: MadeMediaType.parseallow and skip over whitespace around the/and=separator tokens in addition to the;separator, for which it was already being allowed. (2786f83)util.concurrent: TweakedFutures.getCheckedconstructor-selection behavior: The method continues to prefer to call constructors with aStringparameter, but now it breaks ties based on whether the constructor has aThrowableparameter. Beyond that, the choice of constructor remains undefined. (For this and other reasons, we discourage the use ofgetChecked.) (59cfb22)
32.1.2
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
<!-- or, for Android: -->
<version>32.1.2-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
- Removed the section of our Gradle metadata that caused Gradle to report conflicts with
listenablefuture. (9ed0fa6) - Changed our Maven project to avoid affecting which version of Mockito our Gradle users see. (71a16d5)
collect: Under J2CL, exposedImmutableListandImmutableSetmethodscopyOfandoffor JavaScript usage. (b41968f)net: OptimizedInternetDomainNameconstruction. (3a1d18f, eaa62eb)
32.1.1
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.1-jre</version>
<!-- or, for Android: -->
<version>32.1.1-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
- Fixed our broken Gradle metadata from 32.1.0. Sorry again for the trouble. If you use Gradle, please still read the release notes from that version: You may still see errors from the new checking that the metadata enables, and the release notes discuss how to fix those errors.
32.1.0
Warning: Our Gradle-metadata version numbers are broken. Read these notes, but upgrade straight to 32.1.2.
We made a mistake in our release script, so the new Gradle metadata (discussed below) has broken version numbers in 32.1.0. Sorry for the trouble and for the need for another quick patch release. We recommend upgrading straight to release 32.1.2, especially if you use Gradle or if you publish a library whose users might use Gradle. Still, read the release notes below if you use Gradle, since the fixed Gradle metadata in 32.1.2 may still require action on your part.
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.0-jre</version>
<!-- or, for Android: -->
<version>32.1.0-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
Gradle Module Metadata
Warning: We made a mistake in our release script, so this is broken in 32.1.0. We recommend upgrading straight to release 32.1.2, especially if you use Gradle or if you publish a library whose users might use Gradle. Still, read the release notes below if you use Gradle, since the fixed Gradle metadata in 32.1.2 may still require action on your part.
The Gradle team has contributed a metadata file for Guava. If you use Gradle 6 or higher, you will see better handling of two kinds of dependency conflicts, plus another small feature related to our dependencies. As a result of this change, you may see errors, which you can resolve as documented below. If you encounter a problem that isn't documented below, or if the documentation is unclear, please let us know.
If you use Gradle 6 (not 5, not 7+)
You may see an error like this one:
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.google.guava:guava:30.1-jre.
Required by:
project : > com.google.cloud.tools.jib:com.google.cloud.tools.jib.gradle.plugin:2.8.0 > gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:2.8.0
> The consumer was configured to find a runtime of a library compatible with Java 15, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of com.google.guava:guava:32.1.1-jre:
- androidRuntimeElements
- jreRuntimeElements
All of them match the consumer attributes:
- Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.1-jre and com.google.guava:guava:32.1.1-jre and com.google.guava:listenablefuture:1.0 declares a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally:
If you do, you'll need to add something like this to a place where you configure the Java plugins:
sourceSets.all {
configurations.getByName(runtimeClasspathConfigurationName) {
attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm")
}
configurations.getByName(compileClasspathConfigurationName) {
attributes.attribute(Attribute.of("org.gradle.jvm.environment", String), "standard-jvm")
}
}If you see an error about a duplicate ListenableFuture class
For example:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-32.1.1-android (com.google.guava:guava:32.1.1-android) and jetified-listenablefuture-1.0 (com.google.guava:listenablefuture:1.0)
This appears to be a Gradle bug.
@mathisdt has provided a workaround:
dependencies {
# dependency definitions here ...
modules {
module("com.google.guava:listenablefuture") {
replacedBy("com.google.guava:guava", "listenablefuture is part of guava")
}
}
}
Selecting the appropriate flavor
When Gradle automatically selects the newest version of Guava in your dependency graph, it will now also select the appropriate flavor (-android or -jre) based on whether you project targets Android or not. For example, if you depend on 32.1.0-android and 30.0-jre, Gradle will select 32.1.0-jre. This is the version most likely to be compatible with all your dependencies.
In the unusual event that you need to override Gradle's choice of flavor, you can do so as follows:
dependencies.constraints {
implementation("com.google.guava:guava") {
attributes {
attribute(
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
objects.named(TargetJvmEnvironment, TargetJvmEnvironment.ANDROID))
}
}
}
// If the above leads to a conflict error because there are additional transitive dependencies to Guava, then use:
configurations.all {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.guava:guava") {
select(candidates.find { it.variantName.contains("android") })
}
}Reporting dependencies that overlap with Guava
If your dependency graph contains the very old google-collections or the hacky listenablefuture, Gradle will now report that those libraries contain duplicates of Guava classes. When this happens, you'll need to tell Gradle to select Guava:
configurations.all {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
// and/or
resolutionStrategy.capabilitiesResolution.withCapability("com.google.guava:listenablefuture") {
select("com.google.guava:guava:0")
}
}If that doesn't work, please let us know. And let us know whether our replacedBy workaround or these other workarounds work instead.
Omitting annotations at runtime
One dependency of Guava that is not needed at runtime (j2objc-annotations) is now omitted from the runtime classpath. (We may omit others in the future. See #6606.)
Other changes
collect: Tweaked more nullness annotations. (501a016, 5c23590)hash: Enhancedcrc32c()to use Java's hardware-accelerated implementation where available. (65c7f10)util.concurrent: AddedDuration-baseddefaultmethods toListeningExecutorService. (e7714b0)- Began updating Javadoc to focus less on APIs that have been superseded by additions to the JDK. We're also looking to add more documentation that directs users to JDK equivalents for our APIs. Further PRs welcome! (c9efc47, 01dcc2e)
- Fixed some problems with using Guava from a Java Agent. (But we don't test that configuration, and we don't know how well we'll be able to keep it working.) (e42d4e8, de62703)
- Fixed
BootstrapMethodErrorwhen usingCacheBuilderfrom a custom system class loader. (As with the previous item, we're not sure how well we'll be able to keep this use case working.) (a667c38) - Suppressed a harmless
unusable-by-jswarning seen by users ofguava-gwt.
32.0.1
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.1-jre</version>
<!-- or, for Android: -->
<version>32.0.1-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
io: FixedFiles.createTempDirandFileBackedOutputStreamunder Windows, which broke as part of the security fix in release 32.0.0. Sorry for the trouble. (fdbf77d)
32.0.0
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.0-jre</version>
<!-- or, for Android: -->
<version>32.0.0-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
Security fixes
- Reimplemented
Files.createTempDirandFileBackedOutputStreamto further address CVE-2020-8908 (#4011) and CVE-2023-2976 (#2575). (feb83a1)
While CVE-2020-8908 was officially closed when we deprecated Files.createTempDir in Guava 30.0, we've heard from users that even recent versions of Guava have been listed as vulnerable in other databases of security vulnerabilities. In response, we've reimplemented the method (and the very rarely used FileBackedOutputStream class, which had a similar issue) to eliminate the insecure behavior entirely. This change could technically affect users in a number of different ways (discussed under "Incompatible changes" below), but in practice, the only problem users are likely to encounter is with Windows. If you are using those APIs under Windows, you should skip 32.0.0 and go straight to 32.0.1 which fixes the problem. (Unfortunately, we didn't think of the Windows problem until after the release. And while we warn that common.io in particular may not work under Windows, we didn't intend to regress support.) Sorry for the trouble.
Incompatible changes
Although this release bumps Guava's major version number, it makes no binary-incompatible changes to the guava artifact.
One change could cause issues for Widows users, and a few other changes could cause issues for users in more usual situations:
- The new implementations of
Files.createTempDirandFileBackedOutputStreamthrow an exception under Windows. This is fixed in 32.0.1. Sorry for the trouble. guava-gwtnow requires GWT 2.10.0.- This release makes a binary-incompatible change to a
@BetaAPI in the separate artifactguava-testlib. Specifically, we changed the return type ofTestingExecutors.sameThreadScheduledExecutortoListeningScheduledExecutorService. The old return type was a package-private class, which caused the Kotlin compiler to produce warnings. (dafaa3e) - This release adds two methods to the Android flavor of Guava:
Invokable.getAnnotatedReturnType()andParameter.getAnnotatedType(). Those methods do not work under an Android VM; we added them only to help our tests of the Android flavor (since we also run those tests under a JRE). Android VMs tolerate such methods as long as the app does not call them or perform reflection on them, and builds tolerate them because of our new Proguard configurations (discussed below). Thus, we expect no impact to most users. However, we could imagine build problems for users who have set up their own build system for the Android flavor of Guava. Please report any problems so that we can judge how safely we might be able to add other methods to the Android flavor in the future, such as APIs that use Java 8 classes likeStream. (b30e73c) - This release removes various APIs from the
guava-gwt. This affects only users of GWT. The APIs we removed areEnums,Sets.complementOf, and theEnum*BiMapclasses'keyType()andvalueType()methods. These changes prepare for the removal of reflective enum-related APIs from J2CL. If one of these changes causes you problems as a GWT user, let us know. (c3a155d, 09db2c2, 3de12be) - The new implementations of
Files.createTempDirandFileBackedOutputStreamare annotated as@J2ObjCIncompatible. If you need to use them under J2ObjC, contact us. (56dc928) - Because the new version of
Files.createTempDirrestricts permissions to the current user, it could break any caller that relies on letting other users access the directory. - The new versions of
Files.createTempDirandFileBackedOutputStreamthrow an exception if they can't create the directory or file securely. Aside from the accidental Windows bug discussed above, this is possible only under Android Ice Cream Sandwich, a very old version of Android that is the oldest one we test Guava with.
Other changes
- Removed
@Betafrom almost all APIs. For details, see the bottom of the release notes. At this point, it's probably simpler to look at a list of APIs that still are@Beta, such as this list forguava-jre. Most of the remaining@BetaAPIs are ingraphandhash. - Enhanced the Guava jar to include Proguard configurations that are picked up automatically by the Android Gradle Plugin. This should help with warnings that were promoted to errors in Android Gradle Plugin 8.x. (aeba1e1)
- Enhanced the Guava jar to include information about method parameters in its class files. If you use static analyzers that look at method-parameter names, you may see new warnings or errors if they are now able to detect mismatches. But mostly, you may see better tooltips and autocompletion in IDEs. (59d174c)
- Improved nullness annotations on a few classes.
- Modified classes with "serial proxies" to declare exception-throwing
readObjectmethods, in accordance with best practice. (e62d6a0) collect: FixedMaps.newHashMapWithExpectedSizeto stop allocating maps that were larger than they needed to be. (6ad621e)collect: Made various APIs work J2CL:Maps.immutableEnumMap+toImmutableEnumMap,EnumMultiset,CollectorTester. Previously, the APIs were present but failed at runtime. (b62c88e, 23ff918, 852a7d3)collect: Optimized memory usage forInternerandMapMaker. (a2e8f3c)graph: Changed directed graphs to reject attempts to add undirected edges. (76260d9)io: AddedBaseEncoding.ignoreCase()to support case-insensitive decoding. (9c1e5de)net: AddedHttpHeadersconstants:net: Added theMediaTypeconstant for JWT. (f942fd2)primitives: Addedrotate()for arrays of all primitive types. (cd338fa, 6e9057d)util.concurrent: ChangedAbstractFutureto runinterruptTask()just beforeafterDone(). Until this change, it ran slightly earlier than that: We used to run it before unblocking any pendingget()calls, and now we run it after. (b337be6)util.concurrent: Fixed some cases in which we could catchInterruptedExceptionbut fail to restore the interrupt bit. (8f0350a)
@Beta removal list
base:Utf8(211907c)base: more APIs (b0cc461)collect:Multimaps.asMap(...)(df0081f)collect:FluentIterableAPIs (73b2f7b)collect:Forwarding[Foo]APIs (9760dbc)collect:ImmutableFoo.Builder.builderWithExpectedSize(...),orderEntriesByValue(...), andEntry-related APIs (61be35c)collect:RangeMap,RangeSet, and friends (fe12c81)collect: more APIs (98820c7, e5e0f66)io:ByteStreams(4897930)io: more APIs (a589256)math: various APIs (912815e)primitives:Longs.tryParse(...)and friends (b3d4856)primitives:UnsignedLongs(b240e8c)primitives: more APIs (fcec25f, ab4302a)reflect:Invokableand some methods inTypeToken(a195f7d)reflect:Parameter(exceptgetAnnotatedType()inguava-android) (b561eb1)testing: various APIs (b331769, 74ad9b8)util.concurrent:FluentFuture(b9a2d58)util.concurrent:Futures(15a0c9f)util.concurrent:Striped(ba8ad69)util.concurrent: variousMoreExecutorsAPIs (a3571b4)util.concurrent: more APIs (bbaf76a)
31.1
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<!-- or, for Android: -->
<version>31.1-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
base: Deprecated theThrowablesmethodslazyStackTraceandlazyStackTraceIsLazy. They are no longer useful on any current platform. (6ebd7d8)collect: Added a new methodImmutableMap.Builder.buildKeepingLast(), which keeps the last value for any given key rather than throwing an exception when a key appears more than once. (68500b2)collect: As a side-effect of thebuildKeepingLast()change, the idiomImmutableList.copyOf(Maps.transformValues(map, function))may produce different results iffunctionhas side-effects. (This is not recommended.) (68500b2)hash: AddedHashing.fingerprint2011(). (13f703c)io: ChangedByteStreams.nullOutputStream()to follow the contract ofOutputStream.writeby throwing an exception if the range of bytes is out of bounds. (1cd85d0)net: Added@CheckReturnValueto the package (with a few exceptions). (a0e2577)net: AddedHttpHeadersconstant forAccess-Control-Allow-Private-Network. (6dabbdf)util.concurrent: Added accumulate/update methods forAtomicDoubleandAtomicDoubleArray. (2d875d3)
APIs promoted from @Beta
base:ThrowablesmethodsgetCausalChainandgetCauseAs(dd462af)collect:StreamsmethodsmapWithIndexandfindLast(8079a29)collect: the remaining methods inComparators:min,max,lexicographical,emptiesFirst,emptiesLast,isInOrder,isInStrictOrder(a3e411c)escape: various APIs (468c68a)io: various APIs inFiles(828d9ee)net: various APIs (261ac7a)reflect: various APIs (9f6a384)testlib: various APIs (93a8f02)util.concurrent:AsyncCallable,ListenableScheduledFuture, andClosingFuture(8b4ad17)util.concurrent:ExecutionSequencer,MoreExecutors.newSequentialExecutor, andMonitor(189d668)util.concurrent:Futuresmethods:submit,submitAsync,scheduleAsync,nonCancellationPropagating,inCompletionOrder(e015172)util.concurrent:Uninterruptibles:awaitTerminationUninterruptiblyand theDurationoverloads in the class (825de9a)util.concurrent: theFluentFuturetype, its factory methods, andaddCallback(9c7e13b)
31.0.1
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0.1-jre</version>
<!-- or, for Android: -->
<version>31.0.1-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
- Fixed GWT compilation failure introduced in release 31.0. (0ad6d6d)
31.0
Maven
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0-jre</version>
<!-- or, for Android: -->
<version>31.0-android</version>
</dependency>Jar files
Guava requires one runtime dependency, which you can download here:
Javadoc
JDiff
Changelog
Known issue (fixed in patch release 31.0.1): guava-gwt breaks GWT compilation
Other Guava artifacts aren't affected, only users of GWT. (If you are using GWT, you would know it.)
Sorry for missing this during release: It was a known issue, and we had a partial workaround in place, but I forgot to include the problem in the list of release blockers.
To pick up the fix, upgrade to 31.0.1.
Main changes
- Changed
guava-androidto generate Java 8 bytecode. We still restrict ourselves to using APIs available on Ice Cream Sandwich. So, as long as you have enabled Java 8 language features for your Android build, this change should have no effect on Android projects. This change does drop support for Java 7 JREs, as announced last year. - Annotated Guava much more thoroughly for nullness. For details, see the bottom of the release notes.
base: ChangedFunctions.forSupplierandPredicates.instanceOfto accept an additional type argument to specify the input type for the returnedFunction/Predicate. The flexibility we're adding should typically not be necessary if users follow the PECS principle, but it can be useful in some cases, particularly around nullness analysis. Note that this change may require updates to callers' source code (to specify an additional type argument). Still, it maintains binary compatibility. (75110e9)collect: AddedImmutableMap.ofEntries, likeMap.ofEntriesbut forImmutableMap. (cd3b419)collect: Added overloads ofImmutableMap.of,ImmutableBiMap.of, andImmutableSortedMap.offor up to 10 entries. (d5c30e3)collect: RenamedImmutableMap.Builder.build()tobuildOrThrow(). The existingbuild()method will continue to exist but may be deprecated, and the new name should be used in new code. (4bbe12c)collect: Removed@BetafromInternerandInterners. (cf31f3a)collect: Added@InlineMetoStreams.stream(Optional)and friends. (a176cd6)graph: MadeEndpointPair.adjacentNoderequire anNinstead of accept anyObject. (b0be21d)hash: Removed@BetafromHashFunction. (e1cc195)hash: Deprecated buggymurmur3_32, and introducedmurmur3_32_fixed. (a36f08f)io: ChangedCharStreams.asWriter(appendable).write(string[, ...])to reject a nullstring. (50e7ddd)io: Fixed a bug inFileBackedOutputStreamcleanup: If writing to the temp file fails, we now delete it before propagating the exception. (6e054ce)net: ChangedHostAndPort.fromStringto reject port numbers spelled with non-ASCII digits. (53fd1d7)net: AddedHttpHeadersconstants forX-Device-Ip,X-Device-Referer,X-Device-Accept-Language,X-Device-Requested-With,Sec-CH-Prefers-Color-Scheme,Sec-CH-UA-Bitness, andKeep-Alive. (da375be, b23b277, 281edd4, 9c88f9a)primitives: Fixed a rounding bug inUnsignedLong.doubleValue(). (e61cf2e)reflect: Changed the type hierarchy ofInvokable:Invokableno longer inherits fromAccessibleObjectorGenericDeclaration, though it continues to define instance methods with the same signatures as the formerly inherited ones. This is technically a breaking API change to this@BetaAPI. We think it very unlikely that anyone is affected in practice. (12af215)testlib: EnhancedNullPointerTesterto allow a parameter of type<T extends @Nullable Object>to benull. (e856722)testlib: Fixed bug affecting derived tests of custom collection test suites: ThesetUpandtearDownmethods are now copied to derived test suites. (c7d9fef)util.concurrent: AddedServiceManager.startupDurations(). (c95ba5a)util.concurrent: Removed the GWT-only overloads ofFutures.catchingandcatchingAsyncthat let callers omit theExecutor. This matches a change made years ago to the non-GWT API. If this breaks your GWT client code compilation, you can fix it by passing an additional parameter,MoreExecutors.directExecutor()(0ff2f78)
Nullness annotations
Previously, we annotated all parameters that could be null, and we did not annotate elsewhere reliably. Now:
- We consistently annotate return types for nullness.
- We annotate "components" of types, like the element type of an array or list and the bound of a type parameter. (To take advantage, Kotlin users can set
-Xtype-enhancement-improvements-strict-mode.)- However, we don't yet annotate any such locations as non-nullable.
- In our annotations (including on parameters), we distinguish between
@Nullable T("always nullable, regardless of the type argument used forT") andT("nullable only if the type argument is"). - We have temporarily increased our usage of jsr305, which we will ultimately phase out.
- We use
@CheckForNullinstead of a type-annotation@Nullablewherever possible. This makes the nullness information available to more Kotlin users. - We've introduced a custom jsr305 annotation that informs Kotlin that unannotated return types are non-null (just like our usage of
@ParametersAreNonnullByDefaultalready did for parameter types). (To take advantage, Kotlin users can set-Xjsr305=strict.)
- We use
(Known issue: We are missing annotations on the TypeToInstanceMap classes. We'll fix this in a future release.)
By providing additional nullness information, this release may result in more errors or warnings from any nullness analyzers you might use. If so, you may need to fix or suppress them as usual. For advice, see the documentation for the analyzer you're using, such as that for the Checker Framework or for Kotlin.
If you use NullAway with the AnnotatedPackages flag set to cover com.google.common, you may see not only additional legitimate errors but also some incorrect errors because Guava no longer uses @Nullable as frequently on type-variable usages. The NullAway developers have suggested a workaround, and they are planning for NullAway 0.9.9 to treat our type-variable usages differently. However, even after 0.9.9, NullAway users are likely to see some incorrect errors if they keep com.google.common in their AnnotatedPackages. A fuller solution will require Guava and tools to adopt an annotation model that is more suited to generics. For updates on that, follow #2960.
We will be using more annotations to provide more nullness information in the future.