ehatcher 2002/06/02 20:28:45
Modified: proposal/xdocs/templates Tag: ANT_15_BRANCH
task_xdoc.template
proposal/xdocs/src/org/apache/tools/ant/xdoclet Tag:
ANT_15_BRANCH TaskSubTask.java TaskTagsHandler.java
Log:
add noting of deprecation for classes and methods in the output XML, also
note abstract classes used for nested elements.
Revision Changes Path
No revision
No revision
1.5.2.1 +11 -7 jakarta-ant/proposal/xdocs/templates/task_xdoc.template
Index: task_xdoc.template
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/xdocs/templates/task_xdoc.template,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- task_xdoc.template 5 Mar 2002 03:26:40 -0000 1.5
+++ task_xdoc.template 3 Jun 2002 03:28:45 -0000 1.5.2.1
@@ -1,6 +1,7 @@
<XDtTagDef:tagDef namespace="Ant"
handler="org.apache.tools.ant.xdoclet.TaskTagsHandler"/>
<task name="<XDtAnt:taskName/>" category="<XDtAnt:categoryName/>"
- classname="<XDtClass:fullClassName/>">
+ classname="<XDtClass:fullClassName/>"
+ <XDtClass:ifHasClassTag
tagName="deprecated">deprecated="true"</XDtClass:ifHasClassTag>>
<XDtMerge:merge file="{0}.xml" generateMergedFile="false"></XDtMerge:merge>
@@ -13,7 +14,8 @@
<attributes>
<XDtAnt:forAllAttributes>
- <attribute name="<XDtMethod:propertyName/>"
type="<XDtParameter:forAllMethodParams><XDtParameter:methodParamType/></XDtParameter:forAllMethodParams>">
+ <attribute name="<XDtMethod:propertyName/>"
type="<XDtParameter:forAllMethodParams><XDtParameter:methodParamType/></XDtParameter:forAllMethodParams>"
+ <XDtMethod:ifHasMethodTag
tagName="deprecated">deprecated="true"</XDtMethod:ifHasMethodTag>>
<description><![CDATA[
<XDtMethod:methodComment no-comment-signs="true"/>
]]></description>
@@ -23,11 +25,10 @@
<elements>
<XDtAnt:forAllElements>
- <element name="<XDtAnt:elementName/>" type="<XDtAnt:elementType/>">
- <description>
- <![CDATA[<XDtMethod:methodComment no-comment-signs="true"/>]]>
- </description>
+ <element name="<XDtAnt:elementName/>" type="<XDtAnt:elementType/>"
+ <XDtMethod:ifHasMethodTag
tagName="deprecated">deprecated="true"</XDtMethod:ifHasMethodTag>
<XDtClass:pushClass value="<XDtAnt:elementType/>">
+
<XDtClass:ifIsClassAbstract>abstract="true"</XDtClass:ifIsClassAbstract>>
<XDtAnt:ifHasAttributes>
<attributes>
<XDtAnt:forAllAttributes>
@@ -40,6 +41,9 @@
</attributes>
</XDtAnt:ifHasAttributes>
</XDtClass:pushClass>
+ <description>
+ <![CDATA[<XDtMethod:methodComment no-comment-signs="true"/>]]>
+ </description>
</element>
</XDtAnt:forAllElements>
@@ -48,7 +52,7 @@
<!-- @todo: wrap setCurrentMethod inside AntTagsHandler -->
<!-- @todo: create a XDtAnt:description wrapper for methodComment -->
<XDtMethod:setCurrentMethod name="addText" parameters="java.lang.String">
- <body>
+ <body <XDtMethod:ifHasMethodTag
tagName="deprecated">deprecated="true"</XDtMethod:ifHasMethodTag>>
<description><![CDATA[
<XDtMethod:methodComment no-comment-signs="true"/>
]]></description>
No revision
No revision
1.1.2.1 +3 -3
jakarta-ant/proposal/xdocs/src/org/apache/tools/ant/xdoclet/TaskSubTask.java
Index: TaskSubTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/xdocs/src/org/apache/tools/ant/xdoclet/TaskSubTask.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- TaskSubTask.java 5 Mar 2002 03:26:40 -0000 1.1
+++ TaskSubTask.java 3 Jun 2002 03:28:45 -0000 1.1.2.1
@@ -69,6 +69,7 @@
public class TaskSubTask extends TemplateSubTask {
public final static String SUBTASK_NAME = "tasks";
+
public String getSubTaskName() {
return SUBTASK_NAME;
}
@@ -104,15 +105,14 @@
return false;
}
- /* Leave deprecated tasks in for now
+/*
Tag[] tags = clazz.tags();
for (int i = 0; i < tags.length; i++) {
if ("@deprecated".equals(tags[i].name())) {
return false;
}
}
- */
-
+*/
if (hasExecuteMethod(clazz)) {
return true;
}
1.1.2.2 +17 -22
jakarta-ant/proposal/xdocs/src/org/apache/tools/ant/xdoclet/TaskTagsHandler.java
Index: TaskTagsHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/xdocs/src/org/apache/tools/ant/xdoclet/TaskTagsHandler.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- TaskTagsHandler.java 28 May 2002 20:16:49 -0000 1.1.2.1
+++ TaskTagsHandler.java 3 Jun 2002 03:28:45 -0000 1.1.2.2
@@ -56,8 +56,6 @@
import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.MethodDoc;
import com.sun.javadoc.Parameter;
-import com.sun.javadoc.Type;
-
import xdoclet.XDocletException;
import xdoclet.XDocletTagSupport;
import xdoclet.tags.AbstractProgramElementTagsHandler;
@@ -172,11 +170,9 @@
String elementName = "<not a valid element>";
if (methodName.startsWith("addConfigured")) {
elementName = methodName.substring(13, methodName.length());
- }
- else if (methodName.startsWith("add")) {
+ } else if (methodName.startsWith("add")) {
elementName = methodName.substring(3, methodName.length());
- }
- else if (methodName.startsWith("create")) {
+ } else if (methodName.startsWith("create")) {
elementName = methodName.substring(6, methodName.length());
}
return elementName.toLowerCase();
@@ -201,9 +197,8 @@
ClassDoc classDoc = null;
String methodName = getCurrentMethod().name();
if (methodName.startsWith("addConfigured") ||
- methodName.startsWith("add") ||
- methodName.startsWith("create"))
- {
+ methodName.startsWith("add") ||
+ methodName.startsWith("create")) {
classDoc = getCurrentMethod().returnType().asClassDoc();
if (classDoc == null) {
Parameter[] params = getCurrentMethod().parameters();
@@ -219,7 +214,7 @@
* Provides the Ant task name.
*
* @see #getTaskName(ClassDoc)
- * @doc:tag type="content"
+ * @doc:tag type="content"
*/
public String taskName() throws XDocletException {
return getTaskName(getCurrentClass());
@@ -272,8 +267,7 @@
null, false, XDocletTagSupport.FOR_CLASS, false);
if (tagValue != null) {
tagValue = tagValue.toLowerCase();
- }
- else {
+ } else {
tagValue = DEFAULT_CATEGORY;
}
return tagValue;
@@ -284,7 +278,6 @@
* Returns true if the method corresponds to an Ant task attribute using
* the rules from IntrospectionHelper
*
- * @todo filter out deprecated methods
* only filter org.apache.tools.ant.Task setters that are hidden
* check that it returns void and only has single argument
* incorporate rules for argument types from IntrospectionHelper
@@ -296,6 +289,7 @@
* - Class with string constructor
*/
private boolean isAntAttribute(MethodDoc method) {
+/*
String[] excludeList = new String[]{"setLocation", "setDescription",
"setOwningTarget", "setRuntimeConfigurableWrapper",
"setTaskName", "setTaskType",
"setProject"};
for (int i = 0; i < excludeList.length; i++) {
@@ -303,7 +297,7 @@
return true;
}
}
-
+*/
return false;
}
@@ -334,7 +328,6 @@
if (params.length != 1) {
continue;
}
-
Parameter param = params[0];
// Screen out attribute setters if there are duplicates,
@@ -343,8 +336,7 @@
MethodDoc oldMethod = (MethodDoc) nameTypeMap.get(method.name());
if (oldMethod == null) {
nameTypeMap.put(method.name(), method);
- }
- else {
+ } else {
if
("java.lang.String".equals(oldMethod.parameters()[0].typeName())) {
attributeMethods.remove(oldMethod);
nameTypeMap.put(method.name(), method);
@@ -367,7 +359,7 @@
List attributeMethods = new ArrayList();
for (int i = 0; i < methods.length; i++) {
- if (! methods[i].isPublic()) {
+ if (!methods[i].isPublic()) {
continue;
}
@@ -386,12 +378,11 @@
if (!name.startsWith("create")) {
continue;
}
- }
- else if (params.length != 1) {
+ } else if (params.length != 1) {
continue;
}
- if ((name.startsWith("add") && !name.equals("addTask")) ||
+ if ((name.startsWith("add") && !name.equals("addText")) ||
name.startsWith("create")) {
attributeMethods.add(methods[i]);
}
@@ -401,7 +392,6 @@
return (MethodDoc[]) attributeMethods.toArray(new MethodDoc[0]);
}
-
/**
* This is a slightly refactored (thank you IntelliJ) version of
* some cut-and-paste from XDoclet code. It sorts all methods together
@@ -413,6 +403,11 @@
List methods = new ArrayList();
while (cur_class != null) {
+ // hardcoded to stop when it hits Task, nothing there
+ // or above that needs to be processed
+ if
(cur_class.qualifiedName().equals("org.apache.tools.ant.Task")) {
+ break;
+ }
List curMethods = Arrays.asList(cur_class.methods());
for (int j = 0; j < curMethods.size(); j++) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>