commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [2/2] [text] Use final.
Date Sat, 23 Sep 2017 17:24:30 GMT
Use final.

Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/0be254ad
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/0be254ad
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/0be254ad

Branch: refs/heads/master
Commit: 0be254ad1483e67d452a74330b78f5896888c2df
Parents: 7134d81
Author: Gary Gregory <garydgregory@gmail.com>
Authored: Sat Sep 23 11:24:24 2017 -0600
Committer: Gary Gregory <garydgregory@gmail.com>
Committed: Sat Sep 23 11:24:24 2017 -0600

----------------------------------------------------------------------
 pom.xml                                         |  7 +-
 .../java/org/apache/commons/text/CaseUtils.java | 10 +--
 .../commons/text/CharacterPredicates.java       | 14 +--
 .../commons/text/RandomStringGenerator.java     | 18 ++--
 .../apache/commons/text/StringEscapeUtils.java  | 18 ++--
 .../java/org/apache/commons/text/WordUtils.java | 20 ++---
 .../text/similarity/JaccardDistance.java        |  2 +-
 .../text/similarity/JaccardSimilarity.java      | 12 +--
 .../text/similarity/JaroWinklerDistance.java    | 20 ++---
 .../text/similarity/LevenshteinDistance.java    |  2 +-
 .../similarity/LongestCommonSubsequence.java    |  6 +-
 .../text/translate/AggregateTranslator.java     |  2 +-
 .../commons/text/translate/EntityArrays.java    | 16 ++--
 .../text/translate/LookupTranslator.java        |  4 +-
 .../commons/text/AlphabetConverterTest.java     | 44 +++++-----
 .../org/apache/commons/text/CaseUtilsTest.java  |  2 +-
 .../commons/text/ExtendedMessageFormatTest.java |  6 +-
 .../commons/text/FormattableUtilsTest.java      |  2 +-
 .../commons/text/RandomStringGeneratorTest.java | 92 ++++++++++----------
 .../org/apache/commons/text/StrBuilderTest.java | 28 +++---
 .../apache/commons/text/StrSubstitutorTest.java | 28 +++---
 .../apache/commons/text/StrTokenizerTest.java   |  8 +-
 .../commons/text/StringEscapeUtilsTest.java     |  8 +-
 .../text/similarity/CosineSimilarityTest.java   | 18 ++--
 .../commons/text/similarity/FuzzyScoreTest.java |  6 +-
 .../LevenshteinDetailedDistanceTest.java        | 18 ++--
 .../text/similarity/LevenshteinResultsTest.java | 28 +++---
 .../similarity/SimilarityScoreFromTest.java     |  4 +-
 .../text/translate/CodePointTranslatorTest.java | 10 +--
 .../text/translate/CsvTranslatorsTest.java      | 20 ++---
 .../text/translate/EntityArraysTest.java        |  5 +-
 .../translate/NumericEntityUnescaperTest.java   |  8 +-
 32 files changed, 244 insertions(+), 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 32af8e3..4971775 100644
--- a/pom.xml
+++ b/pom.xml
@@ -148,13 +148,14 @@
     <!-- Override default buildNumber timestamp format, needed for coveralls plugin -->
     <maven.buildNumber.timestampFormat>{0,date,yyyy-MM-dd HH:mm:ssZ}</maven.buildNumber.timestampFormat>
 
-    <!-- Override 01-23-2017 for java 9-ea compatibility -->
-    <commons.jacoco.version>0.7.9</commons.jacoco.version>
-
     <!-- Use clirr version that works on Java 8 -->
     <commons.clirr.version>2.8</commons.clirr.version>
 
     <checkstyle.plugin.version>2.17</checkstyle.plugin.version>
+    
+    <!-- Overrides for Java 9 compatibility until commons-parent 43 comes out. -->
+    <commons.jacoco.version>0.7.9</commons.jacoco.version>
+    <commons.findbugs.version>3.0.5</commons.findbugs.version>
   </properties>
 
 

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/CaseUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/CaseUtils.java b/src/main/java/org/apache/commons/text/CaseUtils.java
index 40bc7cd..f768217 100644
--- a/src/main/java/org/apache/commons/text/CaseUtils.java
+++ b/src/main/java/org/apache/commons/text/CaseUtils.java
@@ -78,10 +78,10 @@ public class CaseUtils {
             return str;
         }
         str = str.toLowerCase();
-        int strLen = str.length();
-        int [] newCodePoints = new int[strLen];
+        final int strLen = str.length();
+        final int [] newCodePoints = new int[strLen];
         int outOffset = 0;
-        Set<Integer> delimiterSet = generateDelimiterSet(delimiters);
+        final Set<Integer> delimiterSet = generateDelimiterSet(delimiters);
         boolean capitalizeNext = false;
         if (capitalizeFirstLetter) {
             capitalizeNext = true;
@@ -96,7 +96,7 @@ public class CaseUtils {
                 }
                 index += Character.charCount(codePoint);
             } else if (capitalizeNext || outOffset == 0 && capitalizeFirstLetter) {
-                int titleCaseCodePoint = Character.toTitleCase(codePoint);
+                final int titleCaseCodePoint = Character.toTitleCase(codePoint);
                 newCodePoints[outOffset++] = titleCaseCodePoint;
                 index += Character.charCount(titleCaseCodePoint);
                 capitalizeNext = false;
@@ -120,7 +120,7 @@ public class CaseUtils {
      * @return Set<Integer>
      */
     private static Set<Integer> generateDelimiterSet(final char[] delimiters) {
-        Set<Integer> delimiterHashSet = new HashSet<>();
+        final Set<Integer> delimiterHashSet = new HashSet<>();
         delimiterHashSet.add(Character.codePointAt(new char[]{' '}, 0));
         if (delimiters == null || delimiters.length == 0) {
             return delimiterHashSet;

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/CharacterPredicates.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/CharacterPredicates.java b/src/main/java/org/apache/commons/text/CharacterPredicates.java
index dc504c7..3c99149 100644
--- a/src/main/java/org/apache/commons/text/CharacterPredicates.java
+++ b/src/main/java/org/apache/commons/text/CharacterPredicates.java
@@ -33,7 +33,7 @@ public enum CharacterPredicates implements CharacterPredicate {
      */
     LETTERS {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return Character.isLetter(codePoint);
         }
     },
@@ -45,7 +45,7 @@ public enum CharacterPredicates implements CharacterPredicate {
      */
     DIGITS {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return Character.isDigit(codePoint);
         }
     },
@@ -57,7 +57,7 @@ public enum CharacterPredicates implements CharacterPredicate {
      */
     ARABIC_NUMERALS {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return codePoint >= '0' && codePoint <= '9';
         }
     },
@@ -69,7 +69,7 @@ public enum CharacterPredicates implements CharacterPredicate {
      */
     ASCII_LOWERCASE_LETTERS {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return codePoint >= 'a' && codePoint <= 'z';
         }
     },
@@ -81,7 +81,7 @@ public enum CharacterPredicates implements CharacterPredicate {
      */
     ASCII_UPPERCASE_LETTERS {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return codePoint >= 'A' && codePoint <= 'Z';
         }
     },
@@ -93,7 +93,7 @@ public enum CharacterPredicates implements CharacterPredicate {
      */
     ASCII_LETTERS {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return ASCII_LOWERCASE_LETTERS.test(codePoint) || ASCII_UPPERCASE_LETTERS.test(codePoint);
         }
     },
@@ -105,7 +105,7 @@ public enum CharacterPredicates implements CharacterPredicate {
      */
     ASCII_ALPHA_NUMERALS {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return ASCII_LOWERCASE_LETTERS.test(codePoint) || ASCII_UPPERCASE_LETTERS.test(codePoint)
                     || ARABIC_NUMERALS.test(codePoint);
         }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/RandomStringGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/RandomStringGenerator.java b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
index a6c01c3..7b70bae 100644
--- a/src/main/java/org/apache/commons/text/RandomStringGenerator.java
+++ b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
@@ -95,9 +95,9 @@ public final class RandomStringGenerator {
      *            source of randomness
      * @param characterList list of predefined set of characters.
      */
-    private RandomStringGenerator(int minimumCodePoint, int maximumCodePoint,
-                                  Set<CharacterPredicate> inclusivePredicates, TextRandomProvider random,
-                                  List<Character> characterList) {
+    private RandomStringGenerator(final int minimumCodePoint, final int maximumCodePoint,
+                                  final Set<CharacterPredicate> inclusivePredicates, final TextRandomProvider random,
+                                  final List<Character> characterList) {
         this.minimumCodePoint = minimumCodePoint;
         this.maximumCodePoint = maximumCodePoint;
         this.inclusivePredicates = inclusivePredicates;
@@ -130,7 +130,7 @@ public final class RandomStringGenerator {
      * @return the random number.
      */
     private int generateRandomNumber(final List<Character> characterList) {
-        int listSize = characterList.size();
+        final int listSize = characterList.size();
         if (random != null) {
             return String.valueOf(characterList.get(random.nextInt(listSize))).codePointAt(0);
         }
@@ -186,7 +186,7 @@ public final class RandomStringGenerator {
 
             if (inclusivePredicates != null) {
                 boolean matchedFilter = false;
-                for (CharacterPredicate predicate : inclusivePredicates) {
+                for (final CharacterPredicate predicate : inclusivePredicates) {
                     if (predicate.test(codePoint)) {
                         matchedFilter = true;
                         break;
@@ -342,7 +342,7 @@ public final class RandomStringGenerator {
          */
         public Builder withinRange(final char[] ... pairs) {
             characterList = new ArrayList<Character>();
-            for (char[] pair :  pairs) {
+            for (final char[] pair :  pairs) {
                 final int minimumCodePoint = pair[0];
                 final int maximumCodePoint = pair[1];
                 Validate.isTrue(minimumCodePoint <= maximumCodePoint,
@@ -384,7 +384,7 @@ public final class RandomStringGenerator {
                 inclusivePredicates.clear();
             }
 
-            for (CharacterPredicate predicate : predicates) {
+            for (final CharacterPredicate predicate : predicates) {
                 inclusivePredicates.add(predicate);
             }
 
@@ -444,9 +444,9 @@ public final class RandomStringGenerator {
          * @return {@code this}, to allow method chaining
          * @since 1.2
          */
-        public Builder selectFrom(char ... chars) {
+        public Builder selectFrom(final char ... chars) {
             characterList = new ArrayList<Character>();
-            for (char c : chars) {
+            for (final char c : chars) {
                 characterList.add(c);
             }
             return this;

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/StringEscapeUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/StringEscapeUtils.java b/src/main/java/org/apache/commons/text/StringEscapeUtils.java
index 05d2348..3ac66ff 100644
--- a/src/main/java/org/apache/commons/text/StringEscapeUtils.java
+++ b/src/main/java/org/apache/commons/text/StringEscapeUtils.java
@@ -61,7 +61,7 @@ public class StringEscapeUtils {
      */
     public static final CharSequenceTranslator ESCAPE_JAVA;
     static {
-        Map<CharSequence, CharSequence> escapeJavaMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> escapeJavaMap = new HashMap<>();
         escapeJavaMap.put("\"", "\\\"");
         escapeJavaMap.put("\\", "\\\\");
         ESCAPE_JAVA = new AggregateTranslator(
@@ -80,7 +80,7 @@ public class StringEscapeUtils {
      */
     public static final CharSequenceTranslator ESCAPE_ECMASCRIPT;
     static {
-        Map<CharSequence, CharSequence> escapeEcmaScriptMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> escapeEcmaScriptMap = new HashMap<>();
         escapeEcmaScriptMap.put("'", "\\'");
         escapeEcmaScriptMap.put("\"", "\\\"");
         escapeEcmaScriptMap.put("\\", "\\\\");
@@ -101,7 +101,7 @@ public class StringEscapeUtils {
      */
     public static final CharSequenceTranslator ESCAPE_JSON;
     static {
-        Map<CharSequence, CharSequence> escapeJsonMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> escapeJsonMap = new HashMap<>();
         escapeJsonMap.put("\"", "\\\"");
         escapeJsonMap.put("\\", "\\\\");
         escapeJsonMap.put("/", "\\/");
@@ -121,7 +121,7 @@ public class StringEscapeUtils {
      */
     public static final CharSequenceTranslator ESCAPE_XML10;
     static {
-        Map<CharSequence, CharSequence> escapeXml10Map = new HashMap<>();
+        final Map<CharSequence, CharSequence> escapeXml10Map = new HashMap<>();
         escapeXml10Map.put("\u0000", StringUtils.EMPTY);
         escapeXml10Map.put("\u0001", StringUtils.EMPTY);
         escapeXml10Map.put("\u0002", StringUtils.EMPTY);
@@ -172,7 +172,7 @@ public class StringEscapeUtils {
      */
     public static final CharSequenceTranslator ESCAPE_XML11;
     static {
-        Map<CharSequence, CharSequence> escapeXml11Map = new HashMap<>();
+        final Map<CharSequence, CharSequence> escapeXml11Map = new HashMap<>();
         escapeXml11Map.put("\u0000", StringUtils.EMPTY);
         escapeXml11Map.put("\u000b", "&#11;");
         escapeXml11Map.put("\u000c", "&#12;");
@@ -233,7 +233,7 @@ public class StringEscapeUtils {
      */
     public static final CharSequenceTranslator ESCAPE_XSI;
     static {
-        Map<CharSequence, CharSequence> escapeXsiMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> escapeXsiMap = new HashMap<>();
         escapeXsiMap.put("|", "\\|");
         escapeXsiMap.put("&", "\\&");
         escapeXsiMap.put(";", "\\;");
@@ -273,7 +273,7 @@ public class StringEscapeUtils {
      */
     public static final CharSequenceTranslator UNESCAPE_JAVA;
     static {
-        Map<CharSequence, CharSequence> unescapeJavaMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> unescapeJavaMap = new HashMap<>();
         unescapeJavaMap.put("\\\\", "\\");
         unescapeJavaMap.put("\\\"", "\"");
         unescapeJavaMap.put("\\'", "'");
@@ -382,12 +382,12 @@ public class StringEscapeUtils {
                 throw new IllegalStateException("XsiUnescaper should never reach the [1] index");
             }
 
-            String s = input.toString();
+            final String s = input.toString();
 
             int segmentStart = 0;
             int searchOffset = 0;
             while (true) {
-                int pos = s.indexOf(BACKSLASH, searchOffset);
+                final int pos = s.indexOf(BACKSLASH, searchOffset);
                 if (pos == -1) {
                     if (segmentStart < s.length()) {
                         out.write(s.substring(segmentStart));

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/WordUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/WordUtils.java b/src/main/java/org/apache/commons/text/WordUtils.java
index b510455..4497dd1 100644
--- a/src/main/java/org/apache/commons/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/text/WordUtils.java
@@ -421,8 +421,8 @@ public class WordUtils {
             return str;
         }
         final Set<Integer> delimiterSet = generateDelimiterSet(delimiters);
-        int strLen = str.length();
-        int [] newCodePoints = new int[strLen];
+        final int strLen = str.length();
+        final int [] newCodePoints = new int[strLen];
         int outOffset = 0;
 
         boolean capitalizeNext = true;
@@ -434,7 +434,7 @@ public class WordUtils {
                 newCodePoints[outOffset++] = codePoint;
                 index += Character.charCount(codePoint);
             } else if (capitalizeNext) {
-                int titleCaseCodePoint = Character.toTitleCase(codePoint);
+                final int titleCaseCodePoint = Character.toTitleCase(codePoint);
                 newCodePoints[outOffset++] = titleCaseCodePoint;
                 index += Character.charCount(titleCaseCodePoint);
                 capitalizeNext = false;
@@ -555,8 +555,8 @@ public class WordUtils {
             return str;
         }
         final Set<Integer> delimiterSet = generateDelimiterSet(delimiters);
-        int strLen = str.length();
-        int [] newCodePoints = new int[strLen];
+        final int strLen = str.length();
+        final int [] newCodePoints = new int[strLen];
         int outOffset = 0;
 
         boolean uncapitalizeNext = true;
@@ -568,7 +568,7 @@ public class WordUtils {
                 newCodePoints[outOffset++] = codePoint;
                 index += Character.charCount(codePoint);
             } else if (uncapitalizeNext) {
-                int titleCaseCodePoint = Character.toLowerCase(codePoint);
+                final int titleCaseCodePoint = Character.toLowerCase(codePoint);
                 newCodePoints[outOffset++] = titleCaseCodePoint;
                 index += Character.charCount(titleCaseCodePoint);
                 uncapitalizeNext = false;
@@ -608,7 +608,7 @@ public class WordUtils {
             return str;
         }
         final int strLen = str.length();
-        int [] newCodePoints = new int[strLen];
+        final int [] newCodePoints = new int[strLen];
         int outOffset = 0;
         boolean whitespace = true;
         for (int index = 0; index < strLen;) {
@@ -789,7 +789,7 @@ public class WordUtils {
             return Character.isWhitespace(codePoint);
         }
         for (int index = 0; index < delimiters.length; index++) {
-            int delimiterCodePoint = Character.codePointAt(delimiters, index);
+            final int delimiterCodePoint = Character.codePointAt(delimiters, index);
             if (delimiterCodePoint == codePoint) {
                 return true;
             }
@@ -836,7 +836,7 @@ public class WordUtils {
      * WordUtils.abbreviate("Now is the time for all good men", 10, 5, null));     = IllegalArgumentException
      * </pre>
      */
-    public static String abbreviate(String str, int lower, int upper, String appendToEnd) {
+    public static String abbreviate(final String str, int lower, int upper, final String appendToEnd) {
         Validate.isTrue(upper >= -1, "upper value cannot be less than -1");
         Validate.isTrue(upper >= lower || upper == -1, "upper value is less than lower value");
 
@@ -886,7 +886,7 @@ public class WordUtils {
      * @return Set<Integer>
      */
     private static Set<Integer> generateDelimiterSet(final char[] delimiters) {
-        Set<Integer> delimiterHashSet = new HashSet<>();
+        final Set<Integer> delimiterHashSet = new HashSet<>();
         if (delimiters == null || delimiters.length == 0) {
             if (delimiters == null) {
                 delimiterHashSet.add(Character.codePointAt(new char[] {' '}, 0));

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java b/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
index 1e30b07..c24543b 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaccardDistance.java
@@ -46,7 +46,7 @@ public class JaccardDistance implements EditDistance<Double> {
      *             if either String input {@code null}
      */
     @Override
-    public Double apply(CharSequence left, CharSequence right) {
+    public Double apply(final CharSequence left, final CharSequence right) {
         if (left == null || right == null) {
             throw new IllegalArgumentException("Input cannot be null");
         }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
index af7ce71..041bc0e 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaccardSimilarity.java
@@ -44,7 +44,7 @@ public class JaccardSimilarity implements SimilarityScore<Double> {
      *             if either String input {@code null}
      */
     @Override
-    public Double apply(CharSequence left, CharSequence right) {
+    public Double apply(final CharSequence left, final CharSequence right) {
         if (left == null || right == null) {
             throw new IllegalArgumentException("Input cannot be null");
         }
@@ -61,12 +61,12 @@ public class JaccardSimilarity implements SimilarityScore<Double> {
      * @param right second character sequence
      * @return index
      */
-    private Double calculateJaccardSimilarity(CharSequence left, CharSequence right) {
-        Set<String> intersectionSet = new HashSet<String>();
-        Set<String> unionSet = new HashSet<String>();
+    private Double calculateJaccardSimilarity(final CharSequence left, final CharSequence right) {
+        final Set<String> intersectionSet = new HashSet<String>();
+        final Set<String> unionSet = new HashSet<String>();
         boolean unionFilled = false;
-        int leftLength = left.length();
-        int rightLength = right.length();
+        final int leftLength = left.length();
+        final int rightLength = right.length();
         if (leftLength == 0 || rightLength == 0) {
             return 0d;
         }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java b/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java
index 272b184..5c79000 100644
--- a/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/JaroWinklerDistance.java
@@ -80,13 +80,13 @@ public class JaroWinklerDistance implements SimilarityScore<Double> {
             throw new IllegalArgumentException("Strings must not be null");
         }
 
-        int[] mtp = matches(left, right);
-        double m = mtp[0];
+        final int[] mtp = matches(left, right);
+        final double m = mtp[0];
         if (m == 0) {
             return 0D;
         }
-        double j = ((m / left.length() + m / right.length() + (m - mtp[1]) / m)) / 3;
-        double jw = j < 0.7D ? j : j + Math.min(defaultScalingFactor, 1D / mtp[3]) * mtp[2] * (1D - j);
+        final double j = ((m / left.length() + m / right.length() + (m - mtp[1]) / m)) / 3;
+        final double jw = j < 0.7D ? j : j + Math.min(defaultScalingFactor, 1D / mtp[3]) * mtp[2] * (1D - j);
         return jw;
     }
 
@@ -106,13 +106,13 @@ public class JaroWinklerDistance implements SimilarityScore<Double> {
             max = second;
             min = first;
         }
-        int range = Math.max(max.length() / 2 - 1, 0);
-        int[] matchIndexes = new int[min.length()];
+        final int range = Math.max(max.length() / 2 - 1, 0);
+        final int[] matchIndexes = new int[min.length()];
         Arrays.fill(matchIndexes, -1);
-        boolean[] matchFlags = new boolean[max.length()];
+        final boolean[] matchFlags = new boolean[max.length()];
         int matches = 0;
         for (int mi = 0; mi < min.length(); mi++) {
-            char c1 = min.charAt(mi);
+            final char c1 = min.charAt(mi);
             for (int xi = Math.max(mi - range, 0), xn = Math.min(mi + range + 1, max.length()); xi < xn; xi++) {
                 if (!matchFlags[xi] && c1 == max.charAt(xi)) {
                     matchIndexes[mi] = xi;
@@ -122,8 +122,8 @@ public class JaroWinklerDistance implements SimilarityScore<Double> {
                 }
             }
         }
-        char[] ms1 = new char[matches];
-        char[] ms2 = new char[matches];
+        final char[] ms1 = new char[matches];
+        final char[] ms2 = new char[matches];
         for (int i = 0, si = 0; i < min.length(); i++) {
             if (matchIndexes[i] != -1) {
                 ms1[si] = min.charAt(i);

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
index f3ef298..54470f9 100644
--- a/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
+++ b/src/main/java/org/apache/commons/text/similarity/LevenshteinDistance.java
@@ -361,7 +361,7 @@ public class LevenshteinDistance implements EditDistance<Integer> {
             m = right.length();
         }
 
-        int[] p = new int[n + 1];
+        final int[] p = new int[n + 1];
 
         // indexes into strings left and right
         int i; // iterates through left

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
index cc5bb45..eb94217 100644
--- a/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
+++ b/src/main/java/org/apache/commons/text/similarity/LongestCommonSubsequence.java
@@ -91,8 +91,8 @@ public class LongestCommonSubsequence implements SimilarityScore<Integer> {
         if (left == null || right == null) {
             throw new IllegalArgumentException("Inputs must not be null");
         }
-        StringBuilder longestCommonSubstringArray = new StringBuilder(Math.max(left.length(), right.length()));
-        int[][] lcsLengthArray = longestCommonSubstringLengthArray(left, right);
+        final StringBuilder longestCommonSubstringArray = new StringBuilder(Math.max(left.length(), right.length()));
+        final int[][] lcsLengthArray = longestCommonSubstringLengthArray(left, right);
         int i = left.length() - 1;
         int j = right.length() - 1;
         int k = lcsLengthArray[left.length()][right.length()] - 1;
@@ -122,7 +122,7 @@ public class LongestCommonSubsequence implements SimilarityScore<Integer> {
      * @return lcsLengthArray
      */
     public int[][] longestCommonSubstringLengthArray(final CharSequence left, final CharSequence right) {
-        int[][] lcsLengthArray = new int[left.length() + 1][right.length() + 1];
+        final int[][] lcsLengthArray = new int[left.length() + 1][right.length() + 1];
         for (int i = 0; i < left.length(); i++) {
             for (int j = 0; j < right.length(); j++) {
                 if (i == 0) {

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java b/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
index 788f8c5..ba25734 100644
--- a/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
@@ -41,7 +41,7 @@ public class AggregateTranslator extends CharSequenceTranslator {
      */
     public AggregateTranslator(final CharSequenceTranslator... translators) {
         if (translators != null) {
-            for (CharSequenceTranslator translator : translators) {
+            for (final CharSequenceTranslator translator : translators) {
                 if (translator != null) {
                     this.translators.add(translator);
                 }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/translate/EntityArrays.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/translate/EntityArrays.java b/src/main/java/org/apache/commons/text/translate/EntityArrays.java
index f314386..463f0a4 100644
--- a/src/main/java/org/apache/commons/text/translate/EntityArrays.java
+++ b/src/main/java/org/apache/commons/text/translate/EntityArrays.java
@@ -37,7 +37,7 @@ public class EntityArrays {
      */
     public static final Map<CharSequence, CharSequence> ISO8859_1_ESCAPE;
     static {
-        Map<CharSequence, CharSequence> initialMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
         initialMap.put("\u00A0", "&nbsp;"); // non-breaking space
         initialMap.put("\u00A1", "&iexcl;"); // inverted exclamation mark
         initialMap.put("\u00A2", "&cent;"); // cent sign
@@ -153,7 +153,7 @@ public class EntityArrays {
      */
     public static final Map<CharSequence, CharSequence> HTML40_EXTENDED_ESCAPE;
     static {
-        Map<CharSequence, CharSequence> initialMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
         // <!-- Latin Extended-B -->
         initialMap.put("\u0192", "&fnof;"); // latin small f with hook = function= florin, U+0192 ISOtech -->
         // <!-- Greek -->
@@ -367,7 +367,7 @@ public class EntityArrays {
      */
     public static final Map<CharSequence, CharSequence> BASIC_ESCAPE;
     static {
-        Map<CharSequence, CharSequence> initialMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
         initialMap.put("\"", "&quot;"); // " - double-quote
         initialMap.put("&", "&amp;");   // & - ampersand
         initialMap.put("<", "&lt;");    // < - less-than
@@ -389,7 +389,7 @@ public class EntityArrays {
      */
     public static final Map<CharSequence, CharSequence> APOS_ESCAPE;
     static {
-        Map<CharSequence, CharSequence> initialMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
         initialMap.put("'", "&apos;"); // XML apostrophe
         APOS_ESCAPE = Collections.unmodifiableMap(initialMap);
     }
@@ -410,7 +410,7 @@ public class EntityArrays {
      */
     public static final Map<CharSequence, CharSequence> JAVA_CTRL_CHARS_ESCAPE;
     static {
-        Map<CharSequence, CharSequence> initialMap = new HashMap<>();
+        final Map<CharSequence, CharSequence> initialMap = new HashMap<>();
         initialMap.put("\b", "\\b");
         initialMap.put("\n", "\\n");
         initialMap.put("\t", "\\t");
@@ -433,10 +433,10 @@ public class EntityArrays {
      * @return Map&lt;String, String&gt; inverted array
      */
     public static Map<CharSequence, CharSequence> invert(final Map<CharSequence, CharSequence> map) {
-        Map<CharSequence, CharSequence> newMap = new HashMap<>();
-        Iterator<Map.Entry<CharSequence, CharSequence>> it = map.entrySet().iterator();
+        final Map<CharSequence, CharSequence> newMap = new HashMap<>();
+        final Iterator<Map.Entry<CharSequence, CharSequence>> it = map.entrySet().iterator();
         while (it.hasNext()) {
-            Map.Entry<CharSequence, CharSequence> pair = it.next();
+            final Map.Entry<CharSequence, CharSequence> pair = it.next();
             newMap.put((CharSequence) pair.getValue(), (CharSequence) pair.getKey());
         }
         return newMap;

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
index c4d5e2e..db66fc5 100644
--- a/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/LookupTranslator.java
@@ -59,10 +59,10 @@ public class LookupTranslator extends CharSequenceTranslator {
         this.prefixSet = new HashSet<>();
         int currentShortest = Integer.MAX_VALUE;
         int currentLongest = 0;
-        Iterator<Map.Entry<CharSequence, CharSequence>> it = lookupMap.entrySet().iterator();
+        final Iterator<Map.Entry<CharSequence, CharSequence>> it = lookupMap.entrySet().iterator();
 
         while (it.hasNext()) {
-            Map.Entry<CharSequence, CharSequence> pair = it.next();
+            final Map.Entry<CharSequence, CharSequence> pair = it.next();
             this.lookupMap.put(pair.getKey().toString(), pair.getValue().toString());
             this.prefixSet.add(pair.getKey().charAt(0));
             final int sz = pair.getKey().length();

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/AlphabetConverterTest.java b/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
index 5e98d98..4aefad7 100644
--- a/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
+++ b/src/test/java/org/apache/commons/text/AlphabetConverterTest.java
@@ -210,7 +210,7 @@ public class AlphabetConverterTest {
 
     @Test(expected=IllegalArgumentException.class)
     public void testCreateConverterFromCharsWithNullAndNull() {
-        Character[] characterArray = new Character[2];
+        final Character[] characterArray = new Character[2];
         characterArray[0] = Character.valueOf('$');
         characterArray[1] = characterArray[0];
 
@@ -219,20 +219,20 @@ public class AlphabetConverterTest {
 
     @Test
     public void testCreateConverterFromCharsOne() {
-        Character[] characterArray = new Character[2];
+        final Character[] characterArray = new Character[2];
         characterArray[0] = new Character('5');
         characterArray[1] = characterArray[0];
-        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
+        final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
 
         assertEquals(1, alphabetConverter.getEncodedCharLength());
     }
 
     @Test
     public void testCreateConverterFromMapAndEquals() {
-        Map<Integer, String> hashMap = new HashMap<>();
-        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(hashMap);
+        final Map<Integer, String> hashMap = new HashMap<>();
+        final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(hashMap);
         hashMap.put(0, "CtDs");
-        AlphabetConverter alphabetConverterTwo = AlphabetConverter.createConverterFromMap(hashMap);
+        final AlphabetConverter alphabetConverterTwo = AlphabetConverter.createConverterFromMap(hashMap);
 
         assertFalse(alphabetConverter.equals(alphabetConverterTwo));
         assertEquals(1, alphabetConverter.getEncodedCharLength());
@@ -240,13 +240,13 @@ public class AlphabetConverterTest {
 
     @Test
     public void testEquals() {
-        Character[] characterArray = new Character[2];
-        Character character = new Character('R');
+        final Character[] characterArray = new Character[2];
+        final Character character = new Character('R');
         characterArray[0] = character;
         characterArray[1] = character;
-        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
-        Map<Integer, String> map = new HashMap<>();
-        AlphabetConverter alphabetConverterTwo = AlphabetConverter.createConverterFromMap(map);
+        final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
+        final Map<Integer, String> map = new HashMap<>();
+        final AlphabetConverter alphabetConverterTwo = AlphabetConverter.createConverterFromMap(map);
 
         assertEquals(1, alphabetConverterTwo.getEncodedCharLength());
         assertFalse(alphabetConverter.equals(alphabetConverterTwo));
@@ -254,39 +254,39 @@ public class AlphabetConverterTest {
 
     @Test
     public void testEqualsWithSameObject() {
-        Character[] characterArray = new Character[2];
-        Character character = new Character('R');
+        final Character[] characterArray = new Character[2];
+        final Character character = new Character('R');
         characterArray[0] = character;
         characterArray[1] = character;
-        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
+        final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
 
         assertTrue(alphabetConverter.equals(alphabetConverter));
     }
 
     @Test
     public void testEqualsWithNull() {
-        Character[] characterArray = new Character[0];
-        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, null, null);
+        final Character[] characterArray = new Character[0];
+        final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, null, null);
 
         assertFalse(alphabetConverter.equals(null));
     }
 
     @Test
     public void testCreateConverterFromCharsAndEquals() {
-        Character[] characterArray = new Character[2];
-        char charOne = '+';
-        Character character = new Character('+');
+        final Character[] characterArray = new Character[2];
+        final char charOne = '+';
+        final Character character = new Character('+');
         characterArray[0] = character;
         characterArray[1] = characterArray[0];
-        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
+        final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromChars(characterArray, characterArray, characterArray);
 
         assertFalse(alphabetConverter.equals(charOne));
     }
 
     @Test
     public void testDecodeReturningNull() throws UnsupportedEncodingException {
-        Map<Integer, String> map = new HashMap<>();
-        AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(map);
+        final Map<Integer, String> map = new HashMap<>();
+        final AlphabetConverter alphabetConverter = AlphabetConverter.createConverterFromMap(map);
         alphabetConverter.decode(null);
 
         assertEquals(1, alphabetConverter.getEncodedCharLength());

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/CaseUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/CaseUtilsTest.java b/src/test/java/org/apache/commons/text/CaseUtilsTest.java
index 0f3cabf..e95f44c 100644
--- a/src/test/java/org/apache/commons/text/CaseUtilsTest.java
+++ b/src/test/java/org/apache/commons/text/CaseUtilsTest.java
@@ -53,7 +53,7 @@ public class CaseUtilsTest {
         assertEquals("ABC@def", CaseUtils.toCamelCase("a b c @def", true, new char[]{'-'}));
         assertEquals("ABC@def", CaseUtils.toCamelCase("a b c @def", true, new char[]{'-'}));
 
-        char[] chars = new char[] { '-', '+', ' ', '@' };
+        final char[] chars = new char[] { '-', '+', ' ', '@' };
         assertEquals("-+@ ", CaseUtils.toCamelCase("-+@ ", true, chars));
         assertEquals("toCamelCase", CaseUtils.toCamelCase("   to-CAMEL-cASE", false, chars));
         assertEquals("ToCamelCase", CaseUtils.toCamelCase("@@@@   to+CAMEL@cASE ", true, chars));

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
index c868a73..ae0aca4 100644
--- a/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
+++ b/src/test/java/org/apache/commons/text/ExtendedMessageFormatTest.java
@@ -443,9 +443,9 @@ public class ExtendedMessageFormatTest {
 
     @Test
     public void testCreatesExtendedMessageFormatTakingString() {
-        ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("Unterminated format element at position ");
-        Map<String, FormatFactory> map = new HashMap<>();
-        ExtendedMessageFormat extendedMessageFormatTwo = new ExtendedMessageFormat("Unterminated format element at position ", map);
+        final ExtendedMessageFormat extendedMessageFormat = new ExtendedMessageFormat("Unterminated format element at position ");
+        final Map<String, FormatFactory> map = new HashMap<>();
+        final ExtendedMessageFormat extendedMessageFormatTwo = new ExtendedMessageFormat("Unterminated format element at position ", map);
 
         assertEquals("Unterminated format element at position ", extendedMessageFormatTwo.toPattern());
         assertFalse(extendedMessageFormat.equals(extendedMessageFormatTwo));

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/FormattableUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/FormattableUtilsTest.java b/src/test/java/org/apache/commons/text/FormattableUtilsTest.java
index 8a3225a..c0ad546 100644
--- a/src/test/java/org/apache/commons/text/FormattableUtilsTest.java
+++ b/src/test/java/org/apache/commons/text/FormattableUtilsTest.java
@@ -138,7 +138,7 @@ public class FormattableUtilsTest {
         }
 
         @Override
-        public void formatTo(Formatter formatter, int flags, int width, int precision) {
+        public void formatTo(final Formatter formatter, final int flags, final int width, final int precision) {
             formatter.format(text);
         }
     };

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
index 667e584..ea320cd 100644
--- a/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
+++ b/src/test/java/org/apache/commons/text/RandomStringGeneratorTest.java
@@ -31,45 +31,45 @@ public class RandomStringGeneratorTest {
 
     private static final CharacterPredicate A_FILTER = new CharacterPredicate() {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return codePoint == 'a';
         }
     };
 
     private static final CharacterPredicate B_FILTER = new CharacterPredicate() {
         @Override
-        public boolean test(int codePoint) {
+        public boolean test(final int codePoint) {
             return codePoint == 'b';
         }
     };
 
     @Test(expected = IllegalArgumentException.class)
     public void testInvalidLength() {
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
         generator.generate(-1);
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void testGenerateMinMaxLengthInvalidLength() {
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
         generator.generate(-1, 0);
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void testGenerateMinMaxLengthMinGreaterThanMax() {
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
         generator.generate(1, 0);
     }
 
-    private static int codePointLength(String s) {
+    private static int codePointLength(final String s) {
         return s.codePointCount(0, s.length());
     }
 
     @Test
     public void testSetLength() {
         final int length = 99;
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
-        String str = generator.generate(length);
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
+        final String str = generator.generate(length);
         assertEquals(length, codePointLength(str));
     }
 
@@ -77,8 +77,8 @@ public class RandomStringGeneratorTest {
     public void testGenerateMinMaxLength() {
         final int minLength = 0;
         final int maxLength = 3;
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
-        String str = generator.generate(minLength, maxLength);
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
+        final String str = generator.generate(minLength, maxLength);
         assertThat(codePointLength(str), allOf(greaterThanOrEqualTo(0), lessThanOrEqualTo(3)));
     }
 
@@ -97,12 +97,12 @@ public class RandomStringGeneratorTest {
         final int length = 5000;
         final int minimumCodePoint = 'a';
         final int maximumCodePoint = 'z';
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange(minimumCodePoint,maximumCodePoint).build();
-        String str = generator.generate(length);
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange(minimumCodePoint,maximumCodePoint).build();
+        final String str = generator.generate(length);
 
         int i = 0;
         do {
-            int codePoint = str.codePointAt(i);
+            final int codePoint = str.codePointAt(i);
             assertTrue(codePoint >= minimumCodePoint && codePoint <= maximumCodePoint);
             i += Character.charCount(codePoint);
         } while (i < str.length());
@@ -112,20 +112,20 @@ public class RandomStringGeneratorTest {
     public void testWithinMultipleRanges() {
         final int length = 5000;
         final char [][] pairs = {{'a','z'},{'0','9'}};
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange(pairs).build();
-        String str = generator.generate(length);
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().withinRange(pairs).build();
+        final String str = generator.generate(length);
 
         int minimumCodePoint = 0, maximumCodePoint = 0;
 
-        for (char [] pair : pairs ) {
+        for (final char [] pair : pairs ) {
             minimumCodePoint = Math.min(minimumCodePoint, pair[0]);
             maximumCodePoint = Math.max(maximumCodePoint, pair[1]);
         }
 
-        for (char [] pair : pairs ) {
+        for (final char [] pair : pairs ) {
             int i = 0;
             do {
-                int codePoint = str.codePointAt(i);
+                final int codePoint = str.codePointAt(i);
                 assertTrue(codePoint >= minimumCodePoint && codePoint <= maximumCodePoint);
                 i += Character.charCount(codePoint);
             } while (i < str.length());
@@ -137,11 +137,11 @@ public class RandomStringGeneratorTest {
     @Test
     public void testNoLoneSurrogates() {
         final int length = 5000;
-        String str = new RandomStringGenerator.Builder().build().generate(length);
+        final String str = new RandomStringGenerator.Builder().build().generate(length);
 
         char lastChar = str.charAt(0);
         for (int i = 1; i < str.length(); i++) {
-            char c = str.charAt(i);
+            final char c = str.charAt(i);
 
             if (Character.isLowSurrogate(c)) {
                 assertTrue(Character.isHighSurrogate(lastChar));
@@ -166,26 +166,26 @@ public class RandomStringGeneratorTest {
         final TextRandomProvider testRandom = new TextRandomProvider() {
 
             @Override
-            public int nextInt(int n) {
+            public int nextInt(final int n) {
                 return testChar;
             }
         };
 
-        String str = new RandomStringGenerator.Builder().usingRandom(testRandom).build().generate(10);
-        for (char c : str.toCharArray()) {
+        final String str = new RandomStringGenerator.Builder().usingRandom(testRandom).build().generate(10);
+        for (final char c : str.toCharArray()) {
             assertEquals(testChar, c);
         }
     }
 
     @Test
     public void testMultipleFilters() {
-        String str = new RandomStringGenerator.Builder().withinRange('a','d')
+        final String str = new RandomStringGenerator.Builder().withinRange('a','d')
                 .filteredBy(A_FILTER, B_FILTER).build().generate(5000);
 
         boolean aFound = false;
         boolean bFound = false;
 
-        for (char c : str.toCharArray()) {
+        for (final char c : str.toCharArray()) {
             if (c == 'a') {
                 aFound = true;
             } else if (c == 'b') {
@@ -204,12 +204,12 @@ public class RandomStringGeneratorTest {
 
         // Request a string in an area of the Basic Multilingual Plane that is
         // largely occupied by private characters
-        String str = new RandomStringGenerator.Builder().withinRange(startOfPrivateBMPChars, 
+        final String str = new RandomStringGenerator.Builder().withinRange(startOfPrivateBMPChars, 
                 Character.MIN_SUPPLEMENTARY_CODE_POINT - 1).build().generate(5000);
 
         int i = 0;
         do {
-            int codePoint = str.codePointAt(i);
+            final int codePoint = str.codePointAt(i);
             assertFalse(Character.getType(codePoint) == Character.PRIVATE_USE);
             i += Character.charCount(codePoint);
         } while (i < str.length());
@@ -222,13 +222,13 @@ public class RandomStringGeneratorTest {
 
     @Test
     public void testRemoveFilters() {
-        RandomStringGenerator.Builder builder = new RandomStringGenerator.Builder().withinRange('a', 'z')
+        final RandomStringGenerator.Builder builder = new RandomStringGenerator.Builder().withinRange('a', 'z')
                 .filteredBy(A_FILTER);
 
         builder.filteredBy();
 
-        String str = builder.build().generate(100);
-        for (char c : str.toCharArray()) {
+        final String str = builder.build().generate(100);
+        for (final char c : str.toCharArray()) {
             if (c != 'a') {
                 // filter was successfully removed
                 return;
@@ -240,50 +240,50 @@ public class RandomStringGeneratorTest {
 
     @Test
     public void testChangeOfFilter() {
-        RandomStringGenerator.Builder builder = new RandomStringGenerator.Builder().withinRange('a', 'z')
+        final RandomStringGenerator.Builder builder = new RandomStringGenerator.Builder().withinRange('a', 'z')
                 .filteredBy(A_FILTER);
-        String str = builder.filteredBy(B_FILTER).build().generate(100);
+        final String str = builder.filteredBy(B_FILTER).build().generate(100);
 
-        for (char c : str.toCharArray()) {
+        for (final char c : str.toCharArray()) {
             assertTrue(c == 'b');
         }
     }
 
     @Test
     public void testZeroLength() {
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().build();
         assertEquals("", generator.generate(0));
     }
 
     @Test
     public void testSelectFromCharArray() {
-        String str = "abc";
-        char[] charArray = str.toCharArray();
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().selectFrom(charArray).build();
+        final String str = "abc";
+        final char[] charArray = str.toCharArray();
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().selectFrom(charArray).build();
 
-        String randomText = generator.generate(5);
+        final String randomText = generator.generate(5);
 
-        for (char c : randomText.toCharArray()) {
+        for (final char c : randomText.toCharArray()) {
             assertTrue(str.indexOf(c) != -1);
         }
     }
 
     @Test
     public void testSelectFromCharVarargs() {
-        String str="abc";
-        RandomStringGenerator generator = new RandomStringGenerator.Builder().selectFrom('a','b','c').build();
-        String randomText = generator.generate(5);
-        for (char c : randomText.toCharArray()) {
+        final String str="abc";
+        final RandomStringGenerator generator = new RandomStringGenerator.Builder().selectFrom('a','b','c').build();
+        final String randomText = generator.generate(5);
+        for (final char c : randomText.toCharArray()) {
             assertTrue(str.indexOf(c) != -1);
         }
     }
 
     @Test(expected=NullPointerException.class)
     public void testGenerateTakingIntThrowsNullPointerException() {
-        RandomStringGenerator.Builder randomStringGeneratorBuilder = new RandomStringGenerator.Builder();
-        CharacterPredicate[] characterPredicateArray = new CharacterPredicate[2];
+        final RandomStringGenerator.Builder randomStringGeneratorBuilder = new RandomStringGenerator.Builder();
+        final CharacterPredicate[] characterPredicateArray = new CharacterPredicate[2];
         randomStringGeneratorBuilder.filteredBy(characterPredicateArray);
-        RandomStringGenerator randomStringGenerator = randomStringGeneratorBuilder.build();
+        final RandomStringGenerator randomStringGenerator = randomStringGeneratorBuilder.build();
 
         randomStringGenerator.generate(18);
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/StrBuilderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/StrBuilderTest.java b/src/test/java/org/apache/commons/text/StrBuilderTest.java
index 9c87395..c841efc 100644
--- a/src/test/java/org/apache/commons/text/StrBuilderTest.java
+++ b/src/test/java/org/apache/commons/text/StrBuilderTest.java
@@ -2048,13 +2048,13 @@ public class StrBuilderTest {
         buffer.flip();
         try {
             sb.append(buffer, -1, 12);
-        } catch (StringIndexOutOfBoundsException e) {
+        } catch (final StringIndexOutOfBoundsException e) {
             assertEquals("startIndex must be valid", e.getMessage());
         }
 
         try {
             sb.append(buffer, 0, -1);
-        } catch (StringIndexOutOfBoundsException e) {
+        } catch (final StringIndexOutOfBoundsException e) {
             assertEquals("length must be valid", e.getMessage());
         }
 
@@ -2064,11 +2064,11 @@ public class StrBuilderTest {
 
     @Test
     public void testAppendCharSequence() {
-        CharSequence obj0 = null;
-        CharSequence obj1 = new StrBuilder("test1");
-        CharSequence obj2 = new StringBuilder("test2");
-        CharSequence obj3 = new StringBuffer("test3");
-        CharBuffer obj4 = CharBuffer.wrap("test4".toCharArray());
+        final CharSequence obj0 = null;
+        final CharSequence obj1 = new StrBuilder("test1");
+        final CharSequence obj2 = new StringBuilder("test2");
+        final CharSequence obj3 = new StringBuffer("test3");
+        final CharBuffer obj4 = CharBuffer.wrap("test4".toCharArray());
 
         final StrBuilder sb0 = new StrBuilder();
         assertEquals("", sb0.append(obj0).toString());
@@ -2092,7 +2092,7 @@ public class StrBuilderTest {
     @Test
     public void testAppendStringBuilderNull() {
         final StrBuilder sb1 = new StrBuilder();
-        StringBuilder b = null;
+        final StringBuilder b = null;
         assertEquals("", sb1.append(b).toString());
 
         final StrBuilder sb2 = new StrBuilder();
@@ -2108,18 +2108,18 @@ public class StrBuilderTest {
 
     @Test(expected=StringIndexOutOfBoundsException.class)
     public void testAppendTakingTwoAndThreeIntsWithZeroAndAppendTakingTwoAndThreeIntsThrowsStringIndexOutOfBoundsExceptionTwo() {
-        Charset charset = Charset.defaultCharset();
-        ByteBuffer byteBuffer = charset.encode("end < start");
-        CharBuffer charBuffer = charset.decode(byteBuffer);
+        final Charset charset = Charset.defaultCharset();
+        final ByteBuffer byteBuffer = charset.encode("end < start");
+        final CharBuffer charBuffer = charset.decode(byteBuffer);
 
         new StrBuilder(630).append(charBuffer, 0, 630);
     }
 
     @Test(expected=StringIndexOutOfBoundsException.class)
     public void testAppendTakingTwoAndThreeIntsThrowsStringIndexOutOfBoundsExceptionAndAppendTakingTwoAndThreeIntsThree() {
-        Charset charset = Charset.defaultCharset();
-        ByteBuffer byteBuffer = charset.encode("asdf");
-        CharBuffer charBuffer = charset.decode(byteBuffer);
+        final Charset charset = Charset.defaultCharset();
+        final ByteBuffer byteBuffer = charset.encode("asdf");
+        final CharBuffer charBuffer = charset.decode(byteBuffer);
 
         new StrBuilder().append(charBuffer, 933, 654);
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/StrSubstitutorTest.java b/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
index 975d481..3990e34 100644
--- a/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
+++ b/src/test/java/org/apache/commons/text/StrSubstitutorTest.java
@@ -739,10 +739,10 @@ public class StrSubstitutorTest {
 
     @Test
     public void testReplaceInTakingTwoAndThreeIntsReturningFalse() {
-        Map<String, Object> hashMap = new HashMap<>();
-        StrLookup.MapStrLookup<Object> strLookup_MapStrLookup = new StrLookup.MapStrLookup<>(hashMap);
-        StrMatcher strMatcher = StrMatcher.tabMatcher();
-        StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup_MapStrLookup, strMatcher, strMatcher, 'b', strMatcher);
+        final Map<String, Object> hashMap = new HashMap<>();
+        final StrLookup.MapStrLookup<Object> strLookup_MapStrLookup = new StrLookup.MapStrLookup<>(hashMap);
+        final StrMatcher strMatcher = StrMatcher.tabMatcher();
+        final StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup_MapStrLookup, strMatcher, strMatcher, 'b', strMatcher);
 
         assertFalse(strSubstitutor.replaceIn((StringBuilder) null, 1315, (-1369)));
         assertEquals('b', strSubstitutor.getEscapeChar());
@@ -751,9 +751,9 @@ public class StrSubstitutorTest {
 
     @Test
     public void testReplaceInTakingStringBuilderWithNonNull() {
-        StrLookup<String> strLookup = StrLookup.systemPropertiesLookup();
-        StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup, "b<H", "b<H", '\'');
-        StringBuilder stringBuilder = new StringBuilder((CharSequence) "b<H");
+        final StrLookup<String> strLookup = StrLookup.systemPropertiesLookup();
+        final StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup, "b<H", "b<H", '\'');
+        final StringBuilder stringBuilder = new StringBuilder((CharSequence) "b<H");
 
         assertEquals('\'', strSubstitutor.getEscapeChar());
         assertFalse(strSubstitutor.replaceIn(stringBuilder));
@@ -761,7 +761,7 @@ public class StrSubstitutorTest {
 
     @Test
     public void testReplaceInTakingStringBufferWithNonNull() {
-        StrSubstitutor strSubstitutor = new StrSubstitutor(new HashMap<String, String>(), "WV@i#y?N*[", "WV@i#y?N*[", '*');
+        final StrSubstitutor strSubstitutor = new StrSubstitutor(new HashMap<String, String>(), "WV@i#y?N*[", "WV@i#y?N*[", '*');
 
         assertFalse(strSubstitutor.isPreserveEscapes());
         assertFalse(strSubstitutor.replaceIn(new StringBuffer("WV@i#y?N*[")));
@@ -770,9 +770,9 @@ public class StrSubstitutorTest {
 
     @Test
     public void testCreatesStrSubstitutorTakingStrLookupAndCallsReplaceTakingTwoAndThreeInts() {
-        Map<String, CharacterPredicates> map = new HashMap<>();
-        StrLookup.MapStrLookup<CharacterPredicates> strLookup_MapStrLookup = new StrLookup.MapStrLookup<>(map);
-        StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup_MapStrLookup);
+        final Map<String, CharacterPredicates> map = new HashMap<>();
+        final StrLookup.MapStrLookup<CharacterPredicates> strLookup_MapStrLookup = new StrLookup.MapStrLookup<>(map);
+        final StrSubstitutor strSubstitutor = new StrSubstitutor(strLookup_MapStrLookup);
 
         assertNull(strSubstitutor.replace((CharSequence) null, 0, 0));
         assertEquals('$', strSubstitutor.getEscapeChar());
@@ -780,7 +780,7 @@ public class StrSubstitutorTest {
 
     @Test
     public void testReplaceTakingCharSequenceReturningNull() {
-        StrSubstitutor strSubstitutor = new StrSubstitutor((StrLookup<?>) null);
+        final StrSubstitutor strSubstitutor = new StrSubstitutor((StrLookup<?>) null);
 
         assertNull( strSubstitutor.replace((CharSequence) null) );
         assertFalse(strSubstitutor.isPreserveEscapes());
@@ -794,8 +794,8 @@ public class StrSubstitutorTest {
 
     @Test
     public void testReplaceInTakingStringBuilderWithNull() {
-        Map<String, Object> map = new HashMap<>();
-        StrSubstitutor strSubstitutor = new StrSubstitutor(map, "", "", 'T', "K+<'f");
+        final Map<String, Object> map = new HashMap<>();
+        final StrSubstitutor strSubstitutor = new StrSubstitutor(map, "", "", 'T', "K+<'f");
 
         assertFalse(strSubstitutor.replaceIn((StringBuilder) null));
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/StrTokenizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/StrTokenizerTest.java b/src/test/java/org/apache/commons/text/StrTokenizerTest.java
index 285ba26..e75603c 100644
--- a/src/test/java/org/apache/commons/text/StrTokenizerTest.java
+++ b/src/test/java/org/apache/commons/text/StrTokenizerTest.java
@@ -913,7 +913,7 @@ public class StrTokenizerTest {
     //-----------------------------------------------------------------------
     @Test
     public void testStringTokenizerStringMatcher() {
-        char chars[]=new char[]{'a', 'b', 'c', 'd'};
+        final char chars[]=new char[]{'a', 'b', 'c', 'd'};
         final StrTokenizer tokens= new StrTokenizer(chars, "bc");
         assertEquals("a", tokens.next());
         assertEquals("d", tokens.next());
@@ -922,7 +922,7 @@ public class StrTokenizerTest {
     //-----------------------------------------------------------------------
     @Test
     public void testStringTokenizerStrMatcher() {
-        char chars[]=new char[]{'a', ',', 'c'};
+        final char chars[]=new char[]{'a', ',', 'c'};
         final StrTokenizer tokens= new StrTokenizer(chars, StrMatcher.commaMatcher());
         assertEquals("a", tokens.next());
         assertEquals("c", tokens.next());
@@ -931,14 +931,14 @@ public class StrTokenizerTest {
     //-----------------------------------------------------------------------
     @Test
     public void testStringTokenizerQuoteMatcher() {
-        char chars[]=new char[]{'\'','a', 'c','\'','d'};
+        final char chars[]=new char[]{'\'','a', 'c','\'','d'};
         final StrTokenizer tokens= new StrTokenizer(chars, StrMatcher.commaMatcher(), StrMatcher.quoteMatcher());
         assertEquals("acd", tokens.next());
     }
 
     @Test
     public void testPreviousTokenAndSetEmptyTokenAsNull() {
-        StrTokenizer strTokenizer = StrTokenizer.getTSVInstance(" \t\n\r\f");
+        final StrTokenizer strTokenizer = StrTokenizer.getTSVInstance(" \t\n\r\f");
         strTokenizer.setEmptyTokenAsNull(true);
 
         assertNull(strTokenizer.previousToken());

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java
index 2f7d319..08b2eea 100644
--- a/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java
+++ b/src/test/java/org/apache/commons/text/StringEscapeUtilsTest.java
@@ -524,7 +524,7 @@ public class StringEscapeUtilsTest {
      */
     @Test
     public void testLang708() throws IOException {
-        byte[] inputBytes = Files.readAllBytes(Paths.get("src/test/resources/stringEscapeUtilsTestData.txt"));
+        final byte[] inputBytes = Files.readAllBytes(Paths.get("src/test/resources/stringEscapeUtilsTestData.txt"));
         final String input = new String(inputBytes, StandardCharsets.UTF_8);
         final String escaped = StringEscapeUtils.escapeEcmaScript(input);
         // just the end:
@@ -572,7 +572,7 @@ public class StringEscapeUtilsTest {
 
     @Test
     public void testBuilder() {
-        String result = StringEscapeUtils.builder(StringEscapeUtils.ESCAPE_XML10).escape("<").append(">").toString();
+        final String result = StringEscapeUtils.builder(StringEscapeUtils.ESCAPE_XML10).escape("<").append(">").toString();
         assertEquals("&lt;>", result);
     }
 
@@ -612,7 +612,7 @@ public class StringEscapeUtilsTest {
 
     @Test
     public void testUnescapeJson() {
-        String jsonString = "{\"age\":100,\"name\":\"kyong.com\n\",\"messages\":[\"msg 1\",\"msg 2\",\"msg 3\"]}";
+        final String jsonString = "{\"age\":100,\"name\":\"kyong.com\n\",\"messages\":[\"msg 1\",\"msg 2\",\"msg 3\"]}";
 
         assertEquals("", StringEscapeUtils.unescapeJson(""));
         assertEquals(" ", StringEscapeUtils.unescapeJson(" "));
@@ -623,7 +623,7 @@ public class StringEscapeUtilsTest {
     @Ignore("https://issues.apache.org/jira/browse/TEXT-100.")
     @Test
     public void testUnescapeJsonFoundBug_Issue_Text_100() {
-        String jsonString = "{\"age\":100,\"name\":\"m\\\"kyong.com\",\"messages\":[\"msg 1\",\"msg 2\",\"msg 3\"]}";
+        final String jsonString = "{\"age\":100,\"name\":\"m\\\"kyong.com\",\"messages\":[\"msg 1\",\"msg 2\",\"msg 3\"]}";
 
         assertEquals(jsonString, StringEscapeUtils.unescapeJson(jsonString));
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/similarity/CosineSimilarityTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/CosineSimilarityTest.java b/src/test/java/org/apache/commons/text/similarity/CosineSimilarityTest.java
index 059c3f6..4df5bff 100644
--- a/src/test/java/org/apache/commons/text/similarity/CosineSimilarityTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/CosineSimilarityTest.java
@@ -28,32 +28,32 @@ public class CosineSimilarityTest{
 
     @Test
     public void testCosineSimilarityWithNonEmptyMap() {
-        CosineSimilarity cosineSimilarity = new CosineSimilarity();
-        Map<CharSequence, Integer> hashMap = new HashMap<>();
-        Integer integer = new Integer((-397));
+        final CosineSimilarity cosineSimilarity = new CosineSimilarity();
+        final Map<CharSequence, Integer> hashMap = new HashMap<>();
+        final Integer integer = new Integer((-397));
         hashMap.put("3J/$3.L", integer);
-        Map<CharSequence, Integer> hashMapTwo = new HashMap<>();
+        final Map<CharSequence, Integer> hashMapTwo = new HashMap<>();
 
         assertEquals(0.0, (double) cosineSimilarity.cosineSimilarity(hashMap, hashMapTwo), 0.01);
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void testCosineSimilarityThrowsIllegalArgumentException() {
-        CosineSimilarity cosineSimilarity = new CosineSimilarity();
-        Map<CharSequence, Integer> map = new HashMap<>();
+        final CosineSimilarity cosineSimilarity = new CosineSimilarity();
+        final Map<CharSequence, Integer> map = new HashMap<>();
         cosineSimilarity.cosineSimilarity(map, null);
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void testCosineSimilarityWithNull() {
-        CosineSimilarity cosineSimilarity = new CosineSimilarity();
+        final CosineSimilarity cosineSimilarity = new CosineSimilarity();
         cosineSimilarity.cosineSimilarity(null, null);
     }
 
     @Test
     public void testCosineSimilarityReturningDoubleWhereByteValueIsZero() {
-        CosineSimilarity cosineSimilarity = new CosineSimilarity();
-        Map<CharSequence, Integer> hashMap = new HashMap<>();
+        final CosineSimilarity cosineSimilarity = new CosineSimilarity();
+        final Map<CharSequence, Integer> hashMap = new HashMap<>();
 
         assertEquals(0.0, (double) cosineSimilarity.cosineSimilarity(hashMap, hashMap), 0.01);
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/similarity/FuzzyScoreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/FuzzyScoreTest.java b/src/test/java/org/apache/commons/text/similarity/FuzzyScoreTest.java
index 17e1965..9c1fbc5 100644
--- a/src/test/java/org/apache/commons/text/similarity/FuzzyScoreTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/FuzzyScoreTest.java
@@ -64,9 +64,9 @@ public class FuzzyScoreTest {
 
     @Test
     public void testGetLocale() {
-        Locale locale = Locale.CANADA_FRENCH;
-        FuzzyScore fuzzyScore = new FuzzyScore(locale);
-        Locale localeTwo = fuzzyScore.getLocale();
+        final Locale locale = Locale.CANADA_FRENCH;
+        final FuzzyScore fuzzyScore = new FuzzyScore(locale);
+        final Locale localeTwo = fuzzyScore.getLocale();
 
         assertSame(locale, localeTwo);
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java b/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
index 590fe08..43f752d 100644
--- a/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/LevenshteinDetailedDistanceTest.java
@@ -403,24 +403,24 @@ public class LevenshteinDetailedDistanceTest {
 
     @Test
     public void testGetDefaultInstanceOne() {
-        LevenshteinDetailedDistance levenshteinDetailedDistance = LevenshteinDetailedDistance.getDefaultInstance();
-        LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("Distance: -2147483643, Insert: 0, Delete: 0, Substitute: 0", "Distance: 0, Insert: 2147483536, Delete: 0, Substitute: 0");
+        final LevenshteinDetailedDistance levenshteinDetailedDistance = LevenshteinDetailedDistance.getDefaultInstance();
+        final LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("Distance: -2147483643, Insert: 0, Delete: 0, Substitute: 0", "Distance: 0, Insert: 2147483536, Delete: 0, Substitute: 0");
 
         assertEquals(21, (int) levenshteinResults.getDistance());
     }
 
     @Test
     public void testGetDefaultInstanceTwo() {
-        LevenshteinDetailedDistance levenshteinDetailedDistance = LevenshteinDetailedDistance.getDefaultInstance();
-        LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("Distance: 2147483647, Insert: 0, Delete: 0, Substitute: 0", "Distance: 0, Insert: 2147483647, Delete: 0, Substitute: 0");
+        final LevenshteinDetailedDistance levenshteinDetailedDistance = LevenshteinDetailedDistance.getDefaultInstance();
+        final LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("Distance: 2147483647, Insert: 0, Delete: 0, Substitute: 0", "Distance: 0, Insert: 2147483647, Delete: 0, Substitute: 0");
 
         assertEquals(20, (int) levenshteinResults.getDistance());
     }
 
     @Test
     public void testCreatesLevenshteinDetailedDistanceTakingInteger6() {
-        LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
-        LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("", "Distance: 38, Insert: 0, Delete: 0, Substitute: 0");
+        final LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
+        final LevenshteinResults levenshteinResults = levenshteinDetailedDistance.apply("", "Distance: 38, Insert: 0, Delete: 0, Substitute: 0");
 
         assertEquals(0, (int) levenshteinResults.getSubstituteCount());
         assertEquals(0, (int) levenshteinResults.getDeleteCount());
@@ -431,8 +431,8 @@ public class LevenshteinDetailedDistanceTest {
 
     @Test(expected=IllegalArgumentException.class)
     public void testApplyThrowsIllegalArgumentExceptionAndCreatesLevenshteinDetailedDistanceTakingInteger() {
-        LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
-        CharSequence charSequence = new StrBuilder();
+        final LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
+        final CharSequence charSequence = new StrBuilder();
 
         levenshteinDetailedDistance.apply(charSequence, null);
     }
@@ -444,7 +444,7 @@ public class LevenshteinDetailedDistanceTest {
 
     @Test
     public void testGetThreshold() {
-        LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
+        final LevenshteinDetailedDistance levenshteinDetailedDistance = new LevenshteinDetailedDistance(0);
 
         assertEquals(0, (int) levenshteinDetailedDistance.getThreshold());
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
index 1c0aac6..f4a1537 100644
--- a/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/LevenshteinResultsTest.java
@@ -25,44 +25,44 @@ public class LevenshteinResultsTest {
 
     @Test
     public void testEqualsReturningFalse() {
-        Integer integerOne = new Integer(1662);
-        Integer integerTwo = new Integer(1164);
-        LevenshteinResults levenshteinResults = new LevenshteinResults(integerOne, integerOne, integerOne, integerOne);
-        LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerOne, integerOne, integerTwo, integerTwo);
+        final Integer integerOne = new Integer(1662);
+        final Integer integerTwo = new Integer(1164);
+        final LevenshteinResults levenshteinResults = new LevenshteinResults(integerOne, integerOne, integerOne, integerOne);
+        final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integerOne, integerOne, integerTwo, integerTwo);
 
         assertFalse(levenshteinResults.equals(levenshteinResultsTwo));
     }
 
     @Test
     public void testEqualsWithNonNull() {
-        Integer integer = new Integer(1);
-        LevenshteinResults levenshteinResults = new LevenshteinResults(null, integer, integer, null);
-        LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(null, null, null, null);
+        final Integer integer = new Integer(1);
+        final LevenshteinResults levenshteinResults = new LevenshteinResults(null, integer, integer, null);
+        final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(null, null, null, null);
 
         assertFalse(levenshteinResults.equals(levenshteinResultsTwo));
     }
 
     @Test
     public void testEqualsWithNull() {
-        Integer integer = new Integer((-647));
-        LevenshteinResults levenshteinResults = new LevenshteinResults(integer, null, null, integer);
+        final Integer integer = new Integer((-647));
+        final LevenshteinResults levenshteinResults = new LevenshteinResults(integer, null, null, integer);
 
         assertFalse(levenshteinResults.equals(null));
     }
 
     @Test
     public void testEqualsDifferenceInSubstitutionCount() {
-        Integer integer = new Integer(1662);
-        LevenshteinResults levenshteinResults = new LevenshteinResults(integer, integer, integer, integer);
-        LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integer, integer, integer, null);
+        final Integer integer = new Integer(1662);
+        final LevenshteinResults levenshteinResults = new LevenshteinResults(integer, integer, integer, integer);
+        final LevenshteinResults levenshteinResultsTwo = new LevenshteinResults(integer, integer, integer, null);
 
         assertFalse(levenshteinResults.equals(levenshteinResultsTwo));
     }
 
     @Test
     public void testEqualsSameObject() {
-        Integer integer = new Integer(1662);
-        LevenshteinResults levenshteinResults = new LevenshteinResults(integer, integer, integer, null);
+        final Integer integer = new Integer(1662);
+        final LevenshteinResults levenshteinResults = new LevenshteinResults(integer, integer, integer, null);
 
         assertTrue(levenshteinResults.equals(levenshteinResults));
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/similarity/SimilarityScoreFromTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/similarity/SimilarityScoreFromTest.java b/src/test/java/org/apache/commons/text/similarity/SimilarityScoreFromTest.java
index 60061f5..2eb45d1 100644
--- a/src/test/java/org/apache/commons/text/similarity/SimilarityScoreFromTest.java
+++ b/src/test/java/org/apache/commons/text/similarity/SimilarityScoreFromTest.java
@@ -30,8 +30,8 @@ public class SimilarityScoreFromTest {
 
     @Test
     public void testApply() {
-        LongestCommonSubsequence longestCommonSubsequence = new LongestCommonSubsequence();
-        SimilarityScoreFrom<Integer> similarityScoreFrom = new SimilarityScoreFrom<>(longestCommonSubsequence, "asdf");
+        final LongestCommonSubsequence longestCommonSubsequence = new LongestCommonSubsequence();
+        final SimilarityScoreFrom<Integer> similarityScoreFrom = new SimilarityScoreFrom<>(longestCommonSubsequence, "asdf");
 
         assertEquals(1, (int) similarityScoreFrom.apply("s"));
     }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/translate/CodePointTranslatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/translate/CodePointTranslatorTest.java b/src/test/java/org/apache/commons/text/translate/CodePointTranslatorTest.java
index 2ab50b3..c3ebefa 100644
--- a/src/test/java/org/apache/commons/text/translate/CodePointTranslatorTest.java
+++ b/src/test/java/org/apache/commons/text/translate/CodePointTranslatorTest.java
@@ -28,11 +28,11 @@ public class CodePointTranslatorTest {
 
   @Test
   public void testAboveReturningNonNull() throws IOException {
-    NumericEntityEscaper numericEntityEscaper = NumericEntityEscaper.above(0);
-    UnicodeEscaper unicodeEscaper = new UnicodeEscaper();
-    String string = unicodeEscaper.toUtf16Escape(0);
-    PipedReader pipedReader = new PipedReader();
-    PipedWriter pipedWriter = new PipedWriter(pipedReader);
+    final NumericEntityEscaper numericEntityEscaper = NumericEntityEscaper.above(0);
+    final UnicodeEscaper unicodeEscaper = new UnicodeEscaper();
+    final String string = unicodeEscaper.toUtf16Escape(0);
+    final PipedReader pipedReader = new PipedReader();
+    final PipedWriter pipedWriter = new PipedWriter(pipedReader);
 
     Assert.assertEquals(1, numericEntityEscaper.translate(string, 0, pipedWriter));
   }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java b/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java
index 304eb77..a70ffad 100644
--- a/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java
+++ b/src/test/java/org/apache/commons/text/translate/CsvTranslatorsTest.java
@@ -33,7 +33,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "hi this is just a plane text nothing to do with csv!";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, input);
     }
 
@@ -43,7 +43,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "hi,this,is,a,test";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, "\"hi,this,is,a,test\"");
     }
 
@@ -53,7 +53,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "hi,this,is,a,\"quote,test";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, "\"hi,this,is,a,\"\"quote,test\"");
     }
 
@@ -63,7 +63,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "hi,this,is,a,CR,test" + String.valueOf(CharUtils.CR);
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, "\"hi,this,is,a,CR,test" + String.valueOf(CharUtils.CR) + "\"");
     }
 
@@ -73,7 +73,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "hi,this,is,a,LF,test" + String.valueOf(CharUtils.LF);
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, "\"hi,this,is,a,LF,test" + String.valueOf(CharUtils.LF) + "\"");
     }
 
@@ -83,7 +83,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "hi,this,is,unescape,test";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, "hi,this,is,unescape,test");
     }
 
@@ -93,7 +93,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "\"hi,this,is,unescape,test\"";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, "hi,this,is,unescape,test");
     }
 
@@ -103,7 +103,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "\"hi,this,is,unescape,test";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, input);
     }
 
@@ -113,7 +113,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "hi,this,is,unescape,test\"";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, input);
     }
 
@@ -123,7 +123,7 @@ public class CsvTranslatorsTest {
         final Writer writer = new StringWriter();
         final String input = "\"hi,this,is,\"unescape,test\"";
         escaper.translateWhole(input, writer);
-        String data = writer.toString();
+        final String data = writer.toString();
         assertEquals(data, "hi,this,is,\"unescape,test");
     }
 

http://git-wip-us.apache.org/repos/asf/commons-text/blob/0be254ad/src/test/java/org/apache/commons/text/translate/EntityArraysTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/text/translate/EntityArraysTest.java b/src/test/java/org/apache/commons/text/translate/EntityArraysTest.java
index 6ab42a2..56ecee3 100644
--- a/src/test/java/org/apache/commons/text/translate/EntityArraysTest.java
+++ b/src/test/java/org/apache/commons/text/translate/EntityArraysTest.java
@@ -38,7 +38,7 @@ public class EntityArraysTest  {
     // LANG-659, LANG-658 - avoid duplicate entries
     @Test
     public void testForDuplicatedDeclaredMapKeys() throws Exception {
-        String packageDirectory = EntityArraysTest.class.getPackage().getName().replace(".", "/");
+        final String packageDirectory = EntityArraysTest.class.getPackage().getName().replace(".", "/");
         try (BufferedReader br = new BufferedReader(new FileReader("src/main/java/" + packageDirectory + "/EntityArrays.java"))) {
             String line;
             int mapDeclarationCounter = 0;
@@ -49,8 +49,9 @@ public class EntityArraysTest  {
                 } else if (line.contains(".put(")) {
                     mapDeclarationCounter++;
                 } else if (line.contains("Collections.unmodifiableMap(initialMap);")) {
-                    String mapVariableName = line.split("=")[0].trim();
+                    final String mapVariableName = line.split("=")[0].trim();
                     @SuppressWarnings("unchecked") // This is test code
+                    final
                     Map<String,String> mapValue = (Map<String, String>)EntityArrays.class.getDeclaredField(mapVariableName).get(EntityArrays.class);
                     // Validate that we are not inserting into the same key twice in the map declaration. If this,
                     // indeed was the case the keySet().size() would be smaller than the number of put() statements


Mime
View raw message