Index: grammar/parser.y =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/grammar/parser.y,v retrieving revision 1.39 diff -u -r1.39 parser.y --- grammar/parser.y 27 May 2004 12:44:44 -0000 1.39 +++ grammar/parser.y 21 Jun 2004 00:38:24 -0000 @@ -23,7 +23,7 @@ // ----- TOP LEVEL // A file consists of 0-n fileparts... -file: | file filepart; +file: | file { line = lexer.getLine(); } filepart; // And a filepart is a package/import statement, javadoc comment, or class declaration. filepart: package | import | javadoc | class; @@ -54,9 +54,9 @@ javadoctags: | javadoctags javadoctag; javadoctag: - JAVADOCTAG { tagLine = lexer.getLine(); } + JAVADOCTAG { line = lexer.getLine(); } javadoctokens { - builder.addJavaDocTag(new TagDef($1.substring(1), buffer(), tagLine)); + builder.addJavaDocTag(new TagDef($1.substring(1), buffer(), line)); }; @@ -119,8 +119,9 @@ classdefinition: modifiers classorinterface IDENTIFIER typeparams extends implements { + cls.lineNumber = line; cls.modifiers.addAll(modifiers); modifiers.clear(); - cls.name = $3; + cls.name = $3; builder.beginClass(cls); cls = new ClassDef(); }; @@ -155,7 +156,7 @@ fullidentifier { cls.implementz.add($1); } | implementslist COMMA fullidentifier { cls.implementz.add($3); }; -members: | members member; +members: | members { line = lexer.getLine(); } member; member: javadoc | @@ -181,8 +182,8 @@ }; extrafields: | - extrafields COMMA arrayidentifier { - makeField($3); + extrafields COMMA { line = lexer.getLine(); } arrayidentifier { + makeField($4); }; @@ -190,15 +191,17 @@ method: modifiers type IDENTIFIER methoddef memberend { + mth.lineNumber = line; mth.modifiers.addAll(modifiers); modifiers.clear(); mth.returns = $2.name; mth.dimensions = $2.dimensions; - mth.name = $3; + mth.name = $3; builder.addMethod(mth); mth = new MethodDef(); }; constructor: - modifiers IDENTIFIER methoddef memberend { + modifiers IDENTIFIER methoddef memberend { + mth.lineNumber = line; mth.modifiers.addAll(modifiers); modifiers.clear(); mth.constructor = true; mth.name = $2; builder.addMethod(mth); @@ -239,7 +242,7 @@ private FieldDef param = new FieldDef(); private java.util.Set modifiers = new java.util.HashSet(); private TypeDef fieldType; -private int tagLine; +private int line; private String buffer() { if (textBuffer.length() > 0) textBuffer.deleteCharAt(textBuffer.length() - 1); @@ -284,6 +287,7 @@ private void makeField(TypeDef field) { FieldDef fd = new FieldDef(); + fd.lineNumber = line; fd.modifiers.addAll(modifiers); fd.type = fieldType.name; fd.dimensions = fieldType.dimensions + field.dimensions; Index: java/com/thoughtworks/qdox/model/AbstractInheritableJavaEntity.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/AbstractInheritableJavaEntity.java,v retrieving revision 1.3 diff -u -r1.3 AbstractInheritableJavaEntity.java --- java/com/thoughtworks/qdox/model/AbstractInheritableJavaEntity.java 8 Jan 2004 20:44:29 -0000 1.3 +++ java/com/thoughtworks/qdox/model/AbstractInheritableJavaEntity.java 21 Jun 2004 00:38:24 -0000 @@ -10,8 +10,8 @@ return tags.length > 0 ? tags[0] : null; } - protected AbstractInheritableJavaEntity(JavaClassParent parent) { - super(parent); + protected AbstractInheritableJavaEntity(JavaClassParent parent, int lineNumber) { + super(parent, lineNumber); } public abstract DocletTag[] getTagsByName(String name, boolean inherited); Index: java/com/thoughtworks/qdox/model/AbstractJavaEntity.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/AbstractJavaEntity.java,v retrieving revision 1.16 diff -u -r1.16 AbstractJavaEntity.java --- java/com/thoughtworks/qdox/model/AbstractJavaEntity.java 17 May 2004 13:31:08 -0000 1.16 +++ java/com/thoughtworks/qdox/model/AbstractJavaEntity.java 21 Jun 2004 00:38:24 -0000 @@ -13,9 +13,15 @@ private String comment; private DocletTag[] tags = new DocletTag[0]; private final JavaClassParent parent; + private final int lineNumber; - protected AbstractJavaEntity(JavaClassParent parent) { + protected AbstractJavaEntity(JavaClassParent parent, int lineNumber) { this.parent = parent; + this.lineNumber = lineNumber; + } + + public int getLineNumber() { + return lineNumber; } public String getName() { Index: java/com/thoughtworks/qdox/model/JavaField.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/JavaField.java,v retrieving revision 1.9 diff -u -r1.9 JavaField.java --- java/com/thoughtworks/qdox/model/JavaField.java 26 Apr 2004 18:50:45 -0000 1.9 +++ java/com/thoughtworks/qdox/model/JavaField.java 21 Jun 2004 00:38:24 -0000 @@ -4,12 +4,16 @@ private Type type; + public JavaField(JavaClass parent, int lineNumber) { + super(parent, lineNumber); + } + public JavaField(JavaClass parent) { - super(parent); + super(parent, 0); } public JavaField() { - this(null); + this(null, 0); } public Type getType() { Index: java/com/thoughtworks/qdox/model/JavaMethod.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/JavaMethod.java,v retrieving revision 1.20 diff -u -r1.20 JavaMethod.java --- java/com/thoughtworks/qdox/model/JavaMethod.java 26 Apr 2004 18:50:45 -0000 1.20 +++ java/com/thoughtworks/qdox/model/JavaMethod.java 21 Jun 2004 00:38:24 -0000 @@ -11,12 +11,16 @@ private Type[] exceptions = Type.EMPTY_ARRAY; private boolean constructor; + public JavaMethod(JavaClass parent, int lineNumber) { + super(parent, lineNumber); + } + public JavaMethod(JavaClass parent) { - super(parent); + super(parent, 0); } public JavaMethod() { - this(null); + this(null, 0); } public Type getReturns() { Index: java/com/thoughtworks/qdox/model/ModelBuilder.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/model/ModelBuilder.java,v retrieving revision 1.24 diff -u -r1.24 ModelBuilder.java --- java/com/thoughtworks/qdox/model/ModelBuilder.java 17 May 2004 13:31:08 -0000 1.24 +++ java/com/thoughtworks/qdox/model/ModelBuilder.java 21 Jun 2004 00:38:24 -0000 @@ -55,7 +55,7 @@ } public void beginClass(ClassDef def) { - currentClass = new JavaClass(currentParent); + currentClass = new JavaClass(currentParent, def.lineNumber); // basic details currentClass.setName(def.name); @@ -130,7 +130,7 @@ } public void addMethod(MethodDef def) { - JavaMethod currentMethod = new JavaMethod(currentClass); + JavaMethod currentMethod = new JavaMethod(currentClass, def.lineNumber); // basic details currentMethod.setName(def.name); @@ -172,7 +172,7 @@ } public void addField(FieldDef def) { - JavaField currentField = new JavaField(currentClass); + JavaField currentField = new JavaField(currentClass, def.lineNumber); currentField.setName(def.name); currentField.setType(createType(def.type, def.dimensions)); Index: java/com/thoughtworks/qdox/parser/structs/ClassDef.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/parser/structs/ClassDef.java,v retrieving revision 1.3 diff -u -r1.3 ClassDef.java --- java/com/thoughtworks/qdox/parser/structs/ClassDef.java 22 Jul 2003 00:37:33 -0000 1.3 +++ java/com/thoughtworks/qdox/parser/structs/ClassDef.java 21 Jun 2004 00:38:24 -0000 @@ -3,7 +3,7 @@ import java.util.HashSet; import java.util.Set; -public class ClassDef { +public class ClassDef extends LocatedDef { public String name = ""; public Set modifiers = new HashSet(); public Set extendz = new HashSet(); Index: java/com/thoughtworks/qdox/parser/structs/FieldDef.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/parser/structs/FieldDef.java,v retrieving revision 1.3 diff -u -r1.3 FieldDef.java --- java/com/thoughtworks/qdox/parser/structs/FieldDef.java 22 Jul 2003 00:37:33 -0000 1.3 +++ java/com/thoughtworks/qdox/parser/structs/FieldDef.java 21 Jun 2004 00:38:24 -0000 @@ -3,7 +3,7 @@ import java.util.HashSet; import java.util.Set; -public class FieldDef { +public class FieldDef extends LocatedDef { public String name = ""; public String type = ""; public Set modifiers = new HashSet(); Index: java/com/thoughtworks/qdox/parser/structs/LocatedDef.java =================================================================== RCS file: java/com/thoughtworks/qdox/parser/structs/LocatedDef.java diff -N java/com/thoughtworks/qdox/parser/structs/LocatedDef.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ java/com/thoughtworks/qdox/parser/structs/LocatedDef.java 21 Jun 2004 00:38:24 -0000 @@ -0,0 +1,7 @@ +package com.thoughtworks.qdox.parser.structs; + +public class LocatedDef { + + public int lineNumber; + +} Index: java/com/thoughtworks/qdox/parser/structs/MethodDef.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/parser/structs/MethodDef.java,v retrieving revision 1.3 diff -u -r1.3 MethodDef.java --- java/com/thoughtworks/qdox/parser/structs/MethodDef.java 22 Jul 2003 00:37:33 -0000 1.3 +++ java/com/thoughtworks/qdox/parser/structs/MethodDef.java 21 Jun 2004 00:38:25 -0000 @@ -5,7 +5,7 @@ import java.util.List; import java.util.Set; -public class MethodDef { +public class MethodDef extends LocatedDef { public String name = ""; public String returns = ""; public Set modifiers = new HashSet(); Index: java/com/thoughtworks/qdox/parser/structs/TagDef.java =================================================================== RCS file: /home/projects/qdox/scm/qdox/src/java/com/thoughtworks/qdox/parser/structs/TagDef.java,v retrieving revision 1.1 diff -u -r1.1 TagDef.java --- java/com/thoughtworks/qdox/parser/structs/TagDef.java 17 May 2004 13:31:59 -0000 1.1 +++ java/com/thoughtworks/qdox/parser/structs/TagDef.java 21 Jun 2004 00:38:25 -0000 @@ -1,10 +1,9 @@ package com.thoughtworks.qdox.parser.structs; -public class TagDef { +public class TagDef extends LocatedDef { public String name; public String text; - public int lineNumber; public TagDef(String name, String text, int lineNumber) { this.name = name;