This adds a fix to gjdoc so it will ignore enum constants and thus produce results for Classpath CVS HEAD. It also re-enables producing docs for all classes, which was broken by the earlier annotation patch.
Changelog: 2007-04-15 Andrew John Hughes <[EMAIL PROTECTED]> * src/gnu/classpath/tools/gjdoc/Parser.java: (BraceComponent.process(Parser,char[],int,int)): Reformatted. (ClassComponent.process(Parser,char[],int,int)): Skip enum constants. (processSourceFile(File,boolean,String,String)): Add log message if stack is not empty or file is ignored. (parse(char[],int[],SourceComponent[])): Update debugging level. (classOpened(char[],int,int)): Add debug messages and include non-annotations. (classClosed()): Add debug messages. * src/gnu/classpath/tools/gjdoc/RootDocImpl.java: (specifiedClasses()): Create array when called. (specifiedPackages()): Likewise. (build()): Don't generate arrays until later. -- Andrew :-) Escape the Java Trap with GNU Classpath! http://www.gnu.org/philosophy/java-trap.html public class gcj extends Freedom implements Java { ... }
Index: src/gnu/classpath/tools/gjdoc/Parser.java =================================================================== RCS file: /sources/classpath/gjdoc/src/gnu/classpath/tools/gjdoc/Parser.java,v retrieving revision 1.27 diff -u -3 -p -u -r1.27 Parser.java --- src/gnu/classpath/tools/gjdoc/Parser.java 9 Apr 2007 23:47:56 -0000 1.27 +++ src/gnu/classpath/tools/gjdoc/Parser.java 15 Apr 2007 20:19:52 -0000 @@ -85,11 +85,12 @@ import gnu.classpath.tools.MalformedInpu } } - int process(Parser parser, char[] source, int startIndex, int endIndex) throws ParseException, IOException { - - parser.classClosed(); - return endIndex; - } + int process(Parser parser, char[] source, int startIndex, int endIndex) + throws ParseException, IOException + { + parser.classClosed(); + return endIndex; + } } class CommentComponent extends SourceComponent { @@ -582,7 +583,25 @@ import gnu.classpath.tools.MalformedInpu if (parser.getAddComments()) parser.ctx.classDoc.setRawCommentText(parser.getLastComment()); parser.setLastComment(null); - + if (parser.ctx.classDoc.isEnum()) + { + for (int a = endIndex; a < source.length; ++a) + { + Debug.log(1, "Enum skipping " + a); + if (source[a] == ';') + { + Debug.log(1, "Found enum ;"); + endIndex = a + 1; + break; + } + if (source[a] == '}') + { + Debug.log(1, "Found enum }"); + parser.classClosed(); + return a + 1; + } + } + } int rc=parser.parse(source, endIndex, parser.getClassLevelComponents()); return rc; } @@ -769,15 +788,15 @@ public class Parser { } } - /* + if (contextStack.size()>0) { - Debug.log(1,"-->contextStack not empty! size is "+contextStack.size()); + Debug.log(1,"-->contextStack not empty! size is "+contextStack.size()); } - */ - + return outerClass; } catch (IgnoredFileParseException ignore) { + Debug.log(1, "File ignored: " + ignore); return null; } } @@ -790,22 +809,22 @@ public class Parser { int i=0; for (; i<componentTypes.length; ++i) { if ((match=componentTypes[i].match(source, index))>=0) { - //Debug.log(9,componentTypes[i].getClass().getName()+" ("+match+"/"+source.length+")"); + //Debug.log(1,componentTypes[i].getClass().getName()+" ("+match+"/"+source.length+")"); break; } } if (i<componentTypes.length) { int endIndex=componentTypes[i].getEndIndex(source, match); - + Debug.log(9, "Processing " + new String(source,index,endIndex-index) + " with " + componentTypes[i]); index=componentTypes[i].process(this, source, index, endIndex); if (index<0) { - //Debug.log(9,"exiting parse because of "+componentTypes[i].getClass().getName()+" (\""+new String(source, index, endIndex-index)+"\")"); + //Debug.log(9,"exiting parse because of "+componentTypes[i].getClass().getName()+" (\""+new String(source, index, endIndex-index)+"\")"); return endIndex; } } else { - //Debug.log(9,"index="+index+", source.length()="+source.length); + //Debug.log(9,"index="+index+", source.length()="+source.length); throw new ParseException("unmatched input in line "+currentLine+": "+new String(source, index, Math.min(50,source.length-index))); } @@ -884,8 +903,7 @@ public class Parser { } classDoc.setImportedClasses((ClassDoc[])importedClassesList.toArray(new ClassDoc[0])); - if (classDoc.isAnnotation()) - currentPackage.addClass(classDoc); + currentPackage.addClass(classDoc); currentClass = classDoc; @@ -896,8 +914,8 @@ public class Parser { if (classDoc.superclass()!=null) referencedClassesList.add(classDoc.superclass()); - //Debug.log(9,"classOpened "+classDoc+", adding superclass "+classDoc.superclass()); - + Debug.log(1,"classOpened "+classDoc+", adding superclass "+classDoc.superclass()); + Debug.log(1,"Pushing " + ctx); contextStack.push(ctx); ctx=new Context(classDoc); //Debug.log(9,"ctx="+ctx); @@ -910,7 +928,6 @@ public class Parser { } void classClosed() throws ParseException, IOException { - ctx.classDoc.setFields((FieldDoc[])toArray(ctx.fieldList, new FieldDoc[0])); ctx.classDoc.setFilteredFields((FieldDoc[])toArray(ctx.filteredFieldList, @@ -934,10 +951,10 @@ public class Parser { } } - //Debug.log(9,"classClosed: "+ctx.classDoc); + Debug.log(1,"classClosed: "+ctx.classDoc); ctx=(Context)contextStack.pop(); - + Debug.log(1, "Popping " + ctx); ClassDoc[] referencedClasses=(ClassDoc[])referencedClassesList.toArray(new ClassDoc[0]); if (Main.DESCEND_SUPERCLASS) { Index: src/gnu/classpath/tools/gjdoc/RootDocImpl.java =================================================================== RCS file: /sources/classpath/gjdoc/src/gnu/classpath/tools/gjdoc/RootDocImpl.java,v retrieving revision 1.24 diff -u -3 -p -u -r1.24 RootDocImpl.java --- src/gnu/classpath/tools/gjdoc/RootDocImpl.java 24 Jan 2007 21:35:19 -0000 1.24 +++ src/gnu/classpath/tools/gjdoc/RootDocImpl.java 15 Apr 2007 20:19:52 -0000 @@ -98,14 +98,14 @@ public class RootDocImpl * line (as Array for quick retrieval by Doclet). This is created * from specifiedClassNames after all classes have been loaded. */ - private ClassDocImpl[] specifiedClasses; + private List specifiedClasses; /** * All packages which were specified on the command line (as Array * for quick retrieval by Doclet). This is created from * specifiedPackageNames after all classes have been loaded. */ - private PackageDocImpl[] specifiedPackages; + private Set specifiedPackages; /** @@ -159,11 +159,17 @@ public class RootDocImpl } - // classes and interfaces specified on the command line. - public ClassDoc[] specifiedClasses() { return specifiedClasses; } + // classes and interfaces specified on the command line. + public ClassDoc[] specifiedClasses() + { + return (ClassDocImpl[]) specifiedClasses.toArray(new ClassDocImpl[0]); + } // packages specified on the command line. - public PackageDoc[] specifiedPackages() { return specifiedPackages; } + public PackageDoc[] specifiedPackages() + { + return (PackageDocImpl[])specifiedPackages.toArray(new PackageDocImpl[0]); + } // Print error message, increment error count. public void printError(java.lang.String msg) { @@ -253,7 +259,7 @@ public class RootDocImpl } } - List specifiedClassesList = new LinkedList(); + specifiedClasses = new LinkedList(); //--- Parse all explicitly specified source files. @@ -263,14 +269,13 @@ public class RootDocImpl printNotice("Loading source file "+specifiedSourceFile+" ..."); ClassDocImpl classDoc = parser.processSourceFile(specifiedSourceFile, true, sourceEncoding, null); if (null != classDoc) { - specifiedClassesList.add(classDoc); - classesList.add(classDoc); - classDoc.setIsIncluded(true); - addPackageDoc(classDoc.containingPackage()); + specifiedClasses.add(classDoc); + classesList.add(classDoc); + classDoc.setIsIncluded(true); + addPackageDoc(classDoc.containingPackage()); } } - - this.specifiedClasses=(ClassDocImpl[])specifiedClassesList.toArray(new ClassDocImpl[0]); + //--- Let the user know that all specified classes are loaded. @@ -306,13 +311,13 @@ public class RootDocImpl //--- Assemble the array with all specified packages - Set specifiedPackageSet = new LinkedHashSet(); + specifiedPackages = new LinkedHashSet(); for (Iterator it = specifiedPackageNames.iterator(); it.hasNext(); ) { String specifiedPackageName = (String)it.next(); PackageDoc specifiedPackageDoc = (PackageDoc)packageDocMap.get(specifiedPackageName); if (null!=specifiedPackageDoc) { ((PackageDocImpl)specifiedPackageDoc).setIsIncluded(true); - specifiedPackageSet.add(specifiedPackageDoc); + specifiedPackages.add(specifiedPackageDoc); ClassDoc[] packageClassDocs=specifiedPackageDoc.allClasses(); for (int i=0; i<packageClassDocs.length; ++i) { @@ -323,7 +328,6 @@ public class RootDocImpl } } } - this.specifiedPackages=(PackageDocImpl[])specifiedPackageSet.toArray(new PackageDocImpl[0]); //--- Resolve pending references in comment data of all classes
signature.asc
Description: Digital signature