4747import java .nio .charset .CharacterCodingException ;
4848import java .nio .charset .Charset ;
4949import java .security .ProtectionDomain ;
50- import java .util .List ;
51- import java .util .Locale ;
52- import java .util .Map ;
53- import java .util .Objects ;
54- import java .util .Properties ;
55- import java .util .ResourceBundle ;
56- import java .util .Set ;
50+ import java .util .*;
5751import java .util .concurrent .Executor ;
5852import java .util .function .Supplier ;
5953import java .util .concurrent .ConcurrentHashMap ;
6054import java .util .stream .Stream ;
6155
56+ import jdk .internal .access .JavaIOAccess ;
6257import jdk .internal .javac .Restricted ;
6358import jdk .internal .loader .NativeLibraries ;
6459import jdk .internal .logger .LoggerFinderLoader .TemporaryLoggerFinder ;
@@ -234,8 +229,6 @@ public static void setErr(PrintStream err) {
234229 setErr0 (err );
235230 }
236231
237- private static volatile Console cons ;
238-
239232 /**
240233 * Returns the unique {@link Console Console} object associated
241234 * with the current Java virtual machine, if any.
@@ -246,15 +239,7 @@ public static void setErr(PrintStream err) {
246239 * @since 1.6
247240 */
248241 public static Console console () {
249- Console c ;
250- if ((c = cons ) == null ) {
251- synchronized (System .class ) {
252- if ((c = cons ) == null ) {
253- cons = c = SharedSecrets .getJavaIOAccess ().console ();
254- }
255- }
256- }
257- return c ;
242+ return SharedSecrets .get (JavaIOAccess .class ).console ();
258243 }
259244
260245 /**
@@ -1994,7 +1979,7 @@ private static void initPhase3() {
19941979
19951980 private static void setJavaLangAccess () {
19961981 // Allow privileged classes outside of java.lang
1997- SharedSecrets .setJavaLangAccess ( new JavaLangAccess () {
1982+ SharedSecrets .set ( JavaLangAccess . class , new JavaLangAccess () {
19981983 public List <Method > getDeclaredPublicMethods (Class <?> klass , String name , Class <?>... parameterTypes ) {
19991984 return klass .getDeclaredPublicMethods (name , parameterTypes );
20001985 }
0 commit comments