Allow access to the raw source code through the Doc interface

This was a bug submitted by someone else a long time back. The id is 4113492. You can view it at

http://developer.java.sun.com/developer/bugParade/bugs/4113492.html

It's declared as dup of another bug. However in my mind it's not. In my project, I need to use Doclet to get all documentation comments as well as body of methods. In jdk1.4 beta release, with SourcePosition, I can only get the start position of the method, but I need start position as well as end position of any methods. In fact, it's much easier if there are methods like implementationText() which return implementation between "{" and "}" in String. In fact the bug report of 4113492 has made it very clear. Please consider reopening it and doing another review.

Thanks,

-Wenjie

[797 byte] By [wenjieqiao] at [2007-9-26 14:21:49]
# 1

Yes, I wondered about this too. The workaround I came up with was to open the given file, read through to the given line and then process all nested { symbols until the end of the method was reached. Rather long-winded and vulnerable to unmatched {} symbols in comments.

It would seem that an "end of element" line value and the ability to retrieve the source text for just that element would be a useful addition to the API.

~Matt

doar@pobox.com

mdoar at 2007-7-2 16:01:01 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

SourcePosition was designed as a simple starting line number, leaving the algorithm to

determine other points in the file as an exercise for the student :)

If you could enumerate under which cases parsing the source file would fail,

that would bolster the case. Also please write up your simplest proposed

extension to the Doclet API. Would knowing the end position of the member suffice?

What would it be called? SourcePosition.endline()?

If you want to formalize this, it's probably best to submit a new request

(java.sun.com/cgi-bin/bugreport.cgi) rather than re-open the old one,

so that we can focus only on what's left to do.

If you don't care to get a formal answer, just post your request here and I'll

get the Javadoc engineer's reply to it.

-Doug Kramer

Javadoc team

dkramer at 2007-7-2 16:01:01 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

Any text which contains a curly bracket will cause trouble when you are trying to work out where the end of the method is. E.g.

public void foo() {

System.out.println("{");

}

Yes, adding to SourcePosition seems right. Perhaps lineEnd() and columnEnd(). Engineering response is fine by me.

~Matt

mdoar at 2007-7-2 16:01:01 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...