createWilcardTypeBindingKey(String, char) method ?NamingConventions.suggest*Names(...) methods and keep same behavior?NamingConventions.removePrefixAndSuffixFor*Name(...) methods and keep same behavior?createWilcardTypeBindingKey(String, char) method ?
While implementing the fix for bug 234609,
the method org.eclipse.jdt.core.BindingKey.createWilcardTypeBindingKey(String, char)
has been deprecated.
In order to create a wildcard binding the following pieces of information are needed:
HashMap<? extends Integer,? super String>, the wildcard type
? extends Integer has a rank of 0 while the following wildcard has a rank of 1)All this information should be encoded in the binding key.
However, BindingKey.createWilcardTypeBindingKey(String, char) allows to pass in only partial information.
Thus this API is not enough to create a proper binding key from which a wildcard type could be recreated.
Hence this method has been deprecated and it is recommended that uses of this method be replaced with the
new API org.eclipse.jdt.core.BindingKey.createWildcardTypeBindingKey(String genericTypeKey, char boundKind, String boundTypeKey, int rank) introduced as of version 3.5.
NamingConventions.suggest*Names(...) methods and keep same behavior?While implementing bug 38111, following methods have been deprecated:
NamingConventions#suggestArgumentNames(IJavaProject, char[], char[], int, char[][])NamingConventions#suggestArgumentNames(IJavaProject, String, String, int, String[])NamingConventions#suggestFieldNames(IJavaProject, char[], char[], int, int, char[][])NamingConventions#suggestFieldNames(IJavaProject, String, String, int, int, String[])NamingConventions#suggestLocalVariableNames(IJavaProject, char[], char[], int, char[][])NamingConventions#suggestLocalVariableNames(IJavaProject, String, String, int, String[])This answer gives some advice to use new API corresponding methods without changing the behavior of the existing code.
A call to one of these methods can be replaced by a call to NamingConventions#suggestVariableNames(int, int, String, IJavaProject, int, String[], boolean)
suggestArgumentNames(...) can be replaced by a call to suggestVariableNames(...) with NamingConventions#VK_PARAMETER as variable kindsuggestFieldNames(...) can be replaced by a call to suggestVariableNames(...) with NamingConventions#VK_INSTANCE_FIELD or NamingConventions#VK_STATIC_FIELD as variable kindsuggestLocalVariableNames(...) can be replaced by a call to suggestVariableNames(...) with NamingConventions#VK_LOCAL as variable kindThe following code
IJavaProject javaProject = ... ; String[] argumentNames = NamingConventions.suggestArgumentNames(javaProject, "java.util", "ArrayList", 0, null);
can be replaced by:
IJavaProject javaProject = ... ; String[] argumentNames = NamingConventions.suggestVariableNames(NamingConventions.VK_PARAMETER, NamingConventions.BK_TYPE_NAME, "ArrayList", javaProject, 0, null, true);
NamingConventions.removePrefixAndSuffixFor*Name(...) methods and keep same behavior?While implementing bug 38111, following methods have been deprecated:
NamingConventions#removePrefixAndSuffixForArgumentName(IJavaProject, char[])NamingConventions#removePrefixAndSuffixForArgumentName(IJavaProject, String)NamingConventions#removePrefixAndSuffixForFieldName(IJavaProject, char[], int)NamingConventions#removePrefixAndSuffixForFieldName(IJavaProject, String, int)NamingConventions#removePrefixAndSuffixForLocalVariableName(IJavaProject, char[])NamingConventions#removePrefixAndSuffixForLocalVariableName(IJavaProject, String)This answer gives some advice to use new API corresponding methods without changing the behavior of the existing code.
A call to one of these methods can be replaced by a call to NamingConventions#getBaseName(int, String, IJavaProject)
removePrefixAndSuffixForArgumentName(...) can be replaced by a call to getBaseName(...) with NamingConventions#VK_PARAMETER as variable kindremovePrefixAndSuffixForFieldName(...) can be replaced by a call to getBaseName(...) with NamingConventions#VK_INSTANCE_FIELD or NamingConventions#VK_STATIC_FIELD as variable kindremovePrefixAndSuffixForLocalVariableName(...) can be replaced by a call to getBaseName(...) with NamingConventions#VK_LOCAL as variable kindThe following code
IJavaProject javaProject = ... ; String name = NamingConventions.removePrefixAndSuffixForArgumentName(javaProject, "preNamesuf");
can be replaced by
IJavaProject javaProject = ... ; String name = NamingConventions.getBaseName(NamingConventions.VK_PARAMETER, "preNamesuf", javaProject);