RFR: 8241187: ToolBox::grep should allow for negative filtering [v2]

Guoxiong Li github.com+13688759+lgxbslgx at openjdk.java.net
Tue Jan 5 12:04:18 UTC 2021


On Mon, 4 Jan 2021 18:11:14 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revise method and test.
>
> test/langtools/tools/lib/toolbox/ToolBox.java line 204:
> 
>> 202:      * @return the strings not matching the regular expression
>> 203:      */
>> 204:     public List<String> grepNotMatch(Pattern pattern, List<String> lines) {
> 
> Instead of new methods named `grepNotMatch` I suggest adding new overloads of `grep` that take an additional `boolean invert` parameter that is conceptually equivalent to the `grep` `-v` option.  The existing `grep` methods can be updated to delegate to the new methods, passing `false` for the new parameter.

@jonathan-gibbons Thank you for your suggestion. The code is updated now.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1934


More information about the compiler-dev mailing list