typetools / typetools/checker-framework

See which other JDK subtypes of `AutoCloseable` should be `@MustCall("close")`

Open
#6,354 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue ResourceLeakChecker
Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

Right now, our JDK model does not annotate AutoCloseable as @MustCall("close"):

https://github.com/typetools/jdk/blob/88af971354b7e482ade8b250fde7699ed2e20217/src/java.base/share/classes/java/lang/AutoCloseable.java#L56-L59

It'd be nice if we could annotate it as @MustCall("close") and then annotate those AutoCloseable types that do not manage a resource as @MustCall(""), but it seems this causes issues with excessive warnings. Perhaps we could fix this? If not, we should at some point look through the list of JDK types implementing AutoCloseable and see which other ones should be @MustCall("close"):

https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/AutoCloseable.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced AutoCloseable.java declaration and the Java SE AutoCloseable API list. Review the JDK types implementing AutoCloseable and investigate why annotating the interface or non-resource types produces excessive warnings. Done means identifying appropriate @MustCall annotations and resolving or documenting the warning behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.