Bug 207330 - [formatter] Handle Formating of method parameter @annotations separately
Summary: [formatter] Handle Formating of method parameter @annotations separately
Status: VERIFIED DUPLICATE of bug 122247
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 minor with 1 vote (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Eric Jodet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-24 12:48 EDT by Nick Chalko CLA
Modified: 2008-02-05 09:11 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Chalko CLA 2007-10-24 12:48:13 EDT
The java format setting New Lines/Annotations/ Force New Lines
makes sense for class and method annotations, but not
for parameter annotations.

This preference should exclude method parameters.

For example (if the method signature needed to wrap)

  public void myLongMethod(String foo, @Nullable String bar)

is formated

  public void myLongMethod(String foo, @Nullable
      String bar)

but I think it would be much better as

  public void myLongMethod(String foo,
      @Nullable String bar)
Comment 1 Eric Jodet CLA 2007-11-07 06:39:47 EST
see also bug 207809
Comment 2 Eric Jodet CLA 2007-12-15 07:25:59 EST
*** Bug 213080 has been marked as a duplicate of this bug. ***
Comment 3 Eric Jodet CLA 2008-01-14 06:02:52 EST
*** Bug 215190 has been marked as a duplicate of this bug. ***
Comment 4 Brock Janiczak CLA 2008-01-18 19:02:23 EST
I am willing to supply a patch for this one, but i am not sure which options need to be supplied.  I can see a few usecases:
1. don't do any newlines just use normal parameter wrapping rules)
2. put each annotation and parameter on a new line (including first annotation)
3. variation on case 2, but not for parameters with a single annotation

Are there others that need to be taken into consideration?

Perhaps these options will be enough:
1. before first parameter annotation
2. after last parameter annotation
3. after parameter annotation
4. keep parameters with one annotation on same line
Comment 5 Eric Jodet CLA 2008-02-01 09:22:35 EST
Fix for bug 122247 should provide 3 new options to better handle the addition of new lines after annotations and differentiate annotations on:
- members (field, method, type)
- parameters
- local variable

*** This bug has been marked as a duplicate of bug 122247 ***
Comment 6 Jerome Lanneluc CLA 2008-02-05 09:11:46 EST
Verified for 3.4M5 using I20080205-0010