Nico R. wrote:
Hello!

In java.io.File.createTempFile(String,String,File) (see
<URL:http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/ea5036d799e5/src/share/classes/java/io/File.java>),
line 1797 says:

        String tmpDir = LazyInitialization.temporaryDirectory();

LazyInitialization, line 1683, has

    static final String temporaryDirectory = temporaryDirectory();


Shouldn’t the createTempFile method read from the /field/ in
LazyInitialization instead of calling the /method/? If I got this
correctly, the brackets in line 1797 should be removed.

Regards
Well spotted - that's what we get for having a field and method with the same name! That code has been replaced in jdk7 so it's not an issue there. For jdk6 code we should just initialize a field to the property value (like in jdk7) and the temporaryDirectory method return the value.

-Alan.

Reply via email to