6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.internal.misc; 27 28 import javax.crypto.SealedObject; 29 import java.io.ObjectInputFilter; 30 import java.lang.module.ModuleDescriptor; 31 import java.util.ResourceBundle; 32 import java.util.jar.JarFile; 33 import java.io.Console; 34 import java.io.FileDescriptor; 35 import java.io.FilePermission; 36 import java.io.ObjectInputStream; 37 import java.io.RandomAccessFile; 38 import java.security.ProtectionDomain; 39 40 /** A repository of "shared secrets", which are a mechanism for 41 calling implementation-private methods in another package without 42 using reflection. A package-private class implements a public 43 interface and provides the ability to call package-private methods 44 within that package; the object implementing that interface is 45 provided through a third package to which access is restricted. 46 This framework avoids the primary disadvantage of using reflection 47 for this purpose, namely the loss of compile-time checking. */ 48 49 public class SharedSecrets { 50 private static final Unsafe unsafe = Unsafe.getUnsafe(); 51 private static JavaUtilJarAccess javaUtilJarAccess; 52 private static JavaLangAccess javaLangAccess; 53 private static JavaLangModuleAccess javaLangModuleAccess; 54 private static JavaLangInvokeAccess javaLangInvokeAccess; 55 private static JavaLangRefAccess javaLangRefAccess; 56 private static JavaIOAccess javaIOAccess; 57 private static JavaNetInetAddressAccess javaNetInetAddressAccess; 58 private static JavaNetHttpCookieAccess javaNetHttpCookieAccess; 59 private static JavaNetSocketAccess javaNetSocketAccess; 60 private static JavaNetUriAccess javaNetUriAccess; 61 private static JavaNetURLAccess javaNetURLAccess; 62 private static JavaNetURLClassLoaderAccess javaNetURLClassLoaderAccess; 63 private static JavaNioAccess javaNioAccess; 64 private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; 65 private static JavaIOFilePermissionAccess javaIOFilePermissionAccess; 66 private static JavaSecurityAccess javaSecurityAccess; 67 private static JavaUtilZipFileAccess javaUtilZipFileAccess; 68 private static JavaUtilResourceBundleAccess javaUtilResourceBundleAccess; 69 private static JavaAWTAccess javaAWTAccess; 70 private static JavaAWTFontAccess javaAWTFontAccess; | 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.internal.access; 27 28 import javax.crypto.SealedObject; 29 import java.io.ObjectInputFilter; 30 import java.lang.module.ModuleDescriptor; 31 import java.util.ResourceBundle; 32 import java.util.jar.JarFile; 33 import java.io.Console; 34 import java.io.FileDescriptor; 35 import java.io.FilePermission; 36 import java.io.ObjectInputStream; 37 import java.io.RandomAccessFile; 38 import java.security.ProtectionDomain; 39 40 /** A repository of "shared secrets", which are a mechanism for 41 calling implementation-private methods in another package without 42 using reflection. A package-private class implements a public 43 interface and provides the ability to call package-private methods 44 within that package; the object implementing that interface is 45 provided through a third package to which access is restricted. 46 This framework avoids the primary disadvantage of using reflection 47 for this purpose, namely the loss of compile-time checking. */ 48 49 public class SharedSecrets { 50 private static final jdk.internal.misc.Unsafe unsafe = 51 jdk.internal.misc.Unsafe.getUnsafe(); 52 private static JavaUtilJarAccess javaUtilJarAccess; 53 private static JavaLangAccess javaLangAccess; 54 private static JavaLangModuleAccess javaLangModuleAccess; 55 private static JavaLangInvokeAccess javaLangInvokeAccess; 56 private static JavaLangRefAccess javaLangRefAccess; 57 private static JavaIOAccess javaIOAccess; 58 private static JavaNetInetAddressAccess javaNetInetAddressAccess; 59 private static JavaNetHttpCookieAccess javaNetHttpCookieAccess; 60 private static JavaNetSocketAccess javaNetSocketAccess; 61 private static JavaNetUriAccess javaNetUriAccess; 62 private static JavaNetURLAccess javaNetURLAccess; 63 private static JavaNetURLClassLoaderAccess javaNetURLClassLoaderAccess; 64 private static JavaNioAccess javaNioAccess; 65 private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; 66 private static JavaIOFilePermissionAccess javaIOFilePermissionAccess; 67 private static JavaSecurityAccess javaSecurityAccess; 68 private static JavaUtilZipFileAccess javaUtilZipFileAccess; 69 private static JavaUtilResourceBundleAccess javaUtilResourceBundleAccess; 70 private static JavaAWTAccess javaAWTAccess; 71 private static JavaAWTFontAccess javaAWTFontAccess; |