[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Cp-tools-discuss] Getting Doc and Tag contexts
From: |
Mark Wielaard |
Subject: |
Re: [Cp-tools-discuss] Getting Doc and Tag contexts |
Date: |
08 May 2002 17:28:10 +0200 |
Hi,
On Tue, 2002-05-07 at 15:05, Julian Scheid wrote:
> Another approach could be to output the name of the currently processed
> package/class. When you get a warning, you can then look some lines up
> and see in what context the warning arose.
> This would require far less changes to the code.
Here is what I have come up with. I record the current class and method
being parsed and pretty printed the warning message using this
information.
Will also add it to the patch manager as Alex requested.
Cheers,
Mark
Index: src/gnu/classpath/tools/doclets/xmldoclet/Driver.java
===================================================================
RCS file:
/cvsroot/cp-tools/gjdoc/src/gnu/classpath/tools/doclets/xmldoclet/Driver.java,v
retrieving revision 1.5
diff -u -r1.5 Driver.java
--- src/gnu/classpath/tools/doclets/xmldoclet/Driver.java 5 May 2002
12:53:55 -0000 1.5
+++ src/gnu/classpath/tools/doclets/xmldoclet/Driver.java 8 May 2002
15:25:24 -0000
@@ -65,6 +65,18 @@
public static final String tagPrefix = "gjdoc";
/**
+ * The current class that is being processed.
+ * Set in outputClassDoc().
+ */
+ private ClassDoc currentClass;
+
+ /**
+ * The current constructor/method that is being processed.
+ * Set in outputExecutableMemberDoc().
+ */
+ private ExecutableMemberDoc currentExecMember;
+
+ /**
* Official Doclet entry point.
*/
public static boolean start(RootDoc rootDoc) {
@@ -95,6 +107,9 @@
}
protected void outputExecutableMemberDocBody(int level, ExecutableMemberDoc
memberDoc) {
+
+ currentExecMember = memberDoc;
+
outputProgramElementDocBody(level, memberDoc);
Parameter[] parameters = memberDoc.parameters();
@@ -205,6 +220,9 @@
}
protected void outputClassDoc(ClassDoc classDoc) {
+
+ currentClass = classDoc;
+
println();
printOpenTag(1, "classdoc xmlns=\"http://www.w3.org/TR/REC-html40\"
xmlns:"+tagPrefix+"=\"http://www.gnu.org/software/cp-tools/gjdocxml\"
name=\""+classDoc.name()+"\"
qualifiedtypename=\""+classDoc.qualifiedName()+"\"");
@@ -333,7 +351,31 @@
outputType(level+1, "exception", throwsTag.exception());
}
else {
- rootDoc.printWarning("In ThrowsTag: Exception
'"+throwsTag.exceptionName()+"' not found.");
+ StringBuffer sb = new StringBuffer("In ThrowsTag: Exception ");
+ sb.append(throwsTag.exceptionName());
+ sb.append(" not found in ");
+ if (currentExecMember instanceof MethodDoc) {
+ MethodDoc m = (MethodDoc)currentExecMember;
+ sb.append(m.returnType().typeName());
+ sb.append(m.returnType().dimension());
+ sb.append(' ');
+ }
+ sb.append(currentClass.qualifiedName());
+ sb.append('.');
+ sb.append(currentExecMember.name());
+ sb.append('(');
+ Parameter[] params = currentExecMember.parameters();
+ for (int j=0; j < params.length; j++) {
+ sb.append(params[j].type().typeName());
+ sb.append(params[j].type().dimension());
+ sb.append(' ');
+ sb.append(params[j].name());
+ if (j != params.length-1)
+ sb.append(", ");
+ }
+ sb.append(')');
+ rootDoc.printWarning(sb.toString());
+
printAtomTag(level+1, "exception
typename=\""+throwsTag.exceptionName()+"\"");
}
}
- [Cp-tools-discuss] Getting Doc and Tag contexts, Mark Wielaard, 2002/05/07
- Re: [Cp-tools-discuss] Getting Doc and Tag contexts, Julian Scheid, 2002/05/07
- Re: [Cp-tools-discuss] Getting Doc and Tag contexts,
Mark Wielaard <=
- Patch Manager (was Re: [Cp-tools-discuss] Getting Doc and Tag contexts), Alex Lancaster, 2002/05/08
- Re: Patch Manager (was Re: [Cp-tools-discuss] Getting Doc and Tag contexts), Mark Wielaard, 2002/05/08
- [Cp-tools-discuss] Re: Patch Manager, Alex Lancaster, 2002/05/08
- Re: Patch Manager (was Re: [Cp-tools-discuss] Getting Doc and Tag contexts), Julian Scheid, 2002/05/08
- [Cp-tools-discuss] Re: Patch Manager, Alex Lancaster, 2002/05/08
- Re: [Cp-tools-discuss] Re: Patch Manager, Mark Wielaard, 2002/05/09
- Re: [Cp-tools-discuss] Re: Patch Manager, nferrier, 2002/05/09
- Re: [Cp-tools-discuss] Re: Patch Manager, Julian Scheid, 2002/05/09
- (C) assignment (was Re: [Cp-tools-discuss] Re: Patch Manager), Alex Lancaster, 2002/05/09
- Re: [Cp-tools-discuss] Re: Patch Manager, Julian Scheid, 2002/05/09