8261623: reference to javac internals in Extern class

Reviewed-by: hannesw
This commit is contained in:
Jonathan Gibbons 2021-02-12 16:16:44 +00:00
parent 350303d4f0
commit 3aa1b4c72c
2 changed files with 13 additions and 13 deletions
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit

@ -198,6 +198,18 @@ public class WorkArounds {
return elementUtils.getTypeElement(className);
}
// TODO: The following should be replaced by a new method such as Elements.isAutomaticModule
// see JDK-8261625
public boolean isAutomaticModule(ModuleElement me) {
if (me == null) {
return false;
} else {
ModuleSymbol msym = (ModuleSymbol) me;
return (msym.flags() & Flags.AUTOMATIC_MODULE) != 0;
}
}
// TODO: need to re-implement this using j.l.m. correctly!, this has
// implications on testInterface, the note here is that javac's supertype
// does the right thing returning Parameters in scope.

@ -47,8 +47,6 @@ import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import javax.tools.DocumentationTool;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.code.Symbol.ModuleSymbol;
import jdk.javadoc.doclet.Reporter;
import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration;
@ -575,7 +573,7 @@ public class Extern {
return DocletConstants.DEFAULT_ELEMENT_NAME;
} else if (moduleName == null) {
// suppress the warning message in the case of automatic modules
if (!isAutomaticModule(me) && issueWarning) {
if (!configuration.workArounds.isAutomaticModule(me) && issueWarning) {
configuration.getReporter().print(Kind.WARNING,
resources.getText("doclet.linkMismatch_ModuleLinkedtoPackage", path));
}
@ -586,16 +584,6 @@ public class Extern {
return moduleName == null ? DocletConstants.DEFAULT_ELEMENT_NAME : moduleName;
}
// The following should be replaced by a new method such as Elements.isAutomaticModule
private boolean isAutomaticModule(ModuleElement me) {
if (me == null) {
return false;
} else {
ModuleSymbol msym = (ModuleSymbol) me;
return (msym.flags() & Flags.AUTOMATIC_MODULE) != 0;
}
}
public boolean isUrl (String urlCandidate) {
try {
new URL(urlCandidate);