code: public static boolean isVisible(Class<?> clazz, ClassLoader classLoader) {
          if (classLoader == null) {
              return true;
          }
          try {
              if (clazz.getClassLoader() == classLoader) {
                  return true;
              }
          } catch (SecurityException ex) {
              // Fall through to loadable check below
          }
  
          // Visible if same Class can be loaded from given ClassLoader
          return isLoadable(clazz, classLoader);
      }
docs: Check whether the given class is visible in the given ClassLoader.
  
  @param clazz the class to check (typically an interface)
  @param classLoader the ClassLoader to check against
  (may be {@code null} in which case this method will always return {@code true})
  @return true if the given class is visible; otherwise false
  @since 6.0.0