Bug 19811 - Code formatter bugs
Summary: Code formatter bugs
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-10 12:39 EDT by Adalbert Homa CLA
Modified: 2003-10-13 10:24 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 Adalbert Homa CLA 2002-06-10 12:39:26 EDT
Eclipse code formatter should abide to Sun's Java code conventions. Most of the
time it does a good job, but at line splitting it has some problems.

I included examples of what I think are bugs:

        // Here is how it should look like acording to Java conventions
        // longName1 = longName2 * (longName3 + longName4 - longName5)
        //            + 4 * longname6; // PREFER
        // 
        // Here is Eclipse formatting
        longName1 =
            longName2 * (longName3 + longName4 - longName5) + 4 *
longName6;

        // Here is how it should look like
        // System.out.println("Server Name: " + serverName_ + ", port="
        //    + serverPort_ + ", numOrbs=" + numOrbs_);
        // 
        // Here is Eclipse formatting
        System.out.println(
            "Server Name: "
                + serverName_
                + ", port="
                + serverPort_
                + ", numOrbs="
                + numOrbs_);

    // 
    // Here is how I would format it (Sun's code converntions does not say)
    //    String[][] doubleList = {
    //            { "alfa", "beta" },
    //            { "alfa", "beta" },
    //            { "alfa", "beta" },
    //            { "alfa", "beta" },            
    //    };
    // 
    // Here is how Eclipse format it
    String[][] doubleList = { { "alfa", "beta" }, {
            "alfa", "beta" }, {
            "alfa", "beta" }, {
            "alfa", "beta" }, };

    // Method parameters formatting.
    // My formatting
    // protected void processRequest(long param1, long param2,long param3, 
    //     long param4) {
    // }
    //
    // Eclipse formatting
    protected void processRequest(
        long param1,
        long param2,
        long param3,
        long param4) {
    }
Comment 1 Philipe Mulet CLA 2002-06-10 12:45:39 EDT
Thanks, will consider post 2.0
Comment 2 Philipe Mulet CLA 2002-07-25 06:30:52 EDT
Resurrecting formatter issues in 2.1 stream.
Comment 3 Philipe Mulet CLA 2002-07-25 06:32:40 EDT
Clearing resolution
Comment 4 Olivier Thomann CLA 2003-01-15 13:22:45 EST
We need to clear 2.1 bug reports that won't be addressed before 2.1. The new 
implementation is still in the works. Therefore we cannot include it for 2.1. 
Not enough testing and we need to polish the preferences. This will be address 
for 2.2 as stated in the JDT/Core plan.
Comment 5 Philipe Mulet CLA 2003-06-12 06:36:23 EDT
Resurrecting for 3.0
Comment 6 Olivier Thomann CLA 2003-06-12 15:59:08 EDT
Reopen for 3.0 consideration.
Comment 7 Olivier Thomann CLA 2003-10-03 09:57:31 EDT
This is improved with the new formatter.
Fixed and released in HEAD.
Comment 8 David Audel CLA 2003-10-13 10:24:22 EDT
Verified.