Bug 52907 - Code formatting not working half of the time
Summary: Code formatting not working half of the time
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows NT
: P3 major with 7 votes (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-24 04:18 EST by Stefan Kuypers CLA
Modified: 2004-03-26 07:40 EST (History)
0 users

See Also:


Attachments
Code formatter settings (8.68 KB, text/plain)
2004-03-02 09:28 EST, Olivier Thomann CLA
no flags Details
other formatter settings (18.64 KB, text/plain)
2004-03-02 09:29 EST, Olivier Thomann CLA
no flags Details
Test case to unzip (50.92 KB, application/octet-stream)
2004-03-02 09:30 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Kuypers CLA 2004-02-24 04:18:09 EST
Since build M6 (nor using M7) the code formatting works only sometimes. I've
been trying to figure out a pattern but without any result uptil now.

The weird thing is that javadoc comments are always formatted correctly (since
M7) but formatting of the code itself is quite unpredictable. On the other hand,
once code formatting stops working for a particular file there is no way to get
it back online again for that file (not even when closing and opening the file).

I'm using JDK 1.4.2_08 and build M7. I have copied my workspace over from build
to build cince M5. I did try to trash the .config directory however but without
result.

Since I'm using the code formatter pretty heavily to be conform to the coding
standards in our company, this bug is causing me quite some extra work hand
formatting my code again.

Kind regards,
Stef
Comment 1 DJ Houghton CLA 2004-02-24 11:49:04 EST
Please include specific examples of where the code formatter is not giving you
expected results. The JDT/Core team may also ask you for your settings.

Are you referring to the code layout after doing a ctrl-shift-f or the
auto-indent and formatting as you type in the java editor?

Moving to JDT/Core.
Comment 2 Olivier Thomann CLA 2004-02-24 18:09:55 EST
Please provide examples and code formatter settings.
Comment 3 Olivier Thomann CLA 2004-02-29 19:40:02 EST
Without reproducable test cases, I will close it.
Please attach test cases specifying what you expect and also attach your
formatter settings.
Comment 4 Olivier Thomann CLA 2004-03-02 09:28:34 EST
Created attachment 8268 [details]
Code formatter settings
Comment 5 Olivier Thomann CLA 2004-03-02 09:29:02 EST
Created attachment 8269 [details]
other formatter settings
Comment 6 Olivier Thomann CLA 2004-03-02 09:30:38 EST
Created attachment 8270 [details]
Test case to unzip
Comment 7 Kurt Pruenner CLA 2004-03-21 11:27:52 EST
Well, I've just run into the same problem, and for me running the formatter with
Ctrl-Shift-F stops working as soon as the code contains an assert statement -
this was the minimal testcase I could come up with that shows it:

public class Test
{
    public Test()
    {
        //assert true;
    }
}

If you set the formatter settings to "Java Conventions", this'll get reformatted
just as it should, but as soon as you remove the "//" from the comment it'll
suddenly stop working (this is of course with Java 1.4 settings for the
compiler). Of course, if you remove or comment out the assert statement the
formatter starts working again.

Hope this helps.

np: The Orb - Outlands (Live 93)
Comment 8 Olivier Thomann CLA 2004-03-21 13:15:24 EST
If you use build M7, you are in the same case than bug 52246.
Please use a newer build. This is fixed since the 24th of February.
If your code is not syntactically correct, it won't format. This is a
restriction of the new formatter that is using an AST instead of just a steam of
tokens.
Please ensure your code is syntactically correct before running the formatter.
Comment 9 Stefan Kuypers CLA 2004-03-23 09:02:15 EST
Apparantly there is still another bug related to formatting the code. Changing
version only helps in some cases.

Stef
Comment 10 Olivier Thomann CLA 2004-03-23 09:56:07 EST
Could you please be more specific? Please describe with examples the cases that
are not working.
Comment 11 Stefan Kuypers CLA 2004-03-24 05:34:57 EST
The bug seems to be fixed in the latest integration build.
Comment 12 Jerome Lanneluc CLA 2004-03-26 07:39:57 EST
Reopening to mark as WORKSFORME.
Comment 13 Jerome Lanneluc CLA 2004-03-26 07:40:25 EST
Reporter said it now works.