+ * Technically it might be better to OSGIfy the Xalan code, which + * would also permit demand-loading of only the classes actually being + * used by this execution... but that's an idea for the future. + *
+ * This code renders the tag keywords (internal, advanced, experimental) + * into their expanded renderings in the Javadoc. + *
+ * Source code recreated from xalan2jtaglet.jar by IntelliJ IDEA (powered by + * FernFlower decompiler), then adjusted to JDK 8 taglet API. + */ public class XSLUsage { public static final String TAG = "xsl.usage"; private static final int INTERNAL = 0; private static final int ADVANCED = 1; private static final int EXPERIMENTAL = 2; private static final int UNSPECIFIED = -1; - private static final String[] names = new String[]{"internal", "advanced", "experimental"}; - private static final String[] colours = new String[]{"FF0000", "00FF00", "0000FF"}; - private static final String[] messages = new String[]{"**For internal use only**", "**For advanced use only**", "**Experimental**"}; - - public XSLUsage() { - } + private static final String[] names = new String[]{ + "internal", "advanced", "experimental" + }; + private static final String[] colours = new String[]{ + "FF0000", "00FF00", "0000FF" + }; + private static final String[] messages = new String[]{ + "**For internal use only**", "**For advanced use only**", "**Experimental**" + }; public static String getHTML(Tag usageTag) { int key = getKey(usageTag); - return key == -1 ? "" : " " + messages[key] + "\n"; + return key == -1 + ? "" + : " " + messages[key] + "\n"; } private static int getKey(Tag usageTag) { for (int i = 0; i < names.length; ++i) { - if (names[i].equals(usageTag.text())) { + if (names[i].equals(usageTag.text())) return i; - } } - return -1; } } diff --git a/xalan2jtaglet/src/main/java/xalan2jtaglet/XSLUsageTag.java b/xalan2jtaglet/src/main/java/xalan2jtaglet/XSLUsageTag.java index c009ec0a4..c2cf80941 100644 --- a/xalan2jtaglet/src/main/java/xalan2jtaglet/XSLUsageTag.java +++ b/xalan2jtaglet/src/main/java/xalan2jtaglet/XSLUsageTag.java @@ -1,17 +1,3 @@ -/** Taglet for Xalan-Java documentation, giving us a standard way to - indicate when classes are public only because they are shared - across packages within Xalan code, not because they are intended for use - by others. Typical: "@xsl.usage internal" - - Technically it might be better to OSGIfy the Xalan code, which - would also permit demand-loading of only the classes actually being - used by this execution... but that's an idea for the future. - */ -// -// Source code recreated from xalan2jtaglet.jar by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - package xalan2jtaglet; import com.sun.javadoc.Tag; @@ -19,71 +5,88 @@ import java.util.Map; +/** + * Taglet for Xalan-Java documentation, giving us a standard way to + * indicate when classes are public only because they are shared + * across packages within Xalan code, not because they are intended for use + * by others. Typical: "@xsl.usage internal" + *
+ * Technically it might be better to OSGIfy the Xalan code, which + * would also permit demand-loading of only the classes actually being + * used by this execution... but that's an idea for the future. + *
+ * This code renders the tag keywords (internal, advanced, experimental) + * into their expanded renderings in the Javadoc. + *
+ * Source code recreated from xalan2jtaglet.jar by IntelliJ IDEA (powered by + * FernFlower decompiler), then adjusted to JDK 8 taglet API. + */ public class XSLUsageTag implements Taglet { private static final String HEADER = "Usage:"; - public XSLUsageTag() {} - + @Override public boolean inConstructor() { return true; } + @Override public boolean inField() { return true; } + @Override public boolean inMethod() { return true; } + @Override public boolean inOverview() { return true; } + @Override public boolean inPackage() { return true; } + @Override public boolean inType() { return true; } + @Override public boolean isInlineTag() { return false; } + @Override public String getName() { return "xsl.usage"; } - public String toString(Tag arg0) { - return "\n
+ * Technically it might be better to OSGIfy the Xalan code, which + * would also permit demand-loading of only the classes actually being + * used by this execution... but that's an idea for the future. + *
+ * This code renders the tag keywords (internal, advanced, experimental) + * into their expanded renderings in the Javadoc. + *
+ * Source code recreated from xalan2jtaglet.jar by IntelliJ IDEA (powered by + * FernFlower decompiler), then adjusted to JDK 9+ taglet API. + */ +public class XSLUsage { + public static final String TAG = "xsl.usage"; + private static final int INTERNAL = 0; + private static final int ADVANCED = 1; + private static final int EXPERIMENTAL = 2; + private static final int UNSPECIFIED = -1; + private static final String[] names = new String[]{ + "internal", "advanced", "experimental" + }; + private static final String[] colours = new String[]{ + "FF0000", "00FF00", "0000FF" + }; + private static final String[] messages = new String[]{ + "**For internal use only**", "**For advanced use only**", "**Experimental**" + }; + + public static String getHTML(DocTree usageTag) { + int key = getKey(usageTag); + return key == -1 + ? "" + : " " + messages[key] + "\n"; + } + + private static int getKey(DocTree usageTag) { + if (usageTag instanceof UnknownBlockTagTree) { + UnknownBlockTagTree tag = (UnknownBlockTagTree) usageTag; + for (int i = 0; i < names.length; ++i) { + if (names[i].equals(tag.getContent().toString())) + return i; + } + } + return -1; + } +} diff --git a/xalan2jtaglet_jdk9/src/main/java/xalan2jtaglet/XSLUsageTag.java b/xalan2jtaglet_jdk9/src/main/java/xalan2jtaglet/XSLUsageTag.java new file mode 100644 index 000000000..e29f8d53a --- /dev/null +++ b/xalan2jtaglet_jdk9/src/main/java/xalan2jtaglet/XSLUsageTag.java @@ -0,0 +1,63 @@ +package xalan2jtaglet; + +import com.sun.source.doctree.DocTree; +import jdk.javadoc.doclet.Taglet; + +import javax.lang.model.element.Element; +import java.util.*; + +/** + * Taglet for Xalan-Java documentation, giving us a standard way to + * indicate when classes are public only because they are shared + * across packages within Xalan code, not because they are intended for use + * by others. Typical: "@xsl.usage internal" + *
+ * Technically it might be better to OSGIfy the Xalan code, which + * would also permit demand-loading of only the classes actually being + * used by this execution... but that's an idea for the future. + *
+ * This code renders the tag keywords (internal, advanced, experimental) + * into their expanded renderings in the Javadoc. + *
+ * Source code recreated from xalan2jtaglet.jar by IntelliJ IDEA (powered by
+ * FernFlower decompiler), then adjusted to JDK 9+ taglet API.
+ */
+public class XSLUsageTag implements Taglet {
+ private static final String HEADER = "Usage:";
+
+ @Override
+ public Set