Google core libraries for Java
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0-jre</version>
<!-- or, for Android: -->
<version>31.0-android</version>
</dependency>
Guava requires one runtime dependency, which you can download here:
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.
guava-android
to 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.base
: Changed Functions.forSupplier
and Predicates.instanceOf
to accept an additional type argument to specify the input type for the returned Function
/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. (75110e936d)collect
: Added ImmutableMap.ofEntries
, like Map.ofEntries
but for ImmutableMap
. (cd3b4197fb)collect
: Added overloads of ImmutableMap.of
, ImmutableBiMap.of
, and ImmutableSortedMap.of
for up to 10 entries. (d5c30e3f19)collect
: Renamed ImmutableMap.Builder.build()
to buildOrThrow()
. The existing build()
method will continue to exist but may be deprecated, and the new name should be used in new code. (4bbe12c4e0)collect
: Removed @Beta
from Interner
and Interners
. (cf31f3a31d)collect
: Added @InlineMe
to Streams.stream(Optional)
and friends. (a176cd60f1)graph
: Made EndpointPair.adjacentNode
require an N
instead of accept any Object
. (b0be21d46c)hash
: Removed @Beta
from HashFunction
. (e1cc195cfb)hash
: Deprecated buggy murmur3_32
, and introduced murmur3_32_fixed
. (a36f08fe31)io
: Changed CharStreams.asWriter(appendable).write(string[, ...])
to reject a null string
. (50e7dddf5c)io
: Fixed a bug in FileBackedOutputStream
cleanup: If writing to the temp file fails, we now delete it before propagating the exception. (6e054cea7b)net
: Changed HostAndPort.fromString
to reject port numbers spelled with non-ASCII digits. (53fd1d7612)net
: Added HttpHeaders
constants for X-Device-Ip
, X-Device-Referer
, X-Device-Accept-Language
, X-Device-Requested-With
, Sec-CH-Prefers-Color-Scheme
, Sec-CH-UA-Bitness
, and Keep-Alive
. (da375be86a, b23b277422, 281edd4b6e, 9c88f9ad6d)primitives
: Fixed a rounding bug in UnsignedLong.doubleValue()
. (e61cf2e8d7)reflect
: Changed the type hierarchy of Invokable
: Invokable
no longer inherits from AccessibleObject
or GenericDeclaration
, 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 @Beta
API. We think it very unlikely that anyone is affected in practice. (12af215974)testlib
: Enhanced NullPointerTester
to allow a parameter of type <T extends @Nullable Object>
to be null
. (e85672246f)testlib
: Fixed bug affecting derived tests of custom collection test suites: The setUp
and tearDown
methods are now copied to derived test suites. (c7d9fef73b)util.concurrent
: Added ServiceManager.startupDurations()
. (c95ba5a298)util.concurrent
: Removed the GWT-only overloads of Futures.catching
and catchingAsync
that let callers omit the Executor
. 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()
(0ff2f78959)Previously, we annotated all parameters that could be null
, and we did not annotate elsewhere reliably. Now:
-Xtype-enhancement-improvements-strict-mode
.)
@Nullable T
("always nullable, regardless of the type argument used for T
") and T
("nullable only if the type argument is").@CheckForNull
instead of a type-annotation @Nullable
wherever possible. This makes the nullness information available to more Kotlin users.@ParametersAreNonnullByDefault
already did for parameter types). (To take advantage, Kotlin users can set -Xjsr305=strict
.)(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 https://github.com/google/guava/issues/2960.
We will be using more annotations to provide more nullness information in the future.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
<!-- or, for Android: -->
<version>30.1.1-android</version>
</dependency>
Guava requires one runtime dependency, which you can download here:
guava-android
under a Java 7 VM. (Android VMs are unaffected.) If the warning itself causes you trouble, you can eliminate it by silencing the logger for com.google.common.base.Preconditions
(which is used only for this warning). This warning prepares for removing support for Java 7 in 2021. Please report any problems. We have tried to make the warning as safe as possible, but anytime a common library logs, especially as aggressively as we do in this new release, there is the potential for NullPointerException
or even deadlock. (To be clear, Guava will not log under Java 8 or Android, but it will under Java 7.) (00c25e9b11)cache
: Fixed compatibility between asMap().compute(...)
and a load. (42bf4f4eb7)cache
: Added @CheckReturnValue
to some APIs. (a5ef129ffc)collect
: Added @DoNotCall
to the mutator methods on immutable types (6ae9532d11)hash
: Removed @Beta
from HashCode
. (2c9f161e10)io
: Removed @Beta
from CountingOutputStream
. (d394bac847)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1-jre</version>
<!-- or, for Android: -->
<version>30.1-android</version>
</dependency>
guava-android
under a Java 7 VM. (Android VMs are unaffected, aside from the need to use desugaring, described in the previous bullet.) This warning is not guaranteed to be logged when running under Java 7, so please don't rely on it as your only warning about future problems. If the warning itself causes you trouble, you can eliminate it by silencing the logger for com.google.common.base.MoreObjects$ToStringHelper
(which is used only for this warning). This warning prepares for removing support for Java 7 in 2021. Please report any problems. We have tried to make the warning as safe as possible, but anytime a common library logs, there is the potential for NullPointerException
or even deadlock. (To be clear, Guava will not log under Java 8 or Android, but it may log under Java 7.) (dc52e6e385)
com.google.common.base.Preconditions
.base
: Deprecated StandardSystemProperty.JAVA_EXT_DIRS
. We do not plan to remove the API, but note that, under recent versions of Java, that property always has a value of null
. (38abf07772)net
: Added HttpHeaders
constants for Origin-Isolation
and X-Request-ID
. (a48fb4f724, 8319d201cd)reflect
: Added ClassInfo.isTopLevel()
. (410627262b)util.concurrent
: Added ClosingFuture.submitAsync(AsyncClosingCallable)
. (c5e2d8d5cb)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
<!-- or, for Android: -->
<version>30.0-android</version>
</dependency>
guava.gwt.emergency_reenable_rpc
) no longer has an effect. (0cb89dd110)cache
: Fixed memory leak in LocalCache
under j2objc. (5e519d91d0)collect
: Added two-element min
and max
methods to Comparators
. (958186c071)collect
: Removed @Beta
from Multimaps.toMultimap
. (b6b4dc49b1)collect
: Made the set returned by ImmutableMap<K, V>.keySet()
serializable as long as K
is serializable, even if V
is not (and similarly for values()
). (f5a69c33fc)collect
: Fixed bug in powerSet.equals(otherPowerSet)
would erroneously return false
if the two power sets' underlying sets were equal but had a different iteration order. (215b1f0dd7)collect
: Eliminated j2objc retain-cycle in SingletonImmutableBiMap
. (0ad38b88bd)eventbus
: Prevented @Subscribe
from being applied to a method that takes a primitive, as that will never be called. (554546c971)graph
: Made Traverser.breadthFirst()
lazier, and optimized Traverser
more generally. (32f2d770f7, b5210ca95c)graph
: Added @DoNotMock
to Traverser
. (6410f18c06)io
: Deprecated Files.createTempDir()
. (fec0dbc463) (CVE-2020-8908; continuing discussion in https://github.com/google/guava/issues/4011)io
: Upgraded ByteStreams.copy(InputStream, OutputStream)
to use the faster FileChannel
if possible. (a1e9a0bd12)math
: Added roundToDouble
to BigDecimalMath
, BigIntegerMath
, and LongMath
. (bee4f3c7ed, 2b5c096ddf, 633abf2c62)net
: Added MediaType
constants for several font/ types. (571cf66bac)net
: Added HttpHeaders
constants for Cross-Origin-Embedder-Policy(-Report-Only)?
. (c3bf73187a)testing
: Made EqualsTester
test that non-String
objects are not equal to their String
representations. (c9570eae69)util.concurrent
: Added ClosingFuture
. (52e048ed6c)util.concurrent
: Removed the deprecated 1-arg ServiceManager.addListener(Listener)
. Use the 2-arg addListener(Listener, Executor)
overload, setting the executor to directExecutor()
for equivalent behavior. (dfb0001714)util.concurrent
: Changed AbstractFuture.toString()
to no longer include the toString()
of the result. (2ebf27fd45)util.concurrent
: Added awaitTerminationUninterruptibly
. (f07b9540dc)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
<!-- or, for Android: -->
<version>29.0-android</version>
</dependency>
guava.gwt.emergency_reenable_rpc
system property to true
. (5214a10b1e)
guava-gwt
artifact, not people who use only the guava
artifact. This release contains no changes that break binary compatibility for any users.ImmutableList
, visit guava.dev/ImmutableList. Also, more easily access the index at guava.dev/api.collect
: Annotated FluentIterable.from(FluentIterable)
with @DoNotCall
. (b1c77b7df3)collect
: Made ceiling
, floor
, headSet(E, boolean)
, and tailSet(E, boolean)
methods available in the GWT-emulated ImmutableSortedSet
. (7e0fe90ca8, 5f2fbf27b2)graph
: Made it possible to set a stable incident edge order by calling the newly added method [Value]Graph.Builder.incidentEdgeOrder(ElementOrder.stable())
. (70164025a8)graph
: Added incidentEdgeOrder()
to the [Value]Graph
interfaces. (cde576ec00)util.concurrent
: Added Duration
-based default
methods to ListeningScheduledExecutorService
. (931e83f969)util.concurrent
: Added immediateVoidFuture
. (9f3bae5853)util.concurrent
: Removed @Beta
from Service
and related classes. (dc46627fea)util.concurrent
: Deprecated the 1-arg overload of ServiceManager.addListener
. (86e3620125)util.concurrent
: Changed the return type of ServiceManager.servicesByState()
to ImmutableSetMultimap
(but also retained a method with the old signature for binary compatibility). (31999ae6f5)util.concurrent
: Made it safe to load the AbstractFuture
class from a ForkJoinPool
thread under a security manager. (6e0c5b5d50)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.2-jre</version>
<!-- or, for Android: -->
<version>28.2-android</version>
</dependency>
guava.gwt.emergency_reenable_rpc
system property to false
. (Even without the system property enabled, apps will now log warnings when sending Guava types over GWT-RPC.) (08bbf53ab0)base
: Added Splitter.splitToStream()
.concurrent
: Added Futures.submit()
(c7ef0cc93b)concurrent
: Made platformThreadFactory()
and related utilities (mainly *Service
) work under Java 11 App Engine, and tweaked other App Engine threading behavior. (e3ee00d6769d219c9646a17114fa00e2955b54aa)concurrent
: Added catch
to StackOverflowError
in AbstractFuture.toString
to prevent long chains of futures from failing toString
calls. (a2e6acc009)concurrent
: Made ListenableFuture
implement Thenable
via a default interface method in GWT/j2cl (e0bac74571).graph
: Fixed bug in AbstractNetwork.hasEdgeConnecting()
causing it to throw if either endpoint was not in the graph. Originally reported as #3721. (2ee7f9da69)graph
: Fixed data race. (0e94fb5bb8)math
: Added Stream
support to Stats
and StatsAccumulator
. (e2f4eba636)math
: Added Quantiles
compute()
methods which return a Map
now return a map with entries in the same order in which the indexes were provided. (786c3d84f1)net
: Added support for scope IDs for IPv6 addresses. (8a7d36a8e5044096919a3512aa6734c95032f38c)net
: Added toBigInteger
and fromIpv4BigInteger
/fromIpv6BigInteger
to InetAddresses
for manipulating InetAddresses
as BigIntegers
(d7a0b3d367)net
: Added MediaType
constants for application/opensearchdescription+xml (f79c4fe0a7) and MPEG-DASH (67dd062cb9), as well as a constant for the header Cross-Origin-Opener-Policy (4ef2111641).net
: Made MediaType
reject empty type, subtype, and attribute (b080067) and non-ASCII parameter values (2278123479). Also, made it serialize empty parameter values to quoted strings (2278123479).@DoNotMock
to several types. (4eea0f79c2, add430908ec77c1859f84bd753b84a5eca57b327)animal-sniffer-annotations
. (5f37e53fd7)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.1-jre</version>
<!-- or, for Android: -->
<version>28.1-android</version>
</dependency>
collect
: Added RangeMap.merge
, analogous to Map.merge
. (687252d35)collect
: Fixed a bug in ImmutableSet.Builder
that could lead to infinite loops when building multiple sets from the same builder. (0007cb257)io
: Fixed an issue where the InputStream
returned by BaseEncoding.decodingStream(Reader)
could fail to throw DecodingException
while decoding an invalid string. (ddd4a49fb)net
: Added MediaType
for "image/heif" and "image/jp2" (508696a4c)net
: Added Upgrade-Insecure-Requests
header to HttpHeaders
. (6a8b716af)concurrent
: Fixed potential memory leak in Futures.whenAllSucceed/whenAllComplete
(494834bd4)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.0-jre</version>
<!-- or, for Android: -->
<version>28.0-android</version>
</dependency>
collect
: Added Duration
-based overloads to some Queues
methods. (21d06cf1d48175ab5cdf3d88f1776d3cba227b37)net
: Added MediaType
for "application/geo+json". (36cd5cfc5)net
: Added a number of constants to HttpHeaders
.concurrent
: Removed deprecated CheckedFuture
and related utilities. (3dd22fe75)concurrent
: Added Duration
-based overloads to many methods.concurrent
: Removed @Beta
from setFuture
. (5ec136091)concurrent
: Added deprecated FluentFuture.from(FluentFuture)
to point out redundant code. (f9f280776)graph
: Added GraphBuilder.immutable()
,ValueGraphBuilder.immutable()
and NetworkBuilder.immutable()
for building immutable graphs in a fluent way.ImmutableMap.entrySet()
. (74fc49faf)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.1-jre</version>
<!-- or, for Android: -->
<version>27.1-android</version>
</dependency>
guava-bom
artifact). (0e5964129)@Beta
from a number of frequently used APIs. (6242bdd27)net
: Added Sec-Fetch
headers to HttpHeaders
. (673b24376)net
: Added SourceMap
header to HttpHeaders
(a99c15f4c)net
: Added MediaType
for "application/jose" and "application/jose+json". (d416e04cf)graph
: Added overloads to methods accepting pairs of nodes to also accept EndpointPair
; changed behavior of *Graph.edges().contains()
to allow undirected graphs to accept ordered EndpointPair
s. (af3ee1c59)<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
<!-- or, for Android: -->
<version>27.0.1-android</version>
</dependency>