Return-Path: Delivered-To: apmail-xml-cocoon-dev-archive@xml.apache.org Received: (qmail 90799 invoked by uid 500); 14 Oct 2002 17:02:57 -0000 Mailing-List: contact cocoon-dev-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-dev@xml.apache.org Delivered-To: mailing list cocoon-dev@xml.apache.org Received: (qmail 90759 invoked from network); 14 Oct 2002 17:02:57 -0000 Date: Mon, 14 Oct 2002 10:03:01 -0700 Subject: Re: new JSR on Java Compiler API Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v546) From: Ovidiu Predescu To: cocoon-dev@xml.apache.org Content-Transfer-Encoding: 7bit In-Reply-To: <3DAA7E58.1020006@anyware-tech.com> Message-Id: X-Mailer: Apple Mail (2.546) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 : > > my.app.MyException (app failed) > at my.app.MyClass (MyClass.java:315) > at my.webapp.myXsp_xsp.generate (myXsp.xsp:79) <=== > at ServerPagesGenerator.generate (ServerPagesGenerator.java:89) > 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. Gotcha! 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. Regards, -- Ovidiu Predescu http://webweavertech.com/ovidiu/weblog/ (Weblog) http://www.geocities.com/SiliconValley/Monitor/7464/ (Apache, GNU, Emacs ...) --------------------------------------------------------------------- To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org For additional commands, email: cocoon-dev-help@xml.apache.org