Bug 341609 - Never join already wrapped annotations
Summary: Never join already wrapped annotations
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-01 08:21 EDT by Kohányi Róbert CLA
Modified: 2011-04-01 08:21 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kohányi Róbert CLA 2011-04-01 08:21:14 EDT
Build Identifier: 20110218-0911

I'd like to propose an enhancement idea for the Java code formatter (Preferences->Java->Code Style->Formatter->Edit...).

When one of the "Insert new line after annotations on {members,parameters,local variables}" options are unchecked (in the "New Lines" tab) *and* the "Never join already wrapped lines" option is checked (in the "Line Wrapping" tab) the code formatter shouldn't re-join already wrapped annotations (on members, variables or parameters – whichever is unchecked).

"Steps to Reproduce" describes what is the problem exactly. Obviously the presented mock class with only one annotation works just good without wrapping, that isn't an issue. Using JPA annotations on entities or JAX-RS annotations could present more of a problem.

A solution could be to add an option "Never join already wrapped annotations", or to extend the "Never join already wrapped lines" function to annotations as well.

Reproducible: Always

Steps to Reproduce:
1. Go to 'Preferences->Java->Code Style->Formatter->Edit...' and open or modify a code formatter profile.
2. Go to the 'New Lines' tab.
3. Uncheck "Insert new line after annotations on members / parameters / local variables.
4. Go to the 'Line Wrapping' tab.
5. Check "Never join already wrapped lines".
6. Create a new Java project. 
7. Create a new annotation class file like this:

@Documented
public @interface Test {}

8. Format the code (Shift+Ctrl+F), then the line will be 'straightened' like it should be:

@Documented public @interface Test {}

9. However! Wrapping the line manually (like that it was in step 7, in the first code snippet) and re-formatting the code will straighten the line (this is the case with parameters and local variables, depending on what options was checked, uncheked - step 3).