< prev index next >

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

Print this page

        

*** 47,56 **** --- 47,57 ---- 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; + import sun.security.action.GetBooleanAction; import sun.security.action.GetPropertyAction; import sun.security.util.SecurityConstants; import static java.lang.module.ModuleDescriptor.Modifier.SYNTHETIC;
*** 97,107 **** * <li>A proxy class is <em>final and non-abstract</em>. * * <li>A proxy class extends {@code java.lang.reflect.Proxy}. * * <li>A proxy class implements exactly the interfaces specified at its ! * creation, in the same order. Invoking {@link Class#getInterfaces getInterfaces} * on its {@code Class} object will return an array containing the same * list of interfaces (in the order specified at its creation), invoking * {@link Class#getMethods getMethods} on its {@code Class} object will return * an array of {@code Method} objects that include all of the * methods in those interfaces, and invoking {@code getMethod} will --- 98,108 ---- * <li>A proxy class is <em>final and non-abstract</em>. * * <li>A proxy class extends {@code java.lang.reflect.Proxy}. * * <li>A proxy class implements exactly the interfaces specified at its ! * creation, in the same order. Invoking {@link Class#getInterfaces() getInterfaces} * on its {@code Class} object will return an array containing the same * list of interfaces (in the order specified at its creation), invoking * {@link Class#getMethods getMethods} on its {@code Class} object will return * an array of {@code Method} objects that include all of the * methods in those interfaces, and invoking {@code getMethod} will
*** 294,303 **** --- 295,311 ---- */ private static final ClassLoaderValue<Constructor<?>> proxyCache = new ClassLoaderValue<>(); /** + * System property to revert to generation of proxy class files for version 1.5 (V49). + * Set to "true" to generate v49 class file format. + */ + private static final boolean PROXY_GENERATOR_V49 = + GetBooleanAction.privilegedGetProperty("jdk.proxy.ProxyGenerator.v49"); + + /** * the invocation handler for this proxy instance. * @serial */ protected InvocationHandler h;
*** 529,540 **** trace(proxyName, m, loader, interfaces); /* * 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; --- 537,549 ---- trace(proxyName, m, loader, interfaces); /* * Generate the specified proxy class. */ ! byte[] proxyClassFile = PROXY_GENERATOR_V49 ! ? ProxyGenerator_v49.generateProxyClass(proxyName, interfaces, accessFlags) ! : ProxyGenerator.generateProxyClass(loader, proxyName, interfaces, accessFlags); try { Class<?> pc = JLA.defineClass(loader, proxyName, proxyClassFile, null, "__dynamic_proxy__"); reverseProxyCache.sub(pc).putIfAbsent(loader, Boolean.TRUE); return pc;
*** 1114,1121 **** } return ih; } - private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class<?>[0]; private static final String PROXY_PACKAGE_PREFIX = ReflectUtil.PROXY_PACKAGE; } --- 1123,1129 ----
< prev index next >