Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 561251

Summary: [14] CR followed by LF in the beginning of text block inserts an additional line
Product: [Eclipse Project] JDT Reporter: Jay Arthanareeswaran <jarthana>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, manoj.palat
Version: 4.14   
Target Milestone: 4.16 M1   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/159708
https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=8f68ce4464f063259009e409d974e96ed60fe208
Whiteboard:

Description Jay Arthanareeswaran CLA 2020-03-19 06:43:28 EDT
This was originally reported via bug 561239:

1. generation of multi-line strings is WRONG, starts with a spurious newline
The code looks like
  private static final String MESSAGE = """
          This is a multi-line
          message that is super-
          exciting!""";
...
    System.out.println("Playing with recent JDK features:");
    System.out.println(MESSAGE);

and the generated output is:
Playing with recent JDK features:

This is a multi-line
message that is super-
exciting!

that blank line is there is NOT CORRECT.

Investigation shows that in case of CR+LF, we treat the LF as part of the text block literal. This is wrong.
Comment 1 Eclipse Genie CLA 2020-03-19 07:31:28 EDT
New Gerrit change created: https://git.eclipse.org/r/159708
Comment 3 Manoj N Palat CLA 2020-04-07 12:03:19 EDT
Verified for Eclipse Version: 2020-06 (4.16) M1 with Build id: I20200406-0600