Modifying and depreciating the application API

Once a global class method or member has been effectively published by including it in a released package, it cannot be removed or changed (this was discussed in Chapter 1, Building and Publishing Your Application, as part of the discussion on managing package ancestry). If you were to create a scratch org configured with your package ancestry, as described in Chapter 1, Building and Publishing Your Application, if you tried changing the ComplianceService.verify method by renaming it verification (for example), when you attempt to push the class to such a scratch org, you will receive the following error:

(ComplianceService) Global/WebService identifiers cannot be removed from managed application: Method: void verify(SET<Id>)  (Line: 1) 
If you want to perform some testing or distribute your package while reserving the ability to make changes to your new APIs, create your package as beta until you are happy with your API definition. Note that you can, of course, change the behavior of your API (determined by the Apex code behind it) at any time, though this has to be done with care.

The @Depreciated annotation can be used to effectively remove the visibility of the class, interface, method, or member that global has been applied to from the perspective of subsequent package version consumers. Developer X can still access the deprecated items by referencing an earlier version of the package through the class version settings shown via the Version Settings tab as described in more detail in the following sections.

The @Deprecated annotation can only be used in scratch orgs configured with a package ancestry, as described in Chapter 1, Building and Publishing Your Application.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.86.18