Skip to content

Transient dependency on Guava 16 prohibits higher-level code moving to Guava 21 #12

Description

@lukeu

The crash one sees when putting Guava 21 on the classpath is the following:

java.lang.NoSuchMethodError: com.google.common.base.Objects.firstNonNull(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
  at com.github.fge.jackson.JsonLoader.fromResource(JsonLoader.java:83
  ....

Guava 21 is appealing because it adds a number of very useful utilities for working with Java 8. However in this release, they have (after a period of planned deprecation) removed methods from their Objects class (due to Java 8 containing an Objects class).

I understand jackson-coreutils may wish to retain support for Java 6. Fortunately, Guava planned ahead and there is a window of cross-over:

A solution may be for jackson-coreutils to depend on Guava 18, 19 or 20. These all contain the class MoreObjects as a duplicate of Objects from Guava 16. So it may just be a matter of bumping the Guava version and substituting Objects with MoreObjects. Upstream code can then use Guava 21+ (which still contains these methods in MoreObjects)

An alternative might be to just inline the calls to the utility functions in Objects, if they are not used too frequently.

Related:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions