[24/24] incubator-freemarker git commit: Merge remote-tracking branch 'origin/2.3-gae' into 2.3

2016-12-06 Thread ddekany
Merge remote-tracking branch 'origin/2.3-gae' into 2.3


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/44201a6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/44201a6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/44201a6d

Branch: refs/heads/2.3
Commit: 44201a6d1701ac66c2dfec8eb98e3f374a47496f
Parents: dd7a2aa 4b989f8
Author: ddekany 
Authored: Tue Dec 6 23:27:36 2016 +0100
Committer: ddekany 
Committed: Tue Dec 6 23:27:36 2016 +0100

--
 .../freemarker/core/AddConcatExpression.java|  58 ++-
 .../freemarker/core/BuiltInsForSequences.java   |  33 +-
 src/main/java/freemarker/core/EvalUtil.java |  26 +-
 src/main/java/freemarker/core/NewBI.java|   8 +-
 .../debug/impl/RmiDebuggedEnvironmentImpl.java  |   2 +-
 .../freemarker/ext/beans/ArgumentTypes.java |  75 ++-
 .../java/freemarker/ext/beans/BeanModel.java|  94 ++--
 .../java/freemarker/ext/beans/BeansWrapper.java |  89 ++--
 .../ext/beans/BeansWrapperBuilder.java  |  17 +-
 .../freemarker/ext/beans/ClassIntrospector.java | 157 ---
 .../ext/beans/MethodAppearanceFineTuner.java|   3 +-
 .../java/freemarker/ext/beans/_BeansAPI.java|  70 +--
 .../freemarker/ext/util/IdentityHashMap.java|   9 +-
 .../java/freemarker/ext/util/ModelCache.java|  19 +-
 .../template/AdapterTemplateModel.java  |   2 +-
 .../java/freemarker/template/Configuration.java |   3 +
 .../template/DefaultObjectWrapper.java  |  23 +-
 .../template/DefaultObjectWrapperBuilder.java   |  18 +-
 .../template/ObjectWrapperAndUnwrapper.java |   2 +-
 .../freemarker/template/SimpleSequence.java |   2 +-
 .../template/TemplateCollectionModelEx.java |   2 +-
 .../java/freemarker/template/_TemplateAPI.java  |   3 +-
 .../resources/freemarker/version.properties |   8 +-
 src/manual/en_US/book.xml   | 459 +++
 src/manual/en_US/docgen.cjson   |   2 +-
 src/test/java/freemarker/core/ASTTest.java  |   2 +-
 .../ext/beans/BeansAPINewInstanceTest.java  |   6 +-
 .../ext/beans/BeansWrapperSingletonsTest.java   |   3 +-
 .../template/DefaultObjectWrapperTest.java  |   1 +
 .../template/TemplateLanguageVersionTest.java   |   3 +-
 .../CopyrightCommentRemoverTemplateLoader.java  |   1 +
 src/test/java/freemarker/test/TemplateTest.java |   1 +
 src/test/java/freemarker/test/TestUtil.java | 115 -
 .../freemarker/test/servlet/WebAppTestCase.java |   2 +-
 .../test/templatesuite/TemplateTestCase.java|  46 +-
 .../test/templatesuite/TemplateTestSuite.java   |   2 +-
 .../models/OverloadedMethods2.java  | 144 +++---
 .../freemarker/test/utility/FileTestCase.java   |   1 -
 .../java/freemarker/test/utility/Helpers.java   | 164 ---
 .../java/freemarker/test/utility/TestUtil.java  | 266 +++
 .../expected/sequence-builtins.txt  |   7 +
 .../templates/sequence-builtins.ftl |   8 +-
 42 files changed, 1078 insertions(+), 878 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/44201a6d/src/main/resources/freemarker/version.properties
--



[03/24] incubator-freemarker git commit: grammar fix

2016-12-06 Thread ddekany
grammar fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/f83161be
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/f83161be
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/f83161be

Branch: refs/heads/2.3
Commit: f83161be9472e493fd21dd6a0c1dd458cf111cab
Parents: 6032411
Author: ratherblue 
Authored: Mon Jul 25 22:49:47 2016 -0700
Committer: ratherblue 
Committed: Mon Jul 25 22:49:47 2016 -0700

--
 src/manual/en_US/book.xml | 216 -
 1 file changed, 108 insertions(+), 108 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/f83161be/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 14732b5..b46e1ea 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -7,9 +7,9 @@
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
-  
+
 http://www.apache.org/licenses/LICENSE-2.0
-  
+
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -44,7 +44,7 @@
 
 Templates are written in the FreeMarker Template Language (FTL).
 It's a simple, specialized language, not a full-blown
-programming language like PHP. You meant to prepare the data to display in
+programming language like PHP. You are meant to prepare the data to 
display in
 a real programming language, like issue database queries and do business
 calculations, and then the template displays that already prepared data.
 In the template you are focusing on how to present the data, and outside
@@ -220,21 +220,21 @@
   +- animals
   |   |
   |   +- mouse
-  |   |   |   
+  |   |   |
   |   |   +- size = "small"
-  |   |   |   
+  |   |   |
   |   |   +- price = 50
   |   |
   |   +- elephant
-  |   |   |   
+  |   |   |
   |   |   +- size = "large"
-  |   |   |   
+  |   |   |
   |   |   +- price = 5000
   |   |
   |   +- python
-  |   |   
+  |   |
   |   +- size = "medium"
-  |   |   
+  |   |
   |   +- price = 4999
   |
   +- message = "It is a test"
@@ -5867,7 +5867,7 @@ To prove that "s" didn't contain the value in escaped 
form:
 [BR]
   [BR]
 [BR]
-  [BR]  
+  [BR]
   liJulia[BR]
   [BR]
@@ -6508,10 +6508,10 @@ import java.io.*;
 public class Test {
 
 public static void main(String[] args) throws Exception {
-
-/* 
 */
-/* You should do this ONLY ONCE in the whole application life-cycle:   
 */
-
+
+/* 
 */
+/* You should do this ONLY ONCE in the whole application life-cycle:   
 */
+
 /* Create and adjust the configuration singleton */
 Configuration cfg = new Configuration(Configuration.VERSION_2_3_25);
 cfg.setDirectoryForTemplateLoading(new 
File("/where/you/store/templates"));
@@ -6519,8 +6519,8 @@ public class Test {
 
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
 cfg.setLogTemplateExceptions(false);
 
-/* 
 */
-/* You usually do these for MULTIPLE TIMES in the application 
life-cycle:   */
+/* 
 */
+/* You usually do these for MULTIPLE TIMES in the application 
life-cycle:   */
 
 /* Create a data-model */
 Map root = new HashMap();
@@ -6966,7 +6966,7 @@ public class Product {
 the second string doesn't contains the first.
 
 public class IndexOfMethod 
implements TemplateMethodModel {
-
+
 public TemplateModel exec(List args) throws TemplateModelException {
 if (args.size() != 2) {
 throw new TemplateModelException("Wrong arguments");
@@ -7060,16 +7060,16 @@ import freemarker.template.TemplateModelException;
 /**
  *  FreeMarker user-defined directive that progressively transforms
  *  the output of its nested content to upper-case.
- *  
- *  
+ *
+ *
  *  pbDirective info/b/p
- * 
+ *
  *  pDirective parameters: None
  *  pLoop variables: None
  *  pDirective nested content: Yes
  */
 public class UpperDirective implements TemplateDirectiveModel {
-
+
 public void execute(Environment env,
   

[21/24] incubator-freemarker git commit: Utilizing Java 5 generics at some places where it doesn't break backward compatibility.

2016-12-06 Thread ddekany
Utilizing Java 5 generics at some places where it doesn't break backward 
compatibility.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/ed403c83
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/ed403c83
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/ed403c83

Branch: refs/heads/2.3
Commit: ed403c83cb0acd0b221ecc6a1daa1ccd3597c291
Parents: c253e33
Author: ddekany 
Authored: Sun Dec 4 21:48:42 2016 +0100
Committer: ddekany 
Committed: Sun Dec 4 21:57:29 2016 +0100

--
 .../test/templatesuite/TemplateTestCase.java| 45 +++-
 .../test/templatesuite/TemplateTestSuite.java   |  2 +-
 2 files changed, 25 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ed403c83/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java
--
diff --git a/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java 
b/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java
index 9e9b4ff..dfac6b3 100644
--- a/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java
+++ b/src/test/java/freemarker/test/templatesuite/TemplateTestCase.java
@@ -52,6 +52,7 @@ import com.google.common.collect.ImmutableSet;
 import freemarker.cache.FileTemplateLoader;
 import freemarker.core.ASTPrinter;
 import freemarker.ext.beans.BeansWrapper;
+import freemarker.ext.beans.BeansWrapperBuilder;
 import freemarker.ext.beans.BooleanModel;
 import freemarker.ext.beans.Java7MembersOnlyBeansWrapper;
 import freemarker.ext.beans.ResourceBundleModel;
@@ -117,7 +118,7 @@ public class TemplateTestCase extends FileTestCase {
 private final boolean noOutput;
 
 private final Configuration conf;
-private final HashMap dataModel = new HashMap();
+private final HashMap dataModel = new HashMap();
 
 public TemplateTestCase(String testName, String simpleTestName, String 
templateName, String expectedFileName, boolean noOutput,
 Version incompatibleImprovements) {
@@ -181,6 +182,8 @@ public class TemplateTestCase extends FileTestCase {
 conf.setTemplateLoader(new CopyrightCommentRemoverTemplateLoader(
 new FileTemplateLoader(new File(getTestClassDirectory(), 
"templates";
 
+BeansWrapper beansWrapper = new 
BeansWrapperBuilder(Configuration.VERSION_2_3_0).build();
+
 dataModel.put(ASSERT_VAR_NAME, AssertDirective.INSTANCE);
 dataModel.put(ASSERT_EQUALS_VAR_NAME, AssertEqualsDirective.INSTANCE);
 dataModel.put(ASSERT_FAILS_VAR_NAME, AssertFailsDirective.INSTANCE);
@@ -239,7 +242,7 @@ public class TemplateTestCase extends FileTestCase {
 } else if (simpleTestName.equals("beans")) {
 dataModel.put("array", new String[] { "array-0", "array-1"});
 dataModel.put("list", Arrays.asList(new String[] { "list-0", 
"list-1", "list-2"}));
-Map tmap = new HashMap();
+Map tmap = new HashMap();
 tmap.put("key", "value");
 Object objKey = new Object();
 tmap.put(objKey, "objValue");
@@ -248,8 +251,8 @@ public class TemplateTestCase extends FileTestCase {
 dataModel.put("obj", new 
freemarker.test.templatesuite.models.BeanTestClass());
 dataModel.put("resourceBundle", new 
ResourceBundleModel(ResourceBundle.getBundle("freemarker.test.templatesuite.models.BeansTestResources"),
 BeansWrapper.getDefaultInstance()));
 dataModel.put("date", new GregorianCalendar(1974, 10, 
14).getTime());
-dataModel.put("statics", 
BeansWrapper.getDefaultInstance().getStaticModels());
-dataModel.put("enums", 
BeansWrapper.getDefaultInstance().getEnumModels());
+dataModel.put("statics", beansWrapper.getStaticModels());
+dataModel.put("enums", beansWrapper.getEnumModels());
 } else if (simpleTestName.equals("boolean")) {
 dataModel.put( "boolean1", TemplateBooleanModel.FALSE);
 dataModel.put( "boolean2", TemplateBooleanModel.TRUE);
@@ -290,23 +293,23 @@ public class TemplateTestCase extends FileTestCase {
 dataModel.put("bigDecimal", new 
SimpleNumber(java.math.BigDecimal.valueOf(1)));
 dataModel.put("bigDecimal2", new 
SimpleNumber(java.math.BigDecimal.valueOf(1, 16)));
 } else if (simpleTestName.equals("simplehash-char-key")) {
-HashMap mStringC = new HashMap();
+HashMap mStringC = new HashMap();
 mStringC.put("c", "string");
 

[16/24] incubator-freemarker git commit: (JavaDoc typo)

2016-12-06 Thread ddekany
(JavaDoc typo)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/ad4d7268
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/ad4d7268
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/ad4d7268

Branch: refs/heads/2.3
Commit: ad4d7268e727aed954b8af7c7365aca013e0b264
Parents: d70e8da
Author: ddekany 
Authored: Sat Dec 3 15:14:42 2016 +0100
Committer: ddekany 
Committed: Sat Dec 3 15:14:42 2016 +0100

--
 src/main/java/freemarker/template/TemplateCollectionModelEx.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ad4d7268/src/main/java/freemarker/template/TemplateCollectionModelEx.java
--
diff --git a/src/main/java/freemarker/template/TemplateCollectionModelEx.java 
b/src/main/java/freemarker/template/TemplateCollectionModelEx.java
index 604eebc..8101f2b 100644
--- a/src/main/java/freemarker/template/TemplateCollectionModelEx.java
+++ b/src/main/java/freemarker/template/TemplateCollectionModelEx.java
@@ -47,7 +47,7 @@ public interface TemplateCollectionModelEx extends 
TemplateCollectionModel {
 boolean isEmpty() throws TemplateModelException;
 
 /**
- * Tells if a given value occurs in the collection, accodring the rules of 
the wrapped collection. As of 2.3.22,
+ * Tells if a given value occurs in the collection, according the rules of 
the wrapped collection. As of 2.3.22,
  * this interface is not yet utilized by FTL, and certainly it won't be 
earlier than 2.4.0. The usefulness of this
  * method is questionable, as the equality rules of Java differs from that 
of FTL, hence, calling this won't be
  * equivalent with {@code ?seq_contains(e)}.



[22/24] incubator-freemarker git commit: FREEMARKER-42: ?first now works with FTL collections (things that can be listed but doesn't support getting items by index), not only with sequences. The pract

2016-12-06 Thread ddekany
FREEMARKER-42: ?first now works with FTL collections (things that can be listed 
but doesn't support getting items by index), not only with sequences. The 
practical importance of this is that ?first now always works on Java Set-s 
(which is useful for Set-s with well defined ordering), while earlier it has 
failed depending on the object_wrapper configuration setting.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/496ddfbc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/496ddfbc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/496ddfbc

Branch: refs/heads/2.3
Commit: 496ddfbc08c6d3242ab5c31694db152d9c1e4c58
Parents: ed403c8
Author: ddekany 
Authored: Mon Dec 5 00:49:38 2016 +0100
Committer: ddekany 
Committed: Mon Dec 5 00:49:38 2016 +0100

--
 .../freemarker/core/BuiltInsForSequences.java   | 33 ++--
 src/manual/en_US/book.xml   | 57 ++--
 .../test/templatesuite/TemplateTestCase.java|  1 +
 .../expected/sequence-builtins.txt  |  7 +++
 .../templates/sequence-builtins.ftl |  8 ++-
 5 files changed, 98 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/496ddfbc/src/main/java/freemarker/core/BuiltInsForSequences.java
--
diff --git a/src/main/java/freemarker/core/BuiltInsForSequences.java 
b/src/main/java/freemarker/core/BuiltInsForSequences.java
index a12d274..d56a95f 100644
--- a/src/main/java/freemarker/core/BuiltInsForSequences.java
+++ b/src/main/java/freemarker/core/BuiltInsForSequences.java
@@ -138,15 +138,40 @@ class BuiltInsForSequences {
 
 }
 
-static class firstBI extends BuiltInForSequence {
+static class firstBI extends BuiltIn {
+
 @Override
-TemplateModel calculateResult(TemplateSequenceModel tsm)
+TemplateModel _eval(Environment env)
+throws TemplateException {
+TemplateModel model = target.eval(env);
+// In 2.3.x only, we prefer TemplateSequenceModel for
+// backward compatibility. In 2.4.x, we prefer 
TemplateCollectionModel. 
+if (model instanceof TemplateSequenceModel && 
!isBuggySeqButGoodCollection(model)) {
+return calculateResultForSequence((TemplateSequenceModel) 
model);
+} else if (model instanceof TemplateCollectionModel) {
+return calculateResultForColletion((TemplateCollectionModel) 
model);
+} else {
+throw new NonSequenceOrCollectionException(target, model, env);
+}
+}
+
+private TemplateModel calculateResultForSequence(TemplateSequenceModel 
seq)
 throws TemplateModelException {
-if (tsm.size() == 0) {
+if (seq.size() == 0) {
+return null;
+}
+return seq.get(0);
+}
+
+private TemplateModel 
calculateResultForColletion(TemplateCollectionModel coll)
+throws TemplateModelException {
+TemplateModelIterator iter = coll.iterator();
+if (!iter.hasNext()) {
 return null;
 }
-return tsm.get(0);
+return iter.next();
 }
+
 }
 
 static class joinBI extends BuiltIn {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/496ddfbc/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index e592d47..4adf154 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -30,7 +30,7 @@
 
 Manual
 
-Freemarker 2.3.25
+Freemarker 2.3.26
   
 
   
@@ -16416,8 +16416,19 @@ N
 first built-in
   
 
-  The first subvariable of the sequence. Template processing
-  will die with error if the sequence is empty.
+  Returns the first item of the sequence. Thus
+  value?first is the
+  same as value[0],
+  except that, since FreeMarker 2.3.26,
+  value?first also works
+  if value doesn't
+  support getting items with numerical index, but still supports to be
+  listed (i.e., with FTL collection values).
+
+  If the sequence or collection is empty, the result will be a
+  missing value (as in
+  empty?first!'No item was
+  found').
 
 
 
@@ -26603,6 +26614,46 @@ TemplateModel x = env.getVariable("x");  // get 
variable x
 
   Version history
 
+  
+2.3.26 

[04/24] incubator-freemarker git commit: couple grammar fixes, rephrase some things

2016-12-06 Thread ddekany
couple grammar fixes, rephrase some things


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/a3fa4d2f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/a3fa4d2f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/a3fa4d2f

Branch: refs/heads/2.3
Commit: a3fa4d2f631e1e9d15e8587034413e779dc52c07
Parents: f83161b
Author: ratherblue 
Authored: Mon Jul 25 22:57:30 2016 -0700
Committer: ratherblue 
Committed: Mon Jul 25 22:57:30 2016 -0700

--
 src/manual/en_US/book.xml | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/a3fa4d2f/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index b46e1ea..18c486d 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -58,15 +58,15 @@
 
 This approach is often referred to as the MVC (Model View Controller) pattern, and is
-particularly popular for dynamic Web pages. It helps in separating the Web
-page designers (HTML authors) from the developers (Java programmers
+particularly popular for dynamic web pages. It helps in separating web
+page designers (HTML authors) from developers (Java programmers
 usually). Designers won't face complicated logic in templates, and can
 change the appearance of a page without programmers having to change or
 recompile code.
 
 While FreeMarker was originally created for generating HTML pages in
 MVC web application frameworks, it isn't bound to servlets or HTML or
-anything Web-related. It's used in non-web application environments as
+anything web-related. It's used in non-web application environments as
 well.
 
 FreeMarker is 
 Template + data-model = output
 
-Let's assume that you need a HTML page in a Web shop, similar to
+Let's assume that you need a HTML page on a website, similar to
 this:
 
 html
@@ -114,10 +114,9 @@
 /body
 /html
 
-But the user name ("John Doe" above) should depend on who the
-logged in Web page visitor is, and the latest product should come from
-a database and thus it potentially changes too. Thus you can't enter
-these into the HTML directly, you can't use static HTML. Instead, you
+But the user's name ("John Doe" above) depends on who the
+logged-in user is, and the latest product information should come from
+a database. Because this data changes, you cannot you cannot use 
static HTML. Instead, you
 can use a template of the desired
 output. The template is the same as the static HTML would be, except
 that it contains some instructions to FreeMarker that makes it



[18/24] incubator-freemarker git commit: (Bit of test code cleanup.)

2016-12-06 Thread ddekany
(Bit of test code cleanup.)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/5be880de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/5be880de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/5be880de

Branch: refs/heads/2.3
Commit: 5be880de56fda5a5650d27376f05e87dc08829be
Parents: cded5be
Author: ddekany 
Authored: Sat Dec 3 15:28:02 2016 +0100
Committer: ddekany 
Committed: Sat Dec 3 15:28:02 2016 +0100

--
 src/test/java/freemarker/core/ASTTest.java  |   2 +-
 .../ext/beans/BeansAPINewInstanceTest.java  |   6 +-
 .../ext/beans/BeansWrapperSingletonsTest.java   |   2 +-
 .../template/TemplateLanguageVersionTest.java   |   2 +-
 .../CopyrightCommentRemoverTemplateLoader.java  |   1 +
 src/test/java/freemarker/test/TemplateTest.java |   1 +
 src/test/java/freemarker/test/TestUtil.java | 126 -
 .../freemarker/test/servlet/WebAppTestCase.java |   2 +-
 .../models/OverloadedMethods2.java  | 144 +-
 .../freemarker/test/utility/FileTestCase.java   |   1 -
 .../java/freemarker/test/utility/Helpers.java   | 164 
 .../java/freemarker/test/utility/TestUtil.java  | 266 +++
 12 files changed, 347 insertions(+), 370 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5be880de/src/test/java/freemarker/core/ASTTest.java
--
diff --git a/src/test/java/freemarker/core/ASTTest.java 
b/src/test/java/freemarker/core/ASTTest.java
index b1e1729..f31b53c 100644
--- a/src/test/java/freemarker/core/ASTTest.java
+++ b/src/test/java/freemarker/core/ASTTest.java
@@ -24,8 +24,8 @@ import java.io.IOException;
 
 import freemarker.core.ASTPrinter.Options;
 import freemarker.template.utility.StringUtil;
-import freemarker.test.TestUtil;
 import freemarker.test.utility.FileTestCase;
+import freemarker.test.utility.TestUtil;
 
 public class ASTTest extends FileTestCase {
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5be880de/src/test/java/freemarker/ext/beans/BeansAPINewInstanceTest.java
--
diff --git a/src/test/java/freemarker/ext/beans/BeansAPINewInstanceTest.java 
b/src/test/java/freemarker/ext/beans/BeansAPINewInstanceTest.java
index ebc679c..d8e5d3a 100644
--- a/src/test/java/freemarker/ext/beans/BeansAPINewInstanceTest.java
+++ b/src/test/java/freemarker/ext/beans/BeansAPINewInstanceTest.java
@@ -21,7 +21,7 @@ package freemarker.ext.beans;
 
 import junit.framework.TestCase;
 import freemarker.template.Configuration;
-import freemarker.test.utility.Helpers;
+import freemarker.test.utility.TestUtil;
 
 public class BeansAPINewInstanceTest extends TestCase {
 
@@ -110,8 +110,8 @@ public class BeansAPINewInstanceTest extends TestCase {
 public Constructors(Integer x, Integer y) { s = "Integer " + x + ", 
Integer " + y; }
 public Constructors(Object x, Object y) { s = "Object " + x + ", 
Object " + y; }
 
-public Constructors(int... xs) { s = "int... " + 
Helpers.arrayToString(xs); }
-public Constructors(Object x, int... ys) { s = "Object " + x + ", 
int... " + Helpers.arrayToString(ys); }
+public Constructors(int... xs) { s = "int... " + 
TestUtil.arrayToString(xs); }
+public Constructors(Object x, int... ys) { s = "Object " + x + ", 
int... " + TestUtil.arrayToString(ys); }
 
 @Override
 public String toString() {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5be880de/src/test/java/freemarker/ext/beans/BeansWrapperSingletonsTest.java
--
diff --git a/src/test/java/freemarker/ext/beans/BeansWrapperSingletonsTest.java 
b/src/test/java/freemarker/ext/beans/BeansWrapperSingletonsTest.java
index d4f762f..9eedd53 100644
--- a/src/test/java/freemarker/ext/beans/BeansWrapperSingletonsTest.java
+++ b/src/test/java/freemarker/ext/beans/BeansWrapperSingletonsTest.java
@@ -39,7 +39,7 @@ import freemarker.template.TemplateModelException;
 import freemarker.template.TemplateScalarModel;
 import freemarker.template.Version;
 import freemarker.template._TemplateAPI;
-import freemarker.test.TestUtil;
+import freemarker.test.utility.TestUtil;
 import junit.framework.TestCase;
 
 public class BeansWrapperSingletonsTest extends TestCase {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5be880de/src/test/java/freemarker/template/TemplateLanguageVersionTest.java
--
diff --git a/src/test/java/freemarker/template/TemplateLanguageVersionTest.java 

[06/24] incubator-freemarker git commit: grammar, phrasing fixes

2016-12-06 Thread ddekany
grammar, phrasing fixes


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/0815e14f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/0815e14f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/0815e14f

Branch: refs/heads/2.3
Commit: 0815e14ffc1e0b91a51fa62b69cef412b0a82ccb
Parents: b64ab13
Author: ratherblue 
Authored: Mon Jul 25 23:19:18 2016 -0700
Committer: ratherblue 
Committed: Mon Jul 25 23:19:18 2016 -0700

--
 src/manual/en_US/book.xml | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/0815e14f/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 2938787..b93691a 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -759,18 +759,18 @@ All Rights Reserved.
 
   Note that since FreeMarker does not interpret text outside FTL
   tags, interpolations and FTL comments, above you could use the FTL
-  tags inside a HTML attributes without problem.
+  tags inside HTML attributes without problem.
 
 
 
   Using built-ins
 
-  The so called built-ins are like subvariables (or rather like
-  methods, if you know that Java term) that aren't coming coming from
-  the data-model, but added by FreeMarker to the values. To make it
-  unambiguous where the subvarable comes from, to access them you have
+  The so-called built-ins are like subvariables (or rather like
+  methods, if you know that Java term) that aren't coming from
+  the data-model, but added by FreeMarker to the values. In order to 
make it
+  clear where subvariables comes from, you have
   to use ? (question mark) instead of
-  . (dot). . (dot) to access them. Examples with some of the most
   commonly used built-ins:
 
@@ -875,17 +875,17 @@ All Rights Reserved.
 
   The data-model often has variables that are optional (i.e.,
   sometimes missing). To spot some typical human mistakes, FreeMarker
-  doesn't tolerate the referring to missing variables, unless you tell
+  doesn't tolerate references to missing variables unless you tell
   explicitly what to do if the variable is missing. Here we will show
   the two most typical ways of doing that.
 
   Note for programmers: A
   non-existent variable and a variable with null
-  value is the same for FreeMarker, so the "missing" term used here
+  value is the same for FreeMarker. The "missing" term used here
   covers both cases.
 
   Wherever you refer to a variable, you can specify a default
-  value for the case the variable is missing, by following the
+  value for the case the variable is missing by following the
   variable name with a ! and the default value.
   Like in the following example, when user is
   missing from data model, the template will behave like if



[17/24] incubator-freemarker git commit: Setting version to 2.3.26-nightly. Also cleaned up version related testing a bit.

2016-12-06 Thread ddekany
Setting version to 2.3.26-nightly. Also cleaned up version related testing a 
bit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/cded5be7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/cded5be7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/cded5be7

Branch: refs/heads/2.3
Commit: cded5be79eb22bca2735275c239cd87bfe25ec27
Parents: ad4d726
Author: ddekany 
Authored: Sat Dec 3 15:15:12 2016 +0100
Committer: ddekany 
Committed: Sat Dec 3 15:24:05 2016 +0100

--
 src/main/java/freemarker/template/Configuration.java |  3 +++
 src/main/java/freemarker/template/_TemplateAPI.java  |  1 +
 src/main/resources/freemarker/version.properties |  8 
 .../freemarker/ext/beans/BeansWrapperSingletonsTest.java |  3 ++-
 .../freemarker/template/DefaultObjectWrapperTest.java|  1 +
 .../freemarker/template/TemplateLanguageVersionTest.java |  3 ++-
 src/test/java/freemarker/test/TestUtil.java  | 11 +++
 7 files changed, 24 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cded5be7/src/main/java/freemarker/template/Configuration.java
--
diff --git a/src/main/java/freemarker/template/Configuration.java 
b/src/main/java/freemarker/template/Configuration.java
index a888a60..3d9ec04 100644
--- a/src/main/java/freemarker/template/Configuration.java
+++ b/src/main/java/freemarker/template/Configuration.java
@@ -410,6 +410,9 @@ public class Configuration extends Configurable implements 
Cloneable, ParserConf
 
 /** FreeMarker version 2.3.25 (an {@link #Configuration(Version) 
incompatible improvements break-point}) */
 public static final Version VERSION_2_3_25 = new Version(2, 3, 25);
+
+/** FreeMarker version 2.3.26 (an {@link #Configuration(Version) 
incompatible improvements break-point}) */
+public static final Version VERSION_2_3_26 = new Version(2, 3, 26);
 
 /** The default of {@link #getIncompatibleImprovements()}, currently 
{@link #VERSION_2_3_0}. */
 public static final Version DEFAULT_INCOMPATIBLE_IMPROVEMENTS = 
Configuration.VERSION_2_3_0;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cded5be7/src/main/java/freemarker/template/_TemplateAPI.java
--
diff --git a/src/main/java/freemarker/template/_TemplateAPI.java 
b/src/main/java/freemarker/template/_TemplateAPI.java
index c3d6e23..0fc702a 100644
--- a/src/main/java/freemarker/template/_TemplateAPI.java
+++ b/src/main/java/freemarker/template/_TemplateAPI.java
@@ -47,6 +47,7 @@ public class _TemplateAPI {
 public static final int VERSION_INT_2_3_23 = 
Configuration.VERSION_2_3_23.intValue();
 public static final int VERSION_INT_2_3_24 = 
Configuration.VERSION_2_3_24.intValue();
 public static final int VERSION_INT_2_3_25 = 
Configuration.VERSION_2_3_25.intValue();
+public static final int VERSION_INT_2_3_26 = 
Configuration.VERSION_2_3_26.intValue();
 public static final int VERSION_INT_2_4_0 = Version.intValueFor(2, 4, 0);
 
 public static void checkVersionNotNullAndSupported(Version 
incompatibleImprovements) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cded5be7/src/main/resources/freemarker/version.properties
--
diff --git a/src/main/resources/freemarker/version.properties 
b/src/main/resources/freemarker/version.properties
index 04a41da..35cabc6 100644
--- a/src/main/resources/freemarker/version.properties
+++ b/src/main/resources/freemarker/version.properties
@@ -58,12 +58,12 @@
 # - When the major version number is increased, major backward
 #   compatibility violations are allowed, but still should be avoided.
 # During Apache Incubation, "-incubating" is added to this string.
-version=2.3.25-incubating
+version=2.3.26-nightly_@timestampInVersion@-incubating
 # This exists as oss.sonatype only allows SNAPSHOT and final releases,
 # so instead 2.3.21-rc01 and such we have to use 2.3.21-SNAPSHOT there.
 # For final releases it's the same as "version".
 # During Apache Incubation, "-incubating" is added to this string.
-mavenVersion=2.3.25-incubating
+mavenVersion=2.3.26-SNAPSHOT-incubating
 
 # Version string that conforms to OSGi
 # 
@@ -77,7 +77,7 @@ mavenVersion=2.3.25-incubating
 #   2.4.0.pre01
 #   2.4.0.nightly_@timestampInVersion@
 # During Apache Incubation, "-incubating" is added to this string.
-versionForOSGi=2.3.25.stable-incubating
+versionForOSGi=2.3.26.nightly_@timestampInVersion@-incubating
 
 # 

[13/24] incubator-freemarker git commit: Manual: Documented % operator weirdness

2016-12-06 Thread ddekany
Manual: Documented % operator weirdness


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/3ccd9e4c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3ccd9e4c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3ccd9e4c

Branch: refs/heads/2.3
Commit: 3ccd9e4cfcfd13e4b392a7d9a8ef1f669fef649e
Parents: ed65316
Author: ddekany 
Authored: Thu Oct 13 22:28:00 2016 +0200
Committer: ddekany 
Committed: Thu Oct 13 22:28:00 2016 +0200

--
 src/manual/en_US/book.xml | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3ccd9e4c/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index ce9b08f..38741d3 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -3286,7 +3286,8 @@ Slicing with right-unlimited ranges:
 
 
 
-  Modulus (remainder): %
+  Modulus (remainder) of integer operands:
+  %
 
   
 
@@ -3323,8 +3324,6 @@ ${12 % 10}
 
   ${3 + "5"}
 
-  will output this:
-
   35
 
   Generally, FreeMarker never converts a string to a number
@@ -3353,6 +3352,26 @@ ${-1.999?int}
 1
 -1
 -1
+
+  Due to historical reasons, the % operator
+  works by first truncating the operands to an integer number, and
+  then returning the remainder of the division:
+
+  ${12 % 5}   #-- Prints 2 --
+${12.9 % 5} #-- Prints 2 --
+${12.1 % 5} #-- Prints 2 --
+
+${12 % 6}   #-- Prints 0 --
+${12 % 6.9} #-- Prints 0 --
+
+  The sign of the result of % is the same as
+  the sign of the left hand operand, and its absolute value is the
+  same as if both operands where positive:
+
+  ${-12 % -5} #-- Prints -2 --
+${-12 % 5} #-- Prints -2 --
+${12 % -5} #-- Prints 2 --
+
 
 
 



[10/24] incubator-freemarker git commit: (Typo fix)

2016-12-06 Thread ddekany
(Typo fix)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/479ea6c5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/479ea6c5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/479ea6c5

Branch: refs/heads/2.3
Commit: 479ea6c538f32bd74f770b1aff63a0bf25329210
Parents: 32c8879
Author: ddekany 
Authored: Thu Aug 11 20:41:24 2016 +0200
Committer: ddekany 
Committed: Thu Aug 11 20:41:24 2016 +0200

--
 src/manual/en_US/book.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/479ea6c5/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index bd5ba49..ce9b08f 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -9145,7 +9145,7 @@ cfg.setTemplateConfigurations(
 The output format associated to a template decides if and what
 kind of auto-escaping is used in that template (unless the template
 overrides that
-with directives). By default, templates has
+with directives). By default, templates have
 undefined output format associated, which does no
 escaping, and in general gives the behavior that you would expect from
 a template engine that doesn't care about output formats and escaping.



[23/24] incubator-freemarker git commit: Made `+` operator when adding two hashes significantly faster (be removing the overhead caused be throwing and then catching an exception).

2016-12-06 Thread ddekany
Made `+` operator when adding two hashes significantly faster (be removing the 
overhead caused be throwing and then catching an exception).


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/4b989f89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/4b989f89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/4b989f89

Branch: refs/heads/2.3
Commit: 4b989f89ba54b0ba309b7385e56e2ecf2466ffef
Parents: 496ddfb
Author: ddekany 
Authored: Tue Dec 6 23:25:42 2016 +0100
Committer: ddekany 
Committed: Tue Dec 6 23:25:55 2016 +0100

--
 .../freemarker/core/AddConcatExpression.java| 58 ++--
 src/main/java/freemarker/core/EvalUtil.java | 26 +++--
 src/manual/en_US/book.xml   |  4 +-
 3 files changed, 65 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b989f89/src/main/java/freemarker/core/AddConcatExpression.java
--
diff --git a/src/main/java/freemarker/core/AddConcatExpression.java 
b/src/main/java/freemarker/core/AddConcatExpression.java
index 4dbfd78..5523118 100644
--- a/src/main/java/freemarker/core/AddConcatExpression.java
+++ b/src/main/java/freemarker/core/AddConcatExpression.java
@@ -74,11 +74,26 @@ final class AddConcatExpression extends Expression {
 } else if (leftModel instanceof TemplateSequenceModel && rightModel 
instanceof TemplateSequenceModel) {
 return new ConcatenatedSequence((TemplateSequenceModel) leftModel, 
(TemplateSequenceModel) rightModel);
 } else {
+boolean hashConcatPossible
+= leftModel instanceof TemplateHashModel && rightModel 
instanceof TemplateHashModel;
 try {
+// We try string addition first. If hash addition is possible, 
then instead of throwing exception
+// we return null and do hash addition instead. (We can't 
simply give hash addition a priority, like
+// with sequence addition above, as FTL strings are often also 
FTL hashes.)
 Object leftOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
-leftModel, leftExp, (String) null, env);
+leftModel, leftExp, /* returnNullOnNonCoercableType = 
*/ hashConcatPossible, (String) null,
+env);
+if (leftOMOrStr == null) {
+return _eval_concatenateHashes(leftModel, rightModel);
+}
+
+// Same trick with null return as above.
 Object rightOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
-rightModel, rightExp, (String) null, env);
+rightModel, rightExp, /* returnNullOnNonCoercableType 
= */ hashConcatPossible, (String) null,
+env);
+if (rightOMOrStr == null) {
+return _eval_concatenateHashes(leftModel, rightModel);
+}
 
 if (leftOMOrStr instanceof String) {
 if (rightOMOrStr instanceof String) {
@@ -98,25 +113,14 @@ final class AddConcatExpression extends Expression {
 } else { // rightOMOrStr instanceof 
TemplateMarkupOutputModel
 return EvalUtil.concatMarkupOutputs(parent,
 leftMO,
-(TemplateMarkupOutputModel) rightOMOrStr);
+(TemplateMarkupOutputModel) rightOMOrStr);
 }
 }
 } catch (NonStringOrTemplateOutputException e) {
-if (leftModel instanceof TemplateHashModel && rightModel 
instanceof TemplateHashModel) {
-if (leftModel instanceof TemplateHashModelEx && rightModel 
instanceof TemplateHashModelEx) {
-TemplateHashModelEx leftModelEx = 
(TemplateHashModelEx) leftModel;
-TemplateHashModelEx rightModelEx = 
(TemplateHashModelEx) rightModel;
-if (leftModelEx.size() == 0) {
-return rightModelEx;
-} else if (rightModelEx.size() == 0) {
-return leftModelEx;
-} else {
-return new ConcatenatedHashEx(leftModelEx, 
rightModelEx);
-}
-} else {
-return new ConcatenatedHash((TemplateHashModel) 
leftModel,
-(TemplateHashModel) 
rightModel);
-}
+// 2.4: Remove 

[11/24] incubator-freemarker git commit: (JavaDoc typo fix)

2016-12-06 Thread ddekany
(JavaDoc typo fix)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/84c26cc0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/84c26cc0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/84c26cc0

Branch: refs/heads/2.3
Commit: 84c26cc0676df5404df661f7fe6770fc5c3f6618
Parents: 479ea6c
Author: ddekany 
Authored: Wed Sep 28 20:09:07 2016 +0200
Committer: ddekany 
Committed: Wed Sep 28 20:09:07 2016 +0200

--
 src/main/java/freemarker/ext/beans/MethodAppearanceFineTuner.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/84c26cc0/src/main/java/freemarker/ext/beans/MethodAppearanceFineTuner.java
--
diff --git a/src/main/java/freemarker/ext/beans/MethodAppearanceFineTuner.java 
b/src/main/java/freemarker/ext/beans/MethodAppearanceFineTuner.java
index 2198772..eeefb68 100644
--- a/src/main/java/freemarker/ext/beans/MethodAppearanceFineTuner.java
+++ b/src/main/java/freemarker/ext/beans/MethodAppearanceFineTuner.java
@@ -35,12 +35,11 @@ import 
freemarker.ext.beans.BeansWrapper.MethodAppearanceDecisionInput;
 public interface MethodAppearanceFineTuner {
 
 /**
- * Experimental method; subject to change!
  * Implement this to tweak certain aspects of how methods appear in the
  * data-model. {@link BeansWrapper} will pass in all Java methods here that
  * it intends to expose in the data-model as methods (so you can do
  * obj.foo() in the template).
- * With this method it you can do the following tweaks:
+ * With this method you can do the following tweaks:
  * 
  *   Hide a method that would be otherwise shown by calling
  * {@link MethodAppearanceDecision#setExposeMethodAs(String)}



[09/24] incubator-freemarker git commit: Emphasize that the "incubating" release is a final release.

2016-12-06 Thread ddekany
Emphasize that the "incubating" release is a final release.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/32c88790
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/32c88790
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/32c88790

Branch: refs/heads/2.3
Commit: 32c88790d559b2f019ab9ebba2b0ffe9a62e54fb
Parents: 2b1ff0e
Author: ddekany 
Authored: Thu Aug 11 20:41:05 2016 +0200
Committer: ddekany 
Committed: Thu Aug 11 20:41:05 2016 +0200

--
 src/manual/en_US/book.xml | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/32c88790/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 212aeb1..bd5ba49 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -26587,9 +26587,10 @@ TemplateModel x = env.getVariable("x");  // get 
variable x
 
 Release date: 2016-06-26
 
-This is a stable, final release. The incubating
-suffix is required by the Apache Software Foundation until the project
-becomes a fully accepted (graduated) Apache project.
+This is a stable, final
+release. The incubating suffix is required
+by the Apache Software Foundation until the project becomes a fully
+accepted (graduated) Apache project.
 
 
   Changes on the FTL side
@@ -26766,10 +26767,10 @@ TemplateModel x = env.getVariable("x");  // get 
variable x
 
 Release date: 2016-03-28
 
-This is a stable, final release. The incubating
-suffix is required by the Apache Software Foundation until the project
-becomes a fully accepted (graduated) Apache project. See disclaimer
-below.
+This is a stable, final
+release. The incubating suffix is required
+by the Apache Software Foundation until the project becomes a fully
+accepted (graduated) Apache project. See disclaimer below.
 
 
   Legal changes



[14/24] incubator-freemarker git commit: Manual: Added missing "since" to outputformat documentation

2016-12-06 Thread ddekany
Manual: Added missing "since" to outputformat documentation


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/bc5f45b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/bc5f45b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/bc5f45b1

Branch: refs/heads/2.3
Commit: bc5f45b1b498fd2c5d8d2ff38f414551241520e7
Parents: 3ccd9e4
Author: ddekany 
Authored: Sun Oct 23 15:22:31 2016 +0200
Committer: ddekany 
Committed: Sun Oct 23 15:22:31 2016 +0200

--
 src/manual/en_US/book.xml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/bc5f45b1/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 38741d3..e592d47 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -21355,8 +21355,10 @@ ${""}
 
   
 
-  Camel case name variant:
-  outputFormat
+  Camel case name variant: outputFormat
+  outputformat exists since FreeMarker
+  2.3.24.
+
 
 
 



[05/24] incubator-freemarker git commit: more text clean up, typos

2016-12-06 Thread ddekany
more text clean up, typos


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/b64ab137
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/b64ab137
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/b64ab137

Branch: refs/heads/2.3
Commit: b64ab13748c100ae9964e142d107d9fd9d42ea5c
Parents: a3fa4d2
Author: ratherblue 
Authored: Mon Jul 25 23:11:55 2016 -0700
Committer: ratherblue 
Committed: Mon Jul 25 23:11:55 2016 -0700

--
 src/manual/en_US/book.xml | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/b64ab137/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index 18c486d..2938787 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -419,8 +419,8 @@
 
 
 Anything not an FTL tag or an interpolation or comment is
-considered as static text, and will not be interpreted by FreeMarker;
-it is just printed to the output as is.
+considered static text and will not be interpreted by FreeMarker;
+it is just printed to the output as-is.
 
 With FTL tags you refer to so-called directives. This is the same kind of
@@ -428,8 +428,8 @@
 table and
 /table) and HTML elements (e.g., the
 table element) to which you refer to with the HTML
-tags. (If you don't feel this difference then just take "FTL tag" and
-"directive" as synonyms.)
+tags. (If you don't understand this difference then consider "FTL tag" 
and
+"directive" synonyms.)
 
 
   You can easily try writing templates on Similarly as earlier when a string was specified directly,
 here a number is specified directly (0). Note
 that the number is not quoted. If you quoted
-it ("0"), FreeMarker were misinterpret it as a
-string literal, and because the price to compare it to is number,
+it ("0"), FreeMarker would misinterpret it as a
+string literal, and because the price to compare it to is a number,
 you get an error.
 
 This will print "Pythons are not free today!" if their price
@@ -594,7 +594,7 @@
 /#list tags.
 
 The sequence
-can be any kind of expression, like we could list the fruits of
+can be any kind of expression. For example we could list the 
fruits of
 the example data model like this:
 
 ul
@@ -630,7 +630,7 @@
 case.
 
 Another frequent listing-related task: let's list the fruits
-separating them with something, like comma:
+separating them with something, like a comma:
 
 pFruits: #list 
misc.fruits as fruit${fruit}#sep, 
/#list
 
@@ -643,7 +643,7 @@
 there will be a next item. Hence there's no comma after the last
 fruit.
 
-Here again, what's if we have 0 fruits? Just printing
+Here again, what if we have 0 fruits? Just printing
 Fruits: and then nothing is awkward. A
 list, just like an if, can
 have an else, which is executed if there were 0



[07/24] incubator-freemarker git commit: Added more information about configuring FreeMarker with string-string key-value pairs.

2016-12-06 Thread ddekany
Added more information about configuring FreeMarker with string-string 
key-value pairs.


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/58cba5b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/58cba5b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/58cba5b9

Branch: refs/heads/2.3
Commit: 58cba5b961154f374989c6eab49e8560623db9de
Parents: 0815e14
Author: ddekany 
Authored: Thu Aug 11 20:29:46 2016 +0200
Committer: ddekany 
Committed: Thu Aug 11 20:29:46 2016 +0200

--
 src/manual/en_US/book.xml | 37 +++--
 1 file changed, 31 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/58cba5b9/src/manual/en_US/book.xml
--
diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml
index b93691a..c6b0c38 100644
--- a/src/manual/en_US/book.xml
+++ b/src/manual/en_US/book.xml
@@ -8083,7 +8083,11 @@ cfg.setSharedVariable("company", "Foo 
Inc.");
 
 Configuration myCfg = new 
Configuration(Configuration.VERSION_2_3_25);
 myCfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
-myCfg.setDefaultEncoding("UTF-8");
+myCfg.setDefaultEncoding("UTF-8");
+DefaultObjectWrapperBuilder owb = new 
DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_25);
+owb.setForceLegacyNonListCollections(false);
+owb.setDefaultDateType(TemplateDateModel.DATETIME);
+myCfg.setObjectWrapper(owb.build());
 
 You do this before you start to actually use the
 Configuration object (typically, when you
@@ -8109,14 +8113,35 @@ myCfg.setDefaultEncoding("UTF-8");
   prop key="incompatible_improvements"2.3.25/prop
   prop key="template_exception_handler"rethrow/prop
   prop key="default_encoding"UTF-8/prop
+  prop key="object_wrapper"
+DefaultObjectWrapper(
+2.3.25,
+forceLegacyNonListCollections = false,
+defaultDateType = 
freemarker.template.TemplateDateModel.DATETIME)
+  /prop
 /props
   /property
 /bean
 
-Note that this kind of configuring
-(String key-value pairs) is somewhat limited
-compared to directly using Java API, so in some cases you have to
-find a way to do this in Java.
+Here's the same when configuring FreeMarker for Struts,
+which looks for a freemarker.properties in the
+classpath:
+
+incompatible_improvements=2.3.25
+template_exception_handler=rethrow
+default_encoding=UTF-8
+object_wrapper=DefaultObjectWrapper( \
+2.3.25, \
+forceLegacyNonListCollections = false, \
+defaultDateType = 
freemarker.template.TemplateDateModel.DATETIME)
+
+As demonstrated above with
+object_wrapper, some settings can accept quite
+complex values, which can be used to instantiate objects of
+arbitrary classes and set their properties. Still, configuring
+with String key-value pairs is limited compared
+to directly using the Java API, so in some cases you have to find
+a way to do this in Java.
   
 
   
@@ -8153,7 +8178,7 @@ myCfg.setDefaultEncoding("UTF-8");
   should set the
   incompatible_improvements setting to
-  2.3.22 or higher, to avoid soe confusing legacy bugs.
+  2.3.22 or higher, to avoid some confusing legacy bugs.
 
   
 



[12/24] incubator-freemarker git commit: Removed experimental status warning from MethodAppearanceFineTuner-related API-s. (These are in use at many places by now, so we can't change them anymore anyw

2016-12-06 Thread ddekany
Removed experimental status warning from MethodAppearanceFineTuner-related 
API-s. (These are in use at many places by now, so we can't change them anymore 
anyway.)


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/ed653168
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/ed653168
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/ed653168

Branch: refs/heads/2.3
Commit: ed65316898dc57e79b9f45d1feee894bc75f5f53
Parents: 84c26cc
Author: ddekany 
Authored: Wed Sep 28 20:10:49 2016 +0200
Committer: ddekany 
Committed: Wed Sep 28 20:10:49 2016 +0200

--
 src/main/java/freemarker/ext/beans/BeansWrapper.java | 2 --
 1 file changed, 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/ed653168/src/main/java/freemarker/ext/beans/BeansWrapper.java
--
diff --git a/src/main/java/freemarker/ext/beans/BeansWrapper.java 
b/src/main/java/freemarker/ext/beans/BeansWrapper.java
index c809fe7..cf2d0c4 100644
--- a/src/main/java/freemarker/ext/beans/BeansWrapper.java
+++ b/src/main/java/freemarker/ext/beans/BeansWrapper.java
@@ -1732,7 +1732,6 @@ public class BeansWrapper implements RichObjectWrapper, 
WriteProtectable {
 }
 
 /**
- * Experimental class; subject to change!
  * Used for
  * {@link MethodAppearanceFineTuner#process}
  * to store the results; see there.
@@ -1775,7 +1774,6 @@ public class BeansWrapper implements RichObjectWrapper, 
WriteProtectable {
 }
 
 /**
- * Experimental class; subject to change!
  * Used for
  * {@link MethodAppearanceFineTuner#process}
  * as input parameter; see there.



incubator-freemarker git commit: Made `+` operator when adding two hashes significantly faster (be removing the overhead caused be throwing and then catching an exception).

2016-12-06 Thread ddekany
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 496ddfbc0 -> 4b989f89b


Made `+` operator when adding two hashes significantly faster (be removing the 
overhead caused be throwing and then catching an exception).


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/4b989f89
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/4b989f89
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/4b989f89

Branch: refs/heads/2.3-gae
Commit: 4b989f89ba54b0ba309b7385e56e2ecf2466ffef
Parents: 496ddfb
Author: ddekany 
Authored: Tue Dec 6 23:25:42 2016 +0100
Committer: ddekany 
Committed: Tue Dec 6 23:25:55 2016 +0100

--
 .../freemarker/core/AddConcatExpression.java| 58 ++--
 src/main/java/freemarker/core/EvalUtil.java | 26 +++--
 src/manual/en_US/book.xml   |  4 +-
 3 files changed, 65 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b989f89/src/main/java/freemarker/core/AddConcatExpression.java
--
diff --git a/src/main/java/freemarker/core/AddConcatExpression.java 
b/src/main/java/freemarker/core/AddConcatExpression.java
index 4dbfd78..5523118 100644
--- a/src/main/java/freemarker/core/AddConcatExpression.java
+++ b/src/main/java/freemarker/core/AddConcatExpression.java
@@ -74,11 +74,26 @@ final class AddConcatExpression extends Expression {
 } else if (leftModel instanceof TemplateSequenceModel && rightModel 
instanceof TemplateSequenceModel) {
 return new ConcatenatedSequence((TemplateSequenceModel) leftModel, 
(TemplateSequenceModel) rightModel);
 } else {
+boolean hashConcatPossible
+= leftModel instanceof TemplateHashModel && rightModel 
instanceof TemplateHashModel;
 try {
+// We try string addition first. If hash addition is possible, 
then instead of throwing exception
+// we return null and do hash addition instead. (We can't 
simply give hash addition a priority, like
+// with sequence addition above, as FTL strings are often also 
FTL hashes.)
 Object leftOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
-leftModel, leftExp, (String) null, env);
+leftModel, leftExp, /* returnNullOnNonCoercableType = 
*/ hashConcatPossible, (String) null,
+env);
+if (leftOMOrStr == null) {
+return _eval_concatenateHashes(leftModel, rightModel);
+}
+
+// Same trick with null return as above.
 Object rightOMOrStr = EvalUtil.coerceModelToStringOrMarkup(
-rightModel, rightExp, (String) null, env);
+rightModel, rightExp, /* returnNullOnNonCoercableType 
= */ hashConcatPossible, (String) null,
+env);
+if (rightOMOrStr == null) {
+return _eval_concatenateHashes(leftModel, rightModel);
+}
 
 if (leftOMOrStr instanceof String) {
 if (rightOMOrStr instanceof String) {
@@ -98,25 +113,14 @@ final class AddConcatExpression extends Expression {
 } else { // rightOMOrStr instanceof 
TemplateMarkupOutputModel
 return EvalUtil.concatMarkupOutputs(parent,
 leftMO,
-(TemplateMarkupOutputModel) rightOMOrStr);
+(TemplateMarkupOutputModel) rightOMOrStr);
 }
 }
 } catch (NonStringOrTemplateOutputException e) {
-if (leftModel instanceof TemplateHashModel && rightModel 
instanceof TemplateHashModel) {
-if (leftModel instanceof TemplateHashModelEx && rightModel 
instanceof TemplateHashModelEx) {
-TemplateHashModelEx leftModelEx = 
(TemplateHashModelEx) leftModel;
-TemplateHashModelEx rightModelEx = 
(TemplateHashModelEx) rightModel;
-if (leftModelEx.size() == 0) {
-return rightModelEx;
-} else if (rightModelEx.size() == 0) {
-return leftModelEx;
-} else {
-return new ConcatenatedHashEx(leftModelEx, 
rightModelEx);
-}
-} else {
-return new ConcatenatedHash((TemplateHashModel) 
leftModel,
-