Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7-beta-1
-
Fix Version/s: 1.6.8, 1.7.1, 1.8-beta-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Most regex/pattern based DGM methods try to allow both, the regex as a String or as a Pattern.
Here are the counter-examples:
String String replaceFirst(Pattern pattern, String replacement) boolean matches(Pattern pattern) Object splitEachLine(String regex) {match -> ... } String replaceAll(String regex) {match -> ... } String replaceAll(Pattern pattern, String replacement) File Object splitEachLine(String sep) {match -> ... } Reader Object splitEachLine(String sep) {match -> ... } InputStream Object splitEachLine(String sep, String charset) {match -> ... } Object splitEachLine(String sep) {match -> ... }
A special case is 'minus', which is particularly bad as you can provide a regex string but this
will not be treated as a regex since that would conflict with String.minus(String).
replaceFirst and replaceAll don't require a String counterpart to Pattern as that is built in to Java - talking about the non-closure variations mentioned in the issue.