Eclipse 3.5 Plug-in Migration FAQ

  1. How can I remove the deprecation warning I get on createWilcardTypeBindingKey(String, char) method ?
  2. How can I remove the deprecation warning I get on NamingConventions.suggest*Names(...) methods and keep same behavior?
  3. How can I remove the deprecation warning I get on NamingConventions.removePrefixAndSuffixFor*Name(...) methods and keep same behavior?

How can I remove the deprecation warning I get on 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:

  1. a generic type (a wildcard is always the wildcard of a generic type)
  2. a kind
  3. a bound type (optional)
  4. 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.

How can I remove deprecation warning I get on NamingConventions.suggest*Names(...) methods and keep same behavior?

While implementing bug 38111, following methods have been deprecated:

  1. NamingConventions#suggestArgumentNames(IJavaProject, char[], char[], int, char[][])
  2. NamingConventions#suggestArgumentNames(IJavaProject, String, String, int, String[])
  3. NamingConventions#suggestFieldNames(IJavaProject, char[], char[], int, int, char[][])
  4. NamingConventions#suggestFieldNames(IJavaProject, String, String, int, int, String[])
  5. NamingConventions#suggestLocalVariableNames(IJavaProject, char[], char[], int, char[][])
  6. 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)

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);

How can I remove deprecation warning I get on NamingConventions.removePrefixAndSuffixFor*Name(...) methods and keep same behavior?

While implementing bug 38111, following methods have been deprecated:

  1. NamingConventions#removePrefixAndSuffixForArgumentName(IJavaProject, char[])
  2. NamingConventions#removePrefixAndSuffixForArgumentName(IJavaProject, String)
  3. NamingConventions#removePrefixAndSuffixForFieldName(IJavaProject, char[], int)
  4. NamingConventions#removePrefixAndSuffixForFieldName(IJavaProject, String, int)
  5. NamingConventions#removePrefixAndSuffixForLocalVariableName(IJavaProject, char[])
  6. 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)

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);