Will Java ever allow comments to nest?
Alex Buckley
alex.buckley at oracle.com
Thu Jul 2 18:04:10 UTC 2020
On 7/2/2020 7:15 AM, Pavel Rappo wrote:
> While experimenting with comments I found that IntelliJ IDEA thinks that these are valid comments:
>
> /* \u002a/ */
> /* *\u002f */
>
> These comments are invalid for the same reason this is not a valid string literal:
>
> "Hello,\u000Aworld"
>
> JLS specifies that the compiler translates Unicode escapes as the first step of lexical translation, 2 steps before comments are discarded:
>
> https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html
>
> I filed a bug against IDEA:
>
> https://youtrack.jetbrains.com/issue/IDEA-245018
Thank you for filing this bug, and (from looking at the comments in
youtrack) helping the vendor to better understand it.
Alex
More information about the discuss
mailing list