RFR 8071479: Stream and lamdification improvements to j.u.regex.Matcher

Xueming Shen xueming.shen at oracle.com
Mon Mar 2 16:56:39 UTC 2015


Hi Paul, it looks good to me.

Thanks,
-Sherman

On 03/02/2015 01:49 AM, Paul Sandoz wrote:
> On Feb 28, 2015, at 4:40 AM, Xueming Shen<xueming.shen at oracle.com>  wrote:
>> Updated to a static private class for the toMatchResult(). Added a private field MatchResult for the anonymous MatchResult
>> wrapper.
>>
>> http://cr.openjdk.java.net/~sherman/regex.stream/src/java.base/share/classes/java/util/regex/Matcher.java.sdiff.html
>>
> Many thanks, i took most of that code and updated:
>
> http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8071479--Matcher-stream-results/webrev/src/java.base/share/classes/java/util/regex/Matcher.java.sdiff.html
>
> - additional documentation for replacer function parameter is moved to the main body
>
> - there is no need for an internal MatchResult instance wrapper. It does not protect against state modification, does not protect against escape, creates another object for all matcher instances, and results in more wrapping. The only way we can avoid the first 2 is by using an immutable match result, which has it's own cost that unfortunately we cannot avoid in the results().
>
> Paul.




More information about the core-libs-dev mailing list