--- jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java 2013/04/02 04:11:28 1.27 +++ jsr166/src/test/tck/AtomicReferenceFieldUpdaterTest.java 2013/04/02 16:14:39 1.28 @@ -13,6 +13,7 @@ public class AtomicReferenceFieldUpdater volatile Integer x = null; Object z; Integer w; + volatile int i; public static void main(String[] args) { junit.textui.TestRunner.run(suite()); @@ -39,13 +40,13 @@ public class AtomicReferenceFieldUpdater } /** - * construction with field not of given type throws RuntimeException + * construction with field not of given type throws ClassCastException */ public void testConstructor2() { try { updaterFor("z"); shouldThrow(); - } catch (RuntimeException success) {} + } catch (ClassCastException success) {} } /** @@ -59,6 +60,16 @@ public class AtomicReferenceFieldUpdater } /** + * Constructor with non-reference field throws ClassCastException + */ + public void testConstructor4() { + try { + updaterFor("i"); + shouldThrow(); + } catch (ClassCastException success) {} + } + + /** * get returns the last value set or assigned */ public void testGetSet() {