Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.netbeans.modules.java.source;

import com.sun.tools.javac.code.Symbol.ClassSymbol;

import java.awt.EventQueue;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -51,8 +52,10 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.lang.model.element.Element;
import javax.lang.model.element.ElementKind;
import javax.lang.model.element.ExecutableElement;
Expand All @@ -68,6 +71,7 @@
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.parser.ParserDelegator;

import org.netbeans.api.annotations.common.CheckForNull;
import org.netbeans.api.annotations.common.NonNull;
import org.netbeans.api.annotations.common.NullAllowed;
Expand Down Expand Up @@ -825,6 +829,19 @@ private static List<TextStream> findJavadoc(
throw x;
}
url = new URL(root, modName + "/" + pkgName + "/" + pageName + ".html");
} catch (IOException ioex) {
// no module-info, let's search Automatic-Module-Info in the manifest
URL manifestURL = new URL(binary, "META-INF/MANIFEST.MF"); // NOI18N
try (InputStream manifestStream = manifestURL.openStream()) {
Manifest manifest = new Manifest(manifestStream);
String amn = manifest.getMainAttributes().getValue("Automatic-Module-Name"); // NOI18N
if (amn == null || amn.isBlank()) {
throw x;
}
url = new URL(root, amn + "/" + pkgName + "/" + pageName + ".html");
} catch (IOException manifestException) {
throw x;
}
}
} else {
// fallback to without module name
Expand Down
Loading