| Summary: | [formatting] wrong placement of curly braces if method has throws declaration in own line | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ulrich Scholz <d7> | ||||||
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> | ||||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | jarthana | ||||||
| Version: | 4.2.1 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | stalebug | ||||||||
| Attachments: |
|
||||||||
I don't see this problem. Did you try out the following formatter options: Braces -> Method Declaration = Next line Line Wrapping -> Method Declarations:Throws Clause = Wrap ... ? That is exactly my setting (Wrap where necessary). The preview shows the formatted code correctly. But if I apply formatting on a full method that has a throws clause, it if formatted incorrectly. If you want, I will attach a desktop recording to show you. Created attachment 230507 [details]
desktop recording showing the formatting problem
I see this behavior 'only' when the Braces option for Method declaration is set to "Next line indented" and not otherwise. Can you check what you have set? On my site, the braces option for Method declaration is set to 'Next line', not to 'Next line indented" Is there a way to attach all my settings at once? (In reply to comment #5) > On my site, the braces option for Method declaration is set to 'Next line', > not to 'Next line indented" > > Is there a way to attach all my settings at once? I don't think the other settings should affect this. For the formatter settings, you can just export and share it. Created attachment 230568 [details]
Eclipse formatter settings showing the problem
I can't reproduce this even with the given formatter setting. May be I should have said this earlier: can you try with one of the recent Kepler builds? I can't imagine what else (apart from the formatter prefs) could cause this. unfortunately, I'm bound to my company-provided Eclipse version and am unable to install a different one. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Currently, if a method has a throws declaration in its own line, formatting places the curly braces of a method at the column given by the throws statement. Instead, they should always be placed at the column given by the method declaration. correct: public void foo() throws Exception { if(true) { bar(); } } not correct (as done today): public void foo() throws Exception { if(true) { bar() } }