8176331: Simplify new doclet packages

Reviewed-by: ksrini
This commit is contained in:
Jonathan Gibbons 2017-03-09 13:46:40 -08:00
parent a6a8595d7e
commit 1aa88debf6
16 changed files with 33 additions and 108 deletions

View File

@ -23,16 +23,13 @@
* questions.
*/
package jdk.javadoc.doclets;
package jdk.javadoc.doclet;
import java.util.Locale;
import java.util.Set;
import javax.lang.model.SourceVersion;
import jdk.javadoc.doclet.Doclet;
import jdk.javadoc.doclet.DocletEnvironment;
import jdk.javadoc.doclet.Reporter;
import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;
/**

View File

@ -23,7 +23,7 @@
* questions.
*/
package jdk.javadoc.doclet.taglet;
package jdk.javadoc.doclet;
import java.util.List;
import java.util.Set;
@ -32,7 +32,7 @@ import com.sun.source.doctree.DocTree;
/**
* The interface for a custom taglet supported by doclets such as
* the {@link jdk.javadoc.doclets.StandardDoclet standard doclet}.
* the {@link jdk.javadoc.doclet.StandardDoclet standard doclet}.
* Custom taglets are used to handle custom tags in documentation
* comments.
*

View File

@ -29,6 +29,12 @@
* to inspect the source-level structures of programs and
* libraries, including API comments embedded in the source.
*
* <p>
* The {@link StandardDoclet standard doclet} can be used to
* generate HTML-formatted documentation. It supports user-defined
* {@link Taglet taglets}, which can be used to generate customized
* output for user-defined tags in documentation comments.
*
* <p style="font-style: italic">
* <b>Note:</b> The declarations in this package supersede those
* in the older package {@code com.sun.javadoc}. For details on the

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The Taglet API provides a way to declare custom tags that can be
* used by the standard doclet.
*
* <p style="font-style: italic">
* <b>Note:</b> The declarations in this package supersede those
* in the older package {@code com.sun.tools.doclets}.
* </p>
*
* @since 9
*/
package jdk.javadoc.doclet.taglet;

View File

@ -1,30 +0,0 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This package contains standard, supported doclets.
*/
package jdk.javadoc.doclets;

View File

@ -34,7 +34,7 @@ import javax.lang.model.element.TypeElement;
import jdk.javadoc.doclet.Doclet;
import jdk.javadoc.doclet.DocletEnvironment;
import jdk.javadoc.doclets.StandardDoclet;
import jdk.javadoc.doclet.StandardDoclet;
import jdk.javadoc.internal.doclets.formats.html.HtmlDoclet;
import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
import jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory;

View File

@ -251,7 +251,7 @@ public class TagletManager {
tagClassLoader = fileManager.getClassLoader(TAGLET_PATH);
Class<?> customTagClass = tagClassLoader.loadClass(classname);
Object instance = customTagClass.getConstructor().newInstance();
Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.taglet.Taglet)instance);
Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.Taglet)instance);
String tname = newLegacy.getName();
Taglet t = customTags.get(tname);
if (t != null) {
@ -315,8 +315,8 @@ public class TagletManager {
private void checkTaglet(Object taglet) {
if (taglet instanceof Taglet) {
checkTagName(((Taglet) taglet).getName());
} else if (taglet instanceof jdk.javadoc.doclet.taglet.Taglet) {
jdk.javadoc.doclet.taglet.Taglet legacyTaglet = (jdk.javadoc.doclet.taglet.Taglet) taglet;
} else if (taglet instanceof jdk.javadoc.doclet.Taglet) {
jdk.javadoc.doclet.Taglet legacyTaglet = (jdk.javadoc.doclet.Taglet) taglet;
customTags.remove(legacyTaglet.getName());
customTags.put(legacyTaglet.getName(), new UserTaglet(legacyTaglet));
checkTagName(legacyTaglet.getName());

View File

@ -34,10 +34,10 @@ import jdk.javadoc.internal.doclets.formats.html.markup.RawHtml;
import jdk.javadoc.internal.doclets.toolkit.Content;
import jdk.javadoc.internal.doclets.toolkit.util.Utils;
import static jdk.javadoc.doclet.taglet.Taglet.Location.*;
import static jdk.javadoc.doclet.Taglet.Location.*;
/**
* A taglet wrapper, allows the public taglet {@link jdk.javadoc.doclet.taglet.Taglet}
* A taglet wrapper, allows the public taglet {@link jdk.javadoc.doclet.Taglet}
* wrapped into an internal Taglet representation.
*
* <p><b>This is NOT part of any supported API.
@ -49,9 +49,9 @@ import static jdk.javadoc.doclet.taglet.Taglet.Location.*;
*/
public class UserTaglet implements Taglet {
final private jdk.javadoc.doclet.taglet.Taglet userTaglet;
final private jdk.javadoc.doclet.Taglet userTaglet;
public UserTaglet(jdk.javadoc.doclet.taglet.Taglet t) {
public UserTaglet(jdk.javadoc.doclet.Taglet t) {
userTaglet = t;
}

View File

@ -93,7 +93,7 @@ public class Start extends ToolOption.Helper {
com.sun.tools.doclets.standard.Standard.class;
private static final Class<?> StdDoclet =
jdk.javadoc.doclets.StandardDoclet.class;
jdk.javadoc.doclet.StandardDoclet.class;
/** Context for this invocation. */
private final Context context;

View File

@ -40,8 +40,6 @@ module jdk.javadoc {
exports com.sun.tools.javadoc;
exports jdk.javadoc.doclet;
exports jdk.javadoc.doclet.taglet;
exports jdk.javadoc.doclets;
provides java.util.spi.ToolProvider
with jdk.javadoc.internal.tool.JavadocToolProvider;

View File

@ -26,12 +26,11 @@ import java.util.List;
import java.util.Set;
import com.sun.source.doctree.DocTree;
import jdk.javadoc.doclet.taglet.Taglet;
import jdk.javadoc.doclet.Taglet;
public class Check implements Taglet {
private static final String TAG_NAME = "check";
private static final String TAG_HEADER = "Check:";
private final EnumSet<Location> allowedSet = EnumSet.allOf(Location.class);
@ -45,6 +44,7 @@ public class Check implements Taglet {
*
* @return false since the tag is not an inline tag.
*/
@Override
public boolean isInlineTag() {
return false;
}
@ -54,28 +54,19 @@ public class Check implements Taglet {
*
* @return the name of this tag.
*/
@Override
public String getName() {
return TAG_NAME;
}
/**
* Given the DocTree representation of this custom tag, return its string
* representation.
*
* @param tag the DocTree representing this custom tag.
*/
public String toString(DocTree tag) {
return "<dt><span class=\"simpleTagLabel\">" + TAG_HEADER + ":</span></dt><dd>" +
tag.toString() + "</dd>\n";
}
/**
* Given an array of DocTrees representing this custom tag, return its string
* Given a list of DocTrees representing this custom tag, return its string
* representation.
*
* @param tags the array of tags representing this custom tag.
* @return null to test if the javadoc throws an exception or not.
*/
@Override
public String toString(List<? extends DocTree> tags) {
return null;
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 4638723 8015882 8176131
* @bug 4638723 8015882 8176131 8176331
* @summary Test to ensure that the refactored version of the standard
* doclet still works with Taglets that implement the 1.4.0 interface.
* @author jamieh

View File

@ -32,9 +32,9 @@ import com.sun.source.doctree.TextTree;
import com.sun.source.doctree.UnknownBlockTagTree;
import com.sun.source.doctree.UnknownInlineTagTree;
import com.sun.source.util.SimpleDocTreeVisitor;
import jdk.javadoc.doclet.taglet.Taglet;
import jdk.javadoc.doclet.taglet.Taglet.Location;
import static jdk.javadoc.doclet.taglet.Taglet.Location.*;
import jdk.javadoc.doclet.Taglet;
import jdk.javadoc.doclet.Taglet.Location;
import static jdk.javadoc.doclet.Taglet.Location.*;
/**

View File

@ -26,8 +26,8 @@ import java.util.List;
import java.util.Set;
import com.sun.source.doctree.DocTree;
import jdk.javadoc.doclet.taglet.Taglet;
import static jdk.javadoc.doclet.taglet.Taglet.Location.*;
import jdk.javadoc.doclet.Taglet;
import static jdk.javadoc.doclet.Taglet.Location.*;
/**
* A sample Inline Taglet representing {@underline ...}. The text

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8035473 8154482 8154399 8159096 8176131
* @bug 8035473 8154482 8154399 8159096 8176131 8176331
* @summary make sure the javadoc tool responds correctly to Xold,
* old doclets and taglets.
* @library /tools/lib
@ -87,7 +87,7 @@ public class EnsureNewOldDoclet extends TestRunner {
CLASS_NAME + "\\$OldTaglet.*");
final static String OLD_STDDOCLET = "com.sun.tools.doclets.standard.Standard";
final static String NEW_STDDOCLET = "jdk.javadoc.doclets.StandardDoclet";
final static String NEW_STDDOCLET = "jdk.javadoc.doclet.StandardDoclet";
public EnsureNewOldDoclet() throws Exception {
@ -340,7 +340,7 @@ public class EnsureNewOldDoclet extends TestRunner {
}
}
public static class NewTaglet implements jdk.javadoc.doclet.taglet.Taglet {
public static class NewTaglet implements jdk.javadoc.doclet.Taglet {
@Override
public Set<Location> getAllowedLocations() {

View File

@ -45,7 +45,7 @@ import com.sun.source.doctree.TextTree;
import com.sun.source.doctree.UnknownBlockTagTree;
import com.sun.source.doctree.UnknownInlineTagTree;
import com.sun.source.util.SimpleDocTreeVisitor;
import jdk.javadoc.doclet.taglet.Taglet;
import jdk.javadoc.doclet.Taglet;
/**
* A sample Inline Taglet representing {@underline ...}. This tag can