Approved. Too bad java doesn't have a better way to do this. On 2011-03-27, at 11:43, André Bargull wrote:
> Change bargull-20110327-FTb by bargull@Bargull02 on 2011-03-27 17:27:27 > in /home/anba/src/svn/openlaszlo/trunk > for http://svn.openlaszlo.org/openlaszlo/trunk > > Summary: Replace reflection with parser visitor implementation > > Bugs Fixed: LPP-9833 (speed up compilation time for dhtml) > > Technical Reviewer: ptw > QA Reviewer: (pending) > > Details: > Although Java's internal reflection capabilities have been improved over > time, it's still faster to create instances by explicit constructor calls > (ca. by factor 4). The only benefit of the reflection approach is a slightly > better maintainability, for example consider the parser was changed and a new > AST type is introduced. In order to minimize the downside of the explicit > constructor call approach, I'm using a ParserVisitor interface > implementation, that way missing methods for new AST types will cause early > compilation errors, so invalid code won't be shipped with releases. > > > Tests: > > Files: > A WEB-INF/lps/server/src/org/openlaszlo/sc/NewInstanceVisitor.java > M WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java > > Changeset: > http://svn.openlaszlo.org/openlaszlo/patches/bargull-20110327-FTb.tar >
