Skip to content
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

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

Open
msridhar opened this issue Dec 10, 2023 · 1 comment
Open
Labels
good first issue A beginner-friendly place to start contributing to the Checker Framework ResourceLeakChecker
Milestone

Comments

@msridhar
Copy link
Contributor

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

@msridhar msridhar added ResourceLeakChecker good first issue A beginner-friendly place to start contributing to the Checker Framework labels Dec 10, 2023
@Tejasker
Copy link

hey @msridhar ,I guess you are correct like annotating @MustCall("close") would lead to excessive warnings especially for classes that don't manage any resources and one cannot determine the appropriate warnings in the stack.

@msridhar msridhar added this to the Medium milestone Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A beginner-friendly place to start contributing to the Checker Framework ResourceLeakChecker
Projects
None yet
Development

No branches or pull requests

2 participants