| Summary: | [Java formatter enhancement] - Different new line behavior if an annotation is places after modifiers | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | sinuhe pop <sinuhepop> |
| Component: | Core | Assignee: | Mateusz Matela <mateusz.matela> |
| Status: | VERIFIED DUPLICATE | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | manoj.palat, mateusz.matela |
| Version: | 3.8 | ||
| Target Milestone: | 4.18 M3 | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Too bad this idea would not work well with the terribly underused default (no modifier) visibility. But some way to have the formatter allow both inlined and newline-separated field annotations in the same codebase would be great. An annotation after other modifiers is considered a type annotation, there's a separate setting for that. *** This bug has been marked as a duplicate of bug 425040 *** Verified for Eclipse 4.18 M3 Version: 2020-12 (4.18) with Build id: I20201117-0600 |
Build Identifier: I usually prefer simple annotations on fields being inlined: @Autowired private Repository<Student> studentRepository; But some annotations look better with new line after each: @Size(min = 1, max = 3) @ManyToMany @JoinTable(name = "CUST_PHONE", joinColumns = @JoinColumn(name = "CUST_ID", referencedColumnName = "ID"), inverseJoinColumns = @JoinColumn(name = "PHONE_ID", referencedColumnName = "ID") ) public Set<PhoneNumber> getPhones() { return phones; } So, I thought that an easy way of having both configurations at the same time is a different behavior (no new line) if annotation is after modifiers, for example: private @Autowired Repository<Student> teacherRepository; This could be configurable, but IMHO this would be the default behaviour, because a new line in this case is specially ugly: private @Autowired Repository<Student> teacherRepository; Same behavior could be applied on methods and types too. Reproducible: Always