Apex Code Items that Are Not Versioned
You can change the behavior of some Apex items across package versions. For example, you can deprecate a method so that new subscribers can no longer reference the package in a subsequent version.
However, the following list of modifiers, keywords, and annotations cannot be versioned. If a package developer makes changes to one of the following modifiers, keywords, or annotations, the changes are reflected across all package versions.
There are limitations on the changes that you can make to some of these items when they are used in Apex code in managed packages.
Package developers can add or remove the following items:
- @future
- @isTest
- with sharing
- without sharing
- transient
Package developers can make limited changes to the following items:
- private—can be changed to global
- public—can be changed to global
- protected—can be changed to global
- abstract—can be changed to virtual but cannot be removed
- final—can be removed but cannot be added
Package developers cannot remove or change the following items:
- global
- virtual
If a package upgrade includes an explicit global constructor for an already released global class (that previously only had an implicit constructor) the new, explicit constructor will be called from the subscriber. Additionally, you cannot reduce the access modifier on the default constructor on a released global class in a package.