changeset 5860:2e76d9500022

Correct or suppress, as appropriate, warnings in the test-ng tests
author Robert Field <Robert.Field@oracle.com>
date Wed, 22 Aug 2012 00:26:07 -0700
parents 30c6386161c0
children 6b67e68ac62e
files test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalFactoryTest.java test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalTest.java test-ng/tests/org/openjdk/tests/java/util/concurrent/AtomicReferenceTest.java test-ng/tests/org/openjdk/tests/java/util/functions/UnaryOperatorTest.java test-ng/tests/org/openjdk/tests/javac/MethodReferenceTestFDCCE.java
diffstat 5 files changed, 11 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalFactoryTest.java	Mon Aug 20 17:00:55 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalFactoryTest.java	Wed Aug 22 00:26:07 2012 -0700
@@ -87,11 +87,11 @@
             th[i] = new Thread() {
                 @Override
                 public void run() {
-                    int threadId = ((Integer) (threadLocal.get())).intValue();
+                    int threadId = threadLocal.get().intValue();
                     assertFalse(visited[threadId], "visited[" + threadId + "]=" + visited[threadId]);
                     visited[threadId] = true;
                     // check the get() again
-                    int secondCheckThreadId = ((Integer) (threadLocal.get())).intValue();
+                    int secondCheckThreadId = threadLocal.get().intValue();
                     assertEquals( secondCheckThreadId, threadId );
                     Thread.yield();
                 }
--- a/test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalTest.java	Mon Aug 20 17:00:55 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/java/lang/ThreadLocalTest.java	Wed Aug 22 00:26:07 2012 -0700
@@ -43,7 +43,7 @@
      * Test of get method, of class ThreadLocal.
      */
     public void testGet() {
-        ThreadLocal instance = new ThreadLocal();
+        ThreadLocal<Object> instance = new ThreadLocal<>();
         Object expResult = null;
         Object result = instance.get();
         assertEquals(result, expResult);
@@ -54,7 +54,7 @@
      */
     public void testSet() {
         String initialValue = "initial value";
-        ThreadLocal instance = new ThreadLocal();
+        ThreadLocal<String> instance = new ThreadLocal<>();
         instance.set(initialValue);
         assertEquals( instance.get(), initialValue );
     }
@@ -64,7 +64,7 @@
      */
     public void testRemove() {
         String putThisIn = "value was set";
-        ThreadLocal instance = new ThreadLocal();
+        ThreadLocal<String> instance = new ThreadLocal<>();
         instance.set( putThisIn );
         instance.remove();
         assertNull( instance.get() );
@@ -75,7 +75,7 @@
      */
     public void testInitWithFactory() {
         String whatDoYouExpect = "OneWithEverything";
-        ThreadLocal<String> hotdogForTheMonk = new ThreadLocal( new StringFactory( whatDoYouExpect ));
+        ThreadLocal<String> hotdogForTheMonk = new ThreadLocal<>( new StringFactory( whatDoYouExpect ));
         assertEquals( hotdogForTheMonk.get(), hotdogForTheMonk.get() );
     }
 
--- a/test-ng/tests/org/openjdk/tests/java/util/concurrent/AtomicReferenceTest.java	Mon Aug 20 17:00:55 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/java/util/concurrent/AtomicReferenceTest.java	Wed Aug 22 00:26:07 2012 -0700
@@ -24,9 +24,7 @@
  */
 package org.openjdk.tests.java.util.concurrent;
 
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
-import java.util.functions.IntUnaryOperator;
 import java.util.functions.UnaryOperator;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
@@ -47,7 +45,7 @@
     public void testUpdateAndGet() {
         System.out.println("getAndUpdate");
         UnaryOperator<Integer> op = (x -> x + 2);
-        AtomicReference instance = new AtomicReference(new Integer(3));
+        AtomicReference<Integer> instance = new AtomicReference<>(new Integer(3));
         Object expResult = 5;
         Object result = instance.updateAndGet( op );
         assertEquals(result, expResult);
@@ -59,7 +57,7 @@
     public void testGetAndUpdate() {
         System.out.println("getAndUpdate");
         UnaryOperator<Integer> op = (x -> x + 3);
-        AtomicReference instance = new AtomicReference(new Integer(3));
+        AtomicReference<Integer> instance = new AtomicReference<>(new Integer(3));
         Object expResult = 3;
         Object result = instance.getAndUpdate( op );
         assertEquals(result, expResult);
--- a/test-ng/tests/org/openjdk/tests/java/util/functions/UnaryOperatorTest.java	Mon Aug 20 17:00:55 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/java/util/functions/UnaryOperatorTest.java	Wed Aug 22 00:26:07 2012 -0700
@@ -25,10 +25,6 @@
 package org.openjdk.tests.java.util.functions;
 
 import java.util.functions.UnaryOperator;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 import static org.testng.Assert.*;
 
@@ -38,6 +34,7 @@
  * @since 1.8
  */
 @Test
+@SuppressWarnings({"rawtypes", "unchecked"})
 public class UnaryOperatorTest {
     
     public UnaryOperatorTest() {
--- a/test-ng/tests/org/openjdk/tests/javac/MethodReferenceTestFDCCE.java	Mon Aug 20 17:00:55 2012 -0700
+++ b/test-ng/tests/org/openjdk/tests/javac/MethodReferenceTestFDCCE.java	Wed Aug 22 00:26:07 2012 -0700
@@ -32,10 +32,12 @@
 import static org.testng.Assert.fail;
 
 /**
+ * Method references and raw types.
  * @author Robert Field
  */
 
 @Test
+@SuppressWarnings({"rawtypes", "unchecked"})
 public class MethodReferenceTestFDCCE {
 
     static void assertCCE(Throwable t) {