Bug 551023 - Java Formatter does not honor never join already wrapped lines for method parameter annotations
Summary: Java Formatter does not honor never join already wrapped lines for method par...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.12   Edit
Hardware: PC Windows 10
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 562481 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-09-12 11:58 EDT by D T CLA
Modified: 2023-03-27 05:51 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description D T CLA 2019-09-12 11:58:50 EDT
I'm using

Eclipse IDE for Enterprise Java Developers.

Version: 2019-06 (4.12.0)
Build id: 20190614-1200

-------------

I have enabled the "never join already wrapped lines" option, but the formatter "destroys" the formatting I set up for parameters.

Before formatting:

````
public long createSnapshotForType(
        @NotNull
        @ApiParam(value = "The version to create it from", required = true) 
        @RequestParam(name = "version", required = true) 
        @Valid
        final VersionNumber version,
        @ApiParam(value = "The configuration type to use", required = true) 
        @PathVariable("type")
        final ConfigurationType type) {
````

After formatting:

````
public long createSnapshotForType(
            @NotNull @ApiParam(value = "The version to create it from",
                    required = true) @RequestParam(name = "version",
                            required = true) @Valid final VersionNumber version,
            @ApiParam(value = "The configuration type to use",
                    required = true) @PathVariable("type") final ConfigurationType type) {
````

This makes the code unnecessary hard to read, especially since it's already hard to read in the first place.

Possible workaround: Add empty line comments to the end of the lines, but this doesn't really help with code readability.
Comment 1 Mateusz Matela CLA 2020-10-12 17:10:33 EDT
*** Bug 562481 has been marked as a duplicate of this bug. ***
Comment 2 Nobody - feel free to take it CLA 2022-05-24 11:36:25 EDT
At least with 2022-03, Eclipse seems to also break formatting of class annotations. Would you mind widening this request's scope to include all types of annotations?
Comment 3 Igor Nemtsov CLA 2023-03-27 05:51:33 EDT
Still waiting for fix this bug, very please-please-please!