jdk/src/share/classes/java/lang/reflect/Proxy.java
changeset 18251 3743160a4cb8
parent 18249 aec7e8963c3e
parent 17497 e65d73b7ae54
child 20825 3d5429b4b601
equal deleted inserted replaced
18250:6a8b17cf0cd9 18251:3743160a4cb8
    29 import java.security.AccessController;
    29 import java.security.AccessController;
    30 import java.security.PrivilegedAction;
    30 import java.security.PrivilegedAction;
    31 import java.util.Arrays;
    31 import java.util.Arrays;
    32 import java.util.IdentityHashMap;
    32 import java.util.IdentityHashMap;
    33 import java.util.Map;
    33 import java.util.Map;
       
    34 import java.util.Objects;
    34 import java.util.concurrent.atomic.AtomicLong;
    35 import java.util.concurrent.atomic.AtomicLong;
    35 import java.util.function.BiFunction;
    36 import java.util.function.BiFunction;
    36 import sun.misc.ProxyGenerator;
    37 import sun.misc.ProxyGenerator;
    37 import sun.misc.VM;
    38 import sun.misc.VM;
    38 import sun.reflect.CallerSensitive;
    39 import sun.reflect.CallerSensitive;
   253     /**
   254     /**
   254      * Constructs a new {@code Proxy} instance from a subclass
   255      * Constructs a new {@code Proxy} instance from a subclass
   255      * (typically, a dynamic proxy class) with the specified value
   256      * (typically, a dynamic proxy class) with the specified value
   256      * for its invocation handler.
   257      * for its invocation handler.
   257      *
   258      *
   258      * @param   h the invocation handler for this proxy instance
   259      * @param  h the invocation handler for this proxy instance
       
   260      *
       
   261      * @throws NullPointerException if the given invocation handler, {@code h},
       
   262      *         is {@code null}.
   259      */
   263      */
   260     protected Proxy(InvocationHandler h) {
   264     protected Proxy(InvocationHandler h) {
       
   265         Objects.requireNonNull(h);
   261         this.h = h;
   266         this.h = h;
   262     }
   267     }
   263 
   268 
   264     /**
   269     /**
   265      * Returns the {@code java.lang.Class} object for a proxy class
   270      * Returns the {@code java.lang.Class} object for a proxy class
   696     public static Object newProxyInstance(ClassLoader loader,
   701     public static Object newProxyInstance(ClassLoader loader,
   697                                           Class<?>[] interfaces,
   702                                           Class<?>[] interfaces,
   698                                           InvocationHandler h)
   703                                           InvocationHandler h)
   699         throws IllegalArgumentException
   704         throws IllegalArgumentException
   700     {
   705     {
   701         if (h == null) {
   706         Objects.requireNonNull(h);
   702             throw new NullPointerException();
       
   703         }
       
   704 
   707 
   705         final SecurityManager sm = System.getSecurityManager();
   708         final SecurityManager sm = System.getSecurityManager();
   706         if (sm != null) {
   709         if (sm != null) {
   707             checkProxyAccess(Reflection.getCallerClass(), loader, interfaces);
   710             checkProxyAccess(Reflection.getCallerClass(), loader, interfaces);
   708         }
   711         }