< prev index next >

src/java.base/share/classes/java/lang/reflect/Proxy.java

Print this page

        

*** 37,52 **** import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; - import java.util.stream.Collectors; - import java.util.stream.Stream; import jdk.internal.loader.BootLoader; import jdk.internal.module.Modules; - import jdk.internal.misc.Unsafe; import jdk.internal.misc.VM; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; import jdk.internal.loader.ClassLoaderValue; import sun.reflect.misc.ReflectUtil; --- 37,51 ---- import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import jdk.internal.loader.BootLoader; + import jdk.internal.misc.JavaLangAccess; + import jdk.internal.misc.SharedSecrets; import jdk.internal.module.Modules; import jdk.internal.misc.VM; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; import jdk.internal.loader.ClassLoaderValue; import sun.reflect.misc.ReflectUtil;
*** 466,476 **** * If the module is not specified in this ProxyBuilder constructor, * it will map from the given loader and interfaces to the module * in which the proxy class will be defined. */ private static final class ProxyBuilder { ! private static final Unsafe UNSAFE = Unsafe.getUnsafe(); // prefix for all proxy class names private static final String proxyClassNamePrefix = "$Proxy"; // next number to use for generation of unique proxy class names --- 465,475 ---- * If the module is not specified in this ProxyBuilder constructor, * it will map from the given loader and interfaces to the module * in which the proxy class will be defined. */ private static final class ProxyBuilder { ! private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); // prefix for all proxy class names private static final String proxyClassNamePrefix = "$Proxy"; // next number to use for generation of unique proxy class names
*** 533,545 **** * Generate the specified proxy class. */ byte[] proxyClassFile = ProxyGenerator.generateProxyClass( proxyName, interfaces.toArray(EMPTY_CLASS_ARRAY), accessFlags); try { ! Class<?> pc = UNSAFE.defineClass(proxyName, proxyClassFile, ! 0, proxyClassFile.length, ! loader, null); reverseProxyCache.sub(pc).putIfAbsent(loader, Boolean.TRUE); return pc; } catch (ClassFormatError e) { /* * A ClassFormatError here means that (barring bugs in the --- 532,543 ---- * Generate the specified proxy class. */ byte[] proxyClassFile = ProxyGenerator.generateProxyClass( proxyName, interfaces.toArray(EMPTY_CLASS_ARRAY), accessFlags); try { ! Class<?> pc = JLA.defineClass(loader, proxyName, proxyClassFile, ! null, "__dynamic_proxy__"); reverseProxyCache.sub(pc).putIfAbsent(loader, Boolean.TRUE); return pc; } catch (ClassFormatError e) { /* * A ClassFormatError here means that (barring bugs in the
< prev index next >