diff --git a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java index 494670bca..fc5350f52 100644 --- a/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java +++ b/src/main/java/org/apache/commons/lang3/CharSequenceUtils.java @@ -237,8 +237,8 @@ public class CharSequenceUtils { } } - int len1 = cs.length(); - int len2 = searchChar.length(); + final int len1 = cs.length(); + final int len2 = searchChar.length(); if (start > len1) { start = len1; @@ -266,7 +266,7 @@ public class CharSequenceUtils { start = len1 - len2; } - char char0 = searchChar.charAt(0); + final char char0 = searchChar.charAt(0); int i = start; while (true) { @@ -286,7 +286,7 @@ public class CharSequenceUtils { } } - private static boolean checkLaterThan1(final CharSequence cs, final CharSequence searchChar, int len2, int start1) { + private static boolean checkLaterThan1(final CharSequence cs, final CharSequence searchChar, final int len2, final int start1) { for (int i = 1, j = len2 - 1; i <= j; i++, j--) { if (cs.charAt(start1 + i) != searchChar.charAt(i) || diff --git a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java index dc0db4e88..b21144c1c 100644 --- a/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/CharSequenceUtilsTest.java @@ -189,9 +189,9 @@ public class CharSequenceUtilsTest { } static class WrapperString implements CharSequence { - private CharSequence inner; + private final CharSequence inner; - WrapperString(CharSequence inner) { + WrapperString(final CharSequence inner) { this.inner = inner; } @@ -201,12 +201,12 @@ public class CharSequenceUtilsTest { } @Override - public char charAt(int index) { + public char charAt(final int index) { return inner.charAt(index); } @Override - public CharSequence subSequence(int start, int end) { + public CharSequence subSequence(final int start, final int end) { return inner.subSequence(start, end); } @@ -243,8 +243,8 @@ public class CharSequenceUtilsTest { testNewLastIndexOfSingle("oraoraoraora", "r"); testNewLastIndexOfSingle("mudamudamudamuda", "d"); - Random random = new Random(); - StringBuilder seg = new StringBuilder(); + final Random random = new Random(); + final StringBuilder seg = new StringBuilder(); while (seg.length() <= CharSequenceUtils.TO_STRING_LIMIT) { seg.append(random.nextInt()); } @@ -260,8 +260,8 @@ public class CharSequenceUtilsTest { } } - private void testNewLastIndexOfSingle(CharSequence a, CharSequence b) { - int maxa = Math.max(a.length(), b.length()); + private void testNewLastIndexOfSingle(final CharSequence a, final CharSequence b) { + final int maxa = Math.max(a.length(), b.length()); for (int i = -maxa - 10; i <= maxa + 10; i++) { testNewLastIndexOfSingle(a, b, i); } @@ -269,12 +269,12 @@ public class CharSequenceUtilsTest { testNewLastIndexOfSingle(a, b, Integer.MAX_VALUE); } - private void testNewLastIndexOfSingle(CharSequence a, CharSequence b, int start) { + private void testNewLastIndexOfSingle(final CharSequence a, final CharSequence b, final int start) { testNewLastIndexOfSingleSingle(a, b, start); testNewLastIndexOfSingleSingle(b, a, start); } - private void testNewLastIndexOfSingleSingle(CharSequence a, CharSequence b, int start) { + private void testNewLastIndexOfSingleSingle(final CharSequence a, final CharSequence b, final int start) { assertEquals( a.toString().lastIndexOf(b.toString(), start), CharSequenceUtils.lastIndexOf(new WrapperString(a.toString()), new WrapperString(b.toString()), start), diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java index eb0234041..5a15ea3c9 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java @@ -732,7 +732,7 @@ public class FastDateParserTest { testSingleLocale(buggyLocale); } - private void testSingleLocale(Locale locale) throws ParseException { + private void testSingleLocale(final Locale locale) throws ParseException { final Calendar cal = Calendar.getInstance(GMT); cal.clear(); cal.set(2003, Calendar.FEBRUARY, 10);