RFR: 8037397: Lost nested character class after intersection &&

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8037397: Lost nested character class after intersection &&

Ian Graves-2
Bug fix with the intersection `&&` operator in regex patterns. In JDK-8037397, some character classes on the right hand side of the operator are dropped in cases where nested `[..]` classes are used with non "nested" ones.

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

Commit messages:
 - Fixing a regex intersection bug that drops expressions on the right hand side

Changes: https://git.openjdk.java.net/jdk/pull/3291/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3291&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8037397
  Stats: 5 lines in 1 file changed: 4 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3291.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3291/head:pull/3291

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection &&

Florent Guillaume-2
On Wed, 31 Mar 2021 20:38:33 GMT, Ian Graves <[hidden email]> wrote:

> Bug fix with the intersection `&&` operator in regex patterns. In JDK-8037397, some character classes on the right hand side of the operator are dropped in cases where nested `[..]` classes are used with non "nested" ones.

src/java.base/share/classes/java/util/regex/Pattern.java line 2666:

> 2664:                             } else { // abc&&def
> 2665:                                 unread();
> 2666:                                 if(right == null) {

Missing space after `if`. There will be a unit test as well?

(Please tell me if these comments aren't suitable or relevant, as I'm not involved in the project.)

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

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection &&

Roger Riggs-2
In reply to this post by Ian Graves-2
On Wed, 31 Mar 2021 20:38:33 GMT, Ian Graves <[hidden email]> wrote:

> Bug fix with the intersection `&&` operator in regex patterns. In JDK-8037397, some character classes on the right hand side of the operator are dropped in cases where nested `[..]` classes are used with non "nested" ones.

Please add a test.

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

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection && [v2]

Ian Graves-2
In reply to this post by Ian Graves-2
> Bug fix with the intersection `&&` operator in regex patterns. In JDK-8037397, some character classes on the right hand side of the operator are dropped in cases where nested `[..]` classes are used with non "nested" ones.

Ian Graves has updated the pull request incrementally with one additional commit since the last revision:

  Fixing missing space

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3291/files
  - new: https://git.openjdk.java.net/jdk/pull/3291/files/76cf0be2..2a783a1e

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3291&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3291&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3291.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3291/head:pull/3291

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection && [v3]

Ian Graves-2
In reply to this post by Ian Graves-2
> Bug fix with the intersection `&&` operator in regex patterns. In JDK-8037397, some character classes on the right hand side of the operator are dropped in cases where nested `[..]` classes are used with non "nested" ones.

Ian Graves has updated the pull request incrementally with one additional commit since the last revision:

  Adding a test.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3291/files
  - new: https://git.openjdk.java.net/jdk/pull/3291/files/2a783a1e..9a46443d

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3291&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3291&range=01-02

  Stats: 35 lines in 1 file changed: 34 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3291.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3291/head:pull/3291

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection && [v3]

Ian Graves-2
In reply to this post by Roger Riggs-2
On Thu, 1 Apr 2021 14:21:20 GMT, Roger Riggs <[hidden email]> wrote:

>> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>>
>>   Adding a test.
>
> Please add a test.

Tagging with CSR because this will impact a long-standing (buggy) behavior.

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

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection && [v3]

Ian Graves-2
In reply to this post by Florent Guillaume-2
On Thu, 1 Apr 2021 00:33:26 GMT, Florent Guillaume <[hidden email]> wrote:

>> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>>
>>   Adding a test.
>
> src/java.base/share/classes/java/util/regex/Pattern.java line 2666:
>
>> 2664:                             } else { // abc&&def
>> 2665:                                 unread();
>> 2666:                                 if(right == null) {
>
> Missing space after `if`. There will be a unit test as well?
>
> (Please tell me if these comments aren't suitable or relevant, as I'm not involved in the project.)

Yep, they are suitable thanks!

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

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection && [v4]

Ian Graves-2
In reply to this post by Ian Graves-2
> Bug fix with the intersection `&&` operator in regex patterns. In JDK-8037397, some character classes on the right hand side of the operator are dropped in cases where nested `[..]` classes are used with non "nested" ones.

Ian Graves has updated the pull request incrementally with one additional commit since the last revision:

  Bumping copyright date.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3291/files
  - new: https://git.openjdk.java.net/jdk/pull/3291/files/9a46443d..de0fa217

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3291&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3291&range=02-03

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3291.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3291/head:pull/3291

PR: https://git.openjdk.java.net/jdk/pull/3291
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8037397: Lost nested character class after intersection && [v3]

Roger Riggs-2
In reply to this post by Ian Graves-2
On Fri, 2 Apr 2021 15:48:50 GMT, Ian Graves <[hidden email]> wrote:

>> Bug fix with the intersection `&&` operator in regex patterns. In JDK-8037397, some character classes on the right hand side of the operator are dropped in cases where nested `[..]` classes are used with non "nested" ones.
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>
>   Adding a test.

Update copyright before push.

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

Marked as reviewed by rriggs (Reviewer).

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