QuestionQ7

Understanding Packages

The opportunityService and opportunityServiceTest classes reside in package A but are used only by package B. Both second-generation packages share the same namespace. Therefore, the classes should be moved to package B for improved organization and control.

What should the architect recommend for this process?

  • A Move the classes of package A to package B and change the code for package B that called this class from package A.
  • B Set the classes as deprecated in package A and recreate them in package B with new names.
  • C Move the classes of package A to package B and create new package versions.
  • D Set the classes as deprecated in package A and recreate them in package B.
Explanation

Second-generation managed packages that share a namespace can share public Apex code across packages in that namespace. Moving the existing Apex classes to the consuming package preserves the namespace-qualified class identity, so package B does not need caller-code changes or replacement classes. The changed contents of both packages must be released through new package versions, because each package version is an immutable snapshot of its metadata.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!