Bug 30102 - NamingConvention: Tests fail
Summary: NamingConvention: Tests fail
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-23 11:24 EST by Martin Aeschlimann CLA
Modified: 2003-02-11 07:46 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 Martin Aeschlimann CLA 2003-01-23 11:24:33 EST
20030122

I changed our tests to use NamingConvention.
There are failuers, please check.

NameProposerTest in jdt.ui.tests
Comment 1 Philipe Mulet CLA 2003-01-23 12:56:46 EST
Martin - can you confirm that the problem is actually in the NamingConvention, 
and not in the test itself?
Comment 2 Martin Aeschlimann CLA 2003-01-23 13:06:37 EST
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)
Comment 3 David Audel CLA 2003-01-24 05:49:20 EST
What is the rule if 'isBlue' is not a boolean ?
Comment 4 Martin Aeschlimann CLA 2003-01-24 08:18:37 EST
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.

Comment 5 David Audel CLA 2003-01-24 08:44:43 EST
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 ?
Comment 6 Martin Aeschlimann CLA 2003-01-24 10:55:39 EST
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.
Comment 7 David Audel CLA 2003-01-27 05:22:07 EST
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.
Comment 8 David Audel CLA 2003-02-11 07:46:45 EST
Verified.