I have created a sample app in developer org and set the class modifier as global and then released its final version as managed package. Now it was caught in security review , now I have to make it Public. When I edit it and try to save it, it shows me error Cannot change it back to public. Any solution to this?
Create a differently name public class and move the global class logic into that and convert your internal code to use that public class instead. Then:
- attempt to delete the global class but based on the special mention of global in Deleting Components from Managed Packages I suspect that can't be done
- add the @deprecated annotation to the global class (but if the code is pushed into non-namespace orgs as part of your development process that won't be possible as it will stop the code compiling in those orgs)
- empty out the methods of the class (so the class doesn't add much to your untested line count) and add a comment explaining that it is no longer used but has to be kept because of the packaging issue; you could also add a throw of an exception with an explanatory message to each method
Alternatively you could move all your code to an org with a different namespace and so be able to cleanup as you please. But that is only practical if the package isn't already in use and isn't too far into processes like the security review you mention.