For the most part, you should be able to just find+replace all
references to com.google.common
with dev.mccue.guava
.
Consult the original documentation for in-depth usage guides.
<dependency>
<groupId>dev.mccue</groupId>
<artifactId>guava</artifactId>
<version>33.2.0</version>
</dependency>
This module is a soft-fork of Guava which
- Is shaded under
dev.mccue.guava
- Has a proper
module-info.java
- Has all usages of
sun.misc.*
, The Security Manager, andfinalize()
removed.
The work of shading is done by this project. Releases of this and dependent modules should contain the guava release or commit hash from which they are generated.
This is an aggregator module and each package of guava has been split into submodules which can be found here
- dev.mccue.guava.base
- dev.mccue.guava.primitives
- dev.mccue.guava.escape
- dev.mccue.guava.math
- dev.mccue.guava.collect
- dev.mccue.guava.xml
- dev.mccue.guava.html
- dev.mccue.guava.graph
- dev.mccue.guava.hash
- dev.mccue.guava.io
- dev.mccue.guava.net
- dev.mccue.guava.reflect
- dev.mccue.guava.concurrent
- It doesn't seem like guava will be modularized any time soon
- I want to enable more libraries to be fully modular so that the
jlink
workflow is more viable - This was fun to do, and it seems as if some people are interested in the results.
I'll try to keep up to date, but if you
- Notice something wrong
- Want me to make a release for a new version
- Want a minute of my time
Feel free to reach out.
- Everything is shaded under
dev.mccue.guava
com.google.common.util.concurrent
is turned intodev.mccue.guava.concurrent
, dropping theutil
- All usages of
sun.misc.Unsafe
are removed- The unsafe implementation is removed, leaving a safe fallback in
LittleEndianByteArray
,AbstractFuture
, andUnsignedBytes
- The unsafe implementation in is replaced with a new one based on
VarHandle
s inStriped64
- The unsafe implementation is removed, leaving a safe fallback in
- All usages of
sun.misc.JavaLangAccess
are removed- Replaced with
Throwable.getStackTrace
inThrowables
- Replaced with
- All usages of
finalize()
are removedFileBackedOutputStream
has a constructor which takes a boolean to indicate that resources should be freed on finalization. This was made private and the logic was removed.
- All usages of the Security Manager are removed
Types
catches anAccessControlException
and that could safely be replaced with catching anException
- Explicit uses of the security manager in
LittleEndianByteArray
,AbstractFuture
,UnsignedBytes
, andStriped64
were removed along with the code to loadsun.misc.Unsafe
.
- All usages of
java.util.logging.Logger
were replaced withjava.lang.System.Logger
- With this change, the only JDK module depended on is
java.base
.
- With this change, the only JDK module depended on is
- All usages of
javax.annotation.*
classes fromcom.google.code.findbugs/jsr305
are replaced with equivalent classes fromdev.mccue/jsr305
FinalizableReferenceQueue
and associated classes were removed- They were rarely used, probably do a job better done by a
Cleaner
, and I wasn't able to validate that they would behave correctly in a module
- They were rarely used, probably do a job better done by a
- Annotation modules are used via
requires static
and are not carried over to dependents. - All annotation usages from
com.google.common.annotations
andcom.google.j2objc.annotations
have been removed - Split into multiple submodules, each with their own
module-info.java
- Drops explicit support for GWT, j2objc, j2cl, etc.
- Drops explicit support for android (equivalent to the
-jre
build) - Does not include
com.google.common.eventbus
(Guava docs explicitly recommends against its use)com.google.common.cache
(Caffiene covers that use.)com.google.common.annotations
(Only@Beta
and@VisibleForTesting
would be relevant without GWT+etc. testing, and you can make your own pretty easily.)
- Compiled for Java 9+, not Java 8