[ https://issues.apache.org/jira/browse/FREEMARKER-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690623#comment-17690623 ]
Dániel Dékány edited comment on FREEMARKER-214 at 2/17/23 9:56 PM: ------------------------------------------------------------------- We should just update JavaCC to the latest 7.x. The version history after 6.1.2 has to be reviewed though, to be on the safe side. was (Author: ddekany): We should just do the JavaCC to latest 7.x update. The version history after 6.1.2 has to be reviewed though, to be on the safe side. > New LookAheadSuccess instance created for each instance of FMParser > ------------------------------------------------------------------- > > Key: FREEMARKER-214 > URL: https://issues.apache.org/jira/browse/FREEMARKER-214 > Project: Apache Freemarker > Issue Type: Bug > Reporter: Donnchadh Ó Donnabháin > Priority: Major > > Each instance of FMParser creates a new instance of LookAheadSuccess. > In our case, where we tend to work with a lot of FreeMarker templates (in > some cases generating freemarker template as an intermediate representation > of a more abstract form), this has had a couple of impacts: > 1. LookAheadSuccess extends java.lang.Error which adds noise to our Java > Flight Recorder recordings, similar to the situation described in > [http://hirt.se/blog/?p=1288] > 2. Each instance fills in a stack trace, causing unnecessary object > allocation, given that > > These issues (non-static LookAheadSuccess instance, extending > java.lang.Error, populating a stack trace) have been addressed in JavaCC 7 in > the following PR > [https://github.com/javacc/javacc/pull/99/files] > > If it seems reasonable, I would be willing to create a PR to update > FreeMarker 2.3 to Java CC 7.x. The unit tests do seem to pass with Java CC 7. > > If upgrading JavaCC is deemed undesirable, the approach used to make the > class static in > [https://github.com/apache/freemarker/blob/2.3-gae/build.xml#L157] could > probably also be used to make the instance final. -- This message was sent by Atlassian Jira (v8.20.10#820010)