code: public static void checkProxyPackageAccess(Class<?> clazz) {
          SecurityManager s = System.getSecurityManager();
          if (s != null) {
              // check proxy interfaces if the given class is a proxy class
              if (Proxy.isProxyClass(clazz)) {
                  for (Class<?> intf : clazz.getInterfaces()) {
                      checkPackageAccess(intf);
                  }
              }
          }
      }
docs: Check package access on the proxy interfaces that the given proxy class
  implements.
  
  @param clazz Proxy class object