I'm using TensorFlow which provides
public final class Graph implements AutoCloseable
However I am getting an error when I try to use the try-with-resources construct of Kotlin like this...
When I look into it, it appears that
use requires a
Closeable and does not work with an
AutoClosable does not inherit from
Closable and is only available in JDK7 and up.
Is there another way around this?
I just noticed this from https://discuss.kotlinlang.org/t/kotlin-needs-try-with-resources/214
Here are the problems with the Closeable.use extension method:
* Doesn't work with Autocloseable (easy to fix, but seriously? this is a can of worms, but Kotlin's stdlib needs to be 100% compatible with whatever the latest JDK is. In fact, you probably need to version the stdlib (and, perhaps, Kotlin itself) together with the JDK.)