public class SharedSecrets
extends Object
This is a backdoor mechanism in Java 6 to allow (some sort of)
controlled access to internals between packages, using
sun.misc.* interfaces (e.g. JavaLangAccess) that are anonymously
instantiated within the exporting package (e.g. java.lang), and
obtained via SharedSecrets, which in turn obtains the
instances from sun.misc.Unsafe. For most packages these interface
objects are created on demand by static init of some key classes of
these packages that call the SharedSecrets setters
(except for JavaLangAccess and JavaNetAccess)
Since this is used from within the standard libraries of Java 6, we need
some sort of support, but we don't want to break Java 1.5 yet by introducing
lots of Java 6 dependencies, which would force us to duplicate their code
even though it might be pure Java (like java.io.Console).
This is a can of worms, which we only open partially to support
EnumSets for both Java 1.5 and 6. We make the cut at java.* packages -
if the backdoor interfaces/types require anything outside sun.* packages,
we leave it out.
All of this is hopefully going away when we drop Java 1.5 support, and is
to be replaced by some native peers providing the required native calls