commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [lang] Fix compiler type warning
Date Sat, 28 May 2016 12:42:37 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 9bc992b13 -> 17e654881


Fix compiler type warning

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/17e65488
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/17e65488
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/17e65488

Branch: refs/heads/master
Commit: 17e65488113a2dbe9894f824f4321a06ee009e02
Parents: 9bc992b
Author: Sebb <sebb@apache.org>
Authored: Sat May 28 13:42:32 2016 +0100
Committer: Sebb <sebb@apache.org>
Committed: Sat May 28 13:42:32 2016 +0100

----------------------------------------------------------------------
 .../commons/lang3/StringUtilsStartsEndsWithTest.java     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/17e65488/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
index a351a2f..fef99bc 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java
@@ -179,7 +179,16 @@ public class StringUtilsStartsEndsWithTest {
         assertFalse(StringUtils.endsWithAny("abcXYZ", "def", "xyz"));
         assertTrue(StringUtils.endsWithAny("abcXYZ", "def", "YZ"));
 
-        assertFalse(StringUtils.endsWithAny("abcXYZ", null));
+        /*
+         * Type null of the last argument to method endsWithAny(CharSequence, CharSequence...)
+         * doesn't exactly match the vararg parameter type. 
+         * Cast to CharSequence[] to confirm the non-varargs invocation,
+         * or pass individual arguments of type CharSequence for a varargs invocation.
+         *
+         * assertFalse(StringUtils.endsWithAny("abcXYZ", null)); // replace with specific
types to avoid warning
+         */
+        assertFalse(StringUtils.endsWithAny("abcXYZ", (CharSequence) null));
+        assertFalse(StringUtils.endsWithAny("abcXYZ", (CharSequence[]) null));
         assertTrue(StringUtils.endsWithAny("abcXYZ", ""));
 
         assertTrue("StringUtils.endsWithAny(abcxyz, StringBuilder(abc), StringBuffer(xyz))",
StringUtils.endsWithAny("abcxyz", new StringBuilder("abc"), new StringBuffer("xyz")));


Mime
View raw message