changeset 239:f1395382fbc4

Generators: reshuffle templates.
author shade
date Wed, 11 May 2016 18:50:43 +0300
parents d81530020d67
children 4768218cfa50
files jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter0aTestGenerator.java jcstress-test-gen/src/main/resources/accessAtomic/X-ArrayAtomicityTest.java.template jcstress-test-gen/src/main/resources/accessAtomic/X-ArrayLargeAtomicityTest.java.template jcstress-test-gen/src/main/resources/accessAtomic/X-FieldAtomicityTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayAtomicityTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayDefaultValuesTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayInitTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeAtomicityTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeDefaultValuesTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeInitTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeTearingTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-ArrayTearingTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-FieldAtomicityTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-FieldDefaultValuesTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-FieldInitTest.java.template jcstress-test-gen/src/main/resources/chapter0a/X-FieldTearingTest.java.template jcstress-test-gen/src/main/resources/defaultValues/X-ArrayDefaultValuesTest.java.template jcstress-test-gen/src/main/resources/defaultValues/X-ArrayLargeDefaultValuesTest.java.template jcstress-test-gen/src/main/resources/defaultValues/X-FieldDefaultValuesTest.java.template jcstress-test-gen/src/main/resources/init/X-ArrayInitTest.java.template jcstress-test-gen/src/main/resources/init/X-ArrayLargeInitTest.java.template jcstress-test-gen/src/main/resources/init/X-FieldInitTest.java.template jcstress-test-gen/src/main/resources/tearing/X-ArrayLargeTearingTest.java.template jcstress-test-gen/src/main/resources/tearing/X-ArrayTearingTest.java.template jcstress-test-gen/src/main/resources/tearing/X-FieldTearingTest.java.template
diffstat 25 files changed, 805 insertions(+), 805 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter0aTestGenerator.java	Wed May 11 01:27:50 2016 +0300
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter0aTestGenerator.java	Wed May 11 18:50:43 2016 +0300
@@ -48,84 +48,84 @@
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-FieldAtomicityTest.java.template"),
+                readFromResource("/accessAtomic/X-FieldAtomicityTest.java.template"),
                 "accessAtomic.fields",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-FieldDefaultValuesTest.java.template"),
+                readFromResource("/defaultValues/X-FieldDefaultValuesTest.java.template"),
                 "defaultValues.fields",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-FieldInitTest.java.template"),
+                readFromResource("/init/X-FieldInitTest.java.template"),
                 "init.fields",
                 new String[]{ "", "volatile", "final" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-FieldTearingTest.java.template"),
+                readFromResource("/tearing/X-FieldTearingTest.java.template"),
                 "tearing.fields",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayDefaultValuesTest.java.template"),
+                readFromResource("/defaultValues/X-ArrayDefaultValuesTest.java.template"),
                 "defaultValues.arrays.small",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayLargeDefaultValuesTest.java.template"),
+                readFromResource("/defaultValues/X-ArrayLargeDefaultValuesTest.java.template"),
                 "defaultValues.arrays.large",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayInitTest.java.template"),
+                readFromResource("/init/X-ArrayInitTest.java.template"),
                 "init.arrays.small",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayLargeInitTest.java.template"),
+                readFromResource("/init/X-ArrayLargeInitTest.java.template"),
                 "init.arrays.large",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayAtomicityTest.java.template"),
+                readFromResource("/accessAtomic/X-ArrayAtomicityTest.java.template"),
                 "accessAtomic.arrays.small",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayLargeAtomicityTest.java.template"),
+                readFromResource("/accessAtomic/X-ArrayLargeAtomicityTest.java.template"),
                 "accessAtomic.arrays.large",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayTearingTest.java.template"),
+                readFromResource("/tearing/X-ArrayTearingTest.java.template"),
                 "tearing.arrays.small",
                 new String[]{ "", "volatile" }
         );
 
         makeTests(
                 dest,
-                readFromResource("/chapter0a/X-ArrayLargeTearingTest.java.template"),
+                readFromResource("/tearing/X-ArrayLargeTearingTest.java.template"),
                 "tearing.arrays.large",
                 new String[]{ "", "volatile" }
         );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/accessAtomic/X-ArrayAtomicityTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields experience non-atomic reads/writes.
+ */
+@JCStressTest
+@Outcome(id = "[$default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the element. Allowed to see this: data race.")
+@Outcome(id = "[$set$]", expect = Expect.ACCEPTABLE, desc = "The value set by the actor thread. Observer sees the complete update.")
+#if[alwaysAtomic]
+@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
+#else[alwaysAtomic]
+@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
+@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
+#end[alwaysAtomic]
+@State
+public class $name$ {
+
+    $modifier$$type$[] a = new $type$[1];
+
+    @Actor
+    public void actor1() {
+        a[0] = $setLiteral$;
+    }
+
+    @Actor
+    public void actor2($Type$Result1 r) {
+        r.r1 = a[0];
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/accessAtomic/X-ArrayLargeAtomicityTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields experience non-atomic reads/writes.
+ */
+@JCStressTest
+@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
+@Outcome(id = "[1]",  expect = Expect.ACCEPTABLE, desc = "Seen all elements set.")
+#if[alwaysAtomic]
+@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
+#else[alwaysAtomic]
+@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
+@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
+#end[alwaysAtomic]
+@State
+public class $name$ {
+
+    $modifier$$type$[] arr = new $type$[2 * 1024 * 1024];
+
+    @Actor
+    public void actor1() {
+        $type$[] a = arr;
+        for (int c = 0; c < a.length; c++) a[c] = $setLiteral$;
+    }
+
+    @Actor
+    public void actor2(IntResult1 r) {
+        $type$[] a = arr;
+        if (a == null) {
+            r.r1 = -1;
+        } else {
+            boolean allCorrect = true;
+            for ($type$ v : a) {
+                allCorrect &= (v == $setLiteral$ || v == $defaultLiteral$);
+            }
+            r.r1 = allCorrect ? 1 : 0;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/accessAtomic/X-FieldAtomicityTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields experience non-atomic reads/writes.
+ */
+@JCStressTest
+@Outcome(id = "[$default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the field. Allowed to see this: data race.")
+@Outcome(id = "[$set$]", expect = Expect.ACCEPTABLE, desc = "The value set by the actor thread. Observer sees the complete update.")
+#if[alwaysAtomic]
+@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
+#else[alwaysAtomic]
+@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
+@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
+#end[alwaysAtomic]
+@State
+public class $name$ {
+
+    $modifier$$type$ x;
+
+    @Actor
+    public void actor1() {
+        x = $setLiteral$;
+    }
+
+    @Actor
+    public void actor2($Type$Result1 r) {
+        r.r1 = x;
+    }
+
+}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayAtomicityTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields experience non-atomic reads/writes.
- */
-@JCStressTest
-@Outcome(id = "[$default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the element. Allowed to see this: data race.")
-@Outcome(id = "[$set$]", expect = Expect.ACCEPTABLE, desc = "The value set by the actor thread. Observer sees the complete update.")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $name$ {
-
-    $modifier$$type$[] a = new $type$[1];
-
-    @Actor
-    public void actor1() {
-        a[0] = $setLiteral$;
-    }
-
-    @Actor
-    public void actor2($Type$Result1 r) {
-        r.r1 = a[0];
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayDefaultValuesTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields are initialized to default values.
- */
-@JCStressTest
-@Outcome(id = "[$default$, $default$, $default$, $default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the element.")
-@Outcome(expect = Expect.FORBIDDEN, desc = "Non-default values are forbidden.")
-@State
-public class $name$ {
-
-    $modifier$$type$[] arr;
-
-    @Actor
-    public void actor1() {
-        arr = new $type$[4];
-    }
-
-    @Actor
-    public void actor2($Type$Result4 r) {
-        $type$[] a = arr;
-        if (a == null) {
-            // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = $defaultLiteral$;
-        } else {
-            r.r1 = a[0];
-            r.r2 = a[1];
-            r.r3 = a[2];
-            r.r4 = a[3];
-        }
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayInitTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields initialization is visible via racy publication.
- */
-@JCStressTest
-#if[!volatile]
-@Outcome(id = "[0]",  expect = Expect.ACCEPTABLE, desc = "Default value for the element. Allowed to see this: data race.")
-#end[!volatile]
-@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
-@Outcome(id = "[1]",  expect = Expect.ACCEPTABLE, desc = "Seen all elements set.")
-@State
-public class $name$ {
-
-    $modifier$$type$[] arr;
-
-    @Actor
-    public void actor1() {
-        $type$[] a = new $type$[4];
-        a[0] = a[1] = a[2] = a[3] = $setLiteral$;
-        arr = a;
-    }
-
-    @Actor
-    public void actor2(IntResult1 r) {
-        $type$[] a = arr;
-        if (a == null) {
-            r.r1 = -1;
-        } else {
-            boolean allSet = true;
-            for ($type$ v : a) {
-                allSet &= (v == $setLiteral$);
-            }
-            r.r1 = allSet ? 1 : 0;
-        }
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeAtomicityTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields experience non-atomic reads/writes.
- */
-@JCStressTest
-@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
-@Outcome(id = "[1]",  expect = Expect.ACCEPTABLE, desc = "Seen all elements set.")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $name$ {
-
-    $modifier$$type$[] arr = new $type$[2 * 1024 * 1024];
-
-    @Actor
-    public void actor1() {
-        $type$[] a = arr;
-        for (int c = 0; c < a.length; c++) a[c] = $setLiteral$;
-    }
-
-    @Actor
-    public void actor2(IntResult1 r) {
-        $type$[] a = arr;
-        if (a == null) {
-            r.r1 = -1;
-        } else {
-            boolean allCorrect = true;
-            for ($type$ v : a) {
-                allCorrect &= (v == $setLiteral$ || v == $defaultLiteral$);
-            }
-            r.r1 = allCorrect ? 1 : 0;
-        }
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeDefaultValuesTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-import java.util.concurrent.*;
-
-#warn
-
-/**
- * Tests if fields are initialized to default values.
- */
-@JCStressTest
-@Outcome(id = "[0]",  expect = Expect.ACCEPTABLE, desc = "Default value for the element.")
-@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
-@Outcome(id = "[1]",  expect = Expect.FORBIDDEN, desc = "Non-default values are forbidden.")
-@State
-public class $name$ {
-
-    $modifier$$type$[] arr;
-
-    @Actor
-    public void actor1() {
-        arr = new $type$[2 * 1024 * 1024];
-    }
-
-    @Actor
-    public void actor2(IntResult1 r) {
-        $type$[] a = arr;
-        if (a == null) {
-            r.r1 = -1;
-        } else {
-            boolean allDefault = true;
-            for ($type$ v : a) {
-                allDefault &= (v == $defaultLiteral$);
-            }
-            r.r1 = allDefault ? 0 : 1;
-        }
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeInitTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields initialization is visible via racy publication.
- */
-@JCStressTest
-#if[!volatile]
-@Outcome(id = "[0]",  expect = Expect.ACCEPTABLE, desc = "Default value for the element. Allowed to see this: data race.")
-#end[!volatile]
-@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
-@Outcome(id = "[1]",  expect = Expect.ACCEPTABLE, desc = "Seen all elements set.")
-@State
-public class $name$ {
-
-    $modifier$$type$[] arr;
-
-    @Actor
-    public void actor1() {
-        $type$[] a = new $type$[2 * 1024 * 1024];
-        for (int c = 0; c < a.length; c++) a[c] = $setLiteral$;
-        arr = a;
-    }
-
-    @Actor
-    public void actor2(IntResult1 r) {
-        $type$[] a = arr;
-        if (a == null) {
-            r.r1 = -1;
-        } else {
-            boolean allSet = true;
-            for ($type$ v : a) {
-                allSet &= (v == $setLiteral$);
-            }
-            r.r1 = allSet ? 1 : 0;
-        }
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayLargeTearingTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-import java.util.concurrent.*;
-
-#warn
-
-/**
- * Tests if fields writes are not word-teared.
- */
-@JCStressTest
-@Outcome(id = "[$set$, $set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Should see the set values only")
-#else[alwaysAtomic]
-@Outcome(id = "[$default$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(id = "[$set$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(id = "[$default$, $set$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $name$ {
-
-    $modifier$$type$[] arr =  new $type$[2 * 1024 * 1024];
-    int idx1 = ThreadLocalRandom.current().nextInt(2 * 1024 * 1024 - 1);
-    int idx2 = idx1 + 1;
-
-    @Actor
-    public void actor1() {
-        arr[idx1] = $setLiteral$;
-    }
-
-    @Actor
-    public void actor2() {
-        arr[idx2] = $setLiteral$;
-    }
-
-    @Arbiter
-    public void arbiter($Type$Result2 r) {
-        r.r1 = arr[idx1];
-        r.r2 = arr[idx2];
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-ArrayTearingTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields writes are not word-teared.
- */
-@JCStressTest
-@Outcome(id = "[$set$, $set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Should see the set values only")
-#else[alwaysAtomic]
-@Outcome(id = "[$default$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(id = "[$set$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(id = "[$default$, $set$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $name$ {
-
-    $modifier$$type$[] arr = new $type$[2];
-
-    @Actor
-    public void actor1() {
-        arr[0] = $setLiteral$;
-    }
-
-    @Actor
-    public void actor2() {
-        arr[1] = $setLiteral$;
-    }
-
-    @Arbiter
-    public void arbiter($Type$Result2 r) {
-        r.r1 = arr[0];
-        r.r2 = arr[1];
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-FieldAtomicityTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields experience non-atomic reads/writes.
- */
-@JCStressTest
-@Outcome(id = "[$default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the field. Allowed to see this: data race.")
-@Outcome(id = "[$set$]", expect = Expect.ACCEPTABLE, desc = "The value set by the actor thread. Observer sees the complete update.")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $name$ {
-
-    $modifier$$type$ x;
-
-    @Actor
-    public void actor1() {
-        x = $setLiteral$;
-    }
-
-    @Actor
-    public void actor2($Type$Result1 r) {
-        r.r1 = x;
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-FieldDefaultValuesTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields are initialized to default values.
- */
-@JCStressTest
-@Outcome(id = "[$default$, $default$, $default$, $default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the field.")
-@Outcome(expect = Expect.FORBIDDEN, desc = "Non-default values are forbidden.")
-@State
-public class $name$ {
-
-    Data data;
-
-    public static class Data {
-        $modifier$$type$ v0, v1, v2, v3;
-    }
-
-    @Actor
-    public void actor1() {
-        data = new Data();
-    }
-
-    @Actor
-    public void actor2($Type$Result4 r) {
-        Data d = this.data;
-        if (d == null) {
-            // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = $defaultLiteral$;
-        } else {
-            r.r1 = d.v0;
-            r.r2 = d.v1;
-            r.r3 = d.v2;
-            r.r4 = d.v3;
-        }
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-FieldInitTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields initialization is visible via racy publication.
- */
-@JCStressTest
-#if[!final]
-@Outcome(id = "[$default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the field. Allowed to see this: data race.")
-#end[!final]
-@Outcome(id = "[$set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
-#else[alwaysAtomic]
-@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec.")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $name$ {
-
-    Data data;
-
-    public static class Data {
-        $modifier$$type$ x = $setLiteral$;
-    }
-
-    @Actor
-    public void actor1() {
-        data = new Data();
-    }
-
-    @Actor
-    public void actor2($Type$Result1 r) {
-        Data d = this.data;
-        if (d == null) {
-            // Pretend we have seen the set value
-            r.r1 = $setLiteral$;
-        } else {
-            r.r1 = d.x;
-        }
-    }
-
-}
--- a/jcstress-test-gen/src/main/resources/chapter0a/X-FieldTearingTest.java.template	Wed May 11 01:27:50 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package $package$;
-
-import org.openjdk.jcstress.annotations.*;
-import org.openjdk.jcstress.infra.results.*;
-
-#warn
-
-/**
- * Tests if fields writes are not word-teared.
- */
-@JCStressTest
-@Outcome(id = "[$set$, $set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
-#if[alwaysAtomic]
-@Outcome(expect = Expect.FORBIDDEN, desc = "Should see the set values only")
-#else[alwaysAtomic]
-@Outcome(id = "[$default$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(id = "[$set$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(id = "[$default$, $set$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
-@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
-@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
-#end[alwaysAtomic]
-@State
-public class $name$ {
-
-    Data data = new Data();
-
-    public static class Data {
-        $modifier$$type$ x1;
-        $modifier$$type$ x2;
-    }
-
-    @Actor
-    public void actor1() {
-        data.x1 = $setLiteral$;
-    }
-
-    @Actor
-    public void actor2() {
-        data.x2 = $setLiteral$;
-    }
-
-    @Arbiter
-    public void arbiter($Type$Result2 r) {
-        r.r1 = data.x1;
-        r.r2 = data.x2;
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/defaultValues/X-ArrayDefaultValuesTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields are initialized to default values.
+ */
+@JCStressTest
+@Outcome(id = "[$default$, $default$, $default$, $default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the element.")
+@Outcome(expect = Expect.FORBIDDEN, desc = "Non-default values are forbidden.")
+@State
+public class $name$ {
+
+    $modifier$$type$[] arr;
+
+    @Actor
+    public void actor1() {
+        arr = new $type$[4];
+    }
+
+    @Actor
+    public void actor2($Type$Result4 r) {
+        $type$[] a = arr;
+        if (a == null) {
+            // Pretend we have seen the default values
+            r.r1 = r.r2 = r.r3 = r.r4 = $defaultLiteral$;
+        } else {
+            r.r1 = a[0];
+            r.r2 = a[1];
+            r.r3 = a[2];
+            r.r4 = a[3];
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/defaultValues/X-ArrayLargeDefaultValuesTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+import java.util.concurrent.*;
+
+#warn
+
+/**
+ * Tests if fields are initialized to default values.
+ */
+@JCStressTest
+@Outcome(id = "[0]",  expect = Expect.ACCEPTABLE, desc = "Default value for the element.")
+@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
+@Outcome(id = "[1]",  expect = Expect.FORBIDDEN, desc = "Non-default values are forbidden.")
+@State
+public class $name$ {
+
+    $modifier$$type$[] arr;
+
+    @Actor
+    public void actor1() {
+        arr = new $type$[2 * 1024 * 1024];
+    }
+
+    @Actor
+    public void actor2(IntResult1 r) {
+        $type$[] a = arr;
+        if (a == null) {
+            r.r1 = -1;
+        } else {
+            boolean allDefault = true;
+            for ($type$ v : a) {
+                allDefault &= (v == $defaultLiteral$);
+            }
+            r.r1 = allDefault ? 0 : 1;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/defaultValues/X-FieldDefaultValuesTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields are initialized to default values.
+ */
+@JCStressTest
+@Outcome(id = "[$default$, $default$, $default$, $default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the field.")
+@Outcome(expect = Expect.FORBIDDEN, desc = "Non-default values are forbidden.")
+@State
+public class $name$ {
+
+    Data data;
+
+    public static class Data {
+        $modifier$$type$ v0, v1, v2, v3;
+    }
+
+    @Actor
+    public void actor1() {
+        data = new Data();
+    }
+
+    @Actor
+    public void actor2($Type$Result4 r) {
+        Data d = this.data;
+        if (d == null) {
+            // Pretend we have seen the default values
+            r.r1 = r.r2 = r.r3 = r.r4 = $defaultLiteral$;
+        } else {
+            r.r1 = d.v0;
+            r.r2 = d.v1;
+            r.r3 = d.v2;
+            r.r4 = d.v3;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/init/X-ArrayInitTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields initialization is visible via racy publication.
+ */
+@JCStressTest
+#if[!volatile]
+@Outcome(id = "[0]",  expect = Expect.ACCEPTABLE, desc = "Default value for the element. Allowed to see this: data race.")
+#end[!volatile]
+@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
+@Outcome(id = "[1]",  expect = Expect.ACCEPTABLE, desc = "Seen all elements set.")
+@State
+public class $name$ {
+
+    $modifier$$type$[] arr;
+
+    @Actor
+    public void actor1() {
+        $type$[] a = new $type$[4];
+        a[0] = a[1] = a[2] = a[3] = $setLiteral$;
+        arr = a;
+    }
+
+    @Actor
+    public void actor2(IntResult1 r) {
+        $type$[] a = arr;
+        if (a == null) {
+            r.r1 = -1;
+        } else {
+            boolean allSet = true;
+            for ($type$ v : a) {
+                allSet &= (v == $setLiteral$);
+            }
+            r.r1 = allSet ? 1 : 0;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/init/X-ArrayLargeInitTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields initialization is visible via racy publication.
+ */
+@JCStressTest
+#if[!volatile]
+@Outcome(id = "[0]",  expect = Expect.ACCEPTABLE, desc = "Default value for the element. Allowed to see this: data race.")
+#end[!volatile]
+@Outcome(id = "[-1]", expect = Expect.ACCEPTABLE, desc = "Have not seen the array yet.")
+@Outcome(id = "[1]",  expect = Expect.ACCEPTABLE, desc = "Seen all elements set.")
+@State
+public class $name$ {
+
+    $modifier$$type$[] arr;
+
+    @Actor
+    public void actor1() {
+        $type$[] a = new $type$[2 * 1024 * 1024];
+        for (int c = 0; c < a.length; c++) a[c] = $setLiteral$;
+        arr = a;
+    }
+
+    @Actor
+    public void actor2(IntResult1 r) {
+        $type$[] a = arr;
+        if (a == null) {
+            r.r1 = -1;
+        } else {
+            boolean allSet = true;
+            for ($type$ v : a) {
+                allSet &= (v == $setLiteral$);
+            }
+            r.r1 = allSet ? 1 : 0;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/init/X-FieldInitTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields initialization is visible via racy publication.
+ */
+@JCStressTest
+#if[!final]
+@Outcome(id = "[$default$]", expect = Expect.ACCEPTABLE, desc = "Default value for the field. Allowed to see this: data race.")
+#end[!final]
+@Outcome(id = "[$set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
+#if[alwaysAtomic]
+@Outcome(expect = Expect.FORBIDDEN, desc = "Other values are forbidden: atomicity violation.")
+#else[alwaysAtomic]
+@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec.")
+@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
+#end[alwaysAtomic]
+@State
+public class $name$ {
+
+    Data data;
+
+    public static class Data {
+        $modifier$$type$ x = $setLiteral$;
+    }
+
+    @Actor
+    public void actor1() {
+        data = new Data();
+    }
+
+    @Actor
+    public void actor2($Type$Result1 r) {
+        Data d = this.data;
+        if (d == null) {
+            // Pretend we have seen the set value
+            r.r1 = $setLiteral$;
+        } else {
+            r.r1 = d.x;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/tearing/X-ArrayLargeTearingTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+import java.util.concurrent.*;
+
+#warn
+
+/**
+ * Tests if fields writes are not word-teared.
+ */
+@JCStressTest
+@Outcome(id = "[$set$, $set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
+#if[alwaysAtomic]
+@Outcome(expect = Expect.FORBIDDEN, desc = "Should see the set values only")
+#else[alwaysAtomic]
+@Outcome(id = "[$default$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(id = "[$set$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(id = "[$default$, $set$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
+@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
+#end[alwaysAtomic]
+@State
+public class $name$ {
+
+    $modifier$$type$[] arr =  new $type$[2 * 1024 * 1024];
+    int idx1 = ThreadLocalRandom.current().nextInt(2 * 1024 * 1024 - 1);
+    int idx2 = idx1 + 1;
+
+    @Actor
+    public void actor1() {
+        arr[idx1] = $setLiteral$;
+    }
+
+    @Actor
+    public void actor2() {
+        arr[idx2] = $setLiteral$;
+    }
+
+    @Arbiter
+    public void arbiter($Type$Result2 r) {
+        r.r1 = arr[idx1];
+        r.r2 = arr[idx2];
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/tearing/X-ArrayTearingTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields writes are not word-teared.
+ */
+@JCStressTest
+@Outcome(id = "[$set$, $set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
+#if[alwaysAtomic]
+@Outcome(expect = Expect.FORBIDDEN, desc = "Should see the set values only")
+#else[alwaysAtomic]
+@Outcome(id = "[$default$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(id = "[$set$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(id = "[$default$, $set$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
+@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
+#end[alwaysAtomic]
+@State
+public class $name$ {
+
+    $modifier$$type$[] arr = new $type$[2];
+
+    @Actor
+    public void actor1() {
+        arr[0] = $setLiteral$;
+    }
+
+    @Actor
+    public void actor2() {
+        arr[1] = $setLiteral$;
+    }
+
+    @Arbiter
+    public void arbiter($Type$Result2 r) {
+        r.r1 = arr[0];
+        r.r2 = arr[1];
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/resources/tearing/X-FieldTearingTest.java.template	Wed May 11 18:50:43 2016 +0300
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package $package$;
+
+import org.openjdk.jcstress.annotations.*;
+import org.openjdk.jcstress.infra.results.*;
+
+#warn
+
+/**
+ * Tests if fields writes are not word-teared.
+ */
+@JCStressTest
+@Outcome(id = "[$set$, $set$]", expect = Expect.ACCEPTABLE, desc = "Seeing the set value.")
+#if[alwaysAtomic]
+@Outcome(expect = Expect.FORBIDDEN, desc = "Should see the set values only")
+#else[alwaysAtomic]
+@Outcome(id = "[$default$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(id = "[$set$, $default$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(id = "[$default$, $set$]", expect = Expect.FORBIDDEN, desc = "Cannot see default values.")
+@Outcome(expect = Expect.ACCEPTABLE_SPEC, desc = "Non-atomic access detected, allowed by spec")
+@Ref("http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.7")
+#end[alwaysAtomic]
+@State
+public class $name$ {
+
+    Data data = new Data();
+
+    public static class Data {
+        $modifier$$type$ x1;
+        $modifier$$type$ x2;
+    }
+
+    @Actor
+    public void actor1() {
+        data.x1 = $setLiteral$;
+    }
+
+    @Actor
+    public void actor2() {
+        data.x2 = $setLiteral$;
+    }
+
+    @Arbiter
+    public void arbiter($Type$Result2 r) {
+        r.r1 = data.x1;
+        r.r2 = data.x2;
+    }
+
+}