Behavior change in java.lang.String and java.util.regex.Pattern split methods

This rule flags all uses of the java.util.regex.Pattern.split and java.lang.String.split method once per file.

In Java 8, when there is a positive-width match at the beginning of the input sequence then an empty leading substring is included at the beginning of the resulting array. A zero-width match at the beginning however never produces such empty leading substring.

For example, when the following method is called: "abc".split("");
In Java 7, the method returns the following array: ["", "a", "b", "c"]
In Java 8, the method returns the following array instead: ["a", "b", "c"]

Review your application and ensure the application does not rely on the empty string previously returned by the split method.

For additional information, see the Java documentation for the following classes: