-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[FLINK-4032] Replace all usages Guava preconditions #2084
Conversation
I think the Kinesis connector is missed out as part of this cleanup. Thanks for this! |
The Kinesis connector already uses Flink's Preconditions class. |
Ah right, sorry I was mistaken by the guava dependency in pom.xml. The dependency can actually be safely removed also though, must have accidentally left it there when the connector was cleaned up to use Flink's preconditions. |
It is still used in FlinkKinesisProducer. |
Oops, my mistake again ;) Thanks. |
public static void checkElementIndex(int index, int size, @Nullable String errorMessage) { | ||
checkArgument(size >= 0, "Size was negative."); | ||
if (index < 0 || index >= size) { | ||
throw new IndexOutOfBoundsException(errorMessage + " Index: " + index + ", Size: " + size); |
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.
shouldn't we check if errorMessage == null
if it is @Nullable
?
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 Preconditions methods print also print "null" if no error message was given. granted, they use String.valueOf(errorMessage), but it's essentially the same.
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.
OK
Looks good overall. Added just a few minor comments. |
@fhueske I've addressed your comments. |
Thanks for the update @zentol. +1 to merge |
Merging |
This PR replaces every usage of the Guava Preconditions in Flink with our own Preconditions class.
In addition,