RFR: 8241187: ToolBox::grep should allow for negative filtering [v4]
Florent Guillaume
github.com+592810+efge at openjdk.java.net
Tue May 11 10:52:57 UTC 2021
On Tue, 11 May 2021 05:34:22 GMT, Guoxiong Li <gli at openjdk.org> wrote:
>> Hi all,
>>
>> This patch adds two methods in `ToolBox` to do the negative filtering. Although the label `noreg-self` was added, I write a test for this enhancement to verify the code. And the method name `grepNotMatch` may need to be improved. Any idea is appreciated.
>>
>> Thank you for taking the time to review.
>>
>> Best Regards.
>
> Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:
>
> Revise comments. Adjust parameter. Clean code.
test/langtools/tools/lib/toolbox/ToolBox.java line 210:
> 208: public List<String> grep(Pattern pattern, List<String> lines, boolean match) {
> 209: return lines.stream()
> 210: .filter(s -> match ? pattern.matcher(s).find() : !pattern.matcher(s).find())
`s -> pattern.matcher(s).find() ^ !match` would avoid repeating the expression
-------------
PR: https://git.openjdk.java.net/jdk/pull/1934
More information about the compiler-dev
mailing list