JavaMemoryModel: Bugs in Tiger beta 1

From: Doron Rajwan (doron@rajwan.org)
Date: Tue Mar 09 2004 - 15:18:43 EST


>From browsing the sources of Tiger beta 1 I see lot of
code that breaks the JMM. Should I use the bug parade
for that?

For example, from java.util.Scanner:

    private static Pattern boolPattern;
    private static final String BOOLEAN_PATTERN =
"true|false";
    private static Pattern boolPattern() {
        if (boolPattern == null)
            boolPattern =
Pattern.compile(BOOLEAN_PATTERN,
                                         
Pattern.CASE_INSENSITIVE);
        return boolPattern;
    }

This code must be fixed: boolPattern must be volatile.

thanks,
  Doron.

=====
Doron Rajwan, mailto:doron@rajwan.org

-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:59 EDT