From 94036044a4bfb2ace879277127e253a0e2e89ffa Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sat, 14 Mar 2009 13:55:29 +0000 Subject: [PATCH] Unnecessary casts (clone) git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@753658 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang/ArrayUtils.java | 18 +++++++++--------- .../apache/commons/lang/text/StrMatcher.java | 2 +- .../apache/commons/lang/text/StrTokenizer.java | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/java/org/apache/commons/lang/ArrayUtils.java b/src/java/org/apache/commons/lang/ArrayUtils.java index 6edd6edb2..d7de38cd7 100644 --- a/src/java/org/apache/commons/lang/ArrayUtils.java +++ b/src/java/org/apache/commons/lang/ArrayUtils.java @@ -278,7 +278,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (Object[]) array.clone(); + return array.clone(); } /** @@ -294,7 +294,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (long[]) array.clone(); + return array.clone(); } /** @@ -310,7 +310,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (int[]) array.clone(); + return array.clone(); } /** @@ -326,7 +326,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (short[]) array.clone(); + return array.clone(); } /** @@ -342,7 +342,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (char[]) array.clone(); + return array.clone(); } /** @@ -358,7 +358,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (byte[]) array.clone(); + return array.clone(); } /** @@ -374,7 +374,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (double[]) array.clone(); + return array.clone(); } /** @@ -390,7 +390,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (float[]) array.clone(); + return array.clone(); } /** @@ -406,7 +406,7 @@ public class ArrayUtils { if (array == null) { return null; } - return (boolean[]) array.clone(); + return array.clone(); } // Subarrays diff --git a/src/java/org/apache/commons/lang/text/StrMatcher.java b/src/java/org/apache/commons/lang/text/StrMatcher.java index cb939ba99..24094141f 100644 --- a/src/java/org/apache/commons/lang/text/StrMatcher.java +++ b/src/java/org/apache/commons/lang/text/StrMatcher.java @@ -282,7 +282,7 @@ public abstract class StrMatcher { */ CharSetMatcher(char chars[]) { super(); - this.chars = (char[]) chars.clone(); + this.chars = chars.clone(); Arrays.sort(this.chars); } diff --git a/src/java/org/apache/commons/lang/text/StrTokenizer.java b/src/java/org/apache/commons/lang/text/StrTokenizer.java index 8c78e8810..cedaf5828 100644 --- a/src/java/org/apache/commons/lang/text/StrTokenizer.java +++ b/src/java/org/apache/commons/lang/text/StrTokenizer.java @@ -447,7 +447,7 @@ public class StrTokenizer implements ListIterator, Cloneable { */ public String[] getTokenArray() { checkTokenized(); - return (String[]) tokens.clone(); + return tokens.clone(); } /** @@ -1103,7 +1103,7 @@ public class StrTokenizer implements ListIterator, Cloneable { // this method exists to enable 100% test coverage StrTokenizer cloned = (StrTokenizer) super.clone(); if (cloned.chars != null) { - cloned.chars = (char[]) cloned.chars.clone(); + cloned.chars = cloned.chars.clone(); } cloned.reset(); return cloned;