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
Right now, our JDK model does not annotate
AutoCloseableas@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 thoseAutoCloseabletypes 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 implementingAutoCloseableand see which other ones should be@MustCall("close"):https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/AutoCloseable.html