You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "axreldable (via GitHub)" <gi...@apache.org> on 2026/02/12 18:19:30 UTC
[PR] GH-130: Fix AutoCloseables to work with @Nullable structures [arrow-java]
axreldable opened a new pull request, #1017:
URL: https://github.com/apache/arrow-java/pull/1017
## What's Changed
`AutoCloseables` supposes to work with nullable `Iterables`, `varargs`, and `collection of nulls`. The PR introduces:
- `@Nullable` annotation for all public methods in `AutoCloseables` (only private flatten doesn't accept null `Iterable`)
- `null` checks to prevent NPEs
---
The change is backward compatible. Only possible NPEs are prevented.
---
Closes #130 .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-130: Fix AutoCloseables to work with @Nullable structures [arrow-java]
Posted by "axreldable (via GitHub)" <gi...@apache.org>.
axreldable commented on code in PR #1017:
URL: https://github.com/apache/arrow-java/pull/1017#discussion_r2816402893
##########
memory/memory-core/src/main/java/org/apache/arrow/util/AutoCloseables.java:
##########
@@ -48,7 +51,10 @@ public void close() throws Exception {
* @param t the throwable to add suppressed exception to
* @param autoCloseables the closeables to close
*/
- public static void close(Throwable t, AutoCloseable... autoCloseables) {
+ public static void close(Throwable t, @Nullable AutoCloseable... autoCloseables) {
+ if (autoCloseables == null) {
+ return;
Review Comment:
Yes, they are saying it's not overly cautious.
https://stackoverflow.com/a/28271272/8269828
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-130: Fix AutoCloseables to work with @Nullable structures [arrow-java]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre merged PR #1017:
URL: https://github.com/apache/arrow-java/pull/1017
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-130: Fix AutoCloseables to work with @Nullable structures [arrow-java]
Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #1017:
URL: https://github.com/apache/arrow-java/pull/1017#discussion_r2816279893
##########
memory/memory-core/src/main/java/org/apache/arrow/util/AutoCloseables.java:
##########
@@ -48,7 +51,10 @@ public void close() throws Exception {
* @param t the throwable to add suppressed exception to
* @param autoCloseables the closeables to close
*/
- public static void close(Throwable t, AutoCloseable... autoCloseables) {
+ public static void close(Throwable t, @Nullable AutoCloseable... autoCloseables) {
+ if (autoCloseables == null) {
+ return;
Review Comment:
That should not happen, but it seems you have a case ;)
##########
memory/memory-core/src/main/java/org/apache/arrow/util/AutoCloseables.java:
##########
@@ -33,7 +35,8 @@ private AutoCloseables() {}
* Returns a new {@link AutoCloseable} that calls {@link #close(Iterable)} on <code>autoCloseables
* </code> when close is called.
*/
- public static AutoCloseable all(final Collection<? extends AutoCloseable> autoCloseables) {
+ public static AutoCloseable all(
+ final @Nullable Collection<? extends @Nullable AutoCloseable> autoCloseables) {
Review Comment:
I don't have problem to add `@Nullable` here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-130: Fix AutoCloseables to work with @Nullable structures [arrow-java]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #1017:
URL: https://github.com/apache/arrow-java/pull/1017#issuecomment-3892631586
<!-- label_helper_comment -->
Thank you for opening a pull request!
Please label the PR with one or more of:
- bug-fix
- chore
- dependencies
- documentation
- enhancement
Also, add the 'breaking-change' label if appropriate.
See [CONTRIBUTING.md](https://github.com/apache/arrow-java/blob/main/CONTRIBUTING.md) for details.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] GH-130: Fix AutoCloseables to work with @Nullable structures [arrow-java]
Posted by "axreldable (via GitHub)" <gi...@apache.org>.
axreldable commented on PR #1017:
URL: https://github.com/apache/arrow-java/pull/1017#issuecomment-3892634108
Please add the `enhancement` label.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org