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 118352 Details for
Bug 251693
NamingConventions.suggestXXXNames should call suggestVariableNames()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug251693_001.txt (text/plain), 22.50 KB, created by
David Audel
on 2008-11-20 07:01:56 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2008-11-20 07:01:56 EST
Size:
22.50 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.23 >diff -u -r1.23 InternalNamingConventions.java >--- model/org/eclipse/jdt/internal/core/InternalNamingConventions.java 20 Nov 2008 09:35:01 -0000 1.23 >+++ model/org/eclipse/jdt/internal/core/InternalNamingConventions.java 20 Nov 2008 11:48:10 -0000 >@@ -12,7 +12,6 @@ > > import java.util.Map; > >-import org.eclipse.jdt.core.Flags; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.compiler.CharOperation; >@@ -38,229 +37,6 @@ > null/*taskPriorities*/, > true/*taskCaseSensitive*/); > } >- public static void suggestArgumentNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[] internalPrefix, char[][] excludedNames, INamingRequestor requestor) { >- Map options = javaProject.getOptions(true); >- CompilerOptions compilerOptions = new CompilerOptions(options); >- AssistOptions assistOptions = new AssistOptions(options); >- >- suggestNames( >- packageName, >- qualifiedTypeName, >- dim, >- internalPrefix, >- assistOptions.argumentPrefixes, >- assistOptions.argumentSuffixes, >- excludedNames, >- getNameScanner(compilerOptions), >- requestor); >- } >- >- public static void suggestFieldNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, int modifiers, char[] internalPrefix, char[][] excludedNames, INamingRequestor requestor) { >- boolean isStatic = Flags.isStatic(modifiers); >- >- Map options = javaProject.getOptions(true); >- CompilerOptions compilerOptions = new CompilerOptions(options); >- AssistOptions assistOptions = new AssistOptions(options); >- >- suggestNames( >- packageName, >- qualifiedTypeName, >- dim, >- internalPrefix, >- isStatic ? assistOptions.staticFieldPrefixes : assistOptions.fieldPrefixes, >- isStatic ? assistOptions.staticFieldSuffixes : assistOptions.fieldSuffixes, >- excludedNames, >- getNameScanner(compilerOptions), >- requestor); >- } >- public static void suggestLocalVariableNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[] internalPrefix, char[][] excludedNames, INamingRequestor requestor) { >- Map options = javaProject.getOptions(true); >- CompilerOptions compilerOptions = new CompilerOptions(options); >- AssistOptions assistOptions = new AssistOptions(options); >- >- suggestNames( >- packageName, >- qualifiedTypeName, >- dim, >- internalPrefix, >- assistOptions.localPrefixes, >- assistOptions.localSuffixes, >- excludedNames, >- getNameScanner(compilerOptions), >- requestor); >- } >- >- private static void suggestNames( >- char[] packageName, >- char[] qualifiedTypeName, >- int dim, >- char[] internalPrefix, >- char[][] prefixes, >- char[][] suffixes, >- char[][] excludedNames, >- Scanner nameScanner, >- INamingRequestor requestor){ >- >- if(qualifiedTypeName == null || qualifiedTypeName.length == 0) >- return; >- >- if(internalPrefix == null) { >- internalPrefix = CharOperation.NO_CHAR; >- } else { >- internalPrefix = removePrefix(internalPrefix, prefixes); >- } >- >- char[] typeName = CharOperation.lastSegment(qualifiedTypeName, '.'); >- >- if(prefixes == null || prefixes.length == 0) { >- prefixes = new char[1][0]; >- } else { >- int length = prefixes.length; >- System.arraycopy(prefixes, 0, prefixes = new char[length+1][], 0, length); >- prefixes[length] = CharOperation.NO_CHAR; >- } >- >- if(suffixes == null || suffixes.length == 0) { >- suffixes = new char[1][0]; >- } else { >- int length = suffixes.length; >- System.arraycopy(suffixes, 0, suffixes = new char[length+1][], 0, length); >- suffixes[length] = CharOperation.NO_CHAR; >- } >- >- char[][] tempNames = null; >- >- // compute variable name for base type >- try{ >- nameScanner.setSource(typeName); >- switch (nameScanner.getNextToken()) { >- case TerminalTokens.TokenNameint : >- case TerminalTokens.TokenNamebyte : >- case TerminalTokens.TokenNameshort : >- case TerminalTokens.TokenNamechar : >- case TerminalTokens.TokenNamelong : >- case TerminalTokens.TokenNamefloat : >- case TerminalTokens.TokenNamedouble : >- case TerminalTokens.TokenNameboolean : >- >- if (internalPrefix != null && internalPrefix.length > 0) return; >- >- char[] name = computeBaseTypeNames(typeName[0], excludedNames); >- if(name != null) { >- tempNames = new char[][]{name}; >- } >- break; >- } >- } catch(InvalidInputException e){ >- // ignore >- } >- >- // compute variable name for non base type >- if(tempNames == null) { >- tempNames = computeNames(typeName); >- } >- >- boolean acceptDefaultName = true; >- SimpleSetOfCharArray foundNames = new SimpleSetOfCharArray(); >- >- next : for (int i = 0; i < tempNames.length; i++) { >- char[] tempName = tempNames[i]; >- if(dim > 0) { >- int length = tempName.length; >- if (tempName[length-1] == 's'){ >- if(tempName.length > 1 && tempName[length-2] == 's') { >- System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length); >- tempName[length] = 'e'; >- 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'; >- } else { >- System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length); >- tempName[length] = 's'; >- } >- } >- >- char[] unprefixedName = tempName; >- unprefixedName[0] = ScannerHelper.toUpperCase(unprefixedName[0]); >- for (int j = 0; j <= internalPrefix.length; j++) { >- if(j == internalPrefix.length || >- CharOperation.prefixEquals(CharOperation.subarray(internalPrefix, j, -1), unprefixedName, j != 0 /*do not check case when there is no prefix*/)) { >- tempName = CharOperation.concat(CharOperation.subarray(internalPrefix, 0, j), unprefixedName); >- if(j == 0) tempName[0] = ScannerHelper.toLowerCase(tempName[0]); >- for (int k = 0; k < prefixes.length; k++) { >- if(prefixes[k].length > 0 >- && ScannerHelper.isLetterOrDigit(prefixes[k][prefixes[k].length - 1])) { >- tempName[0] = ScannerHelper.toUpperCase(tempName[0]); >- } else { >- tempName[0] = ScannerHelper.toLowerCase(tempName[0]); >- } >- char[] prefixName = CharOperation.concat(prefixes[k], tempName); >- for (int l = 0; l < suffixes.length; l++) { >- char[] suffixName = CharOperation.concat(prefixName, suffixes[l]); >- suffixName = >- excludeNames( >- suffixName, >- prefixName, >- suffixes[l], >- excludedNames); >- try{ >- nameScanner.setSource(suffixName); >- switch (nameScanner.getNextToken()) { >- case TerminalTokens.TokenNameIdentifier : >- int token = nameScanner.getNextToken(); >- if (token == TerminalTokens.TokenNameEOF && nameScanner.startPosition == suffixName.length) { >- if (!foundNames.includes(suffixName)) { >- acceptName(suffixName, prefixes[k], suffixes[l], k == 0, l == 0, internalPrefix.length - j, requestor); >- foundNames.add(suffixName); >- acceptDefaultName = false; >- } >- } >- break; >- default: >- suffixName = CharOperation.concat( >- prefixName, >- String.valueOf(1).toCharArray(), >- suffixes[l] >- ); >- suffixName = >- excludeNames( >- suffixName, >- prefixName, >- suffixes[l], >- excludedNames); >- nameScanner.setSource(suffixName); >- switch (nameScanner.getNextToken()) { >- case TerminalTokens.TokenNameIdentifier : >- token = nameScanner.getNextToken(); >- if (token == TerminalTokens.TokenNameEOF && nameScanner.startPosition == suffixName.length) { >- if (!foundNames.includes(suffixName)) { >- acceptName(suffixName, prefixes[k], suffixes[l], k == 0, l == 0, internalPrefix.length - j, requestor); >- foundNames.add(suffixName); >- acceptDefaultName = false; >- } >- } >- } >- } >- } catch(InvalidInputException e){ >- // ignore >- } >- } >- } >- continue next; >- } >- } >- } >- // if no names were found >- if(acceptDefaultName) { >- char[] name = excludeNames(DEFAULT_NAME, DEFAULT_NAME, CharOperation.NO_CHAR, excludedNames); >- requestor.acceptNameWithoutPrefixAndSuffix(name, 0); >- } >- } >- > > private static void acceptName( > char[] name, >@@ -311,35 +87,6 @@ > return name; > } > >- private static char[][] computeNames(char[] sourceName){ >- char[][] names = new char[5][]; >- int nameCount = 0; >- boolean previousIsUpperCase = false; >- boolean previousIsLetter = true; >- for(int i = sourceName.length - 1 ; i >= 0 ; i--){ >- boolean isUpperCase = ScannerHelper.isUpperCase(sourceName[i]); >- boolean isLetter = ScannerHelper.isLetter(sourceName[i]); >- if(isUpperCase && !previousIsUpperCase && previousIsLetter){ >- char[] name = CharOperation.subarray(sourceName,i,sourceName.length); >- if(name.length > 1){ >- if(nameCount == names.length) { >- System.arraycopy(names, 0, names = new char[nameCount * 2][], 0, nameCount); >- } >- name[0] = ScannerHelper.toLowerCase(name[0]); >- names[nameCount++] = name; >- } >- } >- previousIsUpperCase = isUpperCase; >- previousIsLetter = isLetter; >- } >- if(nameCount == 0){ >- names[nameCount++] = CharOperation.toLowerCase(sourceName); >- } >- System.arraycopy(names, 0, names = new char[nameCount][], 0, nameCount); >- return names; >- } >- >- > private static char[][] computeNonBaseTypeNames(char[] sourceName, boolean isConstantField){ > int length = sourceName.length; > >@@ -626,7 +373,7 @@ > break; > } > >- return InternalNamingConventions.removeVariablePrefixAndSuffix(name, prefixes, suffixes, true); >+ return InternalNamingConventions.removeVariablePrefixAndSuffix(name, prefixes, suffixes, true); > } > > private static char[] removeVariablePrefixAndSuffix(char[] name, char[][] prefixes, char[][] suffixes, boolean updateFirstCharacter) { >@@ -741,19 +488,6 @@ > > return withoutPrefixName; > } >- >- public static final boolean prefixEquals(char[] prefix, char[] name) { >- >- int max = prefix.length; >- if (name.length < max) >- return false; >- for (int i = max; >- --i >= 0; >- ) // assumes the prefix is not larger than the name >- if (prefix[i] != name[i]) >- return false; >- return true; >- } > > public static final int VK_STATIC_FIELD = 1; > public static final int VK_INSTANCE_FIELD = 2; >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.40 >diff -u -r1.40 NamingConventions.java >--- model/org/eclipse/jdt/core/NamingConventions.java 20 Nov 2008 09:35:00 -0000 1.40 >+++ model/org/eclipse/jdt/core/NamingConventions.java 20 Nov 2008 11:48:10 -0000 >@@ -12,7 +12,6 @@ > > import org.eclipse.jdt.core.compiler.CharOperation; > >-import org.eclipse.jdt.internal.codeassist.impl.AssistOptions; > import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; > import org.eclipse.jdt.internal.core.INamingRequestor; > import org.eclipse.jdt.internal.core.InternalNamingConventions; >@@ -316,46 +315,6 @@ > return c; > } > >- private static char[] removePrefixAndSuffix(char[] name, char[][] prefixes, char[][] suffixes) { >- // remove longer prefix >- char[] withoutPrefixName = name; >- if (prefixes != null) { >- int bestLength = 0; >- for (int i= 0; i < prefixes.length; i++) { >- char[] prefix = prefixes[i]; >- if (CharOperation.prefixEquals(prefix, name)) { >- int currLen = prefix.length; >- boolean lastCharIsLetter = ScannerHelper.isLetter(prefix[currLen - 1]); >- if(!lastCharIsLetter || (lastCharIsLetter && name.length > currLen && ScannerHelper.isUpperCase(name[currLen]))) { >- if (bestLength < currLen && name.length != currLen) { >- withoutPrefixName = CharOperation.subarray(name, currLen, name.length); >- bestLength = currLen; >- } >- } >- } >- } >- } >- >- // remove longer suffix >- char[] withoutSuffixName = withoutPrefixName; >- if(suffixes != null) { >- int bestLength = 0; >- for (int i = 0; i < suffixes.length; i++) { >- char[] suffix = suffixes[i]; >- if(CharOperation.endsWith(withoutPrefixName, suffix)) { >- int currLen = suffix.length; >- if(bestLength < currLen && withoutPrefixName.length != currLen) { >- withoutSuffixName = CharOperation.subarray(withoutPrefixName, 0, withoutPrefixName.length - currLen); >- bestLength = currLen; >- } >- } >- } >- } >- >- withoutSuffixName[0] = ScannerHelper.toLowerCase(withoutSuffixName[0]); >- return withoutSuffixName; >- } >- > /** > * Remove prefix and suffix from an argument name. > * <p> >@@ -382,11 +341,7 @@ > * @deprecated Use {@link #getBaseName(int, String, IJavaProject)} instead with {@link #VK_PARAMETER} as variable kind. > */ > public static char[] removePrefixAndSuffixForArgumentName(IJavaProject javaProject, char[] argumentName) { >- AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true)); >- return removePrefixAndSuffix( >- argumentName, >- assistOptions.argumentPrefixes, >- assistOptions.argumentSuffixes); >+ return InternalNamingConventions.removeVariablePrefixAndSuffix(VK_PARAMETER, javaProject, argumentName); > } > > /** >@@ -448,12 +403,10 @@ > * with {@link #VK_INSTANCE_FIELD} or {@link #VK_STATIC_FIELD} as variable kind. > */ > public static char[] removePrefixAndSuffixForFieldName(IJavaProject javaProject, char[] fieldName, int modifiers) { >- boolean isStatic = Flags.isStatic(modifiers); >- AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true)); >- return removePrefixAndSuffix( >- fieldName, >- isStatic ? assistOptions.staticFieldPrefixes : assistOptions.fieldPrefixes, >- isStatic ? assistOptions.staticFieldSuffixes : assistOptions.fieldSuffixes); >+ return InternalNamingConventions.removeVariablePrefixAndSuffix( >+ Flags.isStatic(modifiers) ? VK_STATIC_FIELD : VK_INSTANCE_FIELD, >+ javaProject, >+ fieldName); > } > > /** >@@ -516,11 +469,7 @@ > * @deprecated Use {@link #getBaseName(int, String, IJavaProject)} instead with {@link #VK_LOCAL} as variable kind. > */ > public static char[] removePrefixAndSuffixForLocalVariableName(IJavaProject javaProject, char[] localName) { >- AssistOptions assistOptions = new AssistOptions(javaProject.getOptions(true)); >- return removePrefixAndSuffix( >- localName, >- assistOptions.localPrefixes, >- assistOptions.localSuffixes); >+ return InternalNamingConventions.removeVariablePrefixAndSuffix(VK_LOCAL, javaProject, localName); > } > > /** >@@ -590,9 +539,19 @@ > IJavaProject javaProject) { > return String.valueOf(InternalNamingConventions.getBaseName(variableKind, javaProject, variableName.toCharArray())); > } >+ >+ private static int getFieldVariableKind(int modifiers) { >+ if (Flags.isStatic(modifiers)) { >+ if (Flags.isFinal(modifiers)) { >+ return VK_STATIC_FINAL_FIELD; >+ } >+ return VK_STATIC_FIELD; >+ } >+ return VK_INSTANCE_FIELD; >+ } > > private static char[] suggestAccessorName(IJavaProject project, char[] fieldName, int modifiers) { >- char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers); >+ char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName); > if (name.length > 0 && ScannerHelper.isLowerCase(name[0])) { > name[0] = ScannerHelper.toUpperCase(name[0]); > } >@@ -630,17 +589,24 @@ > * @deprecated Use {@link #suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean)} instead with {@link #VK_PARAMETER} as variable kind. > */ > public static char[][] suggestArgumentNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames) { >- NamingRequestor requestor = new NamingRequestor(); >- InternalNamingConventions.suggestArgumentNames( >- javaProject, >- packageName, >- qualifiedTypeName, >- dim, >- null, >- excludedNames, >- requestor); >- >- return requestor.getResults(); >+ if(qualifiedTypeName == null || qualifiedTypeName.length == 0) >+ return CharOperation.NO_CHAR_CHAR; >+ >+ char[] typeName = CharOperation.lastSegment(qualifiedTypeName, '.'); >+ >+ NamingRequestor requestor = new NamingRequestor(); >+ InternalNamingConventions.suggestVariableNames( >+ VK_PARAMETER, >+ BK_TYPE_NAME, >+ typeName, >+ javaProject, >+ dim, >+ null, >+ excludedNames, >+ true, >+ requestor); >+ >+ return requestor.getResults(); > } > > /** >@@ -719,18 +685,24 @@ > * with {@link #VK_INSTANCE_FIELD} or {@link #VK_STATIC_FIELD} as variable kind. > */ > public static char[][] suggestFieldNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, int modifiers, char[][] excludedNames) { >- NamingRequestor requestor = new NamingRequestor(); >- InternalNamingConventions.suggestFieldNames( >- javaProject, >- packageName, >- qualifiedTypeName, >- dim, >- modifiers, >- null, >- excludedNames, >- requestor); >- >- return requestor.getResults(); >+ if(qualifiedTypeName == null || qualifiedTypeName.length == 0) >+ return CharOperation.NO_CHAR_CHAR; >+ >+ char[] typeName = CharOperation.lastSegment(qualifiedTypeName, '.'); >+ >+ NamingRequestor requestor = new NamingRequestor(); >+ InternalNamingConventions.suggestVariableNames( >+ Flags.isStatic(modifiers) ? VK_STATIC_FIELD : VK_INSTANCE_FIELD, >+ BK_TYPE_NAME, >+ typeName, >+ javaProject, >+ dim, >+ null, >+ excludedNames, >+ true, >+ requestor); >+ >+ return requestor.getResults(); > } > > /** >@@ -812,7 +784,7 @@ > */ > public static char[] suggestGetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) { > if (isBoolean) { >- char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers); >+ char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName); > int prefixLen = GETTER_BOOL_NAME.length; > if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name) > && name.length > prefixLen && ScannerHelper.isUpperCase(name[prefixLen])) { >@@ -901,17 +873,25 @@ > * @deprecated Use {@link #suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean)} instead with {@link #VK_LOCAL} as variable kind. > */ > public static char[][] suggestLocalVariableNames(IJavaProject javaProject, char[] packageName, char[] qualifiedTypeName, int dim, char[][] excludedNames) { >+ if(qualifiedTypeName == null || qualifiedTypeName.length == 0) >+ return CharOperation.NO_CHAR_CHAR; >+ >+ char[] typeName = CharOperation.lastSegment(qualifiedTypeName, '.'); >+ > NamingRequestor requestor = new NamingRequestor(); >- InternalNamingConventions.suggestLocalVariableNames( >- javaProject, >- packageName, >- qualifiedTypeName, >- dim, >- null, >- excludedNames, >- requestor); >- >+ InternalNamingConventions.suggestVariableNames( >+ VK_LOCAL, >+ BK_TYPE_NAME, >+ typeName, >+ javaProject, >+ dim, >+ null, >+ excludedNames, >+ true, >+ requestor); >+ > return requestor.getResults(); >+ > } > /** > * Suggest names for a local variable. The name is computed from variable's type >@@ -1004,7 +984,7 @@ > public static char[] suggestSetterName(IJavaProject project, char[] fieldName, int modifiers, boolean isBoolean, char[][] excludedNames) { > > if (isBoolean) { >- char[] name = removePrefixAndSuffixForFieldName(project, fieldName, modifiers); >+ char[] name = InternalNamingConventions.getBaseName(getFieldVariableKind(modifiers), project, fieldName); > int prefixLen = GETTER_BOOL_NAME.length; > if (CharOperation.prefixEquals(GETTER_BOOL_NAME, name) > && name.length > prefixLen && ScannerHelper.isUpperCase(name[prefixLen])) { >#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.24 >diff -u -r1.24 NamingConventionTests.java >--- src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java 20 Nov 2008 09:35:02 -0000 1.24 >+++ src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java 20 Nov 2008 11:48:12 -0000 >@@ -1052,6 +1052,23 @@ > "getÉfield", //$NON-NLS-1$ > new String(suggestion)); > } >+public void testSuggestGetterName009() { >+ Hashtable options = JavaCore.getOptions(); >+ options.put(JavaCore.CODEASSIST_STATIC_FINAL_FIELD_PREFIXES,"PRE_"); //$NON-NLS-1$ >+ options.put(JavaCore.CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES,"_SUF"); //$NON-NLS-1$ >+ JavaCore.setOptions(options); >+ >+ char[] suggestion = NamingConventions.suggestGetterName( >+ this.project, >+ "PRE_FIELD_NAME_SUF".toCharArray(), //$NON-NLS-1$ >+ Flags.AccStatic | Flags.AccFinal, >+ false, >+ CharOperation.NO_CHAR_CHAR); >+ >+ assumeEquals( >+ "getFieldName", //$NON-NLS-1$ >+ new String(suggestion)); >+} > public void testSuggestSetterName001() { > char[] suggestion = NamingConventions.suggestSetterName( > this.project, >@@ -1076,6 +1093,23 @@ > "setIsSomething", //$NON-NLS-1$ > new String(suggestion)); > } >+public void testSuggestSetterName003() { >+ Hashtable options = JavaCore.getOptions(); >+ options.put(JavaCore.CODEASSIST_STATIC_FINAL_FIELD_PREFIXES,"PRE_"); //$NON-NLS-1$ >+ options.put(JavaCore.CODEASSIST_STATIC_FINAL_FIELD_SUFFIXES,"_SUF"); //$NON-NLS-1$ >+ JavaCore.setOptions(options); >+ >+ char[] suggestion = NamingConventions.suggestSetterName( >+ this.project, >+ "PRE_FIELD_NAME_SUF".toCharArray(), //$NON-NLS-1$ >+ Flags.AccStatic | Flags.AccFinal, >+ false, >+ CharOperation.NO_CHAR_CHAR); >+ >+ assumeEquals( >+ "setFieldName", //$NON-NLS-1$ >+ new String(suggestion)); >+} > /* > * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=133562 > */
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 251693
: 118352