You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cm...@yahoo.com on 2001/06/06 00:30:03 UTC

Jasper34: first round

Hi,

I'm going to do a number of commits on jasper34 - some will be large and I
want to give a summary to make it easier to track the changes.

Basically it's a 'simple' refactoring, the code is working almost the same
as before ( we're still passing all the tests we did, no important bug
is fixed directly by the change ).

The changes will improve jasper modularity, make the code easier to read
and enable the planned optimizations. 

- split jasper.compiler into functional components ( generator,
javacompiler, javagen, parser, core, jsptree )

- split JspParseEventListener: the code generation goes to ServletWriter
and JavaCodeGenerator, the internal representation of the JSP page goes to
jsptree and JspPageInfo. 

- removed the line number generation hack, the
JavaCodeGenerator will maintain and generate the line number info. This is
the first step in mapping the java line numbers to jsp lines ( it's quite
simple now )

- moved Generator to a base class ( instead of interface ), added explicit 
methods for each processing stage. Removed *Phase - now we have
generateInitMethod, generateServiceMethod, etc ( it is much easier to
read ). Code from Hooks is used to avoid making extra calls.

- moved all the 1.1 parser code to a separate package

- moved all interfaces to the container ( the original ones ) to core,
there is a lot of work still to be done

- started to implement the Visitor pattern on the code generator. All jsp
information will be stored in jsptree package. The current code is still
using a tree of Generators, as previously - doing the separation will be
the next step.

- some small changes in the generated code, simplifying the generated
methods ( less try/catch, move that to runtime ). This again will help
doing direct bytecode generation ( no java compiler ).

Few more notes:

The Visitor pattern will help us improve the generator and allow to use
the direct bytecode generation where possible ( by using a bytecode
generator if the page is "pure" - no scriptlets ).

Moving the java generation to javagen will allow better line number
management ( right now we just generate comments ). It will also simplify
the code a lot, and the thing will be reusable. Same for the javacompiler,
both are not specific to jasper.

There are many other small changes, I'll try to do small commits with
more comments. This is just the first step, but I think you may feel small
improvements already :-) Please review and let me know what you think.

Regarding XSLT - moving to Visitor also means that a xslt implementation
of the generator will be possible - but I don't plan to work on it
soon. The current code is good enough for most optimizations we need, 
XSLT or advanced processings might help a lot in future, but now it's
not needed. 

Costin