Automatic Resource Management, V.2
jjb at google.com
Mon Apr 20 07:15:05 PDT 2009
It is possible that we may end up with some other "auto" interfaces in
future. And as mentioned, a package-based solution is 100% safe, as it
requires explicit import. Of course I agree with you that package with a
single class in it is a bit suspect. I think this is best left as an "open
issue" for the time being.
On Mon, Apr 20, 2009 at 3:43 AM, Rémi Forax <forax at univ-mlv.fr> wrote:
> Joshua Bloch a écrit :
>> Good question. We did it to eliminate the possibility of name clashes in
>> existing programs. JBoss actually uses the name AutoCloseable. Types in
>> java.lang are automatically imported, and putting AutoCloseable in
>> java.lang.auto avoids this issue. It doesn't make the construct any less
>> usable, as you don't have to mention AutoCloseable explicitly to use the
> I don't like the fact that the JDK will contains a package with only one
> just to avoid name clash that is hypothetical because classes of the
> current package are imported
> before java.lang ones and everybody should avoid to use import *.
> In my opinion, (which is biased) , I prefer sacrificing source backward
> compatibility to having to take
> 15 minutes each year because I will have to explain to my students why the
> java.lang.auto with one interface exists.
> Else what about renaming (yes again) AutoCloseable to ARMCloseable ?
More information about the coin-dev