@@ -0,0 +1,1329 @@
+package org.jctools.sets;%0A%0Aimport org.openjdk.jcstress.annotations.Actor;%0Aimport org.openjdk.jcstress.annotations.JCStressTest;%0Aimport org.openjdk.jcstress.annotations.Outcome;%0Aimport org.openjdk.jcstress.annotations.State;%0Aimport org.openjdk.jcstress.infra.results.IntResult1;%0A%0Aimport static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE;%0Aimport static org.openjdk.jcstress.annotations.Expect.FORBIDDEN;%0A%0A/**%0A * @author Tolstopyatov Vsevolod%0A * @since 13/05/17%0A */%0A@JCStressTest%0A@Outcome(id = %220%22, expect = FORBIDDEN, desc = %22Missing read%22)%0A@Outcome(id = %221%22, expect = ACCEPTABLE, desc = %22Ok%22)%0A@Outcome(id = %222%22, expect = FORBIDDEN, desc = %22Duplicate reads%22)%0A@Outcome(expect = FORBIDDEN, desc = %22Can't happen%22)%0A@State%0Apublic class SingleWriterHashSetDuplicateReadsTest %7B%0A%0A    private final SingleWriterHashSet%3CInteger%3E set = new SingleWriterHashSet%3C%3E(16);%0A%0A    public SingleWriterHashSetDuplicateReadsTest() %7B%0A        // Collide elements so removal of 1 will shift 17%0A        set.add(1);%0A        set.add(17);%0A    %7D%0A%0A    @Actor%0A    public void actor1() %7B%0A        set.remove(1);%0A    %7D%0A%0A    @Actor%0A    public void actor2(IntResult1 result) %7B%0A        int counter = 0;%0A        for (Integer integer : set) %7B%0A            if (integer == 17) %7B%0A                ++counter;%0A            %7D%0A        %7D%0A%0A        result.r1 = counter;%0A    %7D%0A%7D

Add jcstress test which reveals issue in SingleWriterHashSet with removal + iterator reads