spotify / missinglink

Build time tool for detecting link problems in java projects
Apache License 2.0
144 stars 27 forks source link

remove Guava from missinglink-core #61

Closed mattnworb closed 4 years ago

mattnworb commented 4 years ago

In the interest of having as few dependencies as possible in the core module, this commit removes Guava from it.

Guava was only really used in three ways in the core module:

  1. Immutable collection types 2. Preconditions checks 3. Joiner for concatenating strings

I replaced 1 with a mix of Collection.singleton(), singletonList() etc., along with vanilla ArrayList / HashMap usage. The classes generated by AutoMatter for POJOs will make copies of any collections passed in, so I skipped a lot of the usage of Guava's Immutable types for making copies of collections before passing them into the generated POJOs.

Use of the Preconditions static methods to throw NullPointerExceptions or IllegalArgumentExceptions I replaced with java.util.Objects.checkNotNull() or vanilla if-else checks.

The plugin module still uses Guava; removing it from that module was out of scope for this change (anyone using Missinglink in other build tools will just depend on the core module).

Closes #60.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.3%) to 78.664% when pulling dbdf55b3af276dde1442d695cc171c3c7ea5d591 on remove-guava into 6fc7ac7dfdb459b7cba8ffe75f4c58403bf016b0 on master.