cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ovidiu Predescu <>
Subject Re: new JSR on Java Compiler API
Date Mon, 14 Oct 2002 17:03:01 GMT

On Monday, October 14, 2002, at 01:20  AM, Sylvain Wallez wrote:

> Ovidiu Predescu wrote:
>> On Friday, October 11, 2002, at 02:09  AM, Sylvain Wallez wrote:
>>> Stefano Mazzocchi wrote:
>>>> People,
>>>> Neal Gafter is about to start the process for a new JSR on Java 
>>>> Compiler API which would hopefully make it fir Tiger (aka Java 
>>>> 1.5). He asked me if there are people interested in helping out 
>>>> with the details of bootstrapping this from Apache and since we 
>>>> (and Tomcat) are the one who need this the most (for XSP and 
>>>> sitemap compilation), I thought about asking here.
>>>> The idea is to allow us to compile stuff without having to use the 
>>>> filesystem to retrieve both the source file and the classes on 
>>>> which the code to be compiled depend upon.
>>>> So, if you are a committer and want to join, just raise your hand 
>>>> and we'll see what happens.
>>> What would be  very cool is to be able to specify line numbers of 
>>> the source file that generated the Java code (like #line in C). This 
>>> would allow for source-level XSP debuggers !
>> I've implemented this feature long time ago for the compiled sitemap, 
>> in the sitemap.xsl stylesheet. The generated sitemap would have lines 
>> like:
>> // file: src/webapp/sitemap.xmap
>> // line: 123
> I know this, and what I'm proposing extends it to the source file and 
> line number information in the bytecode.
> The above allows to find the line in the sitemap/XSP that generated a 
> given statement in the Java code. But exceptions stacktraces still 
> refer to source lines of the generated java code, and not source lines 
> of the original sitemap/XSP.
> My proposal would allow to have exceptions carry the file name and 
> line number of the _sitemap/XSP file_ that originated the Java code. 
> You would then have stacktraces like this :
> (app failed)
>  at (
>  at my.webapp.myXsp_xsp.generate (myXsp.xsp:79)        <===
>  at ServerPagesGenerator.generate (
>  at my.webapp.sitemap_xmap.match123 (sitemap.xmap:152) <===
>  ...
> This kind of information would greatly help debugging Cocoon 
> applications, and would also allow source-level debugging of XSPs 
> using existing debuggers.


I was thinking along the same lines when I've wrote the code to 
generate filename/line number in the sitemap. You can have an exception 
translator which maps line numbers from compiled XSP and sitemaps to 
the original source code. This is a common technique used in debuggers, 
including JSP debuggers. This mapping however happens by analyzing the 
translated source code, in our case the XSP or sitemap generated Java 
code, which embeds comments containing filename and line number 
information. You technically don't need to go to the low level Java 
bytecodes to generate this information.

Ovidiu Predescu <> (Weblog) (Apache, GNU, 
Emacs ...)

To unsubscribe, e-mail:
For additional commands, email:

View raw message