Deprecated Annotation

Use the deprecated annotation to identify methods, classes, exceptions, enums, interfaces, or variables that can no longer be referenced in subsequent releases of the managed package in which they reside. This is useful when you are refactoring code in managed packages as the requirements evolve. New subscribers cannot see the deprecated elements, while the elements continue to function for existing subscribers and API integrations.

The following code snippet shows a deprecated method. The same syntax can be used to deprecate classes, exceptions, enums, interfaces, or variables.

  @deprecated
  // This method is deprecated. Use myOptimizedMethod(String a, String b) instead. 
    
  public void myMethod(String a) {
   
}

Note the following rules when deprecating Apex identifiers:

For more information about package versions, see Developing Apex in Managed Packages.

© Copyright 2000–2012 salesforce.com, inc. All rights reserved.
Various trademarks held by their respective owners.