INRIA / INRIA/spoon

[Question] SniperJavaPrettyPrinter, add comment to method

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

Description

how can i add some inline-comments before a method and keep everything else unchanged, printing with SniperJavaPrettyPrinter?

i am am trying:
```
CtComment cc1 = factory.createInlineComment("TEST 1");
CtComment cc2 = factory.createInlineComment("TEST 2");
CtComment cc3 = factory.createInlineComment("");
method.setComments(List.of(cc1,cc2,cc3));
```

but this comments the method out:
```
// TEST 1
// TEST 2
// public static void main(String[] args)
```

i am using 11.3.1-beta-8 and java 25.

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.