mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-04 20:18:49 +00:00
8137056: Move SharedSecrets and interface friends out of sun.misc
Reviewed-by: alanb, mchung, psandoz, rriggs
This commit is contained in:
parent
748e8913b9
commit
0cc24c29ca
@ -27,6 +27,8 @@ package java.io;
|
||||
|
||||
import java.util.*;
|
||||
import java.nio.charset.Charset;
|
||||
import jdk.internal.misc.JavaIOAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.nio.cs.StreamDecoder;
|
||||
import sun.nio.cs.StreamEncoder;
|
||||
|
||||
@ -519,7 +521,7 @@ public final class Console implements Flushable
|
||||
try {
|
||||
// Add a shutdown hook to restore console's echo state should
|
||||
// it be necessary.
|
||||
sun.misc.SharedSecrets.getJavaLangAccess()
|
||||
SharedSecrets.getJavaLangAccess()
|
||||
.registerShutdownHook(0 /* shutdown hook invocation order */,
|
||||
false /* only register if shutdown is not in progress */,
|
||||
new Runnable() {
|
||||
@ -536,7 +538,7 @@ public final class Console implements Flushable
|
||||
// by a shutdown hook
|
||||
}
|
||||
|
||||
sun.misc.SharedSecrets.setJavaIOAccess(new sun.misc.JavaIOAccess() {
|
||||
SharedSecrets.setJavaIOAccess(new JavaIOAccess() {
|
||||
public Console console() {
|
||||
if (istty()) {
|
||||
if (cons == null)
|
||||
|
||||
@ -26,6 +26,7 @@ package java.io;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* This class holds a set of filenames to be deleted on VM exit through a shutdown hook.
|
||||
@ -41,7 +42,7 @@ class DeleteOnExitHook {
|
||||
// delete on exit list and cause the DeleteOnExitHook to be
|
||||
// registered during shutdown in progress. So set the
|
||||
// registerShutdownInProgress parameter to true.
|
||||
sun.misc.SharedSecrets.getJavaLangAccess()
|
||||
SharedSecrets.getJavaLangAccess()
|
||||
.registerShutdownHook(2 /* Shutdown hook invocation order */,
|
||||
true /* register even if shutdown in progress */,
|
||||
new Runnable() {
|
||||
|
||||
@ -27,8 +27,8 @@ package java.io;
|
||||
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import sun.nio.ch.FileChannelImpl;
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,8 @@ import sun.reflect.Reflection;
|
||||
import sun.security.util.SecurityConstants;
|
||||
import sun.reflect.annotation.AnnotationType;
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import jdk.internal.misc.JavaLangAccess;;
|
||||
import jdk.internal.misc.SharedSecrets;;
|
||||
|
||||
/**
|
||||
* The <code>System</code> class contains several useful class fields
|
||||
@ -212,7 +214,7 @@ public final class System {
|
||||
public static Console console() {
|
||||
if (cons == null) {
|
||||
synchronized (System.class) {
|
||||
cons = sun.misc.SharedSecrets.getJavaIOAccess().console();
|
||||
cons = SharedSecrets.getJavaIOAccess().console();
|
||||
}
|
||||
}
|
||||
return cons;
|
||||
@ -1216,7 +1218,7 @@ public final class System {
|
||||
|
||||
private static void setJavaLangAccess() {
|
||||
// Allow privileged classes outside of java.lang
|
||||
sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
|
||||
SharedSecrets.setJavaLangAccess(new JavaLangAccess(){
|
||||
public sun.reflect.ConstantPool getConstantPool(Class<?> klass) {
|
||||
return klass.getConstantPool();
|
||||
}
|
||||
|
||||
@ -233,7 +233,8 @@ class Thread implements Runnable {
|
||||
private volatile Interruptible blocker;
|
||||
private final Object blockerLock = new Object();
|
||||
|
||||
/* Set the blocker field; invoked via sun.misc.SharedSecrets from java.nio code
|
||||
/* Set the blocker field; invoked via jdk.internal.misc.SharedSecrets
|
||||
* from java.nio code
|
||||
*/
|
||||
void blockedOn(Interruptible b) {
|
||||
synchronized (blockerLock) {
|
||||
|
||||
@ -27,9 +27,9 @@ package java.lang.ref;
|
||||
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.AccessController;
|
||||
import sun.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.VM;
|
||||
|
||||
final class Finalizer extends FinalReference<Object> { /* Package-private; must be in
|
||||
|
||||
@ -26,10 +26,10 @@
|
||||
package java.lang.ref;
|
||||
|
||||
import sun.misc.Cleaner;
|
||||
import sun.misc.JavaLangRefAccess;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import jdk.internal.misc.JavaLangRefAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
/**
|
||||
* Abstract base class for reference objects. This class defines the
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
package java.lang.reflect;
|
||||
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.reflect.CallerSensitive;
|
||||
import sun.reflect.ConstructorAccessor;
|
||||
import sun.reflect.Reflection;
|
||||
@ -582,7 +583,7 @@ public final class Constructor<T> extends Executable {
|
||||
|
||||
// A Constructor for an inner class
|
||||
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(thisDeclClass),
|
||||
this,
|
||||
thisDeclClass,
|
||||
|
||||
@ -28,6 +28,8 @@ package java.lang.reflect;
|
||||
import java.lang.annotation.*;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.reflect.annotation.AnnotationParser;
|
||||
import sun.reflect.annotation.AnnotationSupport;
|
||||
import sun.reflect.annotation.TypeAnnotationParser;
|
||||
@ -79,7 +81,7 @@ public abstract class Executable extends AccessibleObject
|
||||
Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) {
|
||||
return AnnotationParser.parseParameterAnnotations(
|
||||
parameterAnnotations,
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
getDeclaringClass());
|
||||
}
|
||||
@ -601,7 +603,7 @@ public abstract class Executable extends AccessibleObject
|
||||
} else {
|
||||
declAnnos = AnnotationParser.parseAnnotations(
|
||||
getAnnotationBytes(),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
getDeclaringClass()
|
||||
);
|
||||
@ -638,7 +640,7 @@ public abstract class Executable extends AccessibleObject
|
||||
*/
|
||||
AnnotatedType getAnnotatedReturnType0(Type returnType) {
|
||||
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
this,
|
||||
getDeclaringClass(),
|
||||
@ -672,7 +674,7 @@ public abstract class Executable extends AccessibleObject
|
||||
if (Modifier.isStatic(this.getModifiers()))
|
||||
return null;
|
||||
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
this,
|
||||
getDeclaringClass(),
|
||||
@ -696,7 +698,7 @@ public abstract class Executable extends AccessibleObject
|
||||
*/
|
||||
public AnnotatedType[] getAnnotatedParameterTypes() {
|
||||
return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
this,
|
||||
getDeclaringClass(),
|
||||
@ -720,7 +722,7 @@ public abstract class Executable extends AccessibleObject
|
||||
*/
|
||||
public AnnotatedType[] getAnnotatedExceptionTypes() {
|
||||
return TypeAnnotationParser.buildAnnotatedTypes(getTypeAnnotationBytes0(),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
this,
|
||||
getDeclaringClass(),
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
package java.lang.reflect;
|
||||
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.reflect.CallerSensitive;
|
||||
import sun.reflect.FieldAccessor;
|
||||
import sun.reflect.Reflection;
|
||||
@ -1152,7 +1153,7 @@ class Field extends AccessibleObject implements Member {
|
||||
} else {
|
||||
declAnnos = AnnotationParser.parseAnnotations(
|
||||
annotations,
|
||||
sun.misc.SharedSecrets.getJavaLangAccess()
|
||||
SharedSecrets.getJavaLangAccess()
|
||||
.getConstantPool(getDeclaringClass()),
|
||||
getDeclaringClass());
|
||||
}
|
||||
@ -1175,7 +1176,7 @@ class Field extends AccessibleObject implements Member {
|
||||
*/
|
||||
public AnnotatedType getAnnotatedType() {
|
||||
return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
this,
|
||||
getDeclaringClass(),
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
package java.lang.reflect;
|
||||
|
||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.reflect.CallerSensitive;
|
||||
import sun.reflect.MethodAccessor;
|
||||
import sun.reflect.Reflection;
|
||||
@ -626,7 +627,7 @@ public final class Method extends Executable {
|
||||
getReturnType());
|
||||
Object result = AnnotationParser.parseMemberValue(
|
||||
memberType, ByteBuffer.wrap(annotationDefault),
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().
|
||||
SharedSecrets.getJavaLangAccess().
|
||||
getConstantPool(getDeclaringClass()),
|
||||
getDeclaringClass());
|
||||
if (result instanceof sun.reflect.annotation.ExceptionProxy)
|
||||
|
||||
@ -35,6 +35,8 @@ import java.util.GregorianCalendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import jdk.internal.misc.JavaNetHttpCookieAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* An HttpCookie object represents an HTTP cookie, which carries state
|
||||
@ -971,8 +973,8 @@ public final class HttpCookie implements Cloneable {
|
||||
}
|
||||
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaNetHttpCookieAccess(
|
||||
new sun.misc.JavaNetHttpCookieAccess() {
|
||||
SharedSecrets.setJavaNetHttpCookieAccess(
|
||||
new JavaNetHttpCookieAccess() {
|
||||
public List<HttpCookie> parse(String header) {
|
||||
return HttpCookie.parse(header, true);
|
||||
}
|
||||
|
||||
@ -43,6 +43,8 @@ import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import jdk.internal.misc.JavaNetInetAddressAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.security.action.*;
|
||||
import sun.net.InetAddressCachePolicy;
|
||||
import sun.net.util.IPAddressUtil;
|
||||
@ -215,7 +217,7 @@ class InetAddress implements java.io.Serializable {
|
||||
* DNS forging.
|
||||
*
|
||||
* Oracle JSSE provider is using this original hostname, via
|
||||
* sun.misc.JavaNetAccess, for SSL/TLS endpoint identification.
|
||||
* jdk.internal.misc.JavaNetAccess, for SSL/TLS endpoint identification.
|
||||
*
|
||||
* Note: May define a new public method in the future if necessary.
|
||||
*/
|
||||
@ -297,8 +299,8 @@ class InetAddress implements java.io.Serializable {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
sun.misc.SharedSecrets.setJavaNetInetAddressAccess(
|
||||
new sun.misc.JavaNetInetAddressAccess() {
|
||||
SharedSecrets.setJavaNetInetAddressAccess(
|
||||
new JavaNetInetAddressAccess() {
|
||||
public String getOriginalHostName(InetAddress ia) {
|
||||
return ia.holder.getOriginalHostName();
|
||||
}
|
||||
|
||||
@ -49,6 +49,9 @@ import java.util.jar.Attributes;
|
||||
import java.util.jar.Attributes.Name;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import jdk.internal.misc.JavaNetAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.Resource;
|
||||
import sun.misc.URLClassPath;
|
||||
import sun.net.www.ParseUtil;
|
||||
@ -769,9 +772,9 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
}
|
||||
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaNetAccess (
|
||||
new sun.misc.JavaNetAccess() {
|
||||
public URLClassPath getURLClassPath (URLClassLoader u) {
|
||||
SharedSecrets.setJavaNetAccess(
|
||||
new JavaNetAccess() {
|
||||
public URLClassPath getURLClassPath(URLClassLoader u) {
|
||||
return u.ucp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,8 +29,9 @@ import java.security.AccessController;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.LongAdder;
|
||||
|
||||
import sun.misc.JavaLangRefAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaNioAccess;
|
||||
import jdk.internal.misc.JavaLangRefAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.Unsafe;
|
||||
import sun.misc.VM;
|
||||
|
||||
@ -702,11 +703,11 @@ class Bits { // package-private
|
||||
|
||||
static {
|
||||
// setup access to this package in SharedSecrets
|
||||
sun.misc.SharedSecrets.setJavaNioAccess(
|
||||
new sun.misc.JavaNioAccess() {
|
||||
SharedSecrets.setJavaNioAccess(
|
||||
new JavaNioAccess() {
|
||||
@Override
|
||||
public sun.misc.JavaNioAccess.BufferPool getDirectBufferPool() {
|
||||
return new sun.misc.JavaNioAccess.BufferPool() {
|
||||
public JavaNioAccess.BufferPool getDirectBufferPool() {
|
||||
return new JavaNioAccess.BufferPool() {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "direct";
|
||||
|
||||
@ -34,6 +34,7 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.channels.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.nio.ch.Interruptible;
|
||||
|
||||
|
||||
@ -206,9 +207,8 @@ public abstract class AbstractInterruptibleChannel
|
||||
}
|
||||
|
||||
|
||||
// -- sun.misc.SharedSecrets --
|
||||
// -- jdk.internal.misc.SharedSecrets --
|
||||
static void blockedOn(Interruptible intr) { // package-private
|
||||
sun.misc.SharedSecrets.getJavaLangAccess().blockedOn(Thread.currentThread(),
|
||||
intr);
|
||||
SharedSecrets.getJavaLangAccess().blockedOn(Thread.currentThread(), intr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,10 +34,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import sun.misc.JavaSecurityAccess;
|
||||
import sun.misc.JavaSecurityProtectionDomainAccess;
|
||||
import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaSecurityAccess;
|
||||
import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
|
||||
import static jdk.internal.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
package java.util;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* A specialized {@link Map} implementation for use with enum type keys. All
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
package java.util;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* A specialized {@link Set} implementation for use with enum types. All of
|
||||
|
||||
@ -24,8 +24,8 @@
|
||||
*/
|
||||
package java.util;
|
||||
|
||||
import sun.misc.JavaLangAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* {@code StringJoiner} is used to construct a sequence of characters separated
|
||||
|
||||
@ -27,8 +27,8 @@ package java.util;
|
||||
|
||||
import java.security.*;
|
||||
|
||||
import sun.misc.JavaLangAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* A class that represents an immutable universally unique identifier (UUID).
|
||||
|
||||
@ -36,10 +36,10 @@ import java.security.CodeSigner;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.AccessController;
|
||||
import java.security.CodeSource;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.IOUtils;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.security.util.ManifestEntryVerifier;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.security.util.SignatureFileVerifier;
|
||||
|
||||
/**
|
||||
|
||||
@ -30,7 +30,7 @@ import java.net.URL;
|
||||
import java.security.CodeSource;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import sun.misc.JavaUtilJarAccess;
|
||||
import jdk.internal.misc.JavaUtilJarAccess;
|
||||
|
||||
class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
|
||||
public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException {
|
||||
|
||||
@ -44,6 +44,8 @@ import java.util.Spliterators;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
import jdk.internal.misc.JavaUtilZipFileAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
import static java.util.zip.ZipConstants64.*;
|
||||
|
||||
@ -781,12 +783,12 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
}
|
||||
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaUtilZipFileAccess(
|
||||
new sun.misc.JavaUtilZipFileAccess() {
|
||||
SharedSecrets.setJavaUtilZipFileAccess(
|
||||
new JavaUtilZipFileAccess() {
|
||||
public boolean startsWithLocHeader(ZipFile zip) {
|
||||
return zip.startsWithLocHeader();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -27,8 +27,6 @@ package jdk.internal.jimage;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import sun.misc.JavaNioAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
|
||||
public final class ImageNativeSubstrate implements ImageSubstrate {
|
||||
static {
|
||||
@ -42,8 +40,10 @@ public final class ImageNativeSubstrate implements ImageSubstrate {
|
||||
});
|
||||
}
|
||||
|
||||
private static final JavaNioAccess NIOACCESS =
|
||||
SharedSecrets.getJavaNioAccess();
|
||||
// TODO: Reinstate when the class below, NIOACCESS, is removed.
|
||||
//private static final JavaNioAccess NIOACCESS =
|
||||
// SharedSecrets.getJavaNioAccess();
|
||||
|
||||
|
||||
private final long id;
|
||||
private final long indexAddress;
|
||||
@ -161,4 +161,59 @@ public final class ImageNativeSubstrate implements ImageSubstrate {
|
||||
public int[] attributeOffsets() {
|
||||
return attributeOffsets(id);
|
||||
}
|
||||
|
||||
// TODO: Remove when JRT-FS no longer indirectly depends on ImageNativeSubstrate
|
||||
/**
|
||||
* Reflective wrapper around ShareSecrets JavaNioAccess.
|
||||
*
|
||||
* SharedSecrets and friend interfaces moved from 'sun.misc' to 'jdk.internal.misc'
|
||||
* in 1.9. This class provides the runtime with access to the appropriate
|
||||
* JavaNioAccess methods whether running on 1.9, or lower.
|
||||
*/
|
||||
static class NIOACCESS {
|
||||
|
||||
private static final String PKG_PREFIX = "jdk.internal.misc";
|
||||
private static final String LEGACY_PKG_PREFIX = "sun.misc";
|
||||
|
||||
private static final Object javaNioAccess;
|
||||
private static final java.lang.reflect.Method newDirectByteBufferMethod;
|
||||
|
||||
static {
|
||||
try {
|
||||
Class<?> c = getJDKClass("JavaNioAccess");
|
||||
|
||||
java.lang.reflect.Method m =
|
||||
getJDKClass("SharedSecrets").getDeclaredMethod("getJavaNioAccess");
|
||||
javaNioAccess = m.invoke(null);
|
||||
|
||||
newDirectByteBufferMethod = c.getDeclaredMethod("newDirectByteBuffer",
|
||||
long.class,
|
||||
int.class,
|
||||
Object.class);
|
||||
} catch (ReflectiveOperationException x) {
|
||||
throw new InternalError(x);
|
||||
}
|
||||
}
|
||||
|
||||
private static Class<?> getJDKClass(String name) throws ClassNotFoundException {
|
||||
try {
|
||||
return Class.forName(PKG_PREFIX + "." + name);
|
||||
} catch (ClassNotFoundException x) {
|
||||
try {
|
||||
return Class.forName(LEGACY_PKG_PREFIX + "." + name);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
x.addSuppressed(ex);
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ByteBuffer newDirectByteBuffer(long addr, int cap, Object ob) {
|
||||
try {
|
||||
return (ByteBuffer) newDirectByteBufferMethod.invoke(javaNioAccess, addr, cap, ob);
|
||||
} catch (ReflectiveOperationException x) {
|
||||
throw new InternalError(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
public interface JavaAWTAccess {
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
* SharedSecrets interface used for the access from java.text.Bidi
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
public interface JavaAWTFontAccess {
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
@ -23,7 +23,8 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.io.Console;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Executable;
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
public interface JavaLangRefAccess {
|
||||
|
||||
@ -23,9 +23,10 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.net.URLClassLoader;
|
||||
import sun.misc.URLClassPath;
|
||||
|
||||
public interface JavaNetAccess {
|
||||
/**
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.net.HttpCookie;
|
||||
import java.util.List;
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.PrivilegedAction;
|
||||
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.security.PermissionCollection;
|
||||
import java.security.ProtectionDomain;
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
@ -23,14 +23,14 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
package jdk.internal.misc;
|
||||
|
||||
import java.util.jar.JarFile;
|
||||
import java.io.Console;
|
||||
import java.io.FileDescriptor;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
import java.security.AccessController;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
/** A repository of "shared secrets", which are a mechanism for
|
||||
calling implementation-private methods in another package without
|
||||
@ -66,6 +66,8 @@ import java.util.jar.Attributes.Name;
|
||||
|
||||
import jdk.internal.jimage.ImageLocation;
|
||||
import jdk.internal.jimage.ImageReader;
|
||||
import jdk.internal.misc.JavaUtilZipFileAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
import sun.net.util.URLUtil;
|
||||
import sun.net.www.ParseUtil;
|
||||
@ -622,8 +624,8 @@ public class URLClassPath {
|
||||
private URLStreamHandler handler;
|
||||
private HashMap<String, Loader> lmap;
|
||||
private boolean closed = false;
|
||||
private static final sun.misc.JavaUtilZipFileAccess zipAccess =
|
||||
sun.misc.SharedSecrets.getJavaUtilZipFileAccess();
|
||||
private static final JavaUtilZipFileAccess zipAccess =
|
||||
SharedSecrets.getJavaUtilZipFileAccess();
|
||||
|
||||
/*
|
||||
* Creates a new JarLoader for the specified URL referring to
|
||||
|
||||
@ -29,8 +29,8 @@ import java.io.IOException;
|
||||
import java.io.FileDescriptor;
|
||||
import java.security.AccessController;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -65,6 +65,8 @@ import java.util.HashSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.StringJoiner;
|
||||
import jdk.internal.misc.JavaNetHttpCookieAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.net.*;
|
||||
import sun.net.www.*;
|
||||
import sun.net.www.http.HttpClient;
|
||||
@ -2878,8 +2880,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
||||
if (cookieHandler == null || value.length() == 0)
|
||||
return value;
|
||||
|
||||
sun.misc.JavaNetHttpCookieAccess access =
|
||||
sun.misc.SharedSecrets.getJavaNetHttpCookieAccess();
|
||||
JavaNetHttpCookieAccess access =
|
||||
SharedSecrets.getJavaNetHttpCookieAccess();
|
||||
StringJoiner retValue = new StringJoiner(","); // RFC 2965, comma separated
|
||||
List<HttpCookie> cookies = access.parse(value);
|
||||
for (HttpCookie cookie : cookies) {
|
||||
|
||||
@ -44,9 +44,10 @@ import java.security.AccessController;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.JavaNioAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.Cleaner;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
public class FileChannelImpl
|
||||
@ -976,8 +977,8 @@ public class FileChannelImpl
|
||||
* Invoked by sun.management.ManagementFactoryHelper to create the management
|
||||
* interface for mapped buffers.
|
||||
*/
|
||||
public static sun.misc.JavaNioAccess.BufferPool getMappedBufferPool() {
|
||||
return new sun.misc.JavaNioAccess.BufferPool() {
|
||||
public static JavaNioAccess.BufferPool getMappedBufferPool() {
|
||||
return new JavaNioAccess.BufferPool() {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "mapped";
|
||||
|
||||
@ -35,12 +35,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import sun.misc.JavaLangAccess;
|
||||
import sun.reflect.LangReflectAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import sun.reflect.ReflectionFactory;
|
||||
|
||||
public final class AnnotationSupport {
|
||||
private static final JavaLangAccess LANG_ACCESS = sun.misc.SharedSecrets.getJavaLangAccess();
|
||||
private static final JavaLangAccess LANG_ACCESS = SharedSecrets.getJavaLangAccess();
|
||||
|
||||
/**
|
||||
* Finds and returns all annotations in {@code annotations} matching
|
||||
|
||||
@ -25,13 +25,13 @@
|
||||
|
||||
package sun.reflect.annotation;
|
||||
|
||||
import sun.misc.JavaLangAccess;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
|
||||
/**
|
||||
* Represents an annotation type at run time. Used to type-check annotations
|
||||
@ -79,7 +79,7 @@ public class AnnotationType {
|
||||
public static AnnotationType getInstance(
|
||||
Class<? extends Annotation> annotationClass)
|
||||
{
|
||||
JavaLangAccess jla = sun.misc.SharedSecrets.getJavaLangAccess();
|
||||
JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
|
||||
AnnotationType result = jla.getAnnotationType(annotationClass); // volatile read
|
||||
if (result == null) {
|
||||
result = new AnnotationType(annotationClass);
|
||||
@ -134,7 +134,7 @@ public class AnnotationType {
|
||||
// of the corresponding annotation types breaks infinite recursion.
|
||||
if (annotationClass != Retention.class &&
|
||||
annotationClass != Inherited.class) {
|
||||
JavaLangAccess jla = sun.misc.SharedSecrets.getJavaLangAccess();
|
||||
JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
|
||||
Map<Class<? extends Annotation>, Annotation> metaAnnotations =
|
||||
AnnotationParser.parseSelectAnnotations(
|
||||
jla.getRawClassAnnotations(annotationClass),
|
||||
|
||||
@ -35,7 +35,8 @@ import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import sun.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import sun.reflect.ConstantPool;
|
||||
import static sun.reflect.annotation.TypeAnnotation.*;
|
||||
|
||||
@ -309,7 +310,7 @@ public final class TypeAnnotationParser {
|
||||
static TypeAnnotation[] parseAllTypeAnnotations(AnnotatedElement decl) {
|
||||
Class<?> container;
|
||||
byte[] rawBytes;
|
||||
JavaLangAccess javaLangAccess = sun.misc.SharedSecrets.getJavaLangAccess();
|
||||
JavaLangAccess javaLangAccess = SharedSecrets.getJavaLangAccess();
|
||||
if (decl instanceof Class) {
|
||||
container = (Class<?>)decl;
|
||||
rawBytes = javaLangAccess.getRawClassTypeAnnotations(container);
|
||||
|
||||
@ -41,9 +41,9 @@ import java.io.FilePermission;
|
||||
import java.net.SocketPermission;
|
||||
import java.net.NetPermission;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import sun.misc.JavaSecurityProtectionDomainAccess;
|
||||
import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaSecurityProtectionDomainAccess;
|
||||
import static jdk.internal.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.security.util.PolicyUtil;
|
||||
import sun.security.util.PropertyExpander;
|
||||
import sun.security.util.Debug;
|
||||
|
||||
@ -42,8 +42,8 @@ import javax.crypto.BadPaddingException;
|
||||
import javax.net.ssl.*;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
|
||||
import sun.misc.JavaNetInetAddressAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaNetInetAddressAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* Implementation of an SSL socket. This is a normal connection type
|
||||
@ -2094,7 +2094,7 @@ public final class SSLSocketImpl extends BaseSSLSocketImpl {
|
||||
*/
|
||||
private static String getOriginalHostname(InetAddress inetAddress) {
|
||||
/*
|
||||
* Get the original hostname via sun.misc.SharedSecrets.
|
||||
* Get the original hostname via jdk.internal.misc.SharedSecrets.
|
||||
*/
|
||||
JavaNetInetAddressAccess jna = SharedSecrets.getJavaNetInetAddressAccess();
|
||||
String originalHostname = jna.getOriginalHostName(inetAddress);
|
||||
|
||||
@ -29,6 +29,7 @@ import java.io.*;
|
||||
import java.nio.*;
|
||||
import java.nio.charset.*;
|
||||
import java.util.Arrays;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* A utility class for reading passwords
|
||||
@ -139,7 +140,7 @@ public class Password {
|
||||
private static byte[] convertToBytes(char[] pass) {
|
||||
if (enc == null) {
|
||||
synchronized (Password.class) {
|
||||
enc = sun.misc.SharedSecrets.getJavaIOAccess()
|
||||
enc = SharedSecrets.getJavaIOAccess()
|
||||
.charset()
|
||||
.newEncoder()
|
||||
.onMalformedInput(CodingErrorAction.REPLACE)
|
||||
|
||||
@ -52,8 +52,8 @@ import java.lang.reflect.Array;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.Bidi;
|
||||
import java.util.Arrays;
|
||||
import sun.misc.JavaAWTFontAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaAWTFontAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.text.normalizer.UBiDiProps;
|
||||
import sun.text.normalizer.UCharacter;
|
||||
import sun.text.normalizer.UTF16;
|
||||
|
||||
@ -39,8 +39,8 @@ import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import sun.misc.JavaLangAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* Platform logger provides an API for the JRE components to log
|
||||
|
||||
@ -27,6 +27,8 @@ package java.io;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* Instances of the file descriptor class serve as an opaque handle
|
||||
@ -145,8 +147,8 @@ public final class FileDescriptor {
|
||||
|
||||
// Set up JavaIOFileDescriptorAccess in SharedSecrets
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaIOFileDescriptorAccess(
|
||||
new sun.misc.JavaIOFileDescriptorAccess() {
|
||||
SharedSecrets.setJavaIOFileDescriptorAccess(
|
||||
new JavaIOFileDescriptorAccess() {
|
||||
public void set(FileDescriptor obj, int fd) {
|
||||
obj.fd = fd;
|
||||
}
|
||||
|
||||
@ -46,6 +46,8 @@ import static java.security.AccessController.doPrivileged;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* java.lang.Process subclass in the UNIX environment.
|
||||
@ -57,8 +59,8 @@ import java.security.PrivilegedExceptionAction;
|
||||
* @since 1.5
|
||||
*/
|
||||
final class ProcessImpl extends Process {
|
||||
private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
|
||||
= sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
|
||||
private static final JavaIOFileDescriptorAccess fdAccess
|
||||
= SharedSecrets.getJavaIOFileDescriptorAccess();
|
||||
|
||||
// Linux platforms support a normal (non-forcible) kill signal.
|
||||
static final boolean SUPPORTS_NORMAL_TERMINATION = true;
|
||||
|
||||
@ -30,11 +30,11 @@ import java.nio.channels.*;
|
||||
import java.io.FileDescriptor;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import sun.nio.ch.FileChannelImpl;
|
||||
import sun.nio.ch.ThreadPool;
|
||||
import sun.nio.ch.SimpleAsynchronousFileChannelImpl;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
|
||||
import static sun.nio.fs.UnixNativeDispatcher.*;
|
||||
import static sun.nio.fs.UnixConstants.*;
|
||||
|
||||
@ -27,6 +27,8 @@ package java.io;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* Instances of the file descriptor class serve as an opaque handle
|
||||
@ -70,8 +72,8 @@ public final class FileDescriptor {
|
||||
|
||||
// Set up JavaIOFileDescriptorAccess in SharedSecrets
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaIOFileDescriptorAccess(
|
||||
new sun.misc.JavaIOFileDescriptorAccess() {
|
||||
SharedSecrets.setJavaIOFileDescriptorAccess(
|
||||
new JavaIOFileDescriptorAccess() {
|
||||
public void set(FileDescriptor obj, int fd) {
|
||||
obj.fd = fd;
|
||||
}
|
||||
|
||||
@ -42,6 +42,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/* This class is for the exclusive use of ProcessBuilder.start() to
|
||||
* create new processes.
|
||||
@ -51,8 +53,8 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
|
||||
final class ProcessImpl extends Process {
|
||||
private static final sun.misc.JavaIOFileDescriptorAccess fdAccess
|
||||
= sun.misc.SharedSecrets.getJavaIOFileDescriptorAccess();
|
||||
private static final JavaIOFileDescriptorAccess fdAccess
|
||||
= SharedSecrets.getJavaIOFileDescriptorAccess();
|
||||
|
||||
// Windows platforms support a forcible kill signal.
|
||||
static final boolean SUPPORTS_NORMAL_TERMINATION = false;
|
||||
|
||||
@ -25,8 +25,8 @@
|
||||
package java.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
|
||||
/**
|
||||
* This class defines the plain DatagramSocketImpl that is used on
|
||||
|
||||
@ -26,8 +26,8 @@ package java.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.FileDescriptor;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
|
||||
/**
|
||||
* This class defines the plain SocketImpl that is used on Windows platforms
|
||||
|
||||
@ -28,8 +28,8 @@ package sun.nio.ch;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
|
||||
class FileDispatcherImpl extends FileDispatcher {
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.io.IOException;
|
||||
import java.io.FileDescriptor;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
|
||||
/**
|
||||
* Windows implementation of AsynchronousFileChannel using overlapped I/O.
|
||||
|
||||
@ -36,8 +36,8 @@ import java.util.Set;
|
||||
|
||||
import com.sun.nio.file.ExtendedOpenOption;
|
||||
|
||||
import sun.misc.JavaIOFileDescriptorAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaIOFileDescriptorAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.nio.ch.FileChannelImpl;
|
||||
import sun.nio.ch.ThreadPool;
|
||||
import sun.nio.ch.WindowsAsynchronousFileChannelImpl;
|
||||
|
||||
@ -50,7 +50,7 @@ import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* The main class to parse JavaBeans XML archive.
|
||||
|
||||
@ -47,8 +47,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import java.security.AccessControlContext;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaSecurityAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaSecurityAccess;
|
||||
|
||||
/**
|
||||
* <code>EventQueue</code> is a platform-independent class
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
package java.awt.font;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import sun.misc.JavaAWTFontAccess;
|
||||
import jdk.internal.misc.JavaAWTFontAccess;
|
||||
|
||||
class JavaAWTFontAccessImpl implements sun.misc.JavaAWTFontAccess {
|
||||
class JavaAWTFontAccessImpl implements JavaAWTFontAccess {
|
||||
|
||||
// java.awt.font.TextAttribute constants
|
||||
public Object getTextAttributeConstant(String name) {
|
||||
|
||||
@ -31,7 +31,7 @@ import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* The <code>NumericShaper</code> class is used to convert Latin-1 (European)
|
||||
|
||||
@ -44,7 +44,7 @@ import java.io.InvalidObjectException;
|
||||
import java.text.AttributedCharacterIterator.Attribute;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* The <code>TextAttribute</code> class defines attribute keys and
|
||||
|
||||
@ -47,9 +47,9 @@ import java.util.Iterator;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
import sun.misc.JavaBeansAccess;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaBeansAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
/**
|
||||
|
||||
@ -35,13 +35,13 @@ import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.applet.*;
|
||||
|
||||
import jdk.internal.misc.JavaSecurityAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.DisplayChangedListener;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
import sun.misc.JavaSecurityAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import com.sun.java.swing.SwingUtilities3;
|
||||
|
||||
@ -47,8 +47,8 @@ import java.security.PrivilegedAction;
|
||||
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.ProtectionDomain;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaSecurityAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaSecurityAccess;
|
||||
|
||||
import sun.awt.AWTAccessor;
|
||||
|
||||
|
||||
@ -44,6 +44,8 @@ import java.beans.PropertyChangeSupport;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
import jdk.internal.misc.JavaAWTAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
import java.util.concurrent.locks.Condition;
|
||||
@ -839,7 +841,7 @@ public final class AppContext {
|
||||
|
||||
// Set up JavaAWTAccess in SharedSecrets
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() {
|
||||
SharedSecrets.setJavaAWTAccess(new JavaAWTAccess() {
|
||||
private boolean hasRootThreadGroup(final AppContext ecx) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
@Override
|
||||
@ -878,13 +880,13 @@ public final class AppContext {
|
||||
// the window of opportunity in which that issue could
|
||||
// happen.
|
||||
if (numAppContexts.get() > 0) {
|
||||
// Defaults to thread group caching.
|
||||
// This is probably not required as we only really need
|
||||
// isolation in a deployed applet environment, in which
|
||||
// case ecx will not be null when we reach here
|
||||
// However it helps emulate the deployed environment,
|
||||
// in tests for instance.
|
||||
ecx = ecx != null ? ecx : getAppContext();
|
||||
// Defaults to thread group caching.
|
||||
// This is probably not required as we only really need
|
||||
// isolation in a deployed applet environment, in which
|
||||
// case ecx will not be null when we reach here
|
||||
// However it helps emulate the deployed environment,
|
||||
// in tests for instance.
|
||||
ecx = ecx != null ? ecx : getAppContext();
|
||||
}
|
||||
|
||||
// getAppletContext() may be called when initializing the main
|
||||
@ -895,8 +897,8 @@ public final class AppContext {
|
||||
// the root TG as its thread group.
|
||||
// See: JDK-8023258
|
||||
final boolean isMainAppContext = ecx == null
|
||||
|| mainAppContext == ecx
|
||||
|| mainAppContext == null && hasRootThreadGroup(ecx);
|
||||
|| mainAppContext == ecx
|
||||
|| mainAppContext == null && hasRootThreadGroup(ecx);
|
||||
|
||||
return isMainAppContext ? null : ecx;
|
||||
}
|
||||
|
||||
@ -34,9 +34,9 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import sun.misc.JavaAWTAccess;
|
||||
import jdk.internal.misc.JavaAWTAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.misc.ManagedLocalsThread;
|
||||
import sun.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* There is a single global LogManager object that is used to
|
||||
|
||||
@ -31,8 +31,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.io.*;
|
||||
import java.time.Clock;
|
||||
|
||||
import sun.misc.JavaLangAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* LogRecord objects are used to pass logging requests between
|
||||
|
||||
@ -56,8 +56,6 @@ import java.security.AccessController;
|
||||
import javax.management.AttributeNotFoundException;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
|
||||
import sun.misc.JavaBeansAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.reflect.misc.MethodUtil;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ package com.sun.jmx.mbeanserver;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import sun.misc.JavaBeansAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaBeansAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* A centralized place for gaining access to java.beans related functionality -
|
||||
|
||||
@ -80,8 +80,8 @@ import javax.management.RuntimeErrorException;
|
||||
import javax.management.RuntimeOperationsException;
|
||||
import javax.management.ServiceNotFoundException;
|
||||
import javax.management.loading.ClassLoaderRepository;
|
||||
import sun.misc.JavaSecurityAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaSecurityAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
import sun.reflect.misc.MethodUtil;
|
||||
import sun.reflect.misc.ReflectUtil;
|
||||
|
||||
@ -36,6 +36,9 @@ import javax.management.RuntimeOperationsException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
||||
import jdk.internal.misc.JavaNioAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import sun.util.logging.LoggingSupport;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -208,7 +211,7 @@ public class ManagementFactoryHelper {
|
||||
public static synchronized List<BufferPoolMXBean> getBufferPoolMXBeans() {
|
||||
if (bufferPools == null) {
|
||||
bufferPools = new ArrayList<>(2);
|
||||
bufferPools.add(createBufferPoolMXBean(sun.misc.SharedSecrets.getJavaNioAccess()
|
||||
bufferPools.add(createBufferPoolMXBean(SharedSecrets.getJavaNioAccess()
|
||||
.getDirectBufferPool()));
|
||||
bufferPools.add(createBufferPoolMXBean(sun.nio.ch.FileChannelImpl
|
||||
.getMappedBufferPool()));
|
||||
@ -222,7 +225,7 @@ public class ManagementFactoryHelper {
|
||||
* Creates management interface for the given buffer pool.
|
||||
*/
|
||||
private static BufferPoolMXBean
|
||||
createBufferPoolMXBean(final sun.misc.JavaNioAccess.BufferPool pool)
|
||||
createBufferPoolMXBean(final JavaNioAccess.BufferPool pool)
|
||||
{
|
||||
return new BufferPoolMXBean() {
|
||||
private volatile ObjectName objname; // created lazily
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
package com.sun.jndi.ldap;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
@ -27,8 +27,8 @@ package java.sql;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
|
||||
/**
|
||||
* <P>A thin wrapper around a millisecond value that allows
|
||||
|
||||
@ -27,8 +27,8 @@ package java.sql;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
|
||||
/**
|
||||
* <P>A thin wrapper around the <code>java.util.Date</code> class that allows the JDBC
|
||||
|
||||
@ -27,8 +27,8 @@ package java.sql;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import sun.misc.SharedSecrets;
|
||||
import sun.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
|
||||
/**
|
||||
* <P>A thin wrapper around {@code java.util.Date} that allows
|
||||
|
||||
@ -26,7 +26,7 @@ import java.security.AccessController;
|
||||
import java.security.DomainCombiner;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.ProtectionDomain;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -34,7 +34,7 @@ import sun.misc.SharedSecrets;
|
||||
* @summary Make sure that JavaSecurityAccess.doIntersectionPrivilege()
|
||||
* is not dropping the information about the domain combiner of
|
||||
* the stack ACC
|
||||
* @modules java.base/sun.misc
|
||||
* @modules java.base/jdk.internal.misc
|
||||
*/
|
||||
|
||||
public class PreserveCombinerTest {
|
||||
|
||||
@ -35,13 +35,15 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
import jdk.internal.misc.JavaAWTAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8065991
|
||||
* @summary check that when LogManager is initialized, a deadlock similar
|
||||
* to that described in 8065709 will not occur.
|
||||
* @modules java.base/sun.misc
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run main/othervm LogManagerAppContextDeadlock UNSECURE
|
||||
* @run main/othervm LogManagerAppContextDeadlock SECURE
|
||||
*
|
||||
@ -97,7 +99,7 @@ public class LogManagerAppContextDeadlock {
|
||||
}
|
||||
|
||||
static {
|
||||
sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() {
|
||||
SharedSecrets.setJavaAWTAccess(new JavaAWTAccess() {
|
||||
@Override
|
||||
public Object getAppletContext() {
|
||||
if (numAppContexts.get() == 0) return null;
|
||||
@ -341,7 +343,7 @@ public class LogManagerAppContextDeadlock {
|
||||
// FileHandlers because we're passing invalid parameters
|
||||
// which will make the creation fail...
|
||||
permissions = new Permissions();
|
||||
permissions.add(new RuntimePermission("accessClassInPackage.sun.misc"));
|
||||
permissions.add(new RuntimePermission("accessClassInPackage.jdk.internal.misc"));
|
||||
|
||||
// these are used for configuring the test itself...
|
||||
allPermissions = new Permissions();
|
||||
|
||||
@ -34,15 +34,15 @@ import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.LoggingPermission;
|
||||
import sun.misc.JavaAWTAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaAWTAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8030850
|
||||
* @summary Tests that setting .level=FINEST for the root logger in logging
|
||||
* configuration file does work.
|
||||
* @modules java.base/sun.misc
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run main/othervm RootLevelInConfigFile
|
||||
*
|
||||
* @author danielfuchs
|
||||
@ -181,7 +181,7 @@ public class RootLevelInConfigFile {
|
||||
perms.add(new PropertyPermission("java.util.logging.config.class","read"));
|
||||
perms.add(new PropertyPermission("java.util.logging.config.file","read"));
|
||||
perms.add(new FilePermission(configFile, "read"));
|
||||
perms.add(new RuntimePermission("accessClassInPackage.sun.misc"));
|
||||
perms.add(new RuntimePermission("accessClassInPackage.jdk.internal.misc"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -33,8 +33,8 @@ import java.util.Map;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.LoggingPermission;
|
||||
import sun.misc.JavaAWTAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaAWTAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -42,7 +42,7 @@ import sun.misc.SharedSecrets;
|
||||
* @summary NPE when using Logger.getAnonymousLogger or
|
||||
* LogManager.getLogManager().getLogger
|
||||
*
|
||||
* @modules java.base/sun.misc
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingApplet
|
||||
* @run main/othervm -Dtest.security=on TestAppletLoggerContext LoadingApplet
|
||||
* @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingMain
|
||||
|
||||
@ -26,8 +26,8 @@ import java.security.Policy;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
import sun.misc.JavaAWTAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaAWTAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -35,7 +35,7 @@ import sun.misc.SharedSecrets;
|
||||
*
|
||||
* @summary NPE with logging while launching webstart
|
||||
*
|
||||
* @modules java.base/sun.misc
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @build TestGetLoggerNPE
|
||||
* @run main/othervm TestGetLoggerNPE getLogger
|
||||
* @run main/othervm TestGetLoggerNPE getLogManager
|
||||
|
||||
@ -21,14 +21,14 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import sun.misc.JavaLangAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8050114
|
||||
* @summary Test JavaLangAccess.formatUnsignedInt/-Long
|
||||
* @modules java.base/sun.misc
|
||||
* @modules java.base/jdk.internal.misc
|
||||
*/
|
||||
public class FormatUnsigned {
|
||||
|
||||
@ -23,14 +23,14 @@
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Comparator;
|
||||
import sun.misc.JavaLangAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
import jdk.internal.misc.JavaLangAccess;
|
||||
import jdk.internal.misc.SharedSecrets;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8013528
|
||||
* @summary Test JavaLangAccess.newUnsafeString
|
||||
* @modules java.base/sun.misc
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @compile -XDignore.symbol.file NewUnsafeString.java
|
||||
*/
|
||||
public class NewUnsafeString {
|
||||
Loading…
x
Reference in New Issue
Block a user