code: public static Manifest loadManifest(Class<?> type) {
  
      try {
        Manifest manifest = null;
        String classpath = type.getName().replace('.', '/') + ".class";
        URL classUrl = type.getClassLoader().getResource(classpath);
        if (classUrl != null) {
          String protocol = classUrl.getProtocol().toLowerCase(Locale.US);
          if ("jar".equals(protocol)) {
            JarURLConnection connection = (JarURLConnection) classUrl.openConnection();
            JarFile jarFile = connection.getJarFile();
            // create a copy to avoid modification of the original manifest...
            manifest = new Manifest(jarFile.getManifest());
          } else if ("file".equals(protocol)) {
            String urlString = URLDecoder.decode(classUrl.getFile(), "UTF-8");
            if (urlString.endsWith(classpath)) {
              String rootpath = urlString.substring(0, urlString.length() - classpath.length());
              File manifestFile = new File(rootpath, JarFile.MANIFEST_NAME);
              if (manifestFile.exists()) {
                InputStream inputStream = new FileInputStream(manifestFile);
                try {
                  manifest = new Manifest(inputStream);
                } finally {
                  inputStream.close();
                }
              }
            }
          }
        }
        return manifest;
      } catch (IOException e) {
        throw new IllegalStateException("Failed to read manifest.", e);
      }
    }
docs: This method tries to load the {@link Manifest} for the given {@link Class}. E.g. if the given
  {@link Class} comes from a {@link JarFile} the {@link JarFile#getManifest() Manifest} of that
  {@link JarFile} is returned.
  
  @param type is the {@link Class} for which the according {@link Manifest} is requested.
  @return the according {@link Manifest} or {@code null} if NOT available.
  @since 2.0.0