FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-130: Fix AutoCloseables to work with @Nullable structures by axreldable · Pull Request #1017 · apache/arrow-java · GitHub

GH-130: Fix AutoCloseables to work with @Nullable structures - #1017

Merged
jbonofre merged 1 commit into
apache:mainfrom
axreldable:ARROW-130-checker-framework-autocloseables-annotations
Feb 17, 2026
Merged

GH-130: Fix AutoCloseables to work with @Nullable structures#1017
jbonofre merged 1 commit into
apache:mainfrom
axreldable:ARROW-130-checker-framework-autocloseables-annotations

Conversation

axreldable commented Feb 12, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

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 method doesn't support null Iterable)
  • null checks to prevent NPEs

The change is backward compatible. Only possible NPEs are prevented.


Closes #130 .

This comment has been minimized.

Copy link
Copy Markdown
Contributor Author

Please add the enhancement label.

lidavidm added the enhancement PRs that add or improve features. label Feb 13, 2026
github-actions Bot added this to the 19.0.0 milestone Feb 13, 2026
axreldable force-pushed the ARROW-130-checker-framework-autocloseables-annotations branch from 338980c to d5c317c Compare February 16, 2026 19:31

jbonofre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't have problem to add @Nullable. That said, I don't consider as a bug fix but more as improvement.

*/
public static AutoCloseable all(final Collection<? extends AutoCloseable> autoCloseables) {
public static AutoCloseable all(
final @Nullable Collection<? extends @Nullable AutoCloseable> autoCloseables) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I don't have problem to add @Nullable here.

public static void close(Throwable t, AutoCloseable... autoCloseables) {
public static void close(Throwable t, @Nullable AutoCloseable... autoCloseables) {
if (autoCloseables == null) {
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

That should not happen, but it seems you have a case ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yes, they are saying it's not overly cautious.
https://stackoverflow.com/a/28271272/8269828

jbonofre merged commit 3298443 into apache:main Feb 17, 2026
26 checks passed
axreldable deleted the ARROW-130-checker-framework-autocloseables-annotations branch February 26, 2026 21:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement PRs that add or improve features.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] Checker Framework annotations for AutoCloseables in arrow-memory-core are incorrect

3 participants


Back | FazBrowse Home | New Git URL