@@ -0,0 +1,1952 @@
+package com.njust.test.juc;%0A%0Aimport java.util.concurrent.atomic.AtomicIntegerFieldUpdater;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Apublic class AtomicIntegerFieldUpdaterDemo%0A%7B%0A    %0A    private AtomicIntegerFieldUpdater%3CDemoData%3E getUpdater(String fieldName)%0A    %7B%0A        return AtomicIntegerFieldUpdater.newUpdater(DemoData.class, fieldName);%0A    %7D%0A    %0A    @Test%0A    public void test01()%0A    %7B%0A        DemoData data = new DemoData();%0A        int actual = getUpdater(%22value1%22).getAndSet(data, 10);%0A        Assert.assertEquals(1, actual);%0A        %0A        actual = getUpdater(%22value2%22).incrementAndGet(data);%0A        Assert.assertEquals(3, actual);%0A    %7D%0A    %0A    @Test%0A    public void testProtected()%0A    %7B%0A        DemoData data = new DemoData();%0A        try%0A        %7B%0A            int value3 = getUpdater(%22value3%22).decrementAndGet(data);%0A            Assert.fail();%0A        %7D%0A        catch (Exception e)%0A        %7B%0A            System.err.println(e);%0A            //java.lang.RuntimeException: java.lang.IllegalAccessException: Class com.njust.test.juc.AtomicIntegerFieldUpdaterDemo can not access a protected member of class com.njust.test.juc.DemoData using an instance of com.njust.test.juc.DemoData%0A        %7D%0A        %0A    %7D%0A    %0A    @Test%0A    public void testPrivate()%0A    %7B%0A        DemoData data = new DemoData();%0A        try%0A        %7B%0A            getUpdater(%22value4%22).compareAndSet(data, 4, 5);%0A            Assert.fail();%0A        %7D%0A        catch (Exception e)%0A        %7B%0A            System.err.println(e);%0A            //java.lang.RuntimeException: java.lang.IllegalAccessException: Class com.njust.test.juc.AtomicIntegerFieldUpdaterDemo can not access a member of class com.njust.test.juc.DemoData with modifiers %22private volatile%22%0A        %7D%0A        %0A    %7D%0A    %0A%7D%0A%0Aclass DemoData%0A%7B%0A    public volatile int value1 = 1;%0A    %0A    volatile int value2 = 2;%0A    %0A    protected volatile int value3 = 3;%0A    %0A    private volatile int value4 = 4;%0A%7D%0A

Create AtomicIntegerFieldUpdaterDemo.java