From 17e65488113a2dbe9894f824f4321a06ee009e02 Mon Sep 17 00:00:00 2001 From: Sebb Date: Sat, 28 May 2016 13:42:32 +0100 Subject: [PATCH] Fix compiler type warning --- .../commons/lang3/StringUtilsStartsEndsWithTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsStartsEndsWithTest.java index a351a2fc5..fef99bcbf 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")));