eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Newline character literal with unicode-escaped single quotes incorrectly parses as single-quote character constant

Open
#827 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

As asked/discussed in https://stackoverflow.com/q/74363301/40342 the following code incorrectly prints `true` when compiled with ECJ (verified with versions 3.19.0 to 3.32.0, earlier versions untested):

```
public class QuoteBug {
static void main(String... args) {
char e = \u0027\n\u0027;
char f = '\'';
System.out.println(e == f);
}
}
```

Using the OpenJDK `javac` this correctly prints `false` as `e` and `f` have the values 10 and 39 respectively, whereas ECJ assignes both variables the value 39.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.