changeset 226:586f4a89c984

Chapters 0.b, 0.c, and 1.a: auto-generated tests.
author shade
date Fri, 06 May 2016 23:20:05 +0300
parents e7bdce583a72
children f1fda49d3736
files jcstress-test-gen/pom.xml jcstress-test-gen/src/main/java/org/openjdk/jcstress/TraceGenMain.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter0bTestGenerator.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter0cTestGenerator.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Op.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Result.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/SeqCstTraceGenerator.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Target.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Value.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/tracer/Op.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java pom.xml tests-all/pom.xml tests-chapter-0b/pom.xml tests-chapter-0c/LICENSE tests-chapter-0c/THIRD_PARTY_README tests-chapter-0c/pom.xml tests-chapter-0c/src/main/java/Test.java tests-chapter-0c/src/main/resources/LICENSE tests-chapter-0c/src/main/resources/THIRD_PARTY_README tests-chapter-1a/LICENSE tests-chapter-1a/THIRD_PARTY_README tests-chapter-1a/pom.xml tests-chapter-1a/src/main/java/Test.java tests-chapter-1a/src/main/resources/LICENSE tests-chapter-1a/src/main/resources/THIRD_PARTY_README
diffstat 26 files changed, 2919 insertions(+), 684 deletions(-) [+]
line wrap: on
line diff
--- a/jcstress-test-gen/pom.xml	Fri May 06 14:18:33 2016 +0300
+++ b/jcstress-test-gen/pom.xml	Fri May 06 23:20:05 2016 +0300
@@ -75,22 +75,6 @@
                         </configuration>
                     </execution>
                     <execution>
-                        <id>volatile-tracegen</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>shade</goal>
-                        </goals>
-                        <configuration>
-                            <finalName>volatile-tracegen</finalName>
-                            <transformers>
-                                <transformer
-                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                                    <mainClass>org.openjdk.jcstress.TraceGenMain</mainClass>
-                                </transformer>
-                            </transformers>
-                        </configuration>
-                    </execution>
-                    <execution>
                         <id>chapter0a-generator</id>
                         <phase>package</phase>
                         <goals>
@@ -106,6 +90,38 @@
                             </transformers>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>chapter0b-generator</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>chapter0b-generator</finalName>
+                            <transformers>
+                                <transformer
+                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                    <mainClass>org.openjdk.jcstress.chapters.Chapter0bTestGenerator</mainClass>
+                                </transformer>
+                            </transformers>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>chapter0c-generator</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>chapter0c-generator</finalName>
+                            <transformers>
+                                <transformer
+                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                    <mainClass>org.openjdk.jcstress.chapters.Chapter0cTestGenerator</mainClass>
+                                </transformer>
+                            </transformers>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
             <plugin>
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/TraceGenMain.java	Fri May 06 14:18:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2005, 2014, 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 org.openjdk.jcstress;
-
-import org.openjdk.jcstress.generator.TestGenerator;
-import org.openjdk.jcstress.tracer.TraceGen;
-
-import java.io.FileNotFoundException;
-
-public class TraceGenMain {
-
-    public static void main(String[] args) throws FileNotFoundException {
-        if (args.length >= 2) {
-            new TraceGen(3, args[0], args[1]).generate();
-        } else {
-            throw new IllegalStateException("Please provide the destination dir");
-        }
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter0bTestGenerator.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2005, 2014, 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 org.openjdk.jcstress.chapters;
+
+import org.openjdk.jcstress.generator.seqcst.SeqCstTraceGenerator;
+import org.openjdk.jcstress.generator.seqcst.Target;
+
+import java.io.FileNotFoundException;
+
+public class Chapter0bTestGenerator {
+
+    public static void main(String[] args) throws FileNotFoundException {
+        String dst;
+        if (args.length >= 1) {
+            dst = args[0];
+        } else {
+            throw new IllegalStateException("Please provide the destination dir");
+        }
+
+        SeqCstTraceGenerator.generate(
+                dst,
+                "org.openjdk.jcstress.tests.seqcst.volatiles",
+                Target.VOLATILE);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter0cTestGenerator.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2005, 2014, 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 org.openjdk.jcstress.chapters;
+
+import org.openjdk.jcstress.generator.seqcst.SeqCstTraceGenerator;
+import org.openjdk.jcstress.generator.seqcst.Target;
+
+import java.io.FileNotFoundException;
+
+public class Chapter0cTestGenerator {
+
+    public static void main(String[] args) throws FileNotFoundException {
+        String dst;
+        if (args.length >= 1) {
+            dst = args[0];
+        } else {
+            throw new IllegalStateException("Please provide the destination dir");
+        }
+
+        SeqCstTraceGenerator.generate(
+                dst,
+                "org.openjdk.jcstress.tests.seqcst.sync",
+                Target.SYNCHRONIZED);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Op.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2005, 2014, 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 org.openjdk.jcstress.generator.seqcst;
+
+import java.util.Objects;
+
+public abstract class Op {
+
+    private final Type type;
+    protected final int varId;
+
+    public static Op newLoad(int varId) {
+        return new LoadOp(varId);
+    }
+
+    public static Op newLoad(Op op, Result res) {
+        LoadOp t = new LoadOp(op.getVarId());
+        t.setResult(res);
+        return t;
+    }
+
+    public static Op newStore(int varId) {
+        return new StoreOp(varId);
+    }
+
+    public static Op newStore(Op op, Value value) {
+        StoreOp t = new StoreOp(op.getVarId());
+        t.setValue(value);
+        return t;
+    }
+
+    private Op(Type type, int varId) {
+        this.type = type;
+        this.varId = varId;
+    }
+
+    public Type getType() {
+        return type;
+    }
+
+    public int getVarId() {
+        return varId;
+    }
+
+    public abstract Result getResult();
+    public abstract void setResult(Result res);
+
+    public abstract Value getValue();
+    public abstract void setValue(Value value);
+
+    public static class LoadOp extends Op {
+        private Result res;
+
+        public LoadOp(int varId) {
+            super(Type.LOAD, varId);
+        }
+
+        @Override
+        public Result getResult() {
+            return Objects.requireNonNull(res);
+        }
+
+        @Override
+        public void setResult(Result res) {
+            this.res = res;
+        }
+
+        @Override
+        public Value getValue() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setValue(Value value) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String toString() {
+            return "r" + res + " = x" + varId;
+        }
+
+    }
+
+    public static class StoreOp extends Op {
+        private Value value;
+
+        public StoreOp(int varId) {
+            super(Type.STORE, varId);
+        }
+
+        @Override
+        public Result getResult() {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setResult(Result res) {
+            throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public Value getValue() {
+            if (value == null) {
+                throw new IllegalStateException("valueId unset");
+            }
+            return value;
+        }
+
+        @Override
+        public void setValue(Value value) {
+            this.value = value;
+        }
+
+        @Override
+        public String toString() {
+            return "x" + varId + " = C" + value;
+        }
+
+    }
+
+    public enum Type {
+        LOAD,
+        STORE,
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Result.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 2015, 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 org.openjdk.jcstress.generator.seqcst;
+
+import java.util.Comparator;
+
+public class Result implements Comparable<Result> {
+    static final Comparator<Result> COMP = Comparator.comparing(t -> t.id);
+    private int id;
+
+    public Result(int id) {
+        this.id = id;
+    }
+
+    @Override
+    public String toString() {
+        return "" + id;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Result result = (Result) o;
+
+        return id == result.id;
+
+    }
+
+    @Override
+    public int hashCode() {
+        return id;
+    }
+
+    @Override
+    public int compareTo(Result o) {
+        return COMP.compare(this, o);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/SeqCstTraceGenerator.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,640 @@
+/*
+ * Copyright (c) 2005, 2014, 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 org.openjdk.jcstress.generator.seqcst;
+
+import org.openjdk.jcstress.generator.ResultGenerator;
+import org.openjdk.jcstress.generator.TestGenerator;
+import org.openjdk.jcstress.generator.Utils;
+
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.util.*;
+import java.util.stream.Collectors;
+
+public class SeqCstTraceGenerator {
+
+    private final String srcDir;
+    private final String pkg;
+    private final Target target;
+    private final ResultGenerator resultGenerator;
+
+    public static void generate(String dst, String pkg, Target target) {
+        new SeqCstTraceGenerator(dst, pkg, target).generate();
+    }
+
+    private SeqCstTraceGenerator(String dst, String pkg, Target target) {
+        this.srcDir = dst;
+        this.pkg = pkg;
+        this.target = target;
+        this.resultGenerator = new ResultGenerator(dst);
+    }
+
+    public void generate() {
+        /*
+           Step 1. Generate all possible traces from the available ops:
+         */
+
+        System.out.print("Generating load/store permutations... ");
+
+        List<Trace> allTraces = new ArrayList<>();
+        {
+            List<Op> possibleOps = new ArrayList<>();
+            for (int v = 0; v < 2; v++) {
+                possibleOps.add(Op.newStore(v));
+                possibleOps.add(Op.newLoad(v));
+                possibleOps.add(Op.newLoad(v));
+            }
+
+            List<Trace> traces = Collections.singletonList(new Trace());
+            for (int l = 0; l < possibleOps.size(); l++) {
+                traces = product(traces, possibleOps);
+                allTraces.addAll(traces);
+            }
+        }
+
+        {
+            List<Op> possibleOps = new ArrayList<>();
+            for (int v = 0; v < 3; v++) {
+                possibleOps.add(Op.newStore(v));
+                possibleOps.add(Op.newLoad(v));
+            }
+
+            List<Trace> traces = Collections.singletonList(new Trace());
+            for (int l = 0; l < possibleOps.size(); l++) {
+                traces = product(traces, possibleOps);
+                allTraces.addAll(traces);
+            }
+        }
+
+        List<Trace> traces = allTraces;
+        System.out.print(" " + traces.size() + " found... ");
+
+        /*
+           Step 2. Filter out non-interesting traces.
+         */
+
+        Set<String> canonicalTraces = new HashSet<>();
+        traces = allTraces.stream()
+                .filter(Trace::hasLoads)            // Has observable effects
+                .filter(Trace::hasStores)           // Has modifications to observe
+                .filter(Trace::matchedLoadStores)   // All modifications are observed; no observing non-modified
+                .filter(t -> canonicalTraces.add(t.canonicalId())) // Only a canonical order of vars accepted
+                .collect(Collectors.toList());
+
+        for (Trace trace : traces) {
+            trace.assignResults();
+        }
+
+        System.out.println(traces.size() + " are interesting.");
+
+        /*
+           Step 3. Distribute load-stores between threads, yielding all possible scenarios.
+         */
+        final int THREADS = 4;
+
+        System.out.print("Generating test cases that distribute load/stores among " + THREADS + " threads... ");
+
+        List<MultiThread> multiThreads = new ArrayList<>();
+        for (Trace trace : traces) {
+
+            int len = trace.getLength();
+            int bitsNeeded = 2*len;
+            if (bitsNeeded > 63) {
+                throw new IllegalStateException("Cannot handle large traces like that");
+            }
+
+            long bound = 1 << bitsNeeded;
+
+            for (long c = 0; c < bound; c++) {
+                Map<Integer, List<Op>> newT = new HashMap<>();
+                for (int t = 0; t < THREADS; t++) {
+                    newT.put(t, new ArrayList<>());
+                }
+
+                long ticket = c;
+                for (Op op : trace.ops) {
+                    int thread = (int)(ticket & 3);
+                    newT.get(thread).add(op);
+                    ticket = ticket >> 2;
+                }
+
+                MultiThread mt = new MultiThread(trace, newT.values().stream().map(Trace::new).collect(Collectors.toList()));
+                multiThreads.add(mt);
+            }
+        }
+        System.out.print(multiThreads.size() + " testcases generated... ");
+
+        /*
+           Step 4. Apply more filters to reduce
+         */
+
+        multiThreads = multiThreads.stream()
+                .filter(MultiThread::isMultiThread)               // really have multiple threads
+                .filter(MultiThread::hasNoSingleLoadThreads)      // threads with single loads produce duplicate tests
+                .filter(MultiThread::hasNoThreadsWithSameLoads)   // threads with the same loads produce duplicate tests
+                .collect(Collectors.toList());
+
+        System.out.print(multiThreads.size() + " interesting... ");
+
+        Set<String> canonicalIds = new HashSet<>();
+        multiThreads = multiThreads.stream()
+                .filter(mt -> canonicalIds.add(mt.canonicalId())) // pass only one canonical
+                .collect(Collectors.toList());
+
+        System.out.println(multiThreads.size() + " unique.");
+
+        /*
+            Step 5. Figure out what executions are sequentially consistent (needed for grading!),
+            and emit the tests.
+         */
+
+        System.out.print("Figuring out SC outcomes for the testcases: ");
+        int testCount = 0;
+        for (MultiThread mt : multiThreads) {
+            Set<Map<Result, Value>> scResults = new HashSet<>();
+
+            // Compute all SC results from the linearization of MT
+            for (Trace linear : mt.linearize()) {
+                SortedMap<Result, Value> results = linear.interpret();
+                scResults.add(results);
+            }
+
+            // TODO: Figure out the set of all possible results
+            Set<Map<Result, Value>> allResults = null;
+
+            if (allResults != null) {
+                // regardless of the reorderings, all results appear SC.
+                //    => the violations are undetectable
+                if (!allResults.containsAll(scResults)) {
+                    System.out.println(scResults);
+                    System.out.println(allResults);
+                    throw new IllegalStateException("SC results should be subset of all results");
+                }
+
+                if (scResults.equals(allResults)) {
+                    // nothing to do here,
+                    continue;
+                }
+            }
+
+            List<String> mappedResult = new ArrayList<>();
+            for (Map<Result, Value> m : scResults) {
+                List<String> mappedValues = new ArrayList<>();
+                for (Value v : m.values()) {
+                    mappedValues.add(v.toString());
+                }
+                mappedResult.add(mappedValues.toString());
+            }
+            emit(mt, mappedResult);
+            if ((testCount++ % 100) == 0)
+                System.out.print(".");
+        }
+        System.out.println();
+        System.out.println("Found " + testCount + " interesting test cases");
+    }
+
+    private void emit(MultiThread mt, List<String> scResults) {
+        String pathname = Utils.ensureDir(srcDir + "/" + pkg.replaceAll("\\.", "/"));
+
+        String klass = mt.canonicalId() + "Test";
+
+        Class[] klasses = new Class[mt.original.loadCount()];
+        for (int c = 0; c < klasses.length; c++) {
+            klasses[c] = int.class;
+        }
+
+        String resultName = resultGenerator.generateResult(new TestGenerator.Types(klasses));
+
+        PrintWriter pw;
+        try {
+            pw = new PrintWriter(pathname + "/" + klass + ".java");
+        } catch (FileNotFoundException e) {
+            throw new IllegalStateException(e);
+        }
+
+        int threads = mt.threads.size();
+
+        pw.println("package " + pkg + ";");
+        pw.println();
+        pw.println("import org.openjdk.jcstress.infra.results.*;");
+        pw.println("import org.openjdk.jcstress.annotations.*;");
+        pw.println();
+        pw.println("@JCStressTest");
+        for (String r : scResults) {
+            pw.println("@Outcome(id = \"" + r + "\", expect = Expect.ACCEPTABLE, desc = \"Sequential consistency.\")");
+        }
+
+        pw.println("@State");
+        pw.println("public class " + klass + " {");
+        pw.println();
+
+        Set<Integer> exist = new HashSet<>();
+        for (Trace trace : mt.threads)  {
+            for (Op op : trace.ops) {
+                if (exist.add(op.getVarId())) {
+                    switch (target) {
+                        case VOLATILE:
+                            pw.println("    volatile int x" + op.getVarId() + ";");
+                            break;
+                        case SYNCHRONIZED:
+                            pw.println("    int x" + op.getVarId() + ";");
+                            break;
+                        default:
+                            throw new IllegalStateException("" + target);
+                    }
+                }
+            }
+        }
+        pw.println();
+
+        for (int t = 0; t < threads; t++) {
+            pw.println("    @Actor");
+            pw.println("    public void actor" + (t+1) + "(" + resultName + " r) {");
+
+            for (Op op : mt.threads.get(t).ops) {
+                switch (op.getType()) {
+                    case LOAD:
+                        if (target == Target.SYNCHRONIZED) {
+                            pw.println("        synchronized (this) {");
+                            pw.print("    ");
+                        }
+                        pw.println("        r.r" + op.getResult() + " = x" + op.getVarId() + ";");
+                        if (target == Target.SYNCHRONIZED) {
+                            pw.println("        }");
+                        }
+                        break;
+                    case STORE:
+                        if (target == Target.SYNCHRONIZED) {
+                            pw.println("        synchronized (this) {");
+                            pw.print("    ");
+                        }
+                        pw.println("        x" + op.getVarId() + " = " + op.getValue() + ";");
+                        if (target == Target.SYNCHRONIZED) {
+                            pw.println("        }");
+                        }
+                        break;
+                }
+            }
+
+            pw.println("    }");
+            pw.println();
+        }
+
+        pw.println("}");
+
+        pw.close();
+    }
+
+    private List<Trace> product(List<Trace> traces, List<Op> ops) {
+        List<Trace> newTraces = new ArrayList<>();
+        for (Trace trace : traces) {
+            for (Op op : ops) {
+                newTraces.add(trace.pushTail(op));
+            }
+        }
+        return newTraces;
+    }
+
+    public class Trace {
+        private final List<Op> ops;
+
+        public Trace() {
+            ops = new ArrayList<>();
+        }
+
+        public Trace(Collection<Op> extOps) {
+            ops = new ArrayList<>(extOps);
+        }
+
+        public Trace pushHead(Op op) {
+            Trace nT = new Trace();
+            nT.ops.add(op);
+            nT.ops.addAll(ops);
+            return nT;
+        }
+
+        public Trace pushTail(Op op) {
+            Trace nT = new Trace();
+            nT.ops.addAll(ops);
+            nT.ops.add(op);
+            return nT;
+        }
+
+        @Override
+        public String toString() {
+            return "{" + ops + '}';
+        }
+
+        public int getLength() {
+            return ops.size();
+        }
+
+        public SortedMap<Result, Value> interpret() {
+            int vars = 0;
+            for (Op op : ops) {
+                vars = Math.max(vars, op.getVarId());
+            }
+
+            Map<Integer, Value> values = new HashMap<>();
+            for (int v = 0; v <= vars; v++) {
+                values.put(v, Value.defaultOne());
+            }
+
+            SortedMap<Result, Value> resValues = new TreeMap<>();
+
+            for (Op op : ops) {
+                switch (op.getType()) {
+                    case LOAD:
+                        Value v = values.get(op.getVarId());
+                        resValues.put(op.getResult(), v);
+                        break;
+                    case STORE:
+                        values.put(op.getVarId(), op.getValue());
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+            }
+
+            return resValues;
+        }
+
+        public Trace removeFirst() {
+            Trace nT = new Trace();
+            nT.ops.addAll(ops);
+            nT.ops.remove(0);
+            return nT;
+        }
+
+        public boolean hasLoads() {
+            for (Op op : ops) {
+                if (op.getType() == Op.Type.LOAD) return true;
+            }
+            return false;
+        }
+
+        public boolean hasStores() {
+            for (Op op : ops) {
+                if (op.getType() == Op.Type.STORE) return true;
+            }
+            return false;
+        }
+
+        public int loadCount() {
+            int count = 0;
+            for (Op op : ops) {
+                if (op.getType() == Op.Type.LOAD) count++;
+            }
+            return count;
+        }
+
+        public int storeCount() {
+            int count = 0;
+            for (Op op : ops) {
+                if (op.getType() == Op.Type.STORE) count++;
+            }
+            return count;
+        }
+
+        public String id() {
+            StringBuilder sb = new StringBuilder();
+            for (Op op : ops) {
+                switch (op.getType()) {
+                    case LOAD:
+                        sb.append("L");
+                        break;
+                    case STORE:
+                        sb.append("S");
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+                sb.append(op.getVarId() + 1);
+                sb.append("_");
+            }
+            return sb.toString();
+        }
+
+        public String loadStoreSeq() {
+            StringBuilder sb = new StringBuilder();
+            for (Op op : ops) {
+                switch (op.getType()) {
+                    case LOAD:
+                        sb.append("L");
+                        break;
+                    case STORE:
+                        sb.append("S");
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+            }
+            return sb.toString();
+        }
+
+        public String canonicalId() {
+            int varId = 0;
+            Map<Integer, Integer> varMap = new HashMap<>();
+            for (Op op : ops) {
+                Integer id = varMap.get(op.getVarId());
+                if (id == null) {
+                    id = varId++;
+                    varMap.put(op.getVarId(), id);
+                }
+            }
+
+            StringBuilder sb = new StringBuilder();
+            for (Op op : ops) {
+                switch (op.getType()) {
+                    case LOAD:
+                        sb.append("L");
+                        break;
+                    case STORE:
+                        sb.append("S");
+                        break;
+                    default:
+                        throw new IllegalStateException();
+                }
+                sb.append(varMap.get(op.getVarId()) + 1);
+                sb.append("_");
+            }
+            return sb.toString();
+        }
+
+        public boolean matchedLoadStores() {
+            Set<Integer> loads = new HashSet<>();
+            Set<Integer> stores = new HashSet<>();
+            for (Op op : ops) {
+                if (op.getType() == Op.Type.STORE) {
+                    stores.add(op.getVarId());
+                }
+                if (op.getType() == Op.Type.LOAD) {
+                    loads.add(op.getVarId());
+                }
+            }
+
+            return loads.equals(stores);
+        }
+
+        public void assignResults() {
+            Value.reset();
+            int resId = 1;
+            for (int c = 0; c < ops.size(); c++) {
+                Op op = ops.get(c);
+                switch (op.getType()) {
+                    case LOAD: {
+                        ops.set(c, Op.newLoad(op, new Result(resId++)));
+                        break;
+                    }
+                    case STORE: {
+                        ops.set(c, Op.newStore(op, Value.newOne()));
+                        break;
+                    }
+                    default:
+                        throw new IllegalStateException();
+                }
+            }
+        }
+    }
+
+    public class MultiThread {
+        private final Trace original;
+        private final List<Trace> threads;
+
+        public MultiThread(Trace original, Collection<Trace> copy) {
+            this.original = original;
+
+            this.threads = new ArrayList<>();
+            for (Trace t : copy) {
+                if (!t.ops.isEmpty())
+                    threads.add(t);
+            }
+        }
+
+        /**
+         * @return all executions from linearizing the thread operations.
+         */
+        public List<Trace> linearize() {
+            if (threads.isEmpty()) {
+                return Collections.singletonList(new Trace());
+            }
+
+            List<Trace> newTraces = new ArrayList<>();
+
+            for (int t = 0; t < threads.size(); t++) {
+                List<Trace> copy = new ArrayList<>();
+                copy.addAll(threads);
+
+                Trace cT = copy.get(t);
+                if (cT.ops.isEmpty()) {
+                    copy.remove(t);
+                    newTraces.addAll(new MultiThread(original, copy).linearize());
+                } else {
+                    Op op = cT.ops.get(0);
+                    copy.set(t, cT.removeFirst());
+
+                    if (cT.ops.isEmpty()) {
+                        copy.remove(t);
+                    }
+
+                    for (Trace trace : new MultiThread(original, copy).linearize()) {
+                        newTraces.add(trace.pushHead(op));
+                    }
+                }
+            }
+
+            return newTraces;
+        }
+
+        @Override
+        public String toString() {
+            return "{" + threads + '}';
+        }
+
+        public String canonicalId() {
+            // Renumber the variable IDs.
+
+            List<Trace> lsTrace = new ArrayList<>();
+            lsTrace.addAll(threads);
+            Collections.sort(lsTrace, (o1, o2) -> o1.loadStoreSeq().compareTo(o2.loadStoreSeq()));
+
+            int varId = 0;
+            Map<Integer, Integer> varMap = new HashMap<>();
+            for (Trace trace : lsTrace) {
+                for (Op op : trace.ops) {
+                    Integer id = varMap.get(op.getVarId());
+                    if (id == null) {
+                        id = varId++;
+                        varMap.put(op.getVarId(), id);
+                    }
+                }
+            }
+
+            StringBuilder sb = new StringBuilder();
+            for (Trace trace : lsTrace) {
+                for (Op op : trace.ops) {
+                    switch (op.getType()) {
+                        case LOAD:
+                            sb.append("L");
+                            break;
+                        case STORE:
+                            sb.append("S");
+                            break;
+                        default:
+                            throw new IllegalStateException();
+                    }
+                    sb.append(varMap.get(op.getVarId()) + 1);
+                    sb.append("_");
+                }
+                sb.append("_");
+            }
+            return sb.toString();
+        }
+
+        public boolean hasNoSingleLoadThreads() {
+            for (Trace trace : threads) {
+                if (trace.loadCount() == 1 && trace.storeCount() == 0) return false;
+            }
+            return true;
+        }
+
+        public boolean hasNoThreadsWithSameLoads() {
+            Set<String> eq = new HashSet<>();
+            for (Trace trace : threads) {
+                if (trace.storeCount() == 0) {
+                    if (!eq.add(trace.id()))
+                        return false;
+                }
+            }
+            return true;
+        }
+
+        public boolean isMultiThread() {
+            return threads.size() > 1;
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Target.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, 2015, 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 org.openjdk.jcstress.generator.seqcst;
+
+public enum Target {
+    VOLATILE,
+    SYNCHRONIZED,
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/generator/seqcst/Value.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 2015, 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 org.openjdk.jcstress.generator.seqcst;
+
+public class Value {
+
+    private static int id;
+
+    {
+        reset();
+    }
+
+    static void reset() {
+        id = 1;
+    }
+
+    static Value newOne() {
+        return new Value(id++);
+    }
+
+    static Value defaultOne() {
+        return new Value(0);
+    }
+
+    private int v;
+
+    public Value(int v) {
+        this.v = v;
+    }
+
+    @Override
+    public String toString() {
+        return "" + v;
+    }
+}
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/tracer/Op.java	Fri May 06 14:18:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2005, 2014, 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 org.openjdk.jcstress.tracer;
-
-public class Op {
-
-    private static int IDS;
-
-    private final Type type;
-    private final int varId;
-    private final int resId;
-
-    public Op(Type type, int varId) {
-        this(type, varId, -1);
-    }
-
-    public Op(Type type, int varId, int resId) {
-        this.type = type;
-        this.varId = varId;
-        this.resId = resId;
-    }
-
-    public int getResId() {
-        return resId;
-    }
-
-    public Op setResId(int resId) {
-        return new Op(type, varId, resId);
-    }
-
-    public enum Type {
-        LOAD,
-        STORE,
-    }
-
-    public Type getType() {
-        return type;
-    }
-
-    public int getVarId() {
-        return varId;
-    }
-
-    @Override
-    public String toString() {
-        switch (type) {
-            case LOAD:
-                return "r" + resId + " = x" + varId;
-            case STORE:
-                return "x" + varId + " = C" + resId;
-            default:
-                throw new IllegalStateException();
-        }
-    }
-}
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/tracer/TraceGen.java	Fri May 06 14:18:33 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*
- * Copyright (c) 2005, 2014, 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 org.openjdk.jcstress.tracer;
-
-import org.openjdk.jcstress.generator.ResultGenerator;
-import org.openjdk.jcstress.generator.TestGenerator;
-import org.openjdk.jcstress.generator.Utils;
-
-import java.io.FileNotFoundException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-public class TraceGen {
-
-    private final int vars;
-    private final String srcDir;
-    private final String resDir;
-    private final ResultGenerator resultGenerator;
-
-    public TraceGen(int vars, String srcDir, String resDir) {
-        this.vars = vars;
-        this.srcDir = srcDir;
-        this.resDir = resDir;
-        this.resultGenerator = new ResultGenerator(srcDir);
-    }
-
-    public void generate() {
-        List<Op> possibleOps = new ArrayList<>();
-        for (int v = 0; v < vars; v++) {
-            for (Op.Type t : Op.Type.values()) {
-                possibleOps.add(new Op(t, v));
-            }
-        }
-
-        List<Trace> allTraces = new ArrayList<>();
-        List<Trace> traces = Collections.singletonList(new Trace());
-        for (int l = 0; l < possibleOps.size(); l++) {
-            traces = product(traces, possibleOps);
-            allTraces.addAll(traces);
-        }
-        System.out.println(traces.size() + " basic traces");
-
-        List<Trace> newTraces = new ArrayList<>();
-        for (Trace trace : allTraces) {
-            if (!trace.hasLoads()) continue;
-            if (!trace.hasStores()) continue;
-            if (trace.hasNonMatchingLoads()) continue;
-            if (trace.hasNonMatchingStores()) continue;
-            if (!trace.canonicalId().equals(trace.id())) continue;
-
-            int constId = 0;
-            int resId = 0;
-            for (int c = 0; c < trace.ops.size(); c++) {
-                Op op = trace.ops.get(c);
-                switch (op.getType()) {
-                    case LOAD:
-                        trace.ops.set(c, op.setResId(resId++));
-                        break;
-                    case STORE:
-                        trace.ops.set(c, op.setResId(constId++));
-                        break;
-                    default:
-                        throw new IllegalStateException();
-                }
-            }
-            newTraces.add(trace);
-        }
-        traces = newTraces;
-        System.out.println(traces.size() + " interesting traces");
-
-        List<MultiTrace> multiTraces = new ArrayList<>();
-        for (Trace trace : traces) {
-            for (int l1 = 0; l1 < trace.getLength(); l1++) {
-                for (int l2 = l1; l2 < trace.getLength(); l2++) {
-                    for (int l3 = l2; l3 < trace.getLength(); l3++) {
-                        MultiTrace mt = split(trace, l1, l2, l3);
-                        multiTraces.add(mt);
-                    }
-                }
-            }
-        }
-        System.out.println(multiTraces.size() + " basic multi-traces");
-
-        Set<String> processedMultitraces = new HashSet<>();
-
-        int testCount = 0;
-        for (MultiTrace mt : multiTraces) {
-            if (!processedMultitraces.add(mt.canonicalId())) continue;
-
-            List<Trace> linearTraces = mt.linearize();
-            Set<Map<Integer, Integer>> scResults = new HashSet<>();
-            Set<Map<Integer, Integer>> allResults = new HashSet<>();
-
-            for (Trace linear : linearTraces) {
-                SortedMap<Integer, Integer> results = linear.interpret();
-                scResults.add(results);
-            }
-
-            for (Trace perm : mt.original.allPermutations()) {
-                SortedMap<Integer, Integer> results = perm.interpret();
-                allResults.add(results);
-            }
-
-            // regardless of the reorderings, all results appear SC.
-            //    => the violations are undetectable
-            assert allResults.containsAll(scResults);
-            if (scResults.equals(allResults)) continue;
-
-            List<String> mappedResult = new ArrayList<>();
-            for (Map<Integer, Integer> m : scResults) {
-                List<String> mappedValues = new ArrayList<>();
-                for (int v : m.values()) {
-                    mappedValues.add(mapConst(v));
-                }
-                mappedResult.add(mappedValues.toString());
-            }
-
-            emit(mt, mappedResult);
-            if ((testCount++ % 1000) == 0)
-                System.out.print(".");
-        }
-        System.out.println();
-        System.out.println(testCount + " interesting multi-traces");
-    }
-
-    private void emit(MultiTrace mt, List<String> results) {
-
-        final String pkg = "org.openjdk.jcstress.tests.seqcst.volatiles";
-
-        String pathname = Utils.ensureDir(srcDir + "/" + pkg.replaceAll("\\.", "/"));
-
-        String klass = mt.id() + "Test";
-
-        Class[] klasses = new Class[mt.original.getLoadCount()];
-        for (int c = 0; c < klasses.length; c++) {
-            klasses[c] = int.class;
-        }
-
-        String resultName = resultGenerator.generateResult(new TestGenerator.Types(klasses));
-
-        PrintWriter pw;
-        try {
-            pw = new PrintWriter(pathname + "/" + klass + ".java");
-        } catch (FileNotFoundException e) {
-            throw new IllegalStateException(e);
-        }
-
-        int threads = mt.traces.size();
-
-        pw.println("package " + pkg + ";");
-        pw.println();
-        pw.println("import org.openjdk.jcstress.infra.results." + resultName + ";");
-        pw.println("import org.openjdk.jcstress.annotations.Actor;");
-        pw.println("import org.openjdk.jcstress.annotations.JCStressTest;");
-        pw.println("import org.openjdk.jcstress.annotations.State;");
-        pw.println("import org.openjdk.jcstress.annotations.Outcome;");
-        pw.println("import org.openjdk.jcstress.annotations.Expect;");
-        pw.println();
-        pw.println("@JCStressTest");
-        for (String r : results) {
-            pw.println("@Outcome(id = \"" + r + "\", expect = Expect.ACCEPTABLE, desc = \"Sequential consistency.\")");
-        }
-
-        pw.println("@State");
-        pw.println("public class " + klass + " {");
-        pw.println();
-
-        Set<Integer> exist = new HashSet<>();
-        for (Trace trace : mt.traces)  {
-            for (Op op : trace.ops) {
-                if (exist.add(op.getVarId()))
-                    pw.println("   volatile int x" + op.getVarId() + ";");
-            }
-        }
-        pw.println();
-
-        for (int t = 0; t < threads; t++) {
-            pw.println("    @Actor");
-            pw.println("    public void actor" + (t+1) + "(" + resultName + " r) {");
-
-            for (Op op : mt.traces.get(t).ops) {
-                switch (op.getType()) {
-                    case LOAD:
-                        pw.println("        r.r" + (op.getResId() + 1) + " = x" + op.getVarId() + ";");
-                        break;
-                    case STORE:
-                        pw.println("        x" + op.getVarId() + " = " + mapConst(op.getResId()) + ";");
-                        break;
-                }
-            }
-
-            pw.println("    }");
-            pw.println();
-        }
-
-        pw.println("}");
-
-        pw.close();
-    }
-
-    private String mapConst(int resId) {
-        return String.valueOf(resId + 1);
-    }
-
-    private MultiTrace split(Trace trace, int s1, int s2, int s3) {
-        Trace t1 = trace.sub(0, s1);
-        Trace t2 = trace.sub(s1, s2);
-        Trace t3 = trace.sub(s2, s3);
-        Trace t4 = trace.sub(s3, trace.getLength());
-        return new MultiTrace(trace, t1, t2, t3, t4);
-    }
-
-    private List<Trace> product(List<Trace> traces, List<Op> ops) {
-        List<Trace> newTraces = new ArrayList<>();
-        for (Trace trace : traces) {
-            for (Op op : ops) {
-                newTraces.add(trace.pushTail(op));
-            }
-        }
-        return newTraces;
-    }
-
-    public class Trace {
-        private final List<Op> ops;
-
-        public Trace() {
-            ops = new ArrayList<>();
-        }
-
-        public Trace(List<Op> extOps) {
-            ops = new ArrayList<>(extOps);
-        }
-
-        public Trace pushHead(Op op) {
-            Trace nT = new Trace();
-            nT.ops.add(op);
-            nT.ops.addAll(ops);
-            return nT;
-        }
-
-        public Trace pushTail(Op op) {
-            Trace nT = new Trace();
-            nT.ops.addAll(ops);
-            nT.ops.add(op);
-            return nT;
-        }
-
-        @Override
-        public String toString() {
-            return "{" + ops + '}';
-        }
-
-        public int getLength() {
-            return ops.size();
-        }
-
-        public Trace sub(int left, int right) {
-            Trace nT = new Trace();
-            nT.ops.addAll(ops.subList(left, right));
-            return nT;
-        }
-
-        public SortedMap<Integer, Integer> interpret() {
-            Map<Integer, Integer> values = new HashMap<>();
-            for (int v = 0; v < vars; v++) {
-                values.put(v, -1);
-            }
-
-            SortedMap<Integer, Integer> resValues = new TreeMap<>();
-
-            for (Op op : ops) {
-                switch (op.getType()) {
-                    case LOAD:
-                        int v = values.get(op.getVarId());
-                        resValues.put(op.getResId(), v);
-                        break;
-                    case STORE:
-                        values.put(op.getVarId(), op.getResId());
-                        break;
-                    default:
-                        throw new IllegalStateException();
-                }
-            }
-
-            return resValues;
-        }
-
-        public List<Trace> allPermutations() {
-            List<Trace> traces = new ArrayList<>();
-            for (List<Op> perm : Utils.permutate(ops)) {
-                traces.add(new Trace(perm));
-            }
-            return traces;
-        }
-
-        public Trace removeFirst() {
-            Trace nT = new Trace();
-            nT.ops.addAll(ops);
-            nT.ops.remove(0);
-            return nT;
-        }
-
-        public boolean hasLoads() {
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.LOAD) return true;
-            }
-            return false;
-        }
-
-        public boolean hasStores() {
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.STORE) return true;
-            }
-            return false;
-        }
-
-        public int getLoadCount() {
-            int count = 0;
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.LOAD) count++;
-            }
-            return count;
-        }
-
-        public int getStoreCount() {
-            int count = 0;
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.STORE) count++;
-            }
-            return count;
-        }
-
-        public String id() {
-            StringBuilder sb = new StringBuilder();
-            for (Op op : ops) {
-                switch (op.getType()) {
-                    case LOAD:
-                        sb.append("L");
-                        break;
-                    case STORE:
-                        sb.append("S");
-                        break;
-                    default:
-                        throw new IllegalStateException();
-                }
-                sb.append(op.getVarId() + 1);
-                sb.append("_");
-            }
-            return sb.toString();
-        }
-
-        public String canonicalId() {
-            int varId = 0;
-            Map<Integer, Integer> varMap = new HashMap<>();
-            for (Op op : ops) {
-                Integer id = varMap.get(op.getVarId());
-                if (id == null) {
-                    id = varId++;
-                    varMap.put(op.getVarId(), id);
-                }
-            }
-
-            StringBuilder sb = new StringBuilder();
-            for (Op op : ops) {
-                switch (op.getType()) {
-                    case LOAD:
-                        sb.append("L");
-                        break;
-                    case STORE:
-                        sb.append("S");
-                        break;
-                    default:
-                        throw new IllegalStateException();
-                }
-                sb.append(varMap.get(op.getVarId()) + 1);
-                sb.append("_");
-            }
-            return sb.toString();
-        }
-
-        public boolean hasNonMatchingLoads() {
-            Set<Integer> stores = new HashSet<>();
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.STORE) {
-                    stores.add(op.getVarId());
-                }
-            }
-
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.LOAD) {
-                    if (!stores.contains(op.getVarId()))
-                        return true;
-                }
-            }
-
-            return false;
-        }
-
-        public boolean hasNonMatchingStores() {
-            Set<Integer> loads = new HashSet<>();
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.LOAD) {
-                    loads.add(op.getVarId());
-                }
-            }
-
-            for (Op op : ops) {
-                if (op.getType() == Op.Type.STORE) {
-                    if (!loads.contains(op.getVarId()))
-                        return true;
-                }
-            }
-
-            return false;
-        }
-    }
-
-    public class MultiTrace {
-        private final Trace original;
-        private final List<Trace> traces;
-
-        public MultiTrace(Trace original, Trace... traces) {
-            this(original, Arrays.asList(traces));
-        }
-
-        public MultiTrace(Trace original, List<Trace> copy) {
-            this.original = original;
-
-            this.traces = new ArrayList<>();
-            for (Trace t : copy) {
-                if (!t.ops.isEmpty())
-                    traces.add(t);
-            }
-
-            Collections.sort(traces, (o1, o2) -> o1.id().compareTo(o2.id()));
-        }
-
-        public List<Trace> linearize() {
-            if (traces.isEmpty()) {
-                return Collections.singletonList(new Trace());
-            }
-
-            List<Trace> newTraces = new ArrayList<>();
-
-            for (int t = 0; t < traces.size(); t++) {
-                List<Trace> copy = new ArrayList<>();
-                copy.addAll(traces);
-
-                Trace cT = copy.get(t);
-                if (cT.ops.isEmpty()) {
-                    copy.remove(t);
-                    for (Trace trace : new MultiTrace(original, copy).linearize()) {
-                        newTraces.add(trace);
-                    }
-                } else {
-                    Op op = cT.ops.get(0);
-                    copy.set(t, cT.removeFirst());
-
-                    if (cT.ops.isEmpty()) {
-                        copy.remove(t);
-                    }
-
-                    for (Trace trace : new MultiTrace(original, copy).linearize()) {
-                        newTraces.add(trace.pushHead(op));
-                    }
-                }
-            }
-
-            return newTraces;
-        }
-
-        @Override
-        public String toString() {
-            return "{" + traces + '}';
-        }
-
-        public String id() {
-            StringBuilder sb = new StringBuilder();
-            for (Trace trace : traces) {
-                sb.append(trace.id());
-                sb.append("_");
-            }
-            return sb.toString();
-        }
-
-        public String canonicalId() {
-            StringBuilder sb = new StringBuilder();
-            for (Trace trace : traces) {
-                if (trace.getLoadCount() == 1 && trace.getStoreCount() == 0) continue;
-                sb.append(trace.id());
-                sb.append("_");
-            }
-            return sb.toString();
-        }
-    }
-
-}
--- a/pom.xml	Fri May 06 14:18:33 2016 +0300
+++ b/pom.xml	Fri May 06 23:20:05 2016 +0300
@@ -166,6 +166,8 @@
         <module>tests-custom</module>
         <module>tests-chapter-0a</module>
         <module>tests-chapter-0b</module>
+        <module>tests-chapter-0c</module>
+        <module>tests-chapter-1a</module>
         <module>tests-all</module>
     </modules>
 
--- a/tests-all/pom.xml	Fri May 06 14:18:33 2016 +0300
+++ b/tests-all/pom.xml	Fri May 06 23:20:05 2016 +0300
@@ -88,5 +88,15 @@
             <artifactId>jcstress-tests-chapter-0b</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.openjdk.jcstress</groupId>
+            <artifactId>jcstress-tests-chapter-0c</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openjdk.jcstress</groupId>
+            <artifactId>jcstress-tests-chapter-1a</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>
--- a/tests-chapter-0b/pom.xml	Fri May 06 14:18:33 2016 +0300
+++ b/tests-chapter-0b/pom.xml	Fri May 06 23:20:05 2016 +0300
@@ -35,7 +35,7 @@
     <artifactId>jcstress-tests-chapter-0b</artifactId>
     <packaging>jar</packaging>
 
-    <name>Chapter 0.b: Language Foundations: Basic Memory Effects</name>
+    <name>Chapter 0.b: Language Foundations: Sequential Consistency, Volatiles</name>
     <url>http://maven.apache.org</url>
 
     <scm>
@@ -65,24 +65,6 @@
                 <version>1.2.1</version>
                 <executions>
                     <execution>
-                        <id>memeffects</id>
-                        <goals>
-                            <goal>exec</goal>
-                        </goals>
-                        <phase>
-                            generate-sources
-                        </phase>
-                        <configuration>
-                            <executable>${java.home}/bin/java</executable>
-                            <arguments>
-                                <argument>-jar</argument>
-                                <argument>../jcstress-test-gen/target/test-gen.jar</argument>
-                                <argument>${project.build.directory}/generated-sources/tests/</argument>
-                                <argument>${project.build.directory}/generated-resources/</argument>
-                            </arguments>
-                        </configuration>
-                    </execution>
-                    <execution>
                         <id>volatiles</id>
                         <goals>
                             <goal>exec</goal>
@@ -94,9 +76,8 @@
                             <executable>${java.home}/bin/java</executable>
                             <arguments>
                                 <argument>-jar</argument>
-                                <argument>../jcstress-test-gen/target/volatile-tracegen.jar</argument>
+                                <argument>../jcstress-test-gen/target/chapter0b-generator.jar</argument>
                                 <argument>${project.build.directory}/generated-sources/tests/</argument>
-                                <argument>${project.build.directory}/generated-resources/</argument>
                             </arguments>
                         </configuration>
                     </execution>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-0c/LICENSE	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it.  By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users.  This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it.  (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.  Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights.  These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have.  You must
+make sure that they, too, receive or can get the source code.  And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software.  If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.  We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License.  The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language.  (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope.  The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program).  Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+    a) You must cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in whole or
+    in part contains or is derived from the Program or any part thereof, to be
+    licensed as a whole at no charge to all third parties under the terms of
+    this License.
+
+    c) If the modified program normally reads commands interactively when run,
+    you must cause it, when started running for such interactive use in the
+    most ordinary way, to print or display an announcement including an
+    appropriate copyright notice and a notice that there is no warranty (or
+    else, saying that you provide a warranty) and that users may redistribute
+    the program under these conditions, and telling the user how to view a copy
+    of this License.  (Exception: if the Program itself is interactive but does
+    not normally print such an announcement, your work based on the Program is
+    not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works.  But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable source
+    code, which must be distributed under the terms of Sections 1 and 2 above
+    on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three years, to
+    give any third party, for a charge no more than your cost of physically
+    performing source distribution, a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of Sections 1
+    and 2 above on a medium customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer to
+    distribute corresponding source code.  (This alternative is allowed only
+    for noncommercial distribution and only if you received the program in
+    object code or executable form with such an offer, in accord with
+    Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it.  For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable.  However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License.  Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License.  However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works.  These actions are prohibited by law if you do not
+accept this License.  Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein.  You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License.  If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices.  Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded.  In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time.  Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission.  For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program.  It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+    One line to give the program's name and a brief idea of what it does.
+
+    Copyright (C) <year> <name of author>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the Free
+    Software Foundation; either version 2 of the License, or (at your option)
+    any later version.
+
+    This program 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 for
+    more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+    with ABSOLUTELY NO WARRANTY; for details type 'show w'.  This is free
+    software, and you are welcome to redistribute it under certain conditions;
+    type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.  Here
+is a sample; alter the names:
+
+    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+    'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+    signature of Ty Coon, 1 April 1989
+
+    Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+    Linking this library statically or dynamically with other modules is making
+    a combined work based on this library.  Thus, the terms and conditions of
+    the GNU General Public License cover the whole combination.
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,
+    and to copy and distribute the resulting executable under terms of your
+    choice, provided that you also meet, for each linked independent module,
+    the terms and conditions of the license of that module.  An independent
+    module is a module which is not derived from or based on this library.  If
+    you modify this library, you may extend this exception to your version of
+    the library, but you are not obligated to do so.  If you do not wish to do
+    so, delete this exception statement from your version.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-0c/THIRD_PARTY_README	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,29 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to JOpt-Simple v4.6.
+
+--- begin of LICENSE ---
+
+Copyright (c) SourceForge
+
+The MIT License Copyright (c) Permission is hereby granted, free of
+charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-0c/pom.xml	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,140 @@
+<!--
+Copyright (c) 2005, 2013, 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.openjdk.jcstress</groupId>
+        <artifactId>jcstress-parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>jcstress-tests-chapter-0c</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Chapter 0.c: Language Foundations: Sequential Consistency, Synchronized</name>
+    <url>http://maven.apache.org</url>
+
+    <scm>
+        <connection>scm:hg:http://hg.openjdk.java.net/code-tools/jcstress/</connection>
+    </scm>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <debug>false</debug>
+                    <meminitial>4096</meminitial>
+                    <fork>true</fork>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>1.2.1</version>
+                <executions>
+                    <execution>
+                        <id>gen</id>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <phase>
+                            generate-sources
+                        </phase>
+                        <configuration>
+                            <executable>${java.home}/bin/java</executable>
+                            <arguments>
+                                <argument>-jar</argument>
+                                <argument>../jcstress-test-gen/target/chapter0c-generator.jar</argument>
+                                <argument>${project.build.directory}/generated-sources/tests/</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.7</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.build.directory}/generated-sources/tests/</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>com.mycila.maven-license-plugin</groupId>
+                <artifactId>maven-license-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>buildnumber-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.openjdk.jcstress</groupId>
+            <artifactId>jcstress-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openjdk.jcstress</groupId>
+            <artifactId>jcstress-test-gen</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-0c/src/main/java/Test.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2005, 2013, 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.
+ */
+// Stub to break the habit of revision control systems to remove empty dirs
+public class Test {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-0c/src/main/resources/LICENSE	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it.  By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users.  This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it.  (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.  Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights.  These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have.  You must
+make sure that they, too, receive or can get the source code.  And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software.  If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.  We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License.  The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language.  (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope.  The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program).  Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+    a) You must cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in whole or
+    in part contains or is derived from the Program or any part thereof, to be
+    licensed as a whole at no charge to all third parties under the terms of
+    this License.
+
+    c) If the modified program normally reads commands interactively when run,
+    you must cause it, when started running for such interactive use in the
+    most ordinary way, to print or display an announcement including an
+    appropriate copyright notice and a notice that there is no warranty (or
+    else, saying that you provide a warranty) and that users may redistribute
+    the program under these conditions, and telling the user how to view a copy
+    of this License.  (Exception: if the Program itself is interactive but does
+    not normally print such an announcement, your work based on the Program is
+    not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works.  But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable source
+    code, which must be distributed under the terms of Sections 1 and 2 above
+    on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three years, to
+    give any third party, for a charge no more than your cost of physically
+    performing source distribution, a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of Sections 1
+    and 2 above on a medium customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer to
+    distribute corresponding source code.  (This alternative is allowed only
+    for noncommercial distribution and only if you received the program in
+    object code or executable form with such an offer, in accord with
+    Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it.  For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable.  However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License.  Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License.  However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works.  These actions are prohibited by law if you do not
+accept this License.  Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein.  You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License.  If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices.  Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded.  In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time.  Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission.  For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program.  It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+    One line to give the program's name and a brief idea of what it does.
+
+    Copyright (C) <year> <name of author>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the Free
+    Software Foundation; either version 2 of the License, or (at your option)
+    any later version.
+
+    This program 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 for
+    more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+    with ABSOLUTELY NO WARRANTY; for details type 'show w'.  This is free
+    software, and you are welcome to redistribute it under certain conditions;
+    type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.  Here
+is a sample; alter the names:
+
+    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+    'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+    signature of Ty Coon, 1 April 1989
+
+    Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+    Linking this library statically or dynamically with other modules is making
+    a combined work based on this library.  Thus, the terms and conditions of
+    the GNU General Public License cover the whole combination.
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,
+    and to copy and distribute the resulting executable under terms of your
+    choice, provided that you also meet, for each linked independent module,
+    the terms and conditions of the license of that module.  An independent
+    module is a module which is not derived from or based on this library.  If
+    you modify this library, you may extend this exception to your version of
+    the library, but you are not obligated to do so.  If you do not wish to do
+    so, delete this exception statement from your version.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-0c/src/main/resources/THIRD_PARTY_README	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,29 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to JOpt-Simple v4.6.
+
+--- begin of LICENSE ---
+
+Copyright (c) SourceForge
+
+The MIT License Copyright (c) Permission is hereby granted, free of
+charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-1a/LICENSE	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it.  By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users.  This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it.  (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.  Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights.  These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have.  You must
+make sure that they, too, receive or can get the source code.  And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software.  If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.  We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License.  The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language.  (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope.  The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program).  Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+    a) You must cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in whole or
+    in part contains or is derived from the Program or any part thereof, to be
+    licensed as a whole at no charge to all third parties under the terms of
+    this License.
+
+    c) If the modified program normally reads commands interactively when run,
+    you must cause it, when started running for such interactive use in the
+    most ordinary way, to print or display an announcement including an
+    appropriate copyright notice and a notice that there is no warranty (or
+    else, saying that you provide a warranty) and that users may redistribute
+    the program under these conditions, and telling the user how to view a copy
+    of this License.  (Exception: if the Program itself is interactive but does
+    not normally print such an announcement, your work based on the Program is
+    not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works.  But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable source
+    code, which must be distributed under the terms of Sections 1 and 2 above
+    on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three years, to
+    give any third party, for a charge no more than your cost of physically
+    performing source distribution, a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of Sections 1
+    and 2 above on a medium customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer to
+    distribute corresponding source code.  (This alternative is allowed only
+    for noncommercial distribution and only if you received the program in
+    object code or executable form with such an offer, in accord with
+    Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it.  For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable.  However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License.  Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License.  However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works.  These actions are prohibited by law if you do not
+accept this License.  Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein.  You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License.  If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices.  Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded.  In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time.  Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission.  For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program.  It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+    One line to give the program's name and a brief idea of what it does.
+
+    Copyright (C) <year> <name of author>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the Free
+    Software Foundation; either version 2 of the License, or (at your option)
+    any later version.
+
+    This program 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 for
+    more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+    with ABSOLUTELY NO WARRANTY; for details type 'show w'.  This is free
+    software, and you are welcome to redistribute it under certain conditions;
+    type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.  Here
+is a sample; alter the names:
+
+    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+    'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+    signature of Ty Coon, 1 April 1989
+
+    Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+    Linking this library statically or dynamically with other modules is making
+    a combined work based on this library.  Thus, the terms and conditions of
+    the GNU General Public License cover the whole combination.
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,
+    and to copy and distribute the resulting executable under terms of your
+    choice, provided that you also meet, for each linked independent module,
+    the terms and conditions of the license of that module.  An independent
+    module is a module which is not derived from or based on this library.  If
+    you modify this library, you may extend this exception to your version of
+    the library, but you are not obligated to do so.  If you do not wish to do
+    so, delete this exception statement from your version.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-1a/THIRD_PARTY_README	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,29 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to JOpt-Simple v4.6.
+
+--- begin of LICENSE ---
+
+Copyright (c) SourceForge
+
+The MIT License Copyright (c) Permission is hereby granted, free of
+charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-1a/pom.xml	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,141 @@
+<!--
+Copyright (c) 2005, 2013, 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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.openjdk.jcstress</groupId>
+        <artifactId>jcstress-parent</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>jcstress-tests-chapter-1a</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Chapter 1.a: Library Foundations: Atomics</name>
+    <url>http://maven.apache.org</url>
+
+    <scm>
+        <connection>scm:hg:http://hg.openjdk.java.net/code-tools/jcstress/</connection>
+    </scm>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <debug>false</debug>
+                    <meminitial>4096</meminitial>
+                    <fork>true</fork>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>1.2.1</version>
+                <executions>
+                    <execution>
+                        <id>gen</id>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <phase>
+                            generate-sources
+                        </phase>
+                        <configuration>
+                            <executable>${java.home}/bin/java</executable>
+                            <arguments>
+                                <argument>-jar</argument>
+                                <argument>../jcstress-test-gen/target/test-gen.jar</argument>
+                                <argument>${project.build.directory}/generated-sources/tests/</argument>
+                                <argument>${project.build.directory}/generated-resources/</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.7</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.build.directory}/generated-sources/tests/</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>com.mycila.maven-license-plugin</groupId>
+                <artifactId>maven-license-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>buildnumber-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.openjdk.jcstress</groupId>
+            <artifactId>jcstress-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.openjdk.jcstress</groupId>
+            <artifactId>jcstress-test-gen</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-1a/src/main/java/Test.java	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2005, 2013, 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.
+ */
+// Stub to break the habit of revision control systems to remove empty dirs
+public class Test {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-1a/src/main/resources/LICENSE	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,347 @@
+The GNU General Public License (GPL)
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share
+and change it.  By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users.  This General Public License applies to
+most of the Free Software Foundation's software and to any other program whose
+authors commit to using it.  (Some other Free Software Foundation software is
+covered by the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price.  Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you
+can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights.  These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for
+a fee, you must give the recipients all the rights that you have.  You must
+make sure that they, too, receive or can get the source code.  And you must
+show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2)
+offer you this license which gives you legal permission to copy, distribute
+and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software.  If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced
+by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents.  We
+wish to avoid the danger that redistributors of a free program will
+individually obtain patent licenses, in effect making the program proprietary.
+To prevent this, we have made it clear that any patent must be licensed for
+everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License.  The "Program", below, refers to any such program
+or work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language.  (Hereinafter, translation is included
+without limitation in the term "modification".) Each licensee is addressed as
+"you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope.  The act of running the Program is
+not restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program).  Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as
+you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the
+Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may
+at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus
+forming a work based on the Program, and copy and distribute such modifications
+or work under the terms of Section 1 above, provided that you also meet all of
+these conditions:
+
+    a) You must cause the modified files to carry prominent notices stating
+    that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in whole or
+    in part contains or is derived from the Program or any part thereof, to be
+    licensed as a whole at no charge to all third parties under the terms of
+    this License.
+
+    c) If the modified program normally reads commands interactively when run,
+    you must cause it, when started running for such interactive use in the
+    most ordinary way, to print or display an announcement including an
+    appropriate copyright notice and a notice that there is no warranty (or
+    else, saying that you provide a warranty) and that users may redistribute
+    the program under these conditions, and telling the user how to view a copy
+    of this License.  (Exception: if the Program itself is interactive but does
+    not normally print such an announcement, your work based on the Program is
+    not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works.  But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms
+of this License, whose permissions for other licensees extend to the entire
+whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on
+the Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+3. You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and
+2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable source
+    code, which must be distributed under the terms of Sections 1 and 2 above
+    on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three years, to
+    give any third party, for a charge no more than your cost of physically
+    performing source distribution, a complete machine-readable copy of the
+    corresponding source code, to be distributed under the terms of Sections 1
+    and 2 above on a medium customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer to
+    distribute corresponding source code.  (This alternative is allowed only
+    for noncommercial distribution and only if you received the program in
+    object code or executable form with such an offer, in accord with
+    Subsection b above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it.  For an executable work, complete source code means all
+the source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable.  However, as a special exception, the source code
+distributed need not include anything that is normally distributed (in either
+source or binary form) with the major components (compiler, kernel, and so on)
+of the operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source
+code from the same place counts as distribution of the source code, even though
+third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License.  Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License.  However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it.
+However, nothing else grants you permission to modify or distribute the Program
+or its derivative works.  These actions are prohibited by law if you do not
+accept this License.  Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program),
+the recipient automatically receives a license from the original licensor to
+copy, distribute or modify the Program subject to these terms and conditions.
+You may not impose any further restrictions on the recipients' exercise of the
+rights granted herein.  You are not responsible for enforcing compliance by
+third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License.  If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution
+of the Program by all those who receive copies directly or indirectly through
+you, then the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and
+the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices.  Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original
+copyright holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded.  In
+such case, this License incorporates the limitation as if written in the body
+of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the
+General Public License from time to time.  Such new versions will be similar in
+spirit to the present version, but may differ in detail to address new problems
+or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any later
+version", you have the option of following the terms and conditions either of
+that version or of any later version published by the Free Software Foundation.
+If the Program does not specify a version number of this License, you may
+choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission.  For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
+PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
+PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE,
+YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
+ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
+PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible
+use to the public, the best way to achieve this is to make it free software
+which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program.  It is safest to attach
+them to the start of each source file to most effectively convey the exclusion
+of warranty; and each file should have at least the "copyright" line and a
+pointer to where the full notice is found.
+
+    One line to give the program's name and a brief idea of what it does.
+
+    Copyright (C) <year> <name of author>
+
+    This program is free software; you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by the Free
+    Software Foundation; either version 2 of the License, or (at your option)
+    any later version.
+
+    This program 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 for
+    more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc., 59
+    Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it
+starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
+    with ABSOLUTELY NO WARRANTY; for details type 'show w'.  This is free
+    software, and you are welcome to redistribute it under certain conditions;
+    type 'show c' for details.
+
+The hypothetical commands 'show w' and 'show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may be
+called something other than 'show w' and 'show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.  Here
+is a sample; alter the names:
+
+    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+    'Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+    signature of Ty Coon, 1 April 1989
+
+    Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General Public
+License instead of this License.
+
+
+"CLASSPATH" EXCEPTION TO THE GPL
+
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
+
+    Linking this library statically or dynamically with other modules is making
+    a combined work based on this library.  Thus, the terms and conditions of
+    the GNU General Public License cover the whole combination.
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,
+    and to copy and distribute the resulting executable under terms of your
+    choice, provided that you also meet, for each linked independent module,
+    the terms and conditions of the license of that module.  An independent
+    module is a module which is not derived from or based on this library.  If
+    you modify this library, you may extend this exception to your version of
+    the library, but you are not obligated to do so.  If you do not wish to do
+    so, delete this exception statement from your version.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests-chapter-1a/src/main/resources/THIRD_PARTY_README	Fri May 06 23:20:05 2016 +0300
@@ -0,0 +1,29 @@
+DO NOT TRANSLATE OR LOCALIZE.
+-----------------------------
+
+%% This notice is provided with respect to JOpt-Simple v4.6.
+
+--- begin of LICENSE ---
+
+Copyright (c) SourceForge
+
+The MIT License Copyright (c) Permission is hereby granted, free of
+charge, to any person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE ---