Bug 45141 - Broken new code formatter
Summary: Broken new code formatter
Status: RESOLVED DUPLICATE of bug 44642
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-17 16:01 EDT by Alexander Ilyin CLA
Modified: 2003-10-31 08:40 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Ilyin CLA 2003-10-17 16:01:23 EDT
Very strange separation of the long line and many spaces before semicolon (";")


Try to format this code

=====start of the Test.java code
package test;

import java.util.Hashtable;

public class Test {

	public Test() {
		Hashtable fields;

		// TODO some todo text
		// direct field names

		//		==== Dictionaries
		//CountryDictInfo
		fields = new Hashtable();

		fields.put("name", "Name");
		fields.put("numericCode", "NumericCode");

		getSqls()
                   .put("finmon.domain.dictionary", new SomeFieldSQLDescriptor(
			this, "SELECT * FROM CountryDict WHERE ",
			" ORDER BY Name", fields))		;

	}
}
=======end of code


Pay attention on spliting the line and where putting the last semicolon

getSqls().put("finmon.domain.dictionary", 
              new SomeFieldSQLDescriptor(this, 
                         "SELECT * FROM CountryDict WHERE ",
			 " ORDER BY Name", fields));
Comment 1 Olivier Thomann CLA 2003-10-20 13:44:56 EDT
With latest code, it returns:
package test;
import java.util.Hashtable;
public class Test {
    public Test() {
        Hashtable fields;
        // TODO some todo text
        // direct field names
        //		==== Dictionaries
        //CountryDictInfo
        fields = new Hashtable();
        fields.put("name", "Name");
        fields.put("numericCode", "NumericCode");
        getSqls()
                .put("finmon.domain.dictionary", new SomeFieldSQLDescriptor(
                        this, "SELECT * FROM CountryDict WHERE ",
                        " ORDER BY Name", fields));
    }
}

Does this look acceptable?
Comment 2 Alexander Ilyin CLA 2003-10-20 18:11:09 EDT
Not yet.

        fields.put("numericCode", "NumericCode");
        getSqls()
                .put("finmon.domain.dictionary", new SomeFieldSQLDescriptor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        this, "SELECT * FROM CountryDict WHERE ",
                        " ORDER BY Name", fields));


Why you split getSqls() and .put. You win just 1 char but not the clearness.

I think old formatter do it fine and readable:

        getSqls().put(
            "finmon.domain.dictionary", 
            new SomeFieldSQLDescriptor(
                this, 
                "SELECT * FROM  CountryDict WHERE ",
                " ORDER BY Name", 
                fields));

If hole arguments line must be droped then each argument must be appeared on new
line with ident (4 spaces)

P.S. I think formatter must use Sun standard Code Conventions for the Java.
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

It's very pragmatic and make code very readable. And its looks like Standard!
Comment 3 Olivier Thomann CLA 2003-10-21 08:26:35 EDT
This is a different problem. The remaining problem is a duplicate of bug 44642.
Comment 4 Olivier Thomann CLA 2003-10-31 08:40:35 EST
Close as duplicate of bug 44642, because the first problem is already fixed.

*** This bug has been marked as a duplicate of 44642 ***