< prev index next >

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

Print this page




 266  * checked exception types that are assignable to one of the exception
 267  * types in the {@code throws} clause of the method in <i>all</i> of
 268  * the proxy interfaces that it can be invoked through.  If the
 269  * {@code invoke} method throws a checked exception that is not
 270  * assignable to any of the exception types declared by the method in one
 271  * of the proxy interfaces that it can be invoked through, then an
 272  * unchecked {@code UndeclaredThrowableException} will be thrown by
 273  * the invocation on the proxy instance.  This restriction means that not
 274  * all of the exception types returned by invoking
 275  * {@code getExceptionTypes} on the {@code Method} object
 276  * passed to the {@code invoke} method can necessarily be thrown
 277  * successfully by the {@code invoke} method.
 278  *
 279  * @author      Peter Jones
 280  * @see         InvocationHandler
 281  * @since       1.3
 282  * @revised 9
 283  * @spec JPMS
 284  */
 285 public class Proxy implements java.io.Serializable {

 286     private static final long serialVersionUID = -2222568056686623797L;
 287 
 288     /** parameter types of a proxy class constructor */
 289     private static final Class<?>[] constructorParams =
 290         { InvocationHandler.class };
 291 
 292     /**
 293      * a cache of proxy constructors with
 294      * {@link Constructor#setAccessible(boolean) accessible} flag already set
 295      */
 296     private static final ClassLoaderValue<Constructor<?>> proxyCache =
 297         new ClassLoaderValue<>();
 298 
 299     /**
 300      * System property to revert to generation of proxy class files for version 1.5 (V49).
 301      * Set to "true" to generate v49 class file format.
 302      */
 303     private static final boolean PROXY_GENERATOR_V49 =
 304             GetBooleanAction.privilegedGetProperty("jdk.proxy.ProxyGenerator.v49");
 305 




 266  * checked exception types that are assignable to one of the exception
 267  * types in the {@code throws} clause of the method in <i>all</i> of
 268  * the proxy interfaces that it can be invoked through.  If the
 269  * {@code invoke} method throws a checked exception that is not
 270  * assignable to any of the exception types declared by the method in one
 271  * of the proxy interfaces that it can be invoked through, then an
 272  * unchecked {@code UndeclaredThrowableException} will be thrown by
 273  * the invocation on the proxy instance.  This restriction means that not
 274  * all of the exception types returned by invoking
 275  * {@code getExceptionTypes} on the {@code Method} object
 276  * passed to the {@code invoke} method can necessarily be thrown
 277  * successfully by the {@code invoke} method.
 278  *
 279  * @author      Peter Jones
 280  * @see         InvocationHandler
 281  * @since       1.3
 282  * @revised 9
 283  * @spec JPMS
 284  */
 285 public class Proxy implements java.io.Serializable {
 286     @java.io.Serial
 287     private static final long serialVersionUID = -2222568056686623797L;
 288 
 289     /** parameter types of a proxy class constructor */
 290     private static final Class<?>[] constructorParams =
 291         { InvocationHandler.class };
 292 
 293     /**
 294      * a cache of proxy constructors with
 295      * {@link Constructor#setAccessible(boolean) accessible} flag already set
 296      */
 297     private static final ClassLoaderValue<Constructor<?>> proxyCache =
 298         new ClassLoaderValue<>();
 299 
 300     /**
 301      * System property to revert to generation of proxy class files for version 1.5 (V49).
 302      * Set to "true" to generate v49 class file format.
 303      */
 304     private static final boolean PROXY_GENERATOR_V49 =
 305             GetBooleanAction.privilegedGetProperty("jdk.proxy.ProxyGenerator.v49");
 306 


< prev index next >