Return carriage on annotated parameters
- Dominant language
- Java
- Stars
- 2k
- Forks
- 392
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 36
Description
Hello,
This is a **low priority issue** but while printing annotations within parameters I've noticed it adds a return carriage. Here is what I mean:
I intend to get this:
```JAVA
public Content pop(@PathVariable int proxy_id) {
```
but with the following code:
```JAVA
//add proxy id to the parameters of the method
CtParameter proxy_int = launcher.getFactory().createParameter();
proxy_int.setSimpleName("proxy_id");
proxy_int.setType(launcher.getFactory().createReference("int"));
CtAnnotation a = launcher.getFactory().createAnnotation(); // creation of the annotation variable
// Type of the annotation
CtTypeReference type = launcher.getFactory().createReference("org.springframework.web.bind.annotation.PathVariable");
a.setType(type);
a.setAnnotationType(type);
proxy_int.addAnnotation(a); // add annotation to the parameter.
method.addParameter(proxy_int); // add the parameter to the method.
```
I get this:
```JAVA
public Content pop(@PathVariable
int proxy_id) {
```
I assume the prettyprinter adds the return carriage because it also does so when adding an annotation for a method or a class, where the return carriage is expected for clarity. While it still works fine it can be a little hard to read when I have a method with 2-3 annotated parameters. Am I doing this wrong, or is this working as intended? Thank you.
```JAVA
@GetMapping("/ContentProviderService/{id}/test")
public void test(@PathVariable
int proxy_id, @RequestBody
Screen screen);
```
Contributor guide
Assessment
This issue has not been assessed yet.