< prev index next >

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

Print this page
*** 48,10 ***
--- 48,11 ---
  import java.util.concurrent.atomic.AtomicLong;
  import java.util.function.BooleanSupplier;
  
  import jdk.internal.access.JavaLangAccess;
  import jdk.internal.access.SharedSecrets;
+ import jdk.internal.value.PrimitiveClass;
  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;

*** 518,11 ***
                          // All proxy superinterfaces are public, must be in named dynamic module
                          throw new InternalError("public proxy in unnamed module: " + module);
                      }
                  }
  
!                 if ((accessFlags & ~Modifier.PUBLIC) != 0) {
                      throw new InternalError("proxy access flags must be Modifier.PUBLIC or 0");
                  }
              }
          }
  
--- 519,11 ---
                          // All proxy superinterfaces are public, must be in named dynamic module
                          throw new InternalError("public proxy in unnamed module: " + module);
                      }
                  }
  
!                 if ((accessFlags & ~(Modifier.PUBLIC | Modifier.IDENTITY)) != 0) {
                      throw new InternalError("proxy access flags must be Modifier.PUBLIC or 0");
                  }
              }
          }
  

*** 540,11 ***
  
              /*
               * Generate the specified proxy class.
               */
              byte[] proxyClassFile = ProxyGenerator.generateProxyClass(loader, proxyName, interfaces,
!                                                                       context.accessFlags() | Modifier.FINAL);
              try {
                  Class<?> pc = JLA.defineClass(loader, proxyName, proxyClassFile,
                                                null, "__dynamic_proxy__");
                  reverseProxyCache.sub(pc).putIfAbsent(loader, Boolean.TRUE);
                  return pc;
--- 541,11 ---
  
              /*
               * Generate the specified proxy class.
               */
              byte[] proxyClassFile = ProxyGenerator.generateProxyClass(loader, proxyName, interfaces,
!                                                                       context.accessFlags() | Modifier.FINAL | Modifier.IDENTITY);
              try {
                  Class<?> pc = JLA.defineClass(loader, proxyName, proxyClassFile,
                                                null, "__dynamic_proxy__");
                  reverseProxyCache.sub(pc).putIfAbsent(loader, Boolean.TRUE);
                  return pc;

*** 874,11 ***
              Class<?> type = null;
              try {
                  type = Class.forName(c.getName(), false, ld);
              } catch (ClassNotFoundException e) {
              }
!             if (type != c) {
                  throw new IllegalArgumentException(c.getName() +
                          " referenced from a method is not visible from class loader");
              }
          }
  
--- 875,11 ---
              Class<?> type = null;
              try {
                  type = Class.forName(c.getName(), false, ld);
              } catch (ClassNotFoundException e) {
              }
!             if (PrimitiveClass.asPrimaryType(type) != PrimitiveClass.asPrimaryType(c)) {
                  throw new IllegalArgumentException(c.getName() +
                          " referenced from a method is not visible from class loader");
              }
          }
  
< prev index next >