8160137: HTMLDoclet and AbstractDoclet should implement Doclet
Reviewed-by: ksrini
This commit is contained in:
parent
7593e50c73
commit
a39651d5ea
@ -46,22 +46,27 @@ public class StandardDoclet implements Doclet {
|
||||
htmlDoclet = new HtmlDoclet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Locale locale, Reporter reporter) {
|
||||
htmlDoclet.init(locale, reporter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Standard";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Doclet.Option> getSupportedOptions() {
|
||||
return htmlDoclet.getSupportedOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return htmlDoclet.sourceVersion();
|
||||
return htmlDoclet.getSupportedSourceVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(DocletEnvironment docEnv) {
|
||||
return htmlDoclet.run(docEnv);
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ import javax.lang.model.element.ModuleElement;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import com.sun.javadoc.PackageDoc;
|
||||
import jdk.javadoc.doclet.Doclet.Option;
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.doclet.Reporter;
|
||||
@ -66,6 +65,11 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
configuration = new ConfigurationImpl();
|
||||
}
|
||||
|
||||
@Override // defined by Doclet
|
||||
public String getName() {
|
||||
return "Html";
|
||||
}
|
||||
|
||||
/**
|
||||
* The global configuration information for this run.
|
||||
*/
|
||||
@ -77,28 +81,19 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
private static final DocPath DOCLET_RESOURCES = DocPath
|
||||
.create("/jdk/javadoc/internal/doclets/formats/html/resources");
|
||||
|
||||
@Override // defined by Doclet
|
||||
public void init(Locale locale, Reporter reporter) {
|
||||
configuration.reporter = reporter;
|
||||
configuration.locale = locale;
|
||||
messages = configuration.getMessages();
|
||||
}
|
||||
|
||||
/**
|
||||
* The "start" method as required by Javadoc.
|
||||
*
|
||||
* @param docEnv the root of the documentation tree.
|
||||
* @see jdk.doclet.DocletEnvironment
|
||||
* @return true if the doclet ran without encountering any errors.
|
||||
*/
|
||||
public boolean run(DocletEnvironment docEnv) {
|
||||
return startDoclet(docEnv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the configuration instance.
|
||||
* Override this method to use a different
|
||||
* configuration.
|
||||
*/
|
||||
@Override // defined by AbstractDoclet
|
||||
public Configuration configuration() {
|
||||
return configuration;
|
||||
}
|
||||
@ -113,6 +108,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
*
|
||||
* @see jdk.doclet.RootDoc
|
||||
*/
|
||||
@Override // defined by AbstractDoclet
|
||||
protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
|
||||
throws Exception {
|
||||
super.generateOtherFiles(docEnv, classtree);
|
||||
@ -228,6 +224,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override // defined by AbstractDoclet
|
||||
protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) {
|
||||
List<TypeElement> list = new ArrayList<>(arr);
|
||||
ListIterator<TypeElement> iterator = list.listIterator();
|
||||
@ -270,6 +267,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override // defined by AbstractDoclet
|
||||
protected void generateModuleFiles() throws Exception {
|
||||
if (configuration.showModules) {
|
||||
ModuleIndexFrameWriter.generate(configuration);
|
||||
@ -303,6 +301,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override // defined by AbstractDoclet
|
||||
protected void generatePackageFiles(ClassTree classtree) throws Exception {
|
||||
Set<PackageElement> packages = configuration.packages;
|
||||
if (packages.size() > 1) {
|
||||
@ -339,6 +338,7 @@ public class HtmlDoclet extends AbstractDoclet {
|
||||
}
|
||||
}
|
||||
|
||||
@Override // defined by Doclet
|
||||
public Set<Option> getSupportedOptions() {
|
||||
return configuration.getSupportedOptions();
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.PackageElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import jdk.javadoc.doclet.Doclet;
|
||||
import jdk.javadoc.doclet.DocletEnvironment;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
|
||||
import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory;
|
||||
@ -53,7 +54,7 @@ import static javax.tools.Diagnostic.Kind.*;
|
||||
*
|
||||
* @author Jamie Ho
|
||||
*/
|
||||
public abstract class AbstractDoclet {
|
||||
public abstract class AbstractDoclet implements Doclet {
|
||||
|
||||
/**
|
||||
* The global configuration information for this run.
|
||||
@ -92,7 +93,8 @@ public abstract class AbstractDoclet {
|
||||
* @param root the {@link DocletEnvironment} that points to the source to document.
|
||||
* @return true if the doclet executed without error. False otherwise.
|
||||
*/
|
||||
public boolean startDoclet(DocletEnvironment root) {
|
||||
@Override
|
||||
public boolean run(DocletEnvironment root) {
|
||||
configuration = configuration();
|
||||
configuration.docEnv = root;
|
||||
configuration.cmtUtils = new CommentUtils(configuration);
|
||||
@ -131,7 +133,8 @@ public abstract class AbstractDoclet {
|
||||
* Returns the SourceVersion indicating the features supported by this doclet.
|
||||
* @return SourceVersion
|
||||
*/
|
||||
public SourceVersion sourceVersion() {
|
||||
@Override
|
||||
public SourceVersion getSupportedSourceVersion() {
|
||||
return SourceVersion.RELEASE_9;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user