Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 90930

Summary: Generate constructor using fields generates wrong parameter name
Product: [Eclipse Project] JDT Reporter: Dirk Baeumer <dirk_baeumer>
Component: UIAssignee: Tobias Widmer <tobias_widmer>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: trevor
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Dirk Baeumer CLA 2005-04-10 11:25:43 EDT
private static class Data {
		public int modifier;
		public char[] name;
		public char[] packageName;
		public char[][] enclosingNames;
		public String path;
	}

Generate constructor using field.

Observer: you get two parameters named "name".
Comment 1 Trevor Robinson CLA 2005-04-20 12:13:01 EDT
This may be related to an issue I just noticed: Generate Constructor Using
Fields now (M6) seems to lowercase argument names:

public class TxnID
{
    public final int nodeID;
    public final int unitID;
    public TxnID2(int nodeid, int unitid)
    {
        // TODO Auto-generated constructor stub
        nodeID = nodeid;
        unitID = unitid;
    }
}
Comment 2 andreas.nilsson CLA 2005-04-22 08:39:45 EDT
I would really prefer if no attempts were made to translate the field name. The
developer has probably chosen the name carefully to make the code easy to
understand.
Comment 3 Tobias Widmer CLA 2005-04-25 05:09:34 EDT
Using JDT Core naming conventions
Fixed > 20050425
Comment 4 Martin Aeschlimann CLA 2005-05-10 12:55:33 EDT
verified by David Saff on I20050509-2010
Comment 5 andreas.nilsson CLA 2005-05-24 04:53:09 EDT
(In reply to comment #3)
> Using JDT Core naming conventions
> Fixed > 20050425

Just out of interest, where can one find the JDT naming conventions?

I just did a quick test with M7 on a class including the fields
'startDate' and 'endDate'. This ended up as 'date' and 'date2'. Is this really
intentional?  I would have expected the names to go unchanged i.e. 

public class SomeClass{
    private Date startDate;
    private Date endDate;

    public SomeClass( Date startDate, Date endDate ){
        this.startDate=startDate;
        this.endDate=endDate;
    }
}

Comment 6 Tobias Widmer CLA 2005-05-24 05:07:21 EDT
Have a look at class org.eclipse.jdt.core.NamingConventions