[jdk17u-dev] RFR: 8285727: Unify fix for JDK-8284920 with version from head

Anton Kozlov akozlov at openjdk.java.net
Thu Apr 28 10:43:52 UTC 2022


On Wed, 27 Apr 2022 18:38:38 GMT, Christoph Langer <clanger at openjdk.org> wrote:

> The upstream patch for JDK-8284920 differs from the version in jdk17u-dev.
> The change in head seems a bit more elegant. Also, the upstream change has a test.
> So we should update jdk17u with the version from head.

Speaking from them code itself, without considering maintainability and possible future merges from the head.

So DOT returns. I think this creates an opportunity for a mistake. IMHO, it's even will be worse, it's will be possible to write `tokenIs(Token.DOT)` instead of `tokenIs(Token.DOT_STR)`, and both will be valid. But the first one peeks a single char and matches both `.` and `..`, the second one -- only `.`. To help to avoid such mistakes, there should be no char token that is in the prefix of a String token, such as DOT and DDOT (and now DOT_STR); COLON and DCOLON. I think making DOT a char is the step back. Instead, I would assume that COLON_CHAR should be renamed back to COLON but made also a String (to fix the last remaining char/String pair of tokens) -- but it is a bit tricky. 

Worth to note the new DOT_STR is not aligned stylistically with the rest of String tokens like DDOT and DCOLON, so I don't feel the new change is elegant, but it is a matter of personal taste. 

Having a test will be great.

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

PR: https://git.openjdk.java.net/jdk17u-dev/pull/373


More information about the jdk-updates-dev mailing list