Re: RFR: 8269753: Misplaced caret in PatternSyntaxException's detail message [v3]

2021-07-26 Thread Pavel Rappo
On Mon, 26 Jul 2021 20:54:53 GMT, Ian Graves  wrote:

>> Fixes a bug where carets aren't indented correctly in PatternSyntaxException 
>> messages because tab characters are converted to spaces in their indentation.
>
> Ian Graves has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Tweaking some spacing. Fixing some report placement.

Marked as reviewed by prappo (Reviewer).

-

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


Re: RFR: 8269753: Misplaced caret in PatternSyntaxException's detail message [v3]

2021-07-26 Thread Ian Graves
> Fixes a bug where carets aren't indented correctly in PatternSyntaxException 
> messages because tab characters are converted to spaces in their indentation.

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

  Tweaking some spacing. Fixing some report placement.

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4906/files
  - new: https://git.openjdk.java.net/jdk/pull/4906/files/339b438a..c47b0651

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=4906=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=4906=01-02

  Stats: 6 lines in 1 file changed: 2 ins; 2 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4906.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4906/head:pull/4906

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


Re: RFR: 8269753: Misplaced caret in PatternSyntaxException's detail message [v2]

2021-07-26 Thread Ian Graves
> Fixes a bug where carets aren't indented correctly in PatternSyntaxException 
> messages because tab characters are converted to spaces in their indentation.

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

  Copyright years

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/4906/files
  - new: https://git.openjdk.java.net/jdk/pull/4906/files/2609dd96..339b438a

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=4906=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=4906=00-01

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

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


Re: RFR: 8269753: Misplaced caret in PatternSyntaxException's detail message

2021-07-26 Thread Pavel Rappo
On Mon, 26 Jul 2021 18:10:03 GMT, Ian Graves  wrote:

> Fixes a bug where carets aren't indented correctly in PatternSyntaxException 
> messages because tab characters are converted to spaces in their indentation.

Changes requested by prappo (Reviewer).

src/java.base/share/classes/java/util/regex/PatternSyntaxException.java line 
111:

> 109: sb.append(System.lineSeparator());
> 110: for (int i = 0; i < index; i++) {
> 111: sb.append((pattern.charAt(i) == '\t') ? '\t' : ' ');

In contrast with 
https://github.com/igraves/jdk/blob/2609dd9618dd43ea0de9abe3e3100262d09c079c/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java#L324,
 this code uses `StringBuilder.append(char)`, which might be even cleaner; good.

test/jdk/java/util/regex/RegExTest.java line 5304:

> 5302: var message = e.getMessage();
> 5303: var sep = System.lineSeparator();
> 5304: if(message.contains(sep + "\t ^")){

Suggestion:

if (message.contains(sep + "\t ^")) {

test/jdk/java/util/regex/RegExTest.java line 5310:

> 5308: failCount++;
> 5309: 
> 5310: report("Correct caret indentation for patterns with tabs");

`report` will not be reached on success; this is different from how `report` is 
used in the rest of the file. Also: `report` seems to be stateful in that it 
resets the `failCount`.

-

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


Re: RFR: 8269753: Misplaced caret in PatternSyntaxException's detail message

2021-07-26 Thread Ian Graves
On Mon, 26 Jul 2021 18:10:03 GMT, Ian Graves  wrote:

> Fixes a bug where carets aren't indented correctly in PatternSyntaxException 
> messages because tab characters are converted to spaces in their indentation.

@pavelrappo

-

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


RFR: 8269753: Misplaced caret in PatternSyntaxException's detail message

2021-07-26 Thread Ian Graves
Fixes a bug where carets aren't indented correctly in PatternSyntaxException 
messages because tab characters are converted to spaces in their indentation.

-

Commit messages:
 - 8269753: Misplaced caret in PatternSyntaxException's detail message

Changes: https://git.openjdk.java.net/jdk/pull/4906/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=4906=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8269753
  Stats: 23 lines in 2 files changed: 21 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4906.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4906/head:pull/4906

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