-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modernizer is at odds with guava recommendations #40
Comments
As a bit of data, I checked the Presto code base, where we previously converted from Type type = requireNonNull(types.get(symbol), "No type for symbol " + symbol); Also note that you can pass a Type type = requireNonNull(types.get(symbol), () -> "No type for symbol " + symbol); Thus, my opinion is that the consistency of using the JDK method everywhere outweighs the advantages of the Guava format string (which does have the nice feature of being safe even if you mess up the format args). |
@kevinb9n any thoughts on this? I would like to close this issue if not. |
Sorry I missed that question. So yeah, I think I know there are a lot of projects that were only using the parts of Guava that now have JDK analogues, and it's easy to understand why they would want to shed all their remaining Guava usages and jettison the dependency. |
I wonder if adding Supplier variants to the various Verify/Precondition methods would be possible. E.g.
|
According to https://code.google.com/p/guava-libraries/wiki/PreconditionsExplained, the guideline if using Guava in JDK7+ is
--- snip ---
We preferred rolling our own preconditions checks over e.g. the comparable utilities from Apache Commons for a few reasons. Piotr Jagielski discusses why he prefers our utilities, but briefly:
After static imports, the Guava methods are clear and unambiguous. checkNotNull makes it clear what is being done, and what exception will be thrown.
checkNotNull returns its argument after validation, allowing simple one-liners in constructors: this.field = checkNotNull(field).
Simple, varargs "printf-style" exception messages. (This advantage is also why we recommend continuing to use checkNotNull over Objects.requireNonNull introduced in JDK 7.)
--- snip ---
which clashes with https://github.com/andrewgaul/modernizer-maven-plugin/blob/master/src/main/resources/modernizer.xml#L597-L607
The text was updated successfully, but these errors were encountered: