Skip to content

[perf] Resource management: update auto-closeables to use try-with-resources #8110

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

Closed
pq opened this issue Apr 23, 2025 · 0 comments · Fixed by #8111
Closed

[perf] Resource management: update auto-closeables to use try-with-resources #8110

pq opened this issue Apr 23, 2025 · 0 comments · Fixed by #8111
Assignees
Labels
P2 performance General performance issues (not perf tool)
Milestone

Comments

@pq
Copy link
Contributor

pq commented Apr 23, 2025

Auto-closeable resources can be managed and disposed automatically if used in try-with-resources statements. (Our currently implementation does not guarantee opened resources are safely closed.)

Image

See the oracle docs for details.

@pq pq added P2 performance General performance issues (not perf tool) labels Apr 23, 2025
@pq pq self-assigned this Apr 23, 2025
@jwren jwren added this to the M85.3 milestone Apr 24, 2025
@jwren jwren closed this as completed in afb700d Apr 24, 2025
pq added a commit that referenced this issue Apr 30, 2025
`MockitoAnnotations.openMocks` returns an auto-closeable that a
`try`-with-resources statement ensures will get closed.

Follow-up from #8111 and
related to #8110.

(Also some opportunistic unused import cleanup.)

---

- [x] I’ve reviewed the contributor guide and applied the relevant
portions to this PR.

<details>
  <summary>Contribution guidelines:</summary><br>

- See our [contributor
guide]([https://github.com/dart-lang/sdk/blob/main/CONTRIBUTING.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview)
for general expectations for PRs.
- Larger or significant changes should be discussed in an issue before
creating a PR.
- Dart contributions to our repos should follow the [Dart style
guide](https://dart.dev/guides/language/effective-dart) and use `dart
format`.
- Java and Kotlin contributions should strive to follow Java and Kotlin
best practices
([discussion](#8098)).
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 performance General performance issues (not perf tool)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants