Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 66390 - [typing] Correct Indentation: throws clause incorrectly indented
Summary: [typing] Correct Indentation: throws clause incorrectly indented
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Rajesh CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-09 15:31 EDT by Paweł Sakowski CLA
Modified: 2011-01-31 06:39 EST (History)
2 users (show)

See Also:


Attachments
Patch (9.65 KB, patch)
2010-10-28 02:59 EDT, Rajesh CLA
daniel_megert: review+
Details | Diff
Patch (31.57 KB, patch)
2011-01-31 05:21 EST, Rajesh CLA
daniel_megert: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paweł Sakowski CLA 2004-06-09 15:31:48 EDT
My preferences:

Code formatter profile: Java Conventions
Editor: Displayed tab width: 8
Editor: Insert spaces for tabs: true

Now, consider the following code:

package foo;

public class Test {
private void thrower()
throws java.sql.SQLException, java.io.IOException {
}
}

If I select it all and "correct indentation" (Ctrl-I), the three method's lines
get shifted 4 spaces each. According to the Java coding conventions, the
"throws" line should get shifted 12 spaces instead. By the way, that's what
(correctly) happens if a long method header is wrapped within a parameter list.
Comment 1 Dani Megert CLA 2004-07-26 09:49:45 EDT
Tom, please check whether it's the text code or the formatter
Comment 2 Tom Hofmann CLA 2004-07-27 04:47:21 EDT
Correct indentation is always text. However, it does not currently support
continuation indentation for method declarations. This is something we may look
at for 3.1.
Comment 3 Tom Hofmann CLA 2004-07-27 04:49:09 EDT
marking as dup since it is the same issue: continuation.

*** This bug has been marked as a duplicate of 65317 ***
Comment 4 Markus Keller CLA 2010-10-26 15:11:35 EDT
This is not fixed with the fix for bug 65317.
Comment 5 Rajesh CLA 2010-10-28 02:59:16 EDT
Created attachment 181905 [details]
Patch

(In reply to comment #4)
> This is not fixed with the fix for bug 65317.

The JavaHeuristicScanner was identifying 'throws' as a keyword but didn't have a specific token symbol defined for it and so was returning a generic symbol. Defined a new Symbol for 'throws' and modified the scanner to return the same. Also added a new test.
Comment 6 Dani Megert CLA 2010-11-02 12:56:15 EDT
The patch looks good and works fine! Two things:
- Did you verify that current clients of the findReferencePosition(int, 
  boolean*) method couldn't profit from the new one?
- Copyright date is not updated.
Comment 7 Rajesh CLA 2010-11-03 13:03:30 EDT
(In reply to comment #6)
> The patch looks good and works fine! Two things:
> - Did you verify that current clients of the findReferencePosition(int, 
>   boolean*) method couldn't profit from the new one?

I had looked at the current users of that method and didn't see them needing the new method(so did consider making it private). Did a check again, since throws is not a scope introducer and this is specifically for 'SmartIndentBeforeThrows' scenario, don't see it being used elsewhere currently.
Comment 8 Dani Megert CLA 2010-11-04 12:36:26 EDT
Good. Thanks Rajesh.

Committed the patch plus copyright updates to HEAD.
Available in builds >= N20101104-2000.
Comment 9 Dani Megert CLA 2010-12-03 03:03:24 EST
All recently made indent fixes had to be reverted due to several regressions (bug 331028, bug 330556 and bug 331734).
Comment 10 Dani Megert CLA 2011-01-28 09:25:10 EST
Committed Rajesh's modified patch (patch will be attached soon).
Comment 11 Rajesh CLA 2011-01-31 05:21:03 EST
Created attachment 187943 [details]
Patch