Skip to content

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

@msridhar

Description

@msridhar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ResourceLeakCheckergood first issueA beginner-friendly place to start contributing to the Checker Framework

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions