jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java
author ctornqvi
Tue, 24 Nov 2015 10:12:32 -0800
changeset 34370 70d1245398ed
parent 34362 3396ae214e7d
child 34372 ccdd9223ab7a
permissions -rw-r--r--
8143931: Back out JDK-8140450 Reviewed-by: coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30906
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
     2
 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5462
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5462
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5462
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5462
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5462
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
32834
e1dca5fe4de3 8137056: Move SharedSecrets and interface friends out of sun.misc
chegar
parents: 31918
diff changeset
    26
package jdk.internal.misc;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.jar.JarFile;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.Console;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.FileDescriptor;
5288
e91651d24b2a 6909281: 6u19 b99(pit):Error loading first applet in browser session( both FF && IE, windows ): NPE is thrown
mullan
parents: 5183
diff changeset
    31
import java.security.ProtectionDomain;
8816
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
    32
import java.security.AccessController;
33674
566777f73c32 8140606: Update library code to use internal Unsafe
chegar
parents: 32834
diff changeset
    33
import jdk.internal.misc.Unsafe;
8816
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
    34
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/** A repository of "shared secrets", which are a mechanism for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    calling implementation-private methods in another package without
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    using reflection. A package-private class implements a public
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    interface and provides the ability to call package-private methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    within that package; the object implementing that interface is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
    provided through a third package to which access is restricted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    This framework avoids the primary disadvantage of using reflection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    for this purpose, namely the loss of compile-time checking. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
public class SharedSecrets {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private static final Unsafe unsafe = Unsafe.getUnsafe();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private static JavaUtilJarAccess javaUtilJarAccess;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private static JavaLangAccess javaLangAccess;
23009
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    48
    private static JavaLangRefAccess javaLangRefAccess;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private static JavaIOAccess javaIOAccess;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    private static JavaNetAccess javaNetAccess;
31918
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
    51
    private static JavaNetInetAddressAccess javaNetInetAddressAccess;
11284
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
    52
    private static JavaNetHttpCookieAccess javaNetHttpCookieAccess;
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
    53
    private static JavaNioAccess javaNioAccess;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
    55
    private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
8816
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
    56
    private static JavaSecurityAccess javaSecurityAccess;
18223
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
    57
    private static JavaUtilZipFileAccess javaUtilZipFileAccess;
11896
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
    58
    private static JavaAWTAccess javaAWTAccess;
25385
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
    59
    private static JavaAWTFontAccess javaAWTFontAccess;
30906
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
    60
    private static JavaBeansAccess javaBeansAccess;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public static JavaUtilJarAccess javaUtilJarAccess() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        if (javaUtilJarAccess == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
            // Ensure JarFile is initialized; we know that that class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
            // provides the shared secret
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
            unsafe.ensureClassInitialized(JarFile.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        return javaUtilJarAccess;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public static void setJavaUtilJarAccess(JavaUtilJarAccess access) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        javaUtilJarAccess = access;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public static void setJavaLangAccess(JavaLangAccess jla) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        javaLangAccess = jla;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public static JavaLangAccess getJavaLangAccess() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        return javaLangAccess;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
23009
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    83
    public static void setJavaLangRefAccess(JavaLangRefAccess jlra) {
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    84
        javaLangRefAccess = jlra;
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    85
    }
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    86
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    87
    public static JavaLangRefAccess getJavaLangRefAccess() {
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    88
        return javaLangRefAccess;
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    89
    }
e2c92ddeb57f 6857566: (bf) DirectByteBuffer garbage creation can outpace reclamation
plevart
parents: 19809
diff changeset
    90
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public static void setJavaNetAccess(JavaNetAccess jna) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        javaNetAccess = jna;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public static JavaNetAccess getJavaNetAccess() {
31918
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
    96
        if (javaNetAccess == null)
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
    97
            unsafe.ensureClassInitialized(java.net.URLClassLoader.class);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        return javaNetAccess;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
31918
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   101
    public static void setJavaNetInetAddressAccess(JavaNetInetAddressAccess jna) {
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   102
        javaNetInetAddressAccess = jna;
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   103
    }
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   104
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   105
    public static JavaNetInetAddressAccess getJavaNetInetAddressAccess() {
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   106
        return javaNetInetAddressAccess;
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   107
    }
1f13aceb00d7 8132705: Refactor SharedSecrets in sun.misc.JavaNetAccess
rriggs
parents: 30906
diff changeset
   108
11284
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   109
    public static void setJavaNetHttpCookieAccess(JavaNetHttpCookieAccess a) {
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   110
        javaNetHttpCookieAccess = a;
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   111
    }
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   112
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   113
    public static JavaNetHttpCookieAccess getJavaNetHttpCookieAccess() {
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   114
        if (javaNetHttpCookieAccess == null)
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   115
            unsafe.ensureClassInitialized(java.net.HttpCookie.class);
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   116
        return javaNetHttpCookieAccess;
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   117
    }
2750cfd2352c 7095980: Ensure HttpURLConnection (and supporting APIs) don't expose HttpOnly cookies
chegar
parents: 10044
diff changeset
   118
1143
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   119
    public static void setJavaNioAccess(JavaNioAccess jna) {
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   120
        javaNioAccess = jna;
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   121
    }
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   122
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   123
    public static JavaNioAccess getJavaNioAccess() {
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   124
        if (javaNioAccess == null) {
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   125
            // Ensure java.nio.ByteOrder is initialized; we know that
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   126
            // this class initializes java.nio.Bits that provides the
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   127
            // shared secret.
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   128
            unsafe.ensureClassInitialized(java.nio.ByteOrder.class);
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   129
        }
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   130
        return javaNioAccess;
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   131
    }
645d4b930f93 6682020: (bf) Support monitoring of direct and mapped buffer usage
alanb
parents: 2
diff changeset
   132
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public static void setJavaIOAccess(JavaIOAccess jia) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        javaIOAccess = jia;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public static JavaIOAccess getJavaIOAccess() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        if (javaIOAccess == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            unsafe.ensureClassInitialized(Console.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return javaIOAccess;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    public static void setJavaIOFileDescriptorAccess(JavaIOFileDescriptorAccess jiofda) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        javaIOFileDescriptorAccess = jiofda;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    public static JavaIOFileDescriptorAccess getJavaIOFileDescriptorAccess() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        if (javaIOFileDescriptorAccess == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            unsafe.ensureClassInitialized(FileDescriptor.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        return javaIOFileDescriptorAccess;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   155
    public static void setJavaSecurityProtectionDomainAccess
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   156
        (JavaSecurityProtectionDomainAccess jspda) {
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   157
            javaSecurityProtectionDomainAccess = jspda;
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   158
    }
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   159
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   160
    public static JavaSecurityProtectionDomainAccess
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   161
        getJavaSecurityProtectionDomainAccess() {
5288
e91651d24b2a 6909281: 6u19 b99(pit):Error loading first applet in browser session( both FF && IE, windows ): NPE is thrown
mullan
parents: 5183
diff changeset
   162
            if (javaSecurityProtectionDomainAccess == null)
e91651d24b2a 6909281: 6u19 b99(pit):Error loading first applet in browser session( both FF && IE, windows ): NPE is thrown
mullan
parents: 5183
diff changeset
   163
                unsafe.ensureClassInitialized(ProtectionDomain.class);
5183
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   164
            return javaSecurityProtectionDomainAccess;
7825d97c4cf2 6633872: Policy/PolicyFile leak dynamic ProtectionDomains.
mullan
parents: 2277
diff changeset
   165
    }
8816
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   166
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   167
    public static void setJavaSecurityAccess(JavaSecurityAccess jsa) {
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   168
        javaSecurityAccess = jsa;
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   169
    }
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   170
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   171
    public static JavaSecurityAccess getJavaSecurityAccess() {
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   172
        if (javaSecurityAccess == null) {
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   173
            unsafe.ensureClassInitialized(AccessController.class);
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   174
        }
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   175
        return javaSecurityAccess;
29f983feda95 6907662: System clipboard should ensure access restrictions
denis
parents: 8556
diff changeset
   176
    }
11896
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   177
18223
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   178
    public static JavaUtilZipFileAccess getJavaUtilZipFileAccess() {
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   179
        if (javaUtilZipFileAccess == null)
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   180
            unsafe.ensureClassInitialized(java.util.zip.ZipFile.class);
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   181
        return javaUtilZipFileAccess;
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   182
    }
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   183
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   184
    public static void setJavaUtilZipFileAccess(JavaUtilZipFileAccess access) {
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   185
        javaUtilZipFileAccess = access;
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   186
    }
35a5c2462991 8008593: Better URLClassLoader resource management
chegar
parents: 11902
diff changeset
   187
11896
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   188
    public static void setJavaAWTAccess(JavaAWTAccess jaa) {
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   189
        javaAWTAccess = jaa;
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   190
    }
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   191
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   192
    public static JavaAWTAccess getJavaAWTAccess() {
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   193
        // this may return null in which case calling code needs to
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   194
        // provision for.
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   195
        return javaAWTAccess;
eb4d5334fccf 6351654: Problem with java/classes_util_i18n
okutsu
parents: 10044
diff changeset
   196
    }
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents: 23009
diff changeset
   197
25385
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   198
    public static void setJavaAWTFontAccess(JavaAWTFontAccess jafa) {
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   199
        javaAWTFontAccess = jafa;
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   200
    }
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   201
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   202
    public static JavaAWTFontAccess getJavaAWTFontAccess() {
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   203
        // this may return null in which case calling code needs to
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   204
        // provision for.
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   205
        return javaAWTFontAccess;
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   206
    }
2c53e38b77aa 8038092: Re-examine Bidi reflective dependency on java.awt.font
naoto
parents: 23581
diff changeset
   207
30906
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
   208
    public static JavaBeansAccess getJavaBeansAccess() {
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
   209
        return javaBeansAccess;
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents: 23009
diff changeset
   210
    }
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents: 23009
diff changeset
   211
30906
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
   212
    public static void setJavaBeansAccess(JavaBeansAccess access) {
1b67cbb0adce 8080663: Use sun.misc.SharedSecrets to allow access from java.management to @ConstructorProperties
jbachorik
parents: 25859
diff changeset
   213
        javaBeansAccess = access;
23581
0ca496340112 8038343: Eliminate use of reflection to access JavaBeans Introspector
alanb
parents: 23009
diff changeset
   214
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
}