Return-Path: X-Original-To: apmail-freemarker-notifications-archive@minotaur.apache.org Delivered-To: apmail-freemarker-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8D863181BB for ; Wed, 30 Dec 2015 18:11:27 +0000 (UTC) Received: (qmail 30178 invoked by uid 500); 30 Dec 2015 18:11:27 -0000 Delivered-To: apmail-freemarker-notifications-archive@freemarker.apache.org Received: (qmail 30157 invoked by uid 500); 30 Dec 2015 18:11:27 -0000 Mailing-List: contact notifications-help@freemarker.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@freemarker.incubator.apache.org Delivered-To: mailing list notifications@freemarker.incubator.apache.org Received: (qmail 30136 invoked by uid 99); 30 Dec 2015 18:11:27 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2015 18:11:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id EF1531804FB for ; Wed, 30 Dec 2015 18:11:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.226 X-Spam-Level: * X-Spam-Status: No, score=1.226 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.554] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ptdHJ517jrOW for ; Wed, 30 Dec 2015 18:11:25 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id C526A439FB for ; Wed, 30 Dec 2015 18:11:22 +0000 (UTC) Received: (qmail 29383 invoked by uid 99); 30 Dec 2015 18:11:22 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Dec 2015 18:11:22 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2C1A7E0B53; Wed, 30 Dec 2015 18:11:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ddekany@apache.org To: notifications@freemarker.incubator.apache.org Date: Wed, 30 Dec 2015 18:11:53 -0000 Message-Id: <570b4d7d496d441da639da65058f7182@git.apache.org> In-Reply-To: <5bc2e3812f964818b5fa5a690376afc9@git.apache.org> References: <5bc2e3812f964818b5fa5a690376afc9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [33/35] incubator-freemarker git commit: Bug fixed: With incompatible_improvements set to 2.3.24, m?is_sequence doesn't return true for Java methods wrapped by BeansWrapper and its subclasses (most notably DefaultObjectWrapper) anymore, as they only impl Bug fixed: With incompatible_improvements set to 2.3.24, m?is_sequence doesn't return true for Java methods wrapped by BeansWrapper and its subclasses (most notably DefaultObjectWrapper) anymore, as they only implement the [index] operator, but not ?size, which causes <#list ...> to fail among others. (They shouldn't implement either, but this is historical heritage.) Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/3a62ff8e Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/3a62ff8e Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/3a62ff8e Branch: refs/heads/2.3 Commit: 3a62ff8ecfc63bec8c43d4996ffa5839b9871a9e Parents: 957264e Author: ddekany Authored: Tue Dec 29 19:29:52 2015 +0100 Committer: ddekany Committed: Tue Dec 29 19:29:52 2015 +0100 ---------------------------------------------------------------------- .../core/BuiltInsForMultipleTypes.java | 7 ++- src/main/java/freemarker/core/Environment.java | 4 +- .../java/freemarker/template/Configuration.java | 5 ++ src/manual/en_US/book.xml | 49 ++++++++++++++++++-- .../expected/type-builtins-ici-2.3.24.txt | 15 ++++++ .../freemarker/test/templatesuite/testcases.xml | 5 +- 6 files changed, 78 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3a62ff8e/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java ---------------------------------------------------------------------- diff --git a/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java b/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java index 861b370..81bcf59 100644 --- a/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java +++ b/src/main/java/freemarker/core/BuiltInsForMultipleTypes.java @@ -436,7 +436,12 @@ class BuiltInsForMultipleTypes { TemplateModel _eval(Environment env) throws TemplateException { TemplateModel tm = target.eval(env); target.assertNonNull(tm, env); - return (tm instanceof TemplateSequenceModel) ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE; + return (tm instanceof TemplateSequenceModel + && ( + !(tm instanceof OverloadedMethodsModel || tm instanceof SimpleMethodModel) + || !env.isIcI2324OrLater()) + ) + ? TemplateBooleanModel.TRUE : TemplateBooleanModel.FALSE; } } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3a62ff8e/src/main/java/freemarker/core/Environment.java ---------------------------------------------------------------------- diff --git a/src/main/java/freemarker/core/Environment.java b/src/main/java/freemarker/core/Environment.java index 5ae1bf7..3d61aaa 100644 --- a/src/main/java/freemarker/core/Environment.java +++ b/src/main/java/freemarker/core/Environment.java @@ -92,7 +92,7 @@ import freemarker.template.utility.UndeclaredThrowableException; * {@link Template#createProcessingEnvironment(Object rootMap, Writer out, ObjectWrapper wrapper)} */ public final class Environment extends Configurable { - + private static final ThreadLocal threadEnv = new ThreadLocal(); private static final Logger LOG = Logger.getLogger("freemarker.runtime"); @@ -2779,7 +2779,7 @@ public final class Environment extends Configurable { return configuration.getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_22; } - private boolean isIcI2324OrLater() { + boolean isIcI2324OrLater() { return configuration.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_24; } http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3a62ff8e/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 8be37db..82c46b3 100644 --- a/src/main/java/freemarker/template/Configuration.java +++ b/src/main/java/freemarker/template/Configuration.java @@ -780,6 +780,11 @@ public class Configuration extends Configurable implements Cloneable, ParserConf * it's executed in the main namespace, but that haven't happened when the imported template was already * imported earlier in another namespace. * + *
  • + * {@code ?is_sequence} doesn't return {@code true} for Java methods wrapped by {@link BeansWrapper} and + * its subclasses (most notably {@link DefaultObjectWrapper}) anymore, as they only implement the + * {@code [index]} operator, but not {@code ?size}, which causes {@code <#list ...>} to fail among others. + * (They shouldn't implement either, but this is historical heritage.) * *

  • * http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3a62ff8e/src/manual/en_US/book.xml ---------------------------------------------------------------------- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 145eb3c..8f43a97 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -17886,7 +17886,13 @@ Sorted by name.last: is_sequence - sequence + sequence (Historical quirk: Before incompatible_improvements + 2.3.24 it returns true for Java methods as + they implement the + [index] + operator, however, they fail on + ?size.) @@ -17911,7 +17917,10 @@ Sorted by name.last: is_indexable - sequence + sequence (Historical quirk: it returns + true for Java methods as they implement the + [index] + operator.) @@ -26553,11 +26562,28 @@ TemplateModel x = env.getVariable("x"); // get variable x <@ and </@ is - now allowed in String literals that contain + now allowed in string literals that contain ${exp}, and will be part of the literal as is. Earlier it was a syntactical error. + + + Bug fixed: With + incompatible_improvements set to 2.3.24 + (see how + here...), + m?is_sequence + doesn't return true for Java methods wrapped + by BeansWrapper and its subclasses (most + notably DefaultObjectWrapper) anymore, as + they only implement the + [index] operator, + but not ?size, which causes + <#list ...> + to fail among others. (They shouldn't implement either, but this + is historical heritage.) + @@ -27448,6 +27474,23 @@ TemplateModel x = env.getVariable("x"); // get variable x + Bug fixed: With + incompatible_improvements set to 2.3.24 + (see how + here...), + m?is_sequence + doesn't return true for Java methods wrapped + by BeansWrapper and its subclasses (most + notably DefaultObjectWrapper) anymore, as + they only implement the + [index] operator, + but not ?size, which causes + <#list ...> + to fail among others. (They shouldn't implement either, but this + is historical heritage.) + + + Added an overload to Configuration.getSupportedBuiltInNames and Configuration.getSupportedBuiltInDirectiveNames http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3a62ff8e/src/test/resources/freemarker/test/templatesuite/expected/type-builtins-ici-2.3.24.txt ---------------------------------------------------------------------- diff --git a/src/test/resources/freemarker/test/templatesuite/expected/type-builtins-ici-2.3.24.txt b/src/test/resources/freemarker/test/templatesuite/expected/type-builtins-ici-2.3.24.txt new file mode 100644 index 0000000..b96f6f9 --- /dev/null +++ b/src/test/resources/freemarker/test/templatesuite/expected/type-builtins-ici-2.3.24.txt @@ -0,0 +1,15 @@ +StNuBoMeTaMaHaHxSeCoCxEnInDiNo +1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 +0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 +0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 +0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 +1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 +0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 +0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/3a62ff8e/src/test/resources/freemarker/test/templatesuite/testcases.xml ---------------------------------------------------------------------- diff --git a/src/test/resources/freemarker/test/templatesuite/testcases.xml b/src/test/resources/freemarker/test/templatesuite/testcases.xml index 31d6606..4a6e539 100644 --- a/src/test/resources/freemarker/test/templatesuite/testcases.xml +++ b/src/test/resources/freemarker/test/templatesuite/testcases.xml @@ -186,7 +186,10 @@ - + + + +