Summary: | NamingConvention: Tests fail | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Martin Aeschlimann <martinae> |
Component: | Core | Assignee: | David Audel <david_audel> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 2.1 | ||
Target Milestone: | 2.1 M5 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Martin Aeschlimann
2003-01-23 11:24:33 EST
Martin - can you confirm that the problem is actually in the NamingConvention, and not in the test itself? yes, it's showing the difference between our old NameProposer and the new NamingConvention. - prefixed ending with a letter (e.g. f) should only be removed if the following caracter of the name if a capital letter (e.g. fCount -> count foo -> foo) (m_color -> color) - if a field begins with is, special handling for getter/setter isBlue -> isBlue -> setBlue && isBlue There are bug reports for this (rules for bean attributes) What is the rule if 'isBlue' is not a boolean ? for non- boolean, get/set must be used. For boolean it can be is/set but also get/set is fine. Important is that when cut the get/set or is/set, the rest is the same. class X { int isBlue; int setGreen; boolean getRed; } Suggested getter and setter should be: getBlue/setBlue or getIsBlue/setIsBlue ? getGreen/setGreen or getSetGreen/setSetGreen ? isRed/setRed or isGetRed/setGetRed ? What part of the field name must be remove to compute getter/setter name ? i would say it is getIsBlue/setIsBlue getSetGreen/setSetGreen isGetRed/setGetRed the only exception is for boolean isXX, because using 'is' for a boolean seems to be a common pattern and isIsXX is really ugly. to use isXX or setXX for e.g. an int is of course possible too, but doesn't make too much sense to me. API Change in org.eclipse.jdt.core.NamingConventions: a new boolean parameter 'isBoolean' added. The value of this parameter is true if the field's type is boolean. suggestSetterName(IJavaProject,char[],int,char[][]) become suggestSetterName(IJavaProject,char[],int,boolean,char[][]) suggestSetterName(IJavaProject,String,int,String[]) become suggestSetterName(IJavaProject,String,int,boolean,String Fixed. Verified. |