ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/AtomicReferenceArrayTest.java
(Generate patch)

Comparing jsr166/src/test/tck/AtomicReferenceArrayTest.java (file contents):
Revision 1.39 by dl, Tue Jan 26 13:33:05 2021 UTC vs.
Revision 1.40 by jsr166, Wed Jan 27 01:57:24 2021 UTC

# Line 101 | Line 101 | public class AtomicReferenceArrayTest ex
101       * get returns the last value set at index
102       */
103      public void testGetSet() {
104 <        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<Item>(SIZE);
104 >        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<>(SIZE);
105          for (int i = 0; i < SIZE; i++) {
106              aa.set(i, one);
107              assertSame(one, aa.get(i));
# Line 116 | Line 116 | public class AtomicReferenceArrayTest ex
116       * get returns the last value lazySet at index by same thread
117       */
118      public void testGetLazySet() {
119 <        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<Item>(SIZE);
119 >        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<>(SIZE);
120          for (int i = 0; i < SIZE; i++) {
121              aa.lazySet(i, one);
122              assertSame(one, aa.get(i));
# Line 131 | Line 131 | public class AtomicReferenceArrayTest ex
131       * compareAndSet succeeds in changing value if equal to expected else fails
132       */
133      public void testCompareAndSet() {
134 <        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<Item>(SIZE);
134 >        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<>(SIZE);
135          for (int i = 0; i < SIZE; i++) {
136              aa.set(i, one);
137              assertTrue(aa.compareAndSet(i, one, two));
# Line 149 | Line 149 | public class AtomicReferenceArrayTest ex
149       * to succeed
150       */
151      public void testCompareAndSetInMultipleThreads() throws InterruptedException {
152 <        final AtomicReferenceArray<Item> a = new AtomicReferenceArray<Item>(1);
152 >        final AtomicReferenceArray<Item> a = new AtomicReferenceArray<>(1);
153          a.set(0, one);
154          Thread t = new Thread(new CheckedRunnable() {
155              public void realRun() {
# Line 170 | Line 170 | public class AtomicReferenceArrayTest ex
170       */
171      @SuppressWarnings("deprecation")
172      public void testWeakCompareAndSet() {
173 <        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<Item>(SIZE);
173 >        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<>(SIZE);
174          for (int i = 0; i < SIZE; i++) {
175              aa.set(i, one);
176              do {} while (!aa.weakCompareAndSet(i, one, two));
# Line 185 | Line 185 | public class AtomicReferenceArrayTest ex
185       * getAndSet returns previous value and sets to given value at given index
186       */
187      public void testGetAndSet() {
188 <        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<Item>(SIZE);
188 >        AtomicReferenceArray<Item> aa = new AtomicReferenceArray<>(SIZE);
189          for (int i = 0; i < SIZE; i++) {
190              aa.set(i, one);
191              assertSame(one, aa.getAndSet(i, zero));
# Line 198 | Line 198 | public class AtomicReferenceArrayTest ex
198       * a deserialized/reserialized array holds same values in same order
199       */
200      public void testSerialization() throws Exception {
201 <        AtomicReferenceArray<Item> x = new AtomicReferenceArray<Item>(SIZE);
201 >        AtomicReferenceArray<Item> x = new AtomicReferenceArray<>(SIZE);
202          for (int i = 0; i < SIZE; i++) {
203              x.set(i, minusOne);
204          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines