Tech Note 13

Guava usage in Curator


Since Curator was created at Netflix it has used Google's popular Guava library. Due to the many versions of Guava used in projects that also use Curator there has always been the potential for conflicts. Recent versions of Guava removed some APIs that Curator uses internally and Curator users were getting ClassNotFoundException, etc. CURATOR-200 addresses these issues by shading Guava into Curator. 

Shaded But Not Gone

Unfortunately, a few of Curator's public APIs use Guava classes (e.g. ListenerContainer's use of Guava's Function). Breaking public APIs would cause as much harm as solving the Guava problem. So, it was decided to to shade all of Guava except for these three classes:

The implication of this is that Curator still has a hard dependency on Guava but only for these three classes. What this means for Curator users is that you can use whatever version of Guava your project needs without concern about ClassNotFoundException, NoSuchMethodException, etc.



Note, this project proves the shaded version of Guava:


For those still not convinced. Here's a disassembly of ListenerContainer.class from Curator 3.3.0. You can see that various Guava classes like MoreExecutors are shaded.