INRIA / INRIA/spoon

Unexpected indent printed out when printing Java multiline string.

Open
#5,983 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

### Describe the bug

Unexpected indent printed out when printing Java multiline string.

### Source code you are trying to analyze/transform

_No response_

### Source code for your Spoon processing

```Java
@Test
void testMultilineString(){
CtType ctType = Launcher.parseClass("class A{ void a(){var s = \"\"\"\na\n\"\"\";} }");
System.out.println(ctType.toStringWithImports());
Assertions.assertEquals("class A {\n" +
" void a() {\n" +
" var s = \"\"\"\na\"\"\";\n" +
" }\n" +
"}\n", ctType.toStringWithImports());
}
```

### Actual output

```Java
class A {
void a() {
var s = """
a
""";
}
}
```

### Expected output

```Java
class A {
void a() {
var s = """
a
""";
}
}
```

### Spoon Version

11.1.0

### JVM Version

Java 17+

### What operating system are you using?

MacOS

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.