-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Replace code duplicates with closeAllSuppress helper #10682
Conversation
e5f888d
to
45bbc8a
Compare
CI: #10674 |
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.
Thanks!
{ | ||
requireNonNull(rootCause, "rootCause is null"); | ||
if (closeables == null) { | ||
return rootCause; |
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.
can we require closeables
not to be null?
vararg call won't pass null here
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.
good point
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.
Added some tests too.
plugin/trino-hive/src/main/java/io/trino/plugin/hive/HivePageSource.java
Outdated
Show resolved
Hide resolved
e97e06f
to
6f24a01
Compare
public void testCloseAllSuppressNullClosable() | ||
{ | ||
RuntimeException rootException = new RuntimeException("root"); | ||
closeAllSuppress(rootException, (AutoCloseable) null); |
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.
@findepi If I passed just null
here (without the cast) it was internally interpreted as whole closeables
array and requireNonNull(closeables, "closeables is null")
check trigger.
I do not think this is a big deal though. Why would someone use untyped null literal here?
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.
I do not think this is a big deal though. Why would someone use untyped null literal here?
agreed, that would be wrong
6f24a01
to
569e4fd
Compare
No description provided.