Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 132764 Details for
Bug 154823
[getter setter] Getters Setters generation doesn't follow naming convention
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
bug154823_003.txt (text/plain), 6.37 KB, created by
David Audel
on 2009-04-22 09:28:24 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
David Audel
Created:
2009-04-22 09:28:24 EDT
Size:
6.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java,v >retrieving revision 1.27 >diff -u -r1.27 NamingConventionTests.java >--- src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java 22 Apr 2009 11:19:36 -0000 1.27 >+++ src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java 22 Apr 2009 13:27:57 -0000 >@@ -1207,6 +1207,58 @@ > "getFieldName", //$NON-NLS-1$ > new String(suggestion)); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154823 >+public void testSuggestGetterName010() { >+ char[] suggestion = NamingConventions.suggestGetterName( >+ this.project, >+ "eMail".toCharArray(), //$NON-NLS-1$ >+ 0, >+ false, >+ CharOperation.NO_CHAR_CHAR); >+ >+ assumeEquals( >+ "geteMail", //$NON-NLS-1$ >+ new String(suggestion)); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154823 >+public void testSuggestGetterName011() { >+ char[] suggestion = NamingConventions.suggestGetterName( >+ this.project, >+ "EMail".toCharArray(), //$NON-NLS-1$ >+ 0, >+ false, >+ CharOperation.NO_CHAR_CHAR); >+ >+ assumeEquals( >+ "getEMail", //$NON-NLS-1$ >+ new String(suggestion)); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154823 >+public void testSuggestGetterName012() { >+ char[] suggestion = NamingConventions.suggestGetterName( >+ this.project, >+ "z".toCharArray(), //$NON-NLS-1$ >+ 0, >+ false, >+ CharOperation.NO_CHAR_CHAR); >+ >+ assumeEquals( >+ "getZ", //$NON-NLS-1$ >+ new String(suggestion)); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154823 >+public void testSuggestGetterName013() { >+ char[] suggestion = NamingConventions.suggestGetterName( >+ this.project, >+ "Z".toCharArray(), //$NON-NLS-1$ >+ 0, >+ false, >+ CharOperation.NO_CHAR_CHAR); >+ >+ assumeEquals( >+ "getZ", //$NON-NLS-1$ >+ new String(suggestion)); >+} > public void testSuggestSetterName001() { > char[] suggestion = NamingConventions.suggestSetterName( > this.project, >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/InternalNamingConventions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/InternalNamingConventions.java,v >retrieving revision 1.27 >diff -u -r1.27 InternalNamingConventions.java >--- model/org/eclipse/jdt/internal/core/InternalNamingConventions.java 22 Apr 2009 11:19:38 -0000 1.27 >+++ model/org/eclipse/jdt/internal/core/InternalNamingConventions.java 22 Apr 2009 13:27:59 -0000 >@@ -298,7 +298,8 @@ > public static char[] getBaseName( > int variableKind, > IJavaProject javaProject, >- char[] name) { >+ char[] name, >+ boolean updateFirstCharacter) { > > AssistOptions assistOptions; > if (javaProject != null) { >@@ -333,11 +334,11 @@ > } > > >- return getBaseName(name, prefixes, suffixes, variableKind == VK_STATIC_FINAL_FIELD); >+ return getBaseName(name, prefixes, suffixes, variableKind == VK_STATIC_FINAL_FIELD, updateFirstCharacter); > } > >- private static char[] getBaseName(char[] name, char[][] prefixes, char[][] suffixes, boolean isConstant) { >- char[] nameWithoutPrefixAndSiffix = removeVariablePrefixAndSuffix(name, prefixes, suffixes, true); >+ private static char[] getBaseName(char[] name, char[][] prefixes, char[][] suffixes, boolean isConstant, boolean updateFirstCharacter) { >+ char[] nameWithoutPrefixAndSiffix = removeVariablePrefixAndSuffix(name, prefixes, suffixes, updateFirstCharacter); > > char[] baseName; > if (isConstant) { >Index: model/org/eclipse/jdt/core/NamingConventions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/NamingConventions.java,v >retrieving revision 1.43 >diff -u -r1.43 NamingConventions.java >--- model/org/eclipse/jdt/core/NamingConventions.java 7 Mar 2009 00:59:02 -0000 1.43 >+++ model/org/eclipse/jdt/core/NamingConventions.java 22 Apr 2009 13:27:58 -0000 >@@ -530,7 +530,7 @@ > int variableKind, > String variableName, > IJavaProject javaProject) { >- return String.valueOf(InternalNamingConventions.getBaseName(variableKind, javaProject, variableName.toCharArray())); >+ return String.valueOf(InternalNamingConventions.getBaseName(variableKind, javaProject, variableName.toCharArray(), true)); > } > > private static int getFieldVariableKind(int modifiers) { >@@ -544,9 +544,11 @@ > } > > private static char[] suggestAccessorName(IJavaProject project, char[] fieldName, int modifiers) { >- char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName); >+ char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName, false); > if (name.length > 0 && ScannerHelper.isLowerCase(name[0])) { >- name[0] = ScannerHelper.toUpperCase(name[0]); >+ if (name.length == 1 || !ScannerHelper.isUpperCase(name[1])) { >+ name[0] = ScannerHelper.toUpperCase(name[0]); >+ } > } > return name; > } >@@ -777,7 +779,7 @@ > */ > public static char[] suggestGetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) { > if (isBoolean) { >- char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName); >+ char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName, false); > int prefixLen = GETTER_BOOL_NAME.length; > if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name) > && name.length > prefixLen && ScannerHelper.isUpperCase(name[prefixLen])) { >@@ -977,7 +979,7 @@ > public static char[] suggestSetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) { > > if (isBoolean) { >- char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName); >+ char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName, false); > int prefixLen = GETTER_BOOL_NAME.length; > if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name) > && name.length > prefixLen && ScannerHelper.isUpperCase(name[prefixLen])) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 154823
:
48470
| 132764