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 127666 Details for
Bug 260840
NamingConventions creates wrong plural for name ending in <vowel>y
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug260840_001.txt (text/plain), 4.28 KB, created by
David Audel
on 2009-03-05 11:05:09 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2009-03-05 11:05:09 EST
Size:
4.28 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#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.24 >diff -u -r1.24 InternalNamingConventions.java >--- model/org/eclipse/jdt/internal/core/InternalNamingConventions.java 20 Nov 2008 12:03:21 -0000 1.24 >+++ model/org/eclipse/jdt/internal/core/InternalNamingConventions.java 5 Mar 2009 14:18:09 -0000 >@@ -625,10 +625,27 @@ > tempName[length+1] = 'S'; > } > } else if(tempName[length-1] == 'Y') { >- System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length); >- tempName[length-1] = 'I'; >- tempName[length] = 'E'; >- tempName[length+1] = 'S'; >+ boolean precededByAVowel = false; >+ if(tempName.length > 1) { >+ switch (tempName[length-2]) { >+ case 'A': >+ case 'E': >+ case 'I': >+ case 'O': >+ case 'U': >+ precededByAVowel = true; >+ break; >+ } >+ } >+ if (precededByAVowel) { >+ System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length); >+ tempName[length] = 'S'; >+ } else { >+ System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length); >+ tempName[length-1] = 'I'; >+ tempName[length] = 'E'; >+ tempName[length+1] = 'S'; >+ } > } else { > System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length); > tempName[length] = 'S'; >@@ -641,10 +658,27 @@ > tempName[length+1] = 's'; > } > } else if(tempName[length-1] == 'y') { >- System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length); >- tempName[length-1] = 'i'; >- tempName[length] = 'e'; >- tempName[length+1] = 's'; >+ boolean precededByAVowel = false; >+ if(tempName.length > 1) { >+ switch (tempName[length-2]) { >+ case 'a': >+ case 'e': >+ case 'i': >+ case 'o': >+ case 'u': >+ precededByAVowel = true; >+ break; >+ } >+ } >+ if (precededByAVowel) { >+ System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length); >+ tempName[length] = 's'; >+ } else { >+ System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length); >+ tempName[length-1] = 'i'; >+ tempName[length] = 'e'; >+ tempName[length+1] = 's'; >+ } > } else { > System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length); > tempName[length] = 's'; >#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.25 >diff -u -r1.25 NamingConventionTests.java >--- src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java 20 Nov 2008 12:03:19 -0000 1.25 >+++ src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java 5 Mar 2009 14:18:10 -0000 >@@ -860,6 +860,40 @@ > "INT", //$NON-NLS-1$ > toString(suggestions)); > } >+/* >+ * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=260840 >+ */ >+public void testSuggestFieldName041() { >+ String[] suggestions = NamingConventions.suggestVariableNames( >+ NamingConventions.VK_INSTANCE_FIELD, >+ NamingConventions.BK_TYPE_NAME, >+ "Key", //$NON-NLS-1$ >+ this.project, >+ 1, >+ new String[]{}, >+ true); >+ >+ assumeEquals( >+ "keys", //$NON-NLS-1$ >+ toString(suggestions)); >+} >+/* >+ * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=260840 >+ */ >+public void testSuggestFieldName042() { >+ String[] suggestions = NamingConventions.suggestVariableNames( >+ NamingConventions.VK_STATIC_FINAL_FIELD, >+ NamingConventions.BK_TYPE_NAME, >+ "Key", //$NON-NLS-1$ >+ this.project, >+ 1, >+ new String[]{}, >+ true); >+ >+ assumeEquals( >+ "KEYS", //$NON-NLS-1$ >+ toString(suggestions)); >+} > /** @deprecated */ > public void testRemovePrefixAndSuffixForFieldName001() { > Hashtable options = JavaCore.getOptions();
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 260840
: 127666