< prev index next >

test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template

Print this page

        

@@ -538,11 +538,11 @@
         // get and add, add and get
         {
             $type$ o = ($type$) vh.getAndAdd(recv, $value3$);
             assertEquals(o, $value1$, "getAndAdd $type$");
             $type$ c = ($type$) vh.addAndGet(recv, $value3$);
-            assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
+            assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
         }
 #end[AtomicAdd]
     }
 
     static void testInstanceFieldUnsupported(VarHandleTestAccess$Type$ recv, VarHandle vh) {

@@ -723,11 +723,11 @@
         // get and add, add and get
         {
             $type$ o = ($type$) vh.getAndAdd( $value3$);
             assertEquals(o, $value1$, "getAndAdd $type$");
             $type$ c = ($type$) vh.addAndGet($value3$);
-            assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
+            assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
         }
 #end[AtomicAdd]
     }
 
     static void testStaticFieldUnsupported(VarHandle vh) {

@@ -911,11 +911,11 @@
             // get and add, add and get
             {
                 $type$ o = ($type$) vh.getAndAdd(array, i, $value3$);
                 assertEquals(o, $value1$, "getAndAdd $type$");
                 $type$ c = ($type$) vh.addAndGet(array, i, $value3$);
-                assertEquals(c, $value1$ + $value3$ + $value3$, "getAndAdd $type$ value");
+                assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value");
             }
 #end[AtomicAdd]
         }
     }
 
< prev index next >