On 27/07/2016 11:39 PM, Martin Buchholz wrote:


On Tue, Jul 26, 2016 at 11:13 PM, David Holmes <david.hol...@oracle.com
<mailto:david.hol...@oracle.com>> wrote:

    On 27/07/2016 3:45 PM, Martin Buchholz wrote:

        Hi David,

        I didn't even look at Console.java!  I just fixed the double-checked
        locking in System.java.

        Looking now at Console.cons, that is NOT safely statically
        initialized:

                SharedSecrets.setJavaIOAccess(new JavaIOAccess() {
                    public Console console() {
                        if (istty()) {
                            if (cons == null)
                                cons = new Console();
                            return cons;
                        }
                        return null;
                    }

        (but it's currently safe because only System.java accesses it)


    The above code is in a static initialization block.


Sure, but the code isn't run (yet), just made available to be run later
via JavaIOAccess when System.console() is called.

Ah! Right - my mistake, sorry.

David

Reply via email to