commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djo...@apache.org
Subject svn commit: r1562017 - in /commons/proper/lang/trunk/src: main/java/org/apache/commons/lang3/ test/java/org/apache/commons/lang3/ test/java/org/apache/commons/lang3/event/ test/java/org/apache/commons/lang3/reflect/testbed/ test/java/org/apache/commons...
Date Tue, 28 Jan 2014 09:31:53 GMT
Author: djones
Date: Tue Jan 28 09:31:53 2014
New Revision: 1562017

URL: http://svn.apache.org/r1562017
Log:
Resolved compiler warnings shown in Eclipse and when compiling with -Xlint:unchecked.

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PrivatelyShadowedChild.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PublicChild.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PubliclyShadowedChild.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/StaticContainer.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/ObjectUtils.java Tue
Jan 28 09:31:53 2014
@@ -182,7 +182,6 @@ public class ObjectUtils {
      * @param object2  the second object, may be {@code null}
      * @return {@code false} if the values of both objects are the same
      */
-    @SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated
in 3.2
     public static boolean notEqual(final Object object1, final Object object2) {
         return ObjectUtils.equals(object1, object2) == false;
     }
@@ -240,7 +239,6 @@ public class ObjectUtils {
         int hash = 1;
         if (objects != null) {
             for (final Object object : objects) {
-                @SuppressWarnings( "Deprecation" ) // ObjectUtils.hashCode(Object) has been
deprecated in 3.2
                 int tmpHash = ObjectUtils.hashCode(object);
                 hash = hash * 31 + tmpHash;
             }

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassPathUtilsTest.java
Tue Jan 28 09:31:53 2014
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertTru
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
 
-import org.apache.commons.lang3.text.WordUtils;
 import org.junit.Test;
 
 /**

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ObjectUtilsTest.java
Tue Jan 28 09:31:53 2014
@@ -72,15 +72,21 @@ public class ObjectUtilsTest {
 
     @Test
     public void testFirstNonNull() {
-        assertEquals(null, ObjectUtils.firstNonNull(null, null));
+        // Cast to Object in line below ensures compiler doesn't complain of unchecked generic
array creation
+        assertEquals(null, ObjectUtils.firstNonNull((Object) null, (Object) null));
         assertEquals("", ObjectUtils.firstNonNull(null, ""));
         final String firstNonNullGenerics = ObjectUtils.firstNonNull(null, null, "123", "456");
         assertEquals("123", firstNonNullGenerics);
         assertEquals("123", ObjectUtils.firstNonNull("123", null, "456", null));
-        assertEquals(null, ObjectUtils.firstNonNull());
+        assertEquals(null, ObjectUtils.firstNonNull(new Object[0]));
         assertSame(Boolean.TRUE, ObjectUtils.firstNonNull(Boolean.TRUE));
-        assertNull(ObjectUtils.firstNonNull());
-        assertNull(ObjectUtils.firstNonNull(null, null));
+        
+        // Explicitly pass in an empty array of Object type to ensure compiler doesn't complain
of unchecked generic array creation
+        assertNull(ObjectUtils.firstNonNull(new Object[0]));
+        
+        // Cast to Object in line below ensures compiler doesn't complain of unchecked generic
array creation
+        assertNull(ObjectUtils.firstNonNull((Object) null, (Object) null));
+        
 //        assertSame("123", ObjectUtils.firstNonNull(null, ObjectUtils.NULL, "123", "456"));
 //        assertSame("456", ObjectUtils.firstNonNull(ObjectUtils.NULL, "456", "123", null));
 //        assertNull(ObjectUtils.firstNonNull(null, null, ObjectUtils.NULL));
@@ -89,7 +95,6 @@ public class ObjectUtilsTest {
     }
 
     //-----------------------------------------------------------------------
-    @SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated
in 3.2
     @Test
     public void testEquals() {
         assertTrue("ObjectUtils.equals(null, null) returned false", ObjectUtils.equals(null,
null));
@@ -108,7 +113,6 @@ public class ObjectUtilsTest {
         assertFalse("ObjectUtils.notEqual(\"foo\", \"foo\") returned false", ObjectUtils.notEqual(FOO,
FOO));
     }
 
-    @SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated
in 3.2
     @Test
     public void testHashCode() {
         assertEquals(0, ObjectUtils.hashCode(null));
@@ -129,7 +133,7 @@ public class ObjectUtilsTest {
 
     @Test
     public void testHashCodeMulti_multiple_likeList() {
-        final List<Object> list0 = new ArrayList<Object>(Arrays.asList());
+        final List<Object> list0 = new ArrayList<Object>(Arrays.asList(new Object[0]));
         assertEquals(list0.hashCode(), ObjectUtils.hashCodeMulti());
         
         final List<Object> list1 = new ArrayList<Object>(Arrays.asList("a"));
@@ -282,14 +286,12 @@ public class ObjectUtilsTest {
         }
     }
 
-    @SuppressWarnings( "deprecation" ) // ObjectUtils.toString(Object) has been deprecated
in 3.2
     @Test
     public void testToString_Object() {
         assertEquals("", ObjectUtils.toString((Object) null) );
         assertEquals(Boolean.TRUE.toString(), ObjectUtils.toString(Boolean.TRUE) );
     }
 
-    @SuppressWarnings( "deprecation" ) // ObjectUtils.toString(Object) has been deprecated
in 3.2
     @Test
     public void testToString_ObjectString() {
         assertEquals(BAR, ObjectUtils.toString((Object) null, BAR) );

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/RandomUtilsTest.java
Tue Jan 28 09:31:53 2014
@@ -19,7 +19,6 @@ package org.apache.commons.lang3;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import org.junit.Test;
 

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
Tue Jan 28 09:31:53 2014
@@ -418,7 +418,6 @@ public class SerializationUtilsTest {
 
 }
 
-@SuppressWarnings("serial")
 class ClassNotFoundSerialization implements Serializable
 {
 

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
Tue Jan 28 09:31:53 2014
@@ -300,7 +300,7 @@ public class StringUtilsTest {
 //        assertNull(StringUtils.join(null)); // generates warning
         assertNull(StringUtils.join((Object[]) null)); // equivalent explicit cast
         // test additional varargs calls
-        assertEquals("", StringUtils.join()); // empty array
+        assertEquals("", StringUtils.join(new Object[0])); // empty array
         assertEquals("", StringUtils.join((Object) null)); // => new Object[]{null}
 
         assertEquals("", StringUtils.join(EMPTY_ARRAY_LIST));

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ValidateTest.java Tue
Jan 28 09:31:53 2014
@@ -106,6 +106,7 @@ public class ValidateTest  {
 
     //-----------------------------------------------------------------------
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unused")
     @Test
     public void testNotNull1() {
         Validate.notNull(new Object());
@@ -122,6 +123,7 @@ public class ValidateTest  {
     }
 
     //-----------------------------------------------------------------------
+    @SuppressWarnings("unused")
     @Test
     public void testNotNull2() {
         Validate.notNull(new Object(), "MSG");

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/event/EventListenerSupportTest.java
Tue Jan 28 09:31:53 2014
@@ -165,7 +165,6 @@ public class EventListenerSupportTest 
     @Test
     public void testSubclassInvocationHandling() throws PropertyVetoException {
 
-        @SuppressWarnings("serial")
         final
         EventListenerSupport<VetoableChangeListener> eventListenerSupport = new EventListenerSupport<VetoableChangeListener>(
                 VetoableChangeListener.class) {

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PrivatelyShadowedChild.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PrivatelyShadowedChild.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PrivatelyShadowedChild.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PrivatelyShadowedChild.java
Tue Jan 28 09:31:53 2014
@@ -19,7 +19,7 @@ package org.apache.commons.lang3.reflect
 /**
  * @version $Id$
  */
-@SuppressWarnings({ "unused", "hiding" }) // deliberate re-use of variable names
+@SuppressWarnings({ "unused" }) // deliberate re-use of variable names
 public class PrivatelyShadowedChild extends Parent {
     private final String s = "ss";
     private final boolean b = true;

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PublicChild.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PublicChild.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PublicChild.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PublicChild.java
Tue Jan 28 09:31:53 2014
@@ -20,6 +20,5 @@ package org.apache.commons.lang3.reflect
  * @version $Id$
  */
 public class PublicChild extends Parent {
-    @SuppressWarnings("hiding") // deliberate reuse of variable name
     static final String VALUE = "child";
 }

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PubliclyShadowedChild.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PubliclyShadowedChild.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PubliclyShadowedChild.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/PubliclyShadowedChild.java
Tue Jan 28 09:31:53 2014
@@ -19,7 +19,6 @@ package org.apache.commons.lang3.reflect
 /**
  * @version $Id$
  */
-@SuppressWarnings("hiding") // deliberate re-use of variable names
 public class PubliclyShadowedChild extends Parent {
     public String s = "ss";
     public boolean b = true;

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/StaticContainer.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/StaticContainer.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/StaticContainer.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/reflect/testbed/StaticContainer.java
Tue Jan 28 09:31:53 2014
@@ -22,7 +22,6 @@ package org.apache.commons.lang3.reflect
 public class StaticContainer {
     public static final Object IMMUTABLE_PUBLIC = "public";
     protected static final Object IMMUTABLE_PROTECTED = "protected";
-    @SuppressWarnings("unused")
     static final Object IMMUTABLE_PACKAGE = "";
     @SuppressWarnings("unused")
     private static final Object IMMUTABLE_PRIVATE = "private";

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java?rev=1562017&r1=1562016&r2=1562017&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/text/StrTokenizerTest.java
Tue Jan 28 09:31:53 2014
@@ -27,13 +27,11 @@ import java.util.List;
 import java.util.NoSuchElementException;
 
 import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.lang3.ObjectUtils;
 
 /**
  * Unit test for Tokenizer.
  * 
  */
-@SuppressWarnings("deprecation") // deliberate use of deprecated code
 public class StrTokenizerTest {
 
     private static final String CSV_SIMPLE_FIXTURE = "A,b,c";



Mime
View raw message