summaryrefslogtreecommitdiff
path: root/jsr166-tests/src/test/java/jsr166/AtomicReferenceFieldUpdaterTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'jsr166-tests/src/test/java/jsr166/AtomicReferenceFieldUpdaterTest.java')
-rw-r--r--jsr166-tests/src/test/java/jsr166/AtomicReferenceFieldUpdaterTest.java78
1 files changed, 2 insertions, 76 deletions
diff --git a/jsr166-tests/src/test/java/jsr166/AtomicReferenceFieldUpdaterTest.java b/jsr166-tests/src/test/java/jsr166/AtomicReferenceFieldUpdaterTest.java
index 9b2e9a9adf..4b0d946d1d 100644
--- a/jsr166-tests/src/test/java/jsr166/AtomicReferenceFieldUpdaterTest.java
+++ b/jsr166-tests/src/test/java/jsr166/AtomicReferenceFieldUpdaterTest.java
@@ -15,8 +15,6 @@ import junit.framework.TestSuite;
public class AtomicReferenceFieldUpdaterTest extends JSR166TestCase {
volatile Integer x = null;
- protected volatile Integer protectedField;
- private volatile Integer privateField;
Object z;
Integer w;
volatile int i;
@@ -28,62 +26,10 @@ public class AtomicReferenceFieldUpdaterTest extends JSR166TestCase {
// main(suite(), args);
// }
// public static Test suite() {
- // return new TestSuite(AtomicReferenceFieldUpdaterTest.class);
+ // return new TestSuite(...);
// }
- // for testing subclass access
- // android-note: Removed because android doesn't restrict reflection access
- // static class AtomicReferenceFieldUpdaterTestSubclass extends AtomicReferenceFieldUpdaterTest {
- // public void checkPrivateAccess() {
- // try {
- // AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- // AtomicReferenceFieldUpdater.newUpdater
- // (AtomicReferenceFieldUpdaterTest.class, Integer.class, "privateField");
- // shouldThrow();
- // } catch (RuntimeException success) {
- // assertNotNull(success.getCause());
- // }
- // }
-
- // public void checkCompareAndSetProtectedSub() {
- // AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- // AtomicReferenceFieldUpdater.newUpdater
- // (AtomicReferenceFieldUpdaterTest.class, Integer.class, "protectedField");
- // this.protectedField = one;
- // assertTrue(a.compareAndSet(this, one, two));
- // assertTrue(a.compareAndSet(this, two, m4));
- // assertSame(m4, a.get(this));
- // assertFalse(a.compareAndSet(this, m5, seven));
- // assertFalse(seven == a.get(this));
- // assertTrue(a.compareAndSet(this, m4, seven));
- // assertSame(seven, a.get(this));
- // }
- // }
-
- // static class UnrelatedClass {
- // public void checkPackageAccess(AtomicReferenceFieldUpdaterTest obj) {
- // obj.x = one;
- // AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- // AtomicReferenceFieldUpdater.newUpdater
- // (AtomicReferenceFieldUpdaterTest.class, Integer.class, "x");
- // assertSame(one, a.get(obj));
- // assertTrue(a.compareAndSet(obj, one, two));
- // assertSame(two, a.get(obj));
- // }
-
- // public void checkPrivateAccess(AtomicReferenceFieldUpdaterTest obj) {
- // try {
- // AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest,Integer> a =
- // AtomicReferenceFieldUpdater.newUpdater
- // (AtomicReferenceFieldUpdaterTest.class, Integer.class, "privateField");
- // throw new AssertionError("should throw");
- // } catch (RuntimeException success) {
- // assertNotNull(success.getCause());
- // }
- // }
- // }
-
- static AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer> updaterFor(String fieldName) {
+ AtomicReferenceFieldUpdater<AtomicReferenceFieldUpdaterTest, Integer> updaterFor(String fieldName) {
return AtomicReferenceFieldUpdater.newUpdater
(AtomicReferenceFieldUpdaterTest.class, Integer.class, fieldName);
}
@@ -131,26 +77,6 @@ public class AtomicReferenceFieldUpdaterTest extends JSR166TestCase {
}
/**
- * construction using private field from subclass throws RuntimeException
- */
- // android-note: Removed because android doesn't restrict reflection access
- // public void testPrivateFieldInSubclass() {
- // AtomicReferenceFieldUpdaterTestSubclass s =
- // new AtomicReferenceFieldUpdaterTestSubclass();
- // s.checkPrivateAccess();
- // }
-
- /**
- * construction from unrelated class; package access is allowed,
- * private access is not
- */
- // android-note: Removed because android doesn't restrict reflection access
- // public void testUnrelatedClassAccess() {
- // new UnrelatedClass().checkPackageAccess(this);
- // new UnrelatedClass().checkPrivateAccess(this);
- // }
-
- /**
* get returns the last value set or assigned
*/
public void testGetSet() {