jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java
changeset 37584 0cc00d7a0755
parent 36511 9d0388c6b336
child 38466 4bcf5f2bb351
equal deleted inserted replaced
37583:60553c2df76e 37584:0cc00d7a0755
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    27 
    27 
    28 import java.lang.module.ModuleDescriptor;
    28 import java.lang.module.ModuleDescriptor;
    29 import java.util.jar.JarFile;
    29 import java.util.jar.JarFile;
    30 import java.io.Console;
    30 import java.io.Console;
    31 import java.io.FileDescriptor;
    31 import java.io.FileDescriptor;
       
    32 import java.io.ObjectInputStream;
    32 import java.security.ProtectionDomain;
    33 import java.security.ProtectionDomain;
    33 import java.security.AccessController;
    34 import java.security.AccessController;
    34 import jdk.internal.misc.Unsafe;
       
    35 
    35 
    36 /** A repository of "shared secrets", which are a mechanism for
    36 /** A repository of "shared secrets", which are a mechanism for
    37     calling implementation-private methods in another package without
    37     calling implementation-private methods in another package without
    38     using reflection. A package-private class implements a public
    38     using reflection. A package-private class implements a public
    39     interface and provides the ability to call package-private methods
    39     interface and provides the ability to call package-private methods
    61     private static JavaUtilZipFileAccess javaUtilZipFileAccess;
    61     private static JavaUtilZipFileAccess javaUtilZipFileAccess;
    62     private static JavaUtilResourceBundleAccess javaUtilResourceBundleAccess;
    62     private static JavaUtilResourceBundleAccess javaUtilResourceBundleAccess;
    63     private static JavaAWTAccess javaAWTAccess;
    63     private static JavaAWTAccess javaAWTAccess;
    64     private static JavaAWTFontAccess javaAWTFontAccess;
    64     private static JavaAWTFontAccess javaAWTFontAccess;
    65     private static JavaBeansAccess javaBeansAccess;
    65     private static JavaBeansAccess javaBeansAccess;
       
    66     private static JavaObjectInputStreamAccess javaObjectInputStreamAccess;
    66 
    67 
    67     public static JavaUtilJarAccess javaUtilJarAccess() {
    68     public static JavaUtilJarAccess javaUtilJarAccess() {
    68         if (javaUtilJarAccess == null) {
    69         if (javaUtilJarAccess == null) {
    69             // Ensure JarFile is initialized; we know that that class
    70             // Ensure JarFile is initialized; we know that that class
    70             // provides the shared secret
    71             // provides the shared secret
   260     }
   261     }
   261 
   262 
   262     public static void setJavaUtilResourceBundleAccess(JavaUtilResourceBundleAccess access) {
   263     public static void setJavaUtilResourceBundleAccess(JavaUtilResourceBundleAccess access) {
   263         javaUtilResourceBundleAccess = access;
   264         javaUtilResourceBundleAccess = access;
   264     }
   265     }
       
   266 
       
   267     public static JavaObjectInputStreamAccess getJavaObjectInputStreamAccess() {
       
   268         if (javaObjectInputStreamAccess == null) {
       
   269             unsafe.ensureClassInitialized(ObjectInputStream.class);
       
   270         }
       
   271         return javaObjectInputStreamAccess;
       
   272     }
       
   273 
       
   274     public static void setJavaObjectInputStreamAccess(JavaObjectInputStreamAccess access) {
       
   275         javaObjectInputStreamAccess = access;
       
   276     }
   265 }
   277 }