How to make a library which uses AutoCloseable and also support Java 6
<p>I'm making a library for Java developers. I would like to make a class that implements the AutoCloseable interface in case the developer uses Java 7. 
But I also need to provide a version of the class without the AutoCloseable interface for developers targeting Android (which doesn't support AutoCloseable).</p>

<p>The name of my class must be the same in both cases.</p>

<p>One solution is a preprocessor, but I'm targeting developers and can't expect them to adopt any non-standard preprocessor.</p>

<p>So, what is the best practice for supporting two versions of the same class depending on the Java version?</p>

<p>Thanks!</p>

<p>--
Update to clarify:<br>
The ONLY difference in the full source code for the two versions would be the two words "implements AutoCloseable":<br>
    public class Transaction { ...<br>
or<br>
    public class Transaction implements AutoCloseable {...  </p>
