code: public static boolean isVisible(Class<?> clazz, ClassLoader classLoader) {
          if (classLoader == null) {
              return true;
          }
          try {
              Class<?> actualClass = classLoader.loadClass(clazz.getName());
              return (clazz == actualClass);
              // Else: different interface class found...
          }
          catch (ClassNotFoundException ex) {
              // No interface class found...
              return false;
          }
      }
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})