RFR: 8225179: (regex) Minor Pattern cleanup

Brent Christian brent.christian at oracle.com
Wed Jun 5 22:29:22 UTC 2019


Hi, Claes

I think the change looks fine.  A couple suggestions:

---
src/java.base/share/classes/java/util/regex/Pattern.java

3505         public boolean is(int ch) {

Would it make sense to have @Override here?


4777 * The matchRef is used when a reference to this group is accessed later
4778 * in the expression. The locals will have a negative value in them to
4779 * indicate that we do not want to unset the group if the reference
4780 * doesn't match.

If matchRef() is being removed, we no longer need its docs.

---
test/micro/org/openjdk/bench/java/util/regex/PatternBench.java

   67         charPatternStrings = new String[] 
{"avaaafooddddddbariiii", "lorem ipsum dolor foo bar", "fpp brr lorem 
ipsum dolor foo bar %", "lorem ipsum dolor foo bar lorem ipsum dolor foo 
bar lorem ipsum dolor foo bar /"};

Having each String on its own line would be nicer to read.


Thanks,
-Brent

On 6/4/19 1:58 AM, Claes Redestad wrote:
> Hi,
> 
> please review this j.u.regex.Pattern cleanup.
> 
> - refactor BitClass to be a BmpCharPredicate (which allows removing
> two identical(!) lambdas), which improves startup and reduces
> allocations when compiling Patterns.
> - remove unused GroupRef class
> - made anonymous lookbehindEnd Node instance into an explicit class
> which will be lazily rather than eagerly loaded
> - various cleanups of unused variables, methods and redundant
> inititialization
> 
> Webrev: http://cr.openjdk.java.net/~redestad/8225179/open.00/
> Bug:    https://bugs.openjdk.java.net/browse/JDK-8225179
> 
> Testing: tier1-3
> 
> Thanks!
> 
> /Claes


More information about the core-libs-dev mailing list