Community
Participate
Working Groups
The getter and setter generation doesn't follow naming convention. Attributes like private String eMail; Should have a corresponding getter and setter like: public String geteMail(); public void seteMail(String eMail); This applies to all attributes where the second character of the attribute is a capital and the first is not.
This seems to affect a lot more than only getter and setter generation. I'm, for instance, using the springIDE plugin and it reports that property 'eMail' doesn't excist if I declare the setter as 'seteMail'. This probably implies that this plugin is leaning on information provided by Eclipse. In runtime the method 'seteMail' is correctly found.
Moving to JDT UI.
(In reply to comment #1) > This seems to affect a lot more than only getter and setter generation. I'm, > for instance, using the springIDE plugin and it reports that property 'eMail' > doesn't excist if I declare the setter as 'seteMail'. This probably implies > that this plugin is leaning on information provided by Eclipse. > > In runtime the method 'seteMail' is correctly found. > Regarding the spec-conformant behaviour of Spring IDE please refer to the comment http://springide.org/project/ticket/355#comment:1 on the corresponding Spring IDE ticket.
Created attachment 48470 [details] A simple program that show the difference
We should follow the bean conventions with say: "Thus when we extract a property or event name from the middle of an existing Java name, we normally convert the first character to lower case. However to support the occasional use of all upper-case names, we check if the first two characters of the name are both upper case and if so leave it alone. So for example, “FooBah” becomes “fooBah” “Z” becomes “z” “URL” becomes “URL” We provide a method Introspector.decapitalize which implements this conversion rule." (http://java.sun.com/products/javabeans/docs/spec.html) The conclusion is: For a field called eMail, we should call the getter 'geteMail'. If we would call it getEMail, Java Beans would conclude that this is a constant name and assume the property is 'EMail'. Getter and setter names are created using NamingConvention.suggestGetter/SetterName. Moving to jdt.core.
Created attachment 132764 [details] Proposed patch
Released for 3.5M7. Tests added NamingConventionTests#testSuggestGetterName010() -> testSuggestGetterName013()
Verified for 3.5M7 using I20090428-0100
*** Bug 201874 has been marked as a duplicate of this bug. ***
This has come up again in bug 322223 (just in case someone CCd here wants to voice an opinion).