-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-17126. implement un-guava Precondition checkNotNull #2143
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
Conversation
|
CC @steveloughran I split the changes in PR #2134 . For practicality and convenience, I decided to breakdown the code implementation. Each PR focuses on a single helper. |
|
💔 -1 overall
This message was automatically generated. |
steveloughran
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than import ordering, production code is good. Test-wise, you should move to LambdaTestUtils.intercept. It's much easier to use and reports failures better
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/unguava/Validate.java
Outdated
Show resolved
Hide resolved
...-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/unguava/TestValidate.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/unguava/Validate.java
Outdated
Show resolved
Hide resolved
76dc374 to
e4e57ae
Compare
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
beb843d to
08c8cb4
Compare
|
💔 -1 overall
This message was automatically generated. |
08c8cb4 to
3d60bb9
Compare
|
🎊 +1 overall
This message was automatically generated. |
HADOOP-17126. use LambdaTestUtils.intercept and fix import ordering [HADOOP-17126]: replace lambda expressions with if/then Author: Ahmed Hussein <[email protected]>
3d60bb9 to
54437cf
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
@steveloughran and @daryn-sharp, Are you guys okay with the current version? |
NOTICE
As part In order to replace Guava Preconditions, we need to implement our own versions of the API.
This PR is to create
checkNotNullin a new package dubbedunguava.This is splitting the PR that was opened previously #2134
The plan is as follows
package org.apache.hadoop.util.unguava;class Validateorg.apache.hadoop.util.unguava.Validatewith the following interfacecheckNotNull(final T obj)checkNotNull(final T reference, final Object errorMessage)checkNotNull(final T obj, final String message, final Object... values)checkNotNull(final T obj,final Supplier<String> msgSupplier)guava.preconditionsusedString.lenientformatwhich suppressed exceptions caused by string formatting of the exception message . So, in order to avoid changing the behavior, the implementation catches exceptions triggered by building the message (IllegalFormat, InsufficientArg, NullPointer..etc)guava.Preconditions.checkNotNullbyunguava.Validate.checkNotNullSimilar Jiras will be created to implement
checkState,checkArgument,checkIndex