Eclipse 3.5 Plug-in Migration FAQ
-
How can I remove the deprecation warning I get on
createWilcardTypeBindingKey(String, char)
method ?
-
How can I remove the deprecation warning I get on
NamingConventions.suggest*Names(...)
methods and keep same behavior?
-
How can I remove the deprecation warning I get on
NamingConventions.removePrefixAndSuffixFor*Name(...)
methods and keep same behavior?
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:
- a generic type (a wildcard is always the wildcard of a generic type)
- a kind
- a bound type (optional)
- a rank (the relative position of the wildcard in the type argument list, e.g. in
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.
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)
- A call to
suggestArgumentNames(...)
can be replaced by a call to suggestVariableNames(...)
with NamingConventions#VK_PARAMETER
as variable kind
- A call to
suggestFieldNames(...)
can be replaced by a call to suggestVariableNames(...)
with NamingConventions#VK_INSTANCE_FIELD
or NamingConventions#VK_STATIC_FIELD
as variable kind
- A call to
suggestLocalVariableNames(...)
can be replaced by a call to suggestVariableNames(...)
with NamingConventions#VK_LOCAL
as variable kind
The 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);
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)
- A call to
removePrefixAndSuffixForArgumentName(...)
can be replaced by a call to getBaseName(...)
with NamingConventions#VK_PARAMETER
as variable kind
- A call to
removePrefixAndSuffixForFieldName(...)
can be replaced by a call to getBaseName(...)
with NamingConventions#VK_INSTANCE_FIELD
or NamingConventions#VK_STATIC_FIELD
as variable kind
- A call to
removePrefixAndSuffixForLocalVariableName(...)
can be replaced by a call to getBaseName(...)
with NamingConventions#VK_LOCAL
as variable kind
The 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);