JLS question regarding Text Blocks
Alex Buckley
alex.buckley at oracle.com
Mon Apr 6 19:05:06 UTC 2020
On 4/6/2020 11:43 AM, Jim Laskey wrote:
> In section 3.10.6 Text Blocks of the updated spec;
>
> "The opening delimiter is a sequence that starts with three double quote
> characters ("""), continues with zero or more space, tab, and form feed
> characters, and concludes with a line terminator."
>
> However, the JEP 378 description reads "The opening delimiter is a
> sequence of three double quote characters (""") followed by zero or more
> white spaces followed by a line terminator.
>
> javac uses the Character.isWhitespace test for characters following the
> opening three double quote characters.
Character::isWhiteSpace allows not only the JLS definition of whitespace
-- space, tab, and FF -- but also LF and CR. So, javac would accept """
followed by some LF/CR characters (its idea of "zero or more white
spaces") followed by a final LF/CR character (the "line terminator", at
least according to the definition in JLS 3.4; can't find a definition in
the API). That can't be right -- it extends the delimiter line into the
content, so to speak.
Alex
More information about the amber-spec-experts
mailing list