[
https://issues.apache.org/jira/browse/FREEMARKER-214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17691743#comment-17691743
]
Donnchadh Ó Donnabháin commented on FREEMARKER-214:
---------------------------------------------------
h2. Changelog
Looking at
[https://github.com/javacc/javacc/blob/master/docs/release-notes.md#70x|https://github.com/javacc/javacc/blob/master/docs/release-notes.md#modifications-in-version-7012]
there are the following documented changes, ignoring C++ and build script
changes
\#193 : Code error in class RCharacterList.SortDescriptors(): fixed
MODIFICATIONS IN VERSION 7.0.10
* \#183 : Lookahead is broken since 7.0.5 (introduced in commit fbac68f)
MODIFICATIONS IN VERSION 7.0.9
MODIFICATIONS IN VERSION 7.0.8
#175 : Doesn't work in Turkish Locale
#73 : javacc/c++: invalid lookahead processing: missing one lookahead to
get rid of the conflict
MODIFICATIONS IN VERSION 7.0.7
JavaCC.jj : remove unused c++ declaration blocs tokens
#172 : add a specific '-version' command line argument
MODIFICATIONS IN VERSION 7.0.6
MODIFICATIONS IN VERSION 7.0.5
#71: Add support for Java7 language features.
#75: Allow empty type parameters in Java code of grammar files.
#77: javacc.org is out of date.
#92: Avoid warning of unused import in generated ParserTokenManager.
#99: LookaheadSuccess creation performance improved.
---WARNING---WARNING---WARNING--- Required Java Platform: Standard Edition 7.0:
known under Eclipse as JavaSE-1.7
MODIFICATIONS IN VERSION 7.0.4
Internal refactoring
MODIFICATIONS IN VERSION 7.0.3
Internal refactoring
MODIFICATIONS IN VERSION 7.0.2
MODIFICATIONS IN VERSION 7.0.1
MODIFICATIONS IN VERSION 7.0.0
This version initiates the table driven parsing process as a optional feature.
h2. Git commit log
Looking through the commits
([https://github.com/javacc/javacc/commits/master/src/main] ):
[https://github.com/javacc/javacc/commit/ecfe7e784dbb900c44ef94e3cc1c5f0ab8106cba]
has results in some output changes
h2. Comparing the generated FMParser generated
Code formatting was first normalised before comparison
{code:java}
laptop:freemarker dodonnabhain$ (JAVA_HOME=`/usr/libexec/java_home -v 11` java
-jar google-java-format-1.15.0-all-deps.jar javacc6/FMParser.java >
javacc6/FMParser-google-format.java)
laptop:freemarker dodonnabhain$ (JAVA_HOME=`/usr/libexec/java_home -v 11` java
-jar google-java-format-1.15.0-all-deps.jar javacc7/FMParser.java >
javacc7/FMParser-google-format.java)
laptop:freemarker dodonnabhain$ diff -Ebu javacc6/FMParser-google-format.java
javacc7/FMParser-google-format.java | diffstat
FMParser-google-format.java | 473
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------
1 file changed, 243 insertions(+), 230 deletions(-){code}
most changes are trivial - see attached diff - [^javacc-7.1.2-diff.txt]
> 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
> Attachments: javacc-7.1.2-diff.txt
>
>
> 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)