freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [7/8] incubator-freemarker git commit: FREEMARKER-64: Removed TemplateMethodModel, using TemplateFunctionModel everywhere instead. Some refinement of existing TemplateCallableModel API-s, most importantly, the support for null argumenArrayLayout. Removed
Date Mon, 07 Aug 2017 22:41:33 GMT
FREEMARKER-64: Removed TemplateMethodModel, using TemplateFunctionModel everywhere instead. Some refinement of existing TemplateCallableModel API-s, most importantly, the support for null argumenArrayLayout. Removed `?isMethod` (use `isFunction` instead) and `?isMacro` (use `isDirective` instead).


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

Branch: refs/heads/3
Commit: 8d5263f2aa0fca589ed67b6f6ccbbd8780ece5ef
Parents: 1333a71
Author: ddekany <ddekany@apache.org>
Authored: Mon Aug 7 20:44:33 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Tue Aug 8 00:11:19 2017 +0200

----------------------------------------------------------------------
 .gitignore                                      |   2 +
 FM3-CHANGE-LOG.txt                              |  19 +-
 .../core/FM2ASTToFM3SourceConverter.java        |   4 +
 .../converter/FM2ToFM3ConverterTest.java        |   4 +
 ...a8DefaultObjectWrapperBridgeMethodsTest.java |  19 +-
 .../impl/Java8DefaultObjectWrapperTest.java     |  43 +--
 .../freemarker/core/DirectiveCallPlaceTest.java |   6 +-
 .../EnvironmentGetTemplateVariantsTest.java     |   2 +-
 .../core/TheadInterruptingSupportTest.java      |   6 +-
 .../impl/AbstractParallelIntrospectionTest.java |   9 +-
 .../CommonSupertypeForUnwrappingHintTest.java   |   8 +-
 .../model/impl/DefaultObjectWrapperTest.java    |  34 ++-
 .../core/model/impl/EnumModelsTest.java         |  11 +-
 .../core/model/impl/ErrorMessagesTest.java      |  24 +-
 .../impl/FineTuneMethodAppearanceTest.java      |   3 +-
 .../core/model/impl/StaticModelsTest.java       |  11 +-
 .../templatesuite/CoreTemplateTestSuite.java    |   4 +-
 .../core/templatesuite/models/MultiModel2.java  |  33 +--
 .../models/SimpleTestFunction.java              |  44 +++
 .../templatesuite/models/SimpleTestMethod.java  |  50 ----
 .../core/templatesuite/models/TestMethod.java   |  16 --
 .../core/userpkg/AllFeaturesDirective.java      |   2 +-
 .../core/userpkg/AllFeaturesFunction.java       |   2 +-
 .../core/userpkg/NamedVarargsOnlyDirective.java |   2 +-
 .../userpkg/PositionalVarargsOnlyDirective.java |   2 +-
 .../userpkg/PositionalVarargsOnlyFunction.java  |   2 +-
 .../core/userpkg/TwoNamedParamsDirective.java   |   2 +-
 .../TwoNestedContentParamsDirective.java        |   2 +-
 .../userpkg/TwoPositionalParamsDirective.java   |   2 +-
 .../userpkg/TwoPositionalParamsFunction.java    |   2 +-
 .../core/userpkg/UpperCaseDirective.java        |   2 +-
 .../core/valueformat/NumberFormatTest.java      |   2 +-
 .../org/apache/freemarker/core/ast-builtins.ast |   4 +-
 .../org/apache/freemarker/core/ast-range.ast    |   6 +-
 .../templatesuite/expected/number-literal.txt   |  10 +-
 .../templatesuite/expected/type-builtins.txt    |  28 +-
 .../core/templatesuite/templates/list2.ftl      |   2 +-
 .../templatesuite/templates/number-literal.ftl  |   2 +-
 .../templates/string-builtins3.ftl              |  32 +--
 .../templatesuite/templates/type-builtins.ftl   |   7 +-
 .../freemarker/core/ASTDynamicTopLevelCall.java |  77 +++--
 .../apache/freemarker/core/ASTExpBuiltIn.java   |  68 +++--
 .../freemarker/core/ASTExpFunctionCall.java     | 229 +++++++++++++++
 .../freemarker/core/ASTExpListLiteral.java      |   5 +-
 .../freemarker/core/ASTExpMethodCall.java       | 226 ---------------
 .../freemarker/core/BuiltInsForDates.java       |  30 +-
 .../core/BuiltInsForExistenceHandling.java      |  49 ++--
 .../core/BuiltInsForMultipleTypes.java          | 114 ++++----
 .../BuiltInsForNestedContentParameters.java     |  20 +-
 .../freemarker/core/BuiltInsForNodes.java       |  38 ++-
 .../freemarker/core/BuiltInsForSequences.java   | 126 ++++----
 .../core/BuiltInsForStringsBasic.java           | 287 ++++++++++++-------
 .../core/BuiltInsForStringsEncoding.java        |  19 +-
 .../freemarker/core/BuiltInsForStringsMisc.java |  20 +-
 .../core/BuiltInsForStringsRegexp.java          |  51 ++--
 .../org/apache/freemarker/core/Environment.java |  21 +-
 .../org/apache/freemarker/core/MessageUtil.java |   2 +-
 .../freemarker/core/NonFunctionException.java   |  62 ++++
 .../freemarker/core/NonMethodException.java     |  62 ----
 .../apache/freemarker/core/_CallableUtils.java  |  61 ++--
 .../core/_ObjectBuilderSettingEvaluator.java    |  31 +-
 .../freemarker/core/debug/DebugModel.java       |   2 +-
 .../core/debug/RmiDebugModelImpl.java           |   4 +-
 .../core/model/ArgumentArrayLayout.java         |  18 ++
 .../core/model/GeneralPurposeNothing.java       |  18 +-
 .../core/model/TemplateCallableModel.java       |  11 +-
 .../core/model/TemplateDirectiveModel.java      |  45 ++-
 .../core/model/TemplateFunctionModel.java       |  10 +
 .../core/model/TemplateMethodModel.java         |  53 ----
 .../core/model/TemplateModelException.java      |   4 +-
 .../freemarker/core/model/impl/BeanModel.java   |  17 +-
 .../core/model/impl/DefaultObjectWrapper.java   |  29 +-
 .../core/model/impl/JavaMethodModel.java        |  94 ++----
 .../model/impl/OverloadedFixArgsMethods.java    |  24 +-
 .../model/impl/OverloadedJavaMethodModel.java   |  86 ++++++
 .../core/model/impl/OverloadedMethods.java      |  59 ++--
 .../core/model/impl/OverloadedMethodsModel.java |  65 -----
 .../model/impl/OverloadedMethodsSubset.java     |  52 ++--
 .../model/impl/OverloadedVarArgsMethods.java    |  57 ++--
 .../core/model/impl/ResourceBundleModel.java    |  40 +--
 .../core/model/impl/SimpleJavaMethodModel.java  | 123 ++++++++
 .../core/model/impl/SimpleMethod.java           |  86 +++---
 .../freemarker/core/model/impl/StaticModel.java |  16 +-
 .../model/impl/TemplateModelListSequence.java   |  13 +-
 .../freemarker/core/model/impl/_MethodUtil.java |  40 +--
 .../apache/freemarker/core/util/FTLUtil.java    |  11 +-
 freemarker-core/src/main/javacc/FTL.jj          |   4 +-
 .../apache/freemarker/servlet/IncludePage.java  |   2 +-
 .../jsp/CustomTagAndELFunctionCombiner.java     | 157 ----------
 .../freemarker/servlet/jsp/JspTagModelBase.java |  33 +--
 .../servlet/jsp/SimpleTagDirectiveModel.java    |   2 +-
 .../servlet/jsp/TagDirectiveModel.java          |   2 +-
 .../freemarker/servlet/jsp/TaglibFactory.java   |  22 +-
 ...eDirectiveModelAndTemplateFunctionModel.java |  77 +++++
 .../freemarker/servlet/jsp/TLDParsingTest.java  |  17 +-
 .../test/templateutil/AssertDirective.java      |   2 +-
 .../templateutil/AssertEqualsDirective.java     |   2 +-
 .../test/templateutil/AssertFailsDirective.java |   2 +-
 .../test/templateutil/NoOutputDirective.java    |   2 +-
 99 files changed, 1802 insertions(+), 1562 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 0d9f1d4..5407d43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,5 @@
 
 .directory
 .Trash*
+
+**/adhoctest/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/FM3-CHANGE-LOG.txt
----------------------------------------------------------------------
diff --git a/FM3-CHANGE-LOG.txt b/FM3-CHANGE-LOG.txt
index d38866b..685160a 100644
--- a/FM3-CHANGE-LOG.txt
+++ b/FM3-CHANGE-LOG.txt
@@ -86,9 +86,6 @@ Node: Changes already mentioned above aren't repeated here!
   translated to `${b}`, while `#{x; m1M3}` is translated to `${x?string('0.0##')}`). The output should remain the same.
 - In `#macro` and `#function` the comma must only be used between by-position parameters (earlier the comma was
   optional).
-  TODO As of this writing, the by-position VS by-name feature isn't implemented yet, so
-  comma is to be used for `#function`, and comma must not be used for `#macro` (even though for now macros are always
-  allowed to be called with by-position parameters as well, just as in FM2).
 - In `#function`, parentheses are now required around parameter list (as in `<#function f(a, b)>`), even if there are
   zero parameters (as in `<#function f()>`). In `#macro`, parentheses are not allowed around parameter list anymore
   (so `#macro m(a b)` becomes to `#macro m a b`). This is to remain more consistent with the look-and-feel of the
@@ -120,8 +117,10 @@ Node: Changes already mentioned above aren't repeated here!
   - Renamed `DirectiveCallPlace` to `CallPlace`
   - Removed Environment.getDirectiveCallPlace(), as TemplateDirectiveModel-s now get the CallPlace as the
     parameter of the `execute` method.
-  - ?isTransform was removed (as there are no transforms anymore).
-    Converter note: The template converter tool replaces it with ?isDirective
+  - `?isTransform` was removed (as there are no transforms anymore); use `?isDirective` instead.
+  - `?isMacro` was removed; use `?isDirective` instead, which returns `true` both for macros and directives defined otherwise.
+  - `?isMethod` was removed; use `?isFunction` instead, which returns `true` both for Java methods and functions defined
+     otherwise (such as with `#function`).
 - The directive returned by `?interpret` doesn't allow nested content anymore. (It wasn't useful earlier either;
   the nested content was simply executed after the interpreted string.)
 - Changes in #macro/#functions
@@ -199,7 +198,6 @@ Major changes / features
     `TemplateDirectiveModel`, `TemplateTransformModel`). FM3 replaces them with only two new interfaces,
     `TemplateDirectiveModel` (differs from the interface with identical name in FM2) and `TemplateFunctionModel`.
     (These are both the subinterfaces of another new interface `TemplateCallableModel`.)
-    [TODO: TemplateMethodModel[Ex] wasn't yet replaced by TemplateFunctionModel.]
   - All callable TempalteModel-s support passing parameters by position and by name, even in the same call
     (e.g., `<@heading "Some title" icon="foo.jpg" />`, `sum(1, 2, 3, abs=true)`)
   - `#macro` now produces a `TemplateDirectiveModel` and `#function` produces a `TemplateFunctionModel`. (Earlier, the
@@ -375,11 +373,10 @@ Core / Models and Object wrapping
   get method (`get(String)`) had priority over methods of similar name. The generic get method is only recognized from its
   name and parameter type, so it's a quite consfusing feature, and might will be removed alltogether.
 - Renamed TemplateDateModel.DATETIME to DATE_TIME (to be consistent with "dateTime" used elsewhere).
-- TemplateModel and TemplateModelEx changes (but they will be probably replaced by TemplateFunctionModel later):
-  Removed FM2 `TemplateMethodModel`, then renamed `TemplateMethodModelEx` to `TemplateMethodModel`. Then changed it further to return
-  `TemplateModel` (instead of `Object`, which allowed returning a non-wrapped value by design in FM2), changed the parameter `List` to
-  `List<? extends TemplateModel>` (which it was earlier too, but there were no generic paramters back then), and allowed throwing
-  `TemplateException` instead of the more restrictive `TemplateModelException`.
+- `TemplateMethod` and `TemplateMethodEx` was removed, taken over by `TemplateFunctionModel`. `TemplateFunctionModel` is
+  the common interface bith for wrapped Java methods and functions defined in the templates, or on any other ways.
+  `OverloadedMethodsModel` and `SimpleMethodModel` were renamed to `OverloadJavaMethodModel` and  `SimpleJavaMethodModel`,
+  which of course extend `TemplateFunctionModel`, but allow inocations without `Environment` parameter.
 
 Core / Template loading and caching
 ...................................

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
----------------------------------------------------------------------
diff --git a/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java b/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
index 57a912f..6d9b25c 100644
--- a/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
+++ b/freemarker-converter/src/main/java/freemarker/core/FM2ASTToFM3SourceConverter.java
@@ -1971,6 +1971,10 @@ public class FM2ASTToFM3SourceConverter {
             .put("web_safe", "html")
             .put("is_transform", "isDirective")
             .put("isTransform", "isDirective")
+            .put("is_macro", "isDirective")
+            .put("isMacro", "isDirective")
+            .put("is_method", "isFunction")
+            .put("isMethod", "isFunction")
             .put("iso_utc_fz", "isoUtcFZ")
             .put("iso_utc_nz", "isoUtcNZ")
             .put("iso_utc_ms_nz", "isoUtcMsNZ")

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-converter/src/test/java/org/freemarker/converter/FM2ToFM3ConverterTest.java
----------------------------------------------------------------------
diff --git a/freemarker-converter/src/test/java/org/freemarker/converter/FM2ToFM3ConverterTest.java b/freemarker-converter/src/test/java/org/freemarker/converter/FM2ToFM3ConverterTest.java
index 63c2a92..0790518 100644
--- a/freemarker-converter/src/test/java/org/freemarker/converter/FM2ToFM3ConverterTest.java
+++ b/freemarker-converter/src/test/java/org/freemarker/converter/FM2ToFM3ConverterTest.java
@@ -475,6 +475,10 @@ public class FM2ToFM3ConverterTest extends ConverterTest {
         assertConverted("${s?html}", "${s?webSafe}");
         assertConverted("${s?isDirective}", "${s?is_transform}");
         assertConverted("${s?isDirective}", "${s?isTransform}");
+        assertConverted("${s?isDirective}", "${s?is_macro}");
+        assertConverted("${s?isDirective}", "${s?isMacro}");
+        assertConverted("${s?isFunction}", "${s?is_method}");
+        assertConverted("${s?isFunction}", "${s?isMethod}");
         assertConvertedSame("${s  ?   upperCase\t?\t\tleftPad(5)}");
         assertConvertedSame("${s <#--1--> ? <#--2--> upperCase}");
         // Runtime params:

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperBridgeMethodsTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperBridgeMethodsTest.java b/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperBridgeMethodsTest.java
index abb373e..095dc37 100644
--- a/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperBridgeMethodsTest.java
+++ b/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperBridgeMethodsTest.java
@@ -20,12 +20,11 @@ package org.apache.freemarker.core.model.impl;
 
 import static org.junit.Assert.*;
 
-import java.util.Collections;
-
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.NonTemplateCallPlace;
 import org.apache.freemarker.core.TemplateException;
+import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
 import org.junit.Test;
 
 public class Java8DefaultObjectWrapperBridgeMethodsTest {
@@ -53,12 +52,14 @@ public class Java8DefaultObjectWrapperBridgeMethodsTest {
         } catch (Exception e) {
             throw new IllegalStateException(e);
         }
-        
-        TemplateMethodModel m1 = (TemplateMethodModel) wrapped.get("m1");
-        assertEquals(BridgeMethodsBean.M1_RETURN_VALUE, "" + m1.execute(Collections.emptyList()));
-        
-        TemplateMethodModel m2 = (TemplateMethodModel) wrapped.get("m2");
-        assertNull(m2.execute(Collections.emptyList()));
+
+        JavaMethodModel m1 = (JavaMethodModel) wrapped.get("m1");
+        assertEquals(
+                BridgeMethodsBean.M1_RETURN_VALUE,
+                "" + m1.execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE));
+
+        JavaMethodModel m2 = (JavaMethodModel) wrapped.get("m2");
+        assertNull(m2.execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE));
     }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperTest.java b/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperTest.java
index 08dc5b1..c2bfad5 100644
--- a/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperTest.java
+++ b/freemarker-core-test-java8/src/test/java/org/apache/freemarker/core/model/impl/Java8DefaultObjectWrapperTest.java
@@ -20,12 +20,12 @@ package org.apache.freemarker.core.model.impl;
 
 import static org.junit.Assert.*;
 
-import java.util.Collections;
-
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.NonTemplateCallPlace;
 import org.apache.freemarker.core.TemplateException;
+import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
+import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
@@ -61,13 +61,13 @@ public class Java8DefaultObjectWrapperTest {
             // Has only indexed read method, so it's not exposed as a property
             assertNull(wrappedBean.get(Java8DefaultMethodsBeanBase.DEFAULT_METHOD_INDEXED_PROP));
 
-            TemplateMethodModel indexedReadMethod = (TemplateMethodModel) wrappedBean.get(
+            JavaMethodModel indexedReadMethod = (JavaMethodModel) wrappedBean.get(
                     Java8DefaultMethodsBeanBase.DEFAULT_METHOD_INDEXED_PROP_GETTER);
             assertNotNull(indexedReadMethod);
             assertEquals(Java8DefaultMethodsBeanBase.DEFAULT_METHOD_INDEXED_PROP_VALUE,
-                    ((TemplateScalarModel) indexedReadMethod.execute(Collections.singletonList(new SimpleNumber(0))))
-                            .getAsString
-                            ());
+                    ((TemplateScalarModel) indexedReadMethod.execute(
+                            new TemplateModel[] { new SimpleNumber(0) }, NonTemplateCallPlace.INSTANCE))
+                            .getAsString());
         }
         {
             // We see default method indexed read method, but it's invalidated by normal getter in the subclass
@@ -114,45 +114,54 @@ public class Java8DefaultObjectWrapperTest {
             // Has only indexed read method, so it's not exposed as a property
             assertNull(wrappedBean.get(Java8DefaultMethodsBean.INDEXED_PROP_4));
 
-            TemplateMethodModel indexedReadMethod = (TemplateMethodModel) wrappedBean.get(
+            JavaMethodModel indexedReadMethod = (JavaMethodModel) wrappedBean.get(
                     Java8DefaultMethodsBean.INDEXED_PROP_GETTER_4);
             assertNotNull(indexedReadMethod);
             assertEquals(Java8DefaultMethodsBean.INDEXED_PROP_4_VALUE,
-                    ((TemplateScalarModel) indexedReadMethod.execute(Collections.singletonList(new SimpleNumber(0))))
+                    ((TemplateScalarModel) indexedReadMethod.execute(
+                            new TemplateModel[] { new SimpleNumber(0) }, NonTemplateCallPlace.INSTANCE))
                             .getAsString());
         }        
         {
-            TemplateMethodModel action = (TemplateMethodModel) wrappedBean.get(
+            JavaMethodModel action = (JavaMethodModel) wrappedBean.get(
                     Java8DefaultMethodsBean.NORMAL_ACTION);
             assertNotNull(action);
             assertEquals(
                     Java8DefaultMethodsBean.NORMAL_ACTION_RETURN_VALUE,
-                    ((TemplateScalarModel) action.execute(Collections.emptyList())).getAsString());
+                    ((TemplateScalarModel) action.execute(
+                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE))
+                            .getAsString());
         }
         
         {
-            TemplateMethodModel action = (TemplateMethodModel) wrappedBean.get(
+            JavaMethodModel action = (JavaMethodModel) wrappedBean.get(
                     Java8DefaultMethodsBean.NORMAL_ACTION);
             assertNotNull(action);
             assertEquals(
                     Java8DefaultMethodsBean.NORMAL_ACTION_RETURN_VALUE,
-                    ((TemplateScalarModel) action.execute(Collections.emptyList())).getAsString());
+                    ((TemplateScalarModel) action.execute(
+                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE))
+                            .getAsString());
         }
         {
-            TemplateMethodModel action = (TemplateMethodModel) wrappedBean.get(
+            JavaMethodModel action = (JavaMethodModel) wrappedBean.get(
                     Java8DefaultMethodsBean.DEFAULT_METHOD_ACTION);
             assertNotNull(action);
             assertEquals(
                     Java8DefaultMethodsBean.DEFAULT_METHOD_ACTION_RETURN_VALUE,
-                    ((TemplateScalarModel) action.execute(Collections.emptyList())).getAsString());
+                    ((TemplateScalarModel) action.execute(
+                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE))
+                            .getAsString());
         }
         {
-            TemplateMethodModel action = (TemplateMethodModel) wrappedBean.get(
+            JavaMethodModel action = (JavaMethodModel) wrappedBean.get(
                     Java8DefaultMethodsBean.OVERRIDDEN_DEFAULT_METHOD_ACTION);
             assertNotNull(action);
             assertEquals(
                     Java8DefaultMethodsBean.OVERRIDDEN_DEFAULT_METHOD_ACTION_RETURN_VALUE,
-                    ((TemplateScalarModel) action.execute(Collections.emptyList())).getAsString());
+                    ((TemplateScalarModel) action.execute(
+                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE))
+                            .getAsString());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/DirectiveCallPlaceTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/DirectiveCallPlaceTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/DirectiveCallPlaceTest.java
index 7ee42c2..25a05ac 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/DirectiveCallPlaceTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/DirectiveCallPlaceTest.java
@@ -137,7 +137,7 @@ public class DirectiveCallPlaceTest extends TemplateTest {
         }
 
         @Override
-        public ArgumentArrayLayout getArgumentArrayLayout() {
+        public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
             return ArgumentArrayLayout.PARAMETERLESS;
         }
 
@@ -207,7 +207,7 @@ public class DirectiveCallPlaceTest extends TemplateTest {
         }
 
         @Override
-        public ArgumentArrayLayout getArgumentArrayLayout() {
+        public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
             return ArgumentArrayLayout.PARAMETERLESS;
         }
 
@@ -245,7 +245,7 @@ public class DirectiveCallPlaceTest extends TemplateTest {
         }
 
         @Override
-        public ArgumentArrayLayout getArgumentArrayLayout() {
+        public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
             return ARGS_LAYOUT;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/EnvironmentGetTemplateVariantsTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/EnvironmentGetTemplateVariantsTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/EnvironmentGetTemplateVariantsTest.java
index a094ec6..d79e37a 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/EnvironmentGetTemplateVariantsTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/EnvironmentGetTemplateVariantsTest.java
@@ -207,7 +207,7 @@ public class EnvironmentGetTemplateVariantsTest extends TemplateTest {
             }
 
             @Override
-            public ArgumentArrayLayout getArgumentArrayLayout() {
+            public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
                 return ArgumentArrayLayout.PARAMETERLESS;
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/TheadInterruptingSupportTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TheadInterruptingSupportTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TheadInterruptingSupportTest.java
index 61c5823..1468e59 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TheadInterruptingSupportTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TheadInterruptingSupportTest.java
@@ -129,7 +129,7 @@ public class TheadInterruptingSupportTest {
             }
 
             @Override
-            public ArgumentArrayLayout getArgumentArrayLayout() {
+            public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
                 return ArgumentArrayLayout.PARAMETERLESS;
             }
 
@@ -150,7 +150,7 @@ public class TheadInterruptingSupportTest {
             }
 
             @Override
-            public ArgumentArrayLayout getArgumentArrayLayout() {
+            public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
                 return ArgumentArrayLayout.PARAMETERLESS;
             }
 
@@ -173,7 +173,7 @@ public class TheadInterruptingSupportTest {
             }
 
             @Override
-            public ArgumentArrayLayout getArgumentArrayLayout() {
+            public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
                 return ArgumentArrayLayout.PARAMETERLESS;
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/AbstractParallelIntrospectionTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/AbstractParallelIntrospectionTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/AbstractParallelIntrospectionTest.java
index aac56b3..7d2b3fc 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/AbstractParallelIntrospectionTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/AbstractParallelIntrospectionTest.java
@@ -20,9 +20,10 @@
 package org.apache.freemarker.core.model.impl;
 
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.NonTemplateCallPlace;
 import org.apache.freemarker.core.TemplateException;
+import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
 
@@ -113,9 +114,11 @@ public abstract class AbstractParallelIntrospectionTest extends TestCase {
 
         private void testMethod(TemplateHashModel h, int objIdx, int mIdx)
                 throws TemplateException, AssertionError {
-            TemplateMethodModel pv = (TemplateMethodModel) h.get("m" + mIdx);
+            JavaMethodModel pv = (JavaMethodModel) h.get("m" + mIdx);
             final int expected = objIdx * 1000 + mIdx;
-            final int got = ((TemplateNumberModel) pv.execute(null)).getAsNumber().intValue();
+            final int got = ((TemplateNumberModel) pv.execute(
+                    Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE))
+                    .getAsNumber().intValue();
             if (got != expected) {
                 throw new AssertionError("Method assertion failed; " +
                         "expected " + expected + ", but got " + got);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/CommonSupertypeForUnwrappingHintTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/CommonSupertypeForUnwrappingHintTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/CommonSupertypeForUnwrappingHintTest.java
index ef15dae..c4e42ab 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/CommonSupertypeForUnwrappingHintTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/CommonSupertypeForUnwrappingHintTest.java
@@ -22,6 +22,7 @@ package org.apache.freemarker.core.model.impl;
 import java.io.Serializable;
 import java.util.List;
 
+import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 
 import junit.framework.TestCase;
@@ -110,17 +111,18 @@ public class CommonSupertypeForUnwrappingHintTest extends TestCase {
         }
 
         @Override
-        Class[] preprocessParameterTypes(CallableMemberDescriptor memberDesc) {
+        Class<?>[] preprocessParameterTypes(CallableMemberDescriptor memberDesc) {
             return memberDesc.getParamTypes();
         }
 
         @Override
-        void afterWideningUnwrappingHints(Class[] paramTypes, int[] paramNumericalTypes) {
+        void afterWideningUnwrappingHints(Class<?>[] paramTypes, int[] paramNumericalTypes) {
             // Do nothing
         }
 
         @Override
-        MaybeEmptyMemberAndArguments getMemberAndArguments(List tmArgs, DefaultObjectWrapper w) throws TemplateModelException {
+        MaybeEmptyMemberAndArguments getMemberAndArguments(TemplateModel[] tmArgs, DefaultObjectWrapper w) throws
+                TemplateModelException {
             throw new RuntimeException("Not implemented in this dummy.");
         }
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
index dd1c841..9ac550c 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/DefaultObjectWrapperTest.java
@@ -41,18 +41,19 @@ import java.util.TreeSet;
 import java.util.Vector;
 
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.NonTemplateCallPlace;
 import org.apache.freemarker.core.Template;
 import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.Version;
 import org.apache.freemarker.core._CoreAPI;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
+import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateBooleanModel;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateCollectionModelEx;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
-import org.apache.freemarker.core.model.TemplateMethodModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateModelIterator;
@@ -191,15 +192,16 @@ public class DefaultObjectWrapperTest {
         assertEquals(1, ow.unwrap(bean.get("x")));
         {
             // Check method calls, and also if the return value is wrapped with the overidden "wrap".
-            final TemplateModel mr = ((TemplateMethodModel) bean.get("m")).execute(
-                    Collections.<TemplateModel>emptyList());
+            final TemplateModel mr = ((JavaMethodModel) bean.get("m")).execute(
+                    Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE);
             assertEquals(Collections.singletonList(1), ow.unwrap(mr));
             assertTrue(DefaultListAdapter.class.isInstance(mr));
         }
         {
             // Check custom TM usage and round trip:
-            final TemplateModel mr = ((TemplateMethodModel) bean.get("incTupple"))
-                    .execute(Collections.singletonList(ow.wrap(new Tupple<>(1, 2))));
+            final TemplateModel mr = ((JavaMethodModel) bean.get("incTupple"))
+                    .execute(new TemplateModel[] { ow.wrap(new Tupple<>(1, 2)) },
+                            NonTemplateCallPlace.INSTANCE);
             assertEquals(new Tupple<>(2, 3), ow.unwrap(mr));
             assertTrue(TuppleAdapter.class.isInstance(mr));
         }
@@ -448,15 +450,15 @@ public class DefaultObjectWrapperTest {
         final TemplateHashModel testBeanTM = (TemplateHashModel) dow.wrap(new RoundtripTesterBean());
 
         {
-            TemplateMethodModel getClassM = (TemplateMethodModel) testBeanTM.get("getClass");
-            TemplateModel r = getClassM.execute(Collections.singletonList(objTM));
+            JavaMethodModel getClassM = (JavaMethodModel) testBeanTM.get("getClass");
+            TemplateModel r = getClassM.execute(new TemplateModel[] { objTM }, NonTemplateCallPlace.INSTANCE);
             final Class rClass = (Class) ((WrapperTemplateModel) r).getWrappedObject();
             assertThat(rClass, typeCompatibleWith(expectedPojoClass));
         }
 
         if (expectedPojoToString != null) {
-            TemplateMethodModel getToStringM = (TemplateMethodModel) testBeanTM.get("toString");
-            TemplateModel r = getToStringM.execute(Collections.singletonList(objTM));
+            JavaMethodModel getToStringM = (JavaMethodModel) testBeanTM.get("toString");
+            TemplateModel r = getToStringM.execute(new TemplateModel[] { objTM }, NonTemplateCallPlace.INSTANCE);
             assertEquals(expectedPojoToString, ((TemplateScalarModel) r).getAsString());
         }
     }
@@ -583,8 +585,9 @@ public class DefaultObjectWrapperTest {
         DefaultIteratorAdapter iteratorAdapter = (DefaultIteratorAdapter) wrappedIterator;
 
         TemplateHashModel api = (TemplateHashModel) iteratorAdapter.getAPI();
-        assertFalse(((TemplateBooleanModel) ((TemplateMethodModel)
-                api.get("hasNext")).execute(Collections.<TemplateModel>emptyList())).getAsBoolean());
+        assertFalse(((TemplateBooleanModel) ((JavaMethodModel)
+                api.get("hasNext")).execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE))
+                .getAsBoolean());
     }
 
     @SuppressWarnings("boxing")
@@ -673,8 +676,8 @@ public class DefaultObjectWrapperTest {
         }
 
         TemplateHashModel api = (TemplateHashModel) enumAdapter.getAPI();
-        assertFalse(((TemplateBooleanModel) ((TemplateMethodModel) api.get("hasMoreElements"))
-                .execute(Collections.<TemplateModel>emptyList())).getAsBoolean());
+        assertFalse(((TemplateBooleanModel) ((JavaMethodModel) api.get("hasMoreElements"))
+                .execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE)).getAsBoolean());
     }
 
     @Test
@@ -729,8 +732,9 @@ public class DefaultObjectWrapperTest {
             fail(); 
         }
         TemplateHashModel apiModel = (TemplateHashModel) ((TemplateModelWithAPISupport) normalModel).getAPI();
-        TemplateMethodModel sizeMethod = (TemplateMethodModel) apiModel.get("size");
-        TemplateNumberModel r = (TemplateNumberModel) sizeMethod.execute(Collections.<TemplateModel>emptyList());
+        JavaMethodModel sizeMethod = (JavaMethodModel) apiModel.get("size");
+        TemplateNumberModel r = (TemplateNumberModel) sizeMethod.execute(
+                Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE);
         assertEquals(expectedSize, r.getAsNumber().intValue());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/EnumModelsTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/EnumModelsTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/EnumModelsTest.java
index 9373cf5..9336388 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/EnumModelsTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/EnumModelsTest.java
@@ -21,11 +21,10 @@ package org.apache.freemarker.core.model.impl;
 
 import static org.junit.Assert.*;
 
-import java.util.ArrayList;
-
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.NonTemplateCallPlace;
+import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateScalarModel;
@@ -58,8 +57,10 @@ public class EnumModelsTest {
         assertTrue(a instanceof TemplateScalarModel);
         assertTrue(a instanceof TemplateHashModel);
         assertEquals(((TemplateScalarModel) a).getAsString(), "ts:A");
-        TemplateMethodModel nameMethod = (TemplateMethodModel) ((TemplateHashModel) a).get("name");
-        assertEquals(((TemplateScalarModel) nameMethod.execute(new ArrayList())).getAsString(), "A");
+        JavaMethodModel nameMethod = (JavaMethodModel) ((TemplateHashModel) a).get("name");
+        assertEquals(((TemplateScalarModel) nameMethod.execute(
+                Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE)).getAsString(),
+                "A");
         
         assertSame(e, enums.get(E.class.getName()));
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/ErrorMessagesTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/ErrorMessagesTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/ErrorMessagesTest.java
index dcb8cf6..89b06be 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/ErrorMessagesTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/ErrorMessagesTest.java
@@ -22,12 +22,12 @@ package org.apache.freemarker.core.model.impl;
 import static org.hamcrest.Matchers.*;
 import static org.junit.Assert.*;
 
-import java.util.Collections;
 import java.util.Date;
 
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.NonTemplateCallPlace;
 import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
+import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.outputformat.impl.HTMLOutputFormat;
@@ -60,9 +60,9 @@ public class ErrorMessagesTest {
         TemplateHashModel thm = (TemplateHashModel) ow.wrap(new TestBean());
         
         {
-            TemplateMethodModel m = (TemplateMethodModel) thm.get("m1");
+            JavaMethodModel m = (JavaMethodModel) thm.get("m1");
             try {
-                m.execute(Collections.singletonList(html));
+                m.execute(new TemplateModel[] { html }, NonTemplateCallPlace.INSTANCE);
                 fail();
             } catch (TemplateModelException e) {
                 assertThat(e.getMessage(), allOf(
@@ -72,9 +72,9 @@ public class ErrorMessagesTest {
         }
         
         {
-            TemplateMethodModel m = (TemplateMethodModel) thm.get("m2");
+            JavaMethodModel m = (JavaMethodModel) thm.get("m2");
             try {
-                m.execute(Collections.singletonList(html));
+                m.execute(new TemplateModel[] { html }, NonTemplateCallPlace.INSTANCE);
                 fail();
             } catch (TemplateModelException e) {
                 assertThat(e.getMessage(), allOf(
@@ -84,9 +84,9 @@ public class ErrorMessagesTest {
         }
         
         for (String methodName : new String[] { "mOverloaded", "mOverloaded3" }) {
-            TemplateMethodModel m = (TemplateMethodModel) thm.get(methodName);
+            JavaMethodModel m = (JavaMethodModel)thm.get(methodName);
             try {
-                m.execute(Collections.singletonList(html));
+                m.execute(new TemplateModel[] { html }, NonTemplateCallPlace.INSTANCE);
                 fail();
             } catch (TemplateModelException e) {
                 assertThat(e.getMessage(), allOf(
@@ -97,9 +97,9 @@ public class ErrorMessagesTest {
         }
         
         {
-            TemplateMethodModel m = (TemplateMethodModel) thm.get("mOverloaded2");
+            JavaMethodModel m = (JavaMethodModel)thm.get("mOverloaded2");
             try {
-                m.execute(Collections.singletonList(html));
+                m.execute(new TemplateModel[] { html }, NonTemplateCallPlace.INSTANCE);
                 fail();
             } catch (TemplateModelException e) {
                 assertThat(e.getMessage(), allOf(
@@ -110,8 +110,8 @@ public class ErrorMessagesTest {
         }
         
         {
-            TemplateMethodModel m = (TemplateMethodModel) thm.get("mOverloaded4");
-            Object r = m.execute(Collections.singletonList(html));
+            JavaMethodModel m = (JavaMethodModel)thm.get("mOverloaded4");
+            Object r = m.execute(new TemplateModel[] { html }, NonTemplateCallPlace.INSTANCE);
             if (r instanceof TemplateScalarModel) {
                 r = ((TemplateScalarModel) r).getAsString();
             }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/FineTuneMethodAppearanceTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/FineTuneMethodAppearanceTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/FineTuneMethodAppearanceTest.java
index eb4d807..e5366f6 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/FineTuneMethodAppearanceTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/FineTuneMethodAppearanceTest.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.*;
 
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateScalarModel;
@@ -48,7 +47,7 @@ public class FineTuneMethodAppearanceTest {
         assertEquals("v1", ((TemplateScalarModel) thm.get("v1")).getAsString());
         assertEquals("v2()", ((TemplateScalarModel) thm.get("v2")).getAsString());
         assertEquals("getV3()", ((TemplateScalarModel) thm.get("v3")).getAsString());
-        assertTrue(thm.get("getV3") instanceof TemplateMethodModel);
+        assertTrue(thm.get("getV3") instanceof JavaMethodModel);
     }
     
     static public class C {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/StaticModelsTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/StaticModelsTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/StaticModelsTest.java
index 44da42a..f888b2c 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/StaticModelsTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/StaticModelsTest.java
@@ -22,11 +22,10 @@ package org.apache.freemarker.core.model.impl;
 import static org.hamcrest.Matchers.*;
 import static org.junit.Assert.*;
 
-import java.util.ArrayList;
-
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.NonTemplateCallPlace;
+import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateScalarModel;
@@ -65,8 +64,10 @@ public class StaticModelsTest {
         assertEquals(((TemplateScalarModel) f).getAsString(), "F OK");
         
         TemplateModel m = s.get("m");
-        assertTrue(m instanceof TemplateMethodModel);
-        assertEquals(((TemplateScalarModel) ((TemplateMethodModel) m).execute(new ArrayList())).getAsString(), "m OK");
+        assertTrue(m instanceof JavaMethodModel);
+        assertEquals(((TemplateScalarModel) ((JavaMethodModel) m).execute(
+                Constants.EMPTY_TEMPLATE_MODEL_ARRAY, NonTemplateCallPlace.INSTANCE)).getAsString(),
+                "m OK");
         
         assertSame(s, statics.get(S.class.getName()));
         

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
index 0b21c75..6beb834 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/CoreTemplateTestSuite.java
@@ -36,9 +36,9 @@ import org.apache.freemarker.core.templatesuite.models.JavaObjectInfo;
 import org.apache.freemarker.core.templatesuite.models.Listables;
 import org.apache.freemarker.core.templatesuite.models.MultiModel1;
 import org.apache.freemarker.core.templatesuite.models.OverloadedMethods2;
+import org.apache.freemarker.core.templatesuite.models.SimpleTestFunction;
 import org.apache.freemarker.core.templatesuite.models.TestBean;
 import org.apache.freemarker.core.templatesuite.models.TestBoolean;
-import org.apache.freemarker.core.templatesuite.models.TestMethod;
 import org.apache.freemarker.core.templatesuite.models.TestNode;
 import org.apache.freemarker.core.templatesuite.models.VarArgTestModel;
 import org.apache.freemarker.test.TemplateTestSuite;
@@ -158,7 +158,7 @@ public class CoreTemplateTestSuite extends TemplateTestSuite {
         } else if (simpleTestName.equals("stringbimethods")) {
             dataModel.put("multi", new TestBoolean());
         } else if (simpleTestName.startsWith("type-builtins")) {
-            dataModel.put("testmethod", new TestMethod());
+            dataModel.put("testfunction", new SimpleTestFunction());
             dataModel.put("testnode", new TestNode());
             dataModel.put("testcollection", new SimpleCollection(new ArrayList<>(), dow));
             dataModel.put("testcollectionEx", DefaultNonListCollectionAdapter.adapt(new HashSet<>(), dow));

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel2.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel2.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel2.java
index 3223652..ad4cbe3 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel2.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/MultiModel2.java
@@ -19,11 +19,12 @@
 
 package org.apache.freemarker.core.templatesuite.models;
 
-import java.util.List;
-
+import org.apache.freemarker.core.CallPlace;
+import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core._CallableUtils;
-import org.apache.freemarker.core.model.TemplateMethodModel;
+import org.apache.freemarker.core.model.ArgumentArrayLayout;
+import org.apache.freemarker.core.model.TemplateFunctionModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
@@ -31,34 +32,26 @@ import org.apache.freemarker.core.model.impl.SimpleScalar;
 /**
  * Testcase to see how FreeMarker deals with multiple Template models.
  */
-public class MultiModel2 implements TemplateScalarModel, TemplateMethodModel {
+public class MultiModel2 implements TemplateScalarModel, TemplateFunctionModel {
 
-    /**
-     * Returns the scalar's value as a String.
-     *
-     * @return the String value of this scalar.
-     */
     @Override
     public String getAsString() {
         return "Model2 is alive!";
     }
 
-    /**
-     * Executes a method call.
-     *
-     * @param args a <tt>List</tt> of <tt>String</tt> objects containing the values
-     * of the arguments passed to the method.
-     * @return the <tt>TemplateModel</tt> produced by the method, or null.
-     */
     @Override
-    public TemplateModel execute(List<? extends TemplateModel> args) throws TemplateException {
+    public TemplateModel execute(TemplateModel[] args, CallPlace callPlace, Environment env) throws TemplateException {
         StringBuilder  aResults = new StringBuilder( "Arguments are:<br />" );
-        for (int i = 0; i < args.size(); i++) {
-            TemplateModel arg = args.get(i);
-            aResults.append(_CallableUtils.castArgToString(arg, i));
+        for (int i = 0; i < args.length; i++) {
+            aResults.append(_CallableUtils.castArgToString(args, i));
             aResults.append("<br />");
         }
 
         return new SimpleScalar( aResults.toString() );
     }
+
+    @Override
+    public ArgumentArrayLayout getFunctionArgumentArrayLayout() {
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestFunction.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestFunction.java
new file mode 100644
index 0000000..0f6f579
--- /dev/null
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestFunction.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.freemarker.core.templatesuite.models;
+
+import org.apache.freemarker.core.CallPlace;
+import org.apache.freemarker.core.Environment;
+import org.apache.freemarker.core.TemplateException;
+import org.apache.freemarker.core.model.ArgumentArrayLayout;
+import org.apache.freemarker.core.model.TemplateFunctionModel;
+import org.apache.freemarker.core.model.TemplateModel;
+import org.apache.freemarker.core.model.impl.SimpleScalar;
+
+/**
+ * A simple method model used as a test bed.
+ */
+public class SimpleTestFunction implements TemplateFunctionModel {
+
+    @Override
+    public TemplateModel execute(TemplateModel[] args, CallPlace callPlace, Environment env) throws TemplateException {
+        return new SimpleScalar("Argument value is: " + args[0]);
+    }
+
+    @Override
+    public ArgumentArrayLayout getFunctionArgumentArrayLayout() {
+        return ArgumentArrayLayout.SINGLE_POSITIONAL_PARAMETER;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestMethod.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestMethod.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestMethod.java
deleted file mode 100644
index 48352a0..0000000
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/SimpleTestMethod.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * 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
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.freemarker.core.templatesuite.models;
-
-import java.util.List;
-
-import org.apache.freemarker.core.model.TemplateMethodModel;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.impl.SimpleScalar;
-
-/**
- * A simple method model used as a test bed.
- */
-public class SimpleTestMethod implements TemplateMethodModel {
-
-    /**
-     * Executes a method call.
-     *
-     * @param args a <tt>List</tt> of <tt>String</tt> objects containing
-     * the values of the arguments passed to the method.
-     * @return the <tt>TemplateModel</tt> produced by the method, or null.
-     */
-    @Override
-    public TemplateModel execute(List<? extends TemplateModel> args) {
-        if ( args.size() == 0 ) {
-            return new SimpleScalar( "Empty list provided" );
-        } else if ( args.size() > 1 ) {
-            return new SimpleScalar( "Argument size is: " + args.size() );
-        } else {
-            return new SimpleScalar( "Single argument value is: " + args.get(0) );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/TestMethod.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/TestMethod.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/TestMethod.java
deleted file mode 100644
index ed97f9e..0000000
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/templatesuite/models/TestMethod.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.apache.freemarker.core.templatesuite.models;
-
-import java.util.List;
-
-import org.apache.freemarker.core.model.TemplateMethodModel;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.impl.SimpleScalar;
-
-public class TestMethod implements TemplateMethodModel {
-
-    @Override
-    public TemplateModel execute(List<? extends TemplateModel> args) {
-        return new SimpleScalar("x");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesDirective.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesDirective.java
index d9bb394..27a42d9 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesDirective.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesDirective.java
@@ -122,7 +122,7 @@ public class AllFeaturesDirective extends TestTemplateCallableModel implements T
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
         return ARGS_LAYOUT;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesFunction.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesFunction.java
index 5825745..f468be7 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesFunction.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/AllFeaturesFunction.java
@@ -105,7 +105,7 @@ public class AllFeaturesFunction extends TestTemplateCallableModel implements Te
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getFunctionArgumentArrayLayout() {
         return ARGS_LAYOUT;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NamedVarargsOnlyDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NamedVarargsOnlyDirective.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NamedVarargsOnlyDirective.java
index a087188..268c7fc 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NamedVarargsOnlyDirective.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/NamedVarargsOnlyDirective.java
@@ -52,7 +52,7 @@ public class NamedVarargsOnlyDirective extends TestTemplateCallableModel impleme
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
         return ARGS_LAYOUT;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyDirective.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyDirective.java
index 2f9532e..9bccfe5 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyDirective.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyDirective.java
@@ -46,7 +46,7 @@ public class PositionalVarargsOnlyDirective extends TestTemplateCallableModel im
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
         return ArgumentArrayLayout.POSITIONAL_VARARGS_PARAMETER_ONLY;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyFunction.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyFunction.java
index eb8a3eb..1c0c82c 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyFunction.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/PositionalVarargsOnlyFunction.java
@@ -56,7 +56,7 @@ public class PositionalVarargsOnlyFunction extends TestTemplateCallableModel imp
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getFunctionArgumentArrayLayout() {
         return ARGS_LAYOUT;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNamedParamsDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNamedParamsDirective.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNamedParamsDirective.java
index 83b5435..3b3ed1c 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNamedParamsDirective.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNamedParamsDirective.java
@@ -62,7 +62,7 @@ public class TwoNamedParamsDirective extends TestTemplateCallableModel implement
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
         return ARGS_LAYOUT;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNestedContentParamsDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNestedContentParamsDirective.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNestedContentParamsDirective.java
index 6f768f4..e2d7ffb 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNestedContentParamsDirective.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoNestedContentParamsDirective.java
@@ -48,7 +48,7 @@ public class TwoNestedContentParamsDirective extends TestTemplateCallableModel i
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
         return ArgumentArrayLayout.PARAMETERLESS;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsDirective.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsDirective.java
index 008d8c8..a057bc3 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsDirective.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsDirective.java
@@ -51,7 +51,7 @@ public class TwoPositionalParamsDirective extends TestTemplateCallableModel impl
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
         return ARGS_LAYOUT;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsFunction.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsFunction.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsFunction.java
index 58e292b..e406c99 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsFunction.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/TwoPositionalParamsFunction.java
@@ -57,7 +57,7 @@ public class TwoPositionalParamsFunction extends TestTemplateCallableModel imple
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getFunctionArgumentArrayLayout() {
         return ARGS_LAYOUT;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/UpperCaseDirective.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/UpperCaseDirective.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/UpperCaseDirective.java
index 05e5d6d..3936502 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/UpperCaseDirective.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/userpkg/UpperCaseDirective.java
@@ -47,7 +47,7 @@ public class UpperCaseDirective implements TemplateDirectiveModel {
     }
 
     @Override
-    public ArgumentArrayLayout getArgumentArrayLayout() {
+    public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
         return ArgumentArrayLayout.PARAMETERLESS;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
index 9bdea77..685ce5a 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/valueformat/NumberFormatTest.java
@@ -186,7 +186,7 @@ public class NumberFormatTest extends TemplateTest {
             }
 
             @Override
-            public ArgumentArrayLayout getArgumentArrayLayout() {
+            public ArgumentArrayLayout getDirectiveArgumentArrayLayout() {
                 return ArgumentArrayLayout.PARAMETERLESS;
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ast
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ast b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ast
index 538dd05..0b0a8f8 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ast
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-builtins.ast
@@ -24,7 +24,7 @@
     #text  // o.a.f.c.ASTStaticText
         - content: "\n"  // String
     ${...}  // o.a.f.c.ASTDollarInterpolation
-        - content: ...(...)  // o.a.f.c.ASTExpMethodCall
+        - content: ...(...)  // o.a.f.c.ASTExpFunctionCall
             - callee: ?leftPad  // o.a.f.c.BuiltInsForStringsBasic$padBI
                 - left-hand operand: x  // o.a.f.c.ASTExpVariable
                 - right-hand operand: "leftPad"  // String
@@ -32,7 +32,7 @@
     #text  // o.a.f.c.ASTStaticText
         - content: "\n"  // String
     ${...}  // o.a.f.c.ASTDollarInterpolation
-        - content: ...(...)  // o.a.f.c.ASTExpMethodCall
+        - content: ...(...)  // o.a.f.c.ASTExpFunctionCall
             - callee: ?leftPad  // o.a.f.c.BuiltInsForStringsBasic$padBI
                 - left-hand operand: x  // o.a.f.c.ASTExpVariable
                 - right-hand operand: "leftPad"  // String

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-range.ast
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-range.ast b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-range.ast
index 9d9bb4b..3d66e58 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-range.ast
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/ast-range.ast
@@ -115,12 +115,12 @@
         - assignment target: "x"  // String
         - assignment operator: "="  // String
         - assignment source: ..  // o.a.f.c.ASTExpRange
-            - left-hand operand: ...(...)  // o.a.f.c.ASTExpMethodCall
+            - left-hand operand: ...(...)  // o.a.f.c.ASTExpFunctionCall
                 - callee: ?indexOf  // o.a.f.c.BuiltInsForStringsBasic$index_ofBI
                     - left-hand operand: n  // o.a.f.c.ASTExpVariable
                     - right-hand operand: "indexOf"  // String
                 - argument value: "x"  // o.a.f.c.ASTExpStringLiteral
-            - right-hand operand: ...(...)  // o.a.f.c.ASTExpMethodCall
+            - right-hand operand: ...(...)  // o.a.f.c.ASTExpFunctionCall
                 - callee: ?indexOf  // o.a.f.c.BuiltInsForStringsBasic$index_ofBI
                     - left-hand operand: m  // o.a.f.c.ASTExpVariable
                     - right-hand operand: "indexOf"  // String
@@ -236,7 +236,7 @@
     #text  // o.a.f.c.ASTStaticText
         - content: "\n"  // String
     ${...}  // o.a.f.c.ASTDollarInterpolation
-        - content: ...(...)  // o.a.f.c.ASTExpMethodCall
+        - content: ...(...)  // o.a.f.c.ASTExpFunctionCall
             - callee: f  // o.a.f.c.ASTExpVariable
             - argument value: ..  // o.a.f.c.ASTExpRange
                 - left-hand operand: m  // o.a.f.c.ASTExpVariable

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/number-literal.txt
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/number-literal.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/number-literal.txt
index b80bc85..18311bd 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/number-literal.txt
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/number-literal.txt
@@ -69,11 +69,11 @@ twelve
 
 <p>Numbers in method calls:</p>
 
-Single argument value is: 1
-Single argument value is: 1
-Single argument value is: 12
-Single argument value is: 3
-Single argument value is: 3
+Argument value is: 1
+Argument value is: 1
+Argument value is: 12
+Argument value is: 3
+Argument value is: 3
 
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/type-builtins.txt
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/type-builtins.txt b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/type-builtins.txt
index eeb191e..4d48327 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/type-builtins.txt
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/expected/type-builtins.txt
@@ -16,17 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-StNuBoMeMaHaHxSeCoCxEnInDiNo
-1 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 1 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 1 0 0 0 0 0 0 0 1 0
-0 0 0 0 0 1 1 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 1 0 1 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 1
-1 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 0 0
-0 0 0 1 0 0 0 0 0 0 0 0 0 0
+StNuBoHaHxSeCoCxEnInFuDiNo
+1 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 1 0 0 0 0 0 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 1 0
+0 0 0 1 1 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 1 0 1 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 1
+1 0 0 1 1 0 0 0 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 1 0 0

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl
index 9893c1b..7d563ed 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/list2.ftl
@@ -82,7 +82,7 @@
 
 <#function resolve(xs)>
     <#assign resolveCallCnt = (resolveCallCnt!0) + 1>
-    <#if xs?isMethod>
+    <#if xs?isFunction>
         <#return xs()>
     <#else>
         <#return xs>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl
index 334841d..348d33b 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl
@@ -44,7 +44,7 @@
           "12" = "twelve",
           "2one" = "two-one",
           one2 = "one-two",
-          call = "org.apache.freemarker.core.templatesuite.models.SimpleTestMethod"?new()
+          call = "org.apache.freemarker.core.templatesuite.models.SimpleTestFunction"?new()
 >
 
 <p>A simple test follows:</p>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/string-builtins3.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/string-builtins3.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/string-builtins3.ftl
index 6442c63..ece74f9 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/string-builtins3.ftl
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/string-builtins3.ftl
@@ -35,10 +35,10 @@
 <@assertFails message='"m" flag'>
     ${'x'?keepBefore('x', 'm')}
 </@assertFails>
-<@assertFails message='3'>
+<@assertFails message='Too many arguments'>
     ${'x'?keepBefore('x', 'i', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?keepBefore()}
 </@assertFails>
 
@@ -61,10 +61,10 @@
 <@assertFails message='"m" flag'>
     ${'x'?keepBeforeLast('x', 'm')}
 </@assertFails>
-<@assertFails message='3'>
+<@assertFails message='Too many arguments'>
     ${'x'?keepBeforeLast('x', 'i', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?keepBeforeLast()}
 </@assertFails>
 
@@ -87,10 +87,10 @@
 <@assertFails message='"m" flag'>
     ${'x'?keepAfter('x', 'm')}
 </@assertFails>
-<@assertFails message='3'>
+<@assertFails message='Too many arguments'>
     ${'x'?keepAfter('x', 'i', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?keepAfter()}
 </@assertFails>
 
@@ -115,10 +115,10 @@
 <@assertFails message='"m" flag'>
     ${'x'?keepAfterLast('x', 'm')}
 </@assertFails>
-<@assertFails message='3'>
+<@assertFails message='Too many arguments'>
     ${'x'?keepAfterLast('x', 'i', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?keepAfterLast()}
 </@assertFails>
 
@@ -129,10 +129,10 @@
 <@assertEquals expected='o' actual='foo'?removeBeginning('fo') />
 <@assertEquals expected='' actual='foo'?removeBeginning('foo') />
 <@assertEquals expected='foo' actual='foo'?removeBeginning('') />
-<@assertFails message='2'>
+<@assertFails message='Too many arguments'>
     ${'x'?removeBeginning('x', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?removeBeginning()}
 </@assertFails>
 
@@ -143,10 +143,10 @@
 <@assertEquals expected='b' actual='bar'?removeEnding('ar') />
 <@assertEquals expected='' actual='bar'?removeEnding('bar') />
 <@assertEquals expected='bar' actual='bar'?removeEnding('') />
-<@assertFails message='2'>
+<@assertFails message='Too many arguments'>
     ${'x'?removeEnding('x', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?removeEnding()}
 </@assertFails>
 
@@ -171,10 +171,10 @@
 <@assertEquals expected='https://example.com' actual="https://example.com"?ensureStartsWith("[a-z]+://", "http://") />
 <@assertEquals expected='http://HTTP://example.com' actual="HTTP://example.com"?ensureStartsWith("[a-z]+://", "http://") />
 <@assertEquals expected='HTTP://example.com' actual="HTTP://example.com"?ensureStartsWith("[a-z]+://", "http://", "ir") />
-<@assertFails message='4'>
+<@assertFails message='Too many arguments'>
     ${'x'?ensureStartsWith('x', 'x', 'x', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?ensureStartsWith()}
 </@assertFails>
 
@@ -185,10 +185,10 @@
 <@assertEquals expected='foo' actual='foo'?ensureEndsWith('') />
 <@assertEquals expected='x' actual=''?ensureEndsWith('x') />
 <@assertEquals expected='' actual=''?ensureEndsWith('') />
-<@assertFails message='2'>
+<@assertFails message='Too many arguments'>
     ${'x'?ensureEndsWith('x', 'x')}
 </@assertFails>
-<@assertFails message='none'>
+<@assertFails message='argument'>
     ${'x'?ensureEndsWith()}
 </@assertFails>
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8d5263f2/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/type-builtins.ftl
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/type-builtins.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/type-builtins.ftl
index 695bd76..3442824 100644
--- a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/type-builtins.ftl
+++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/type-builtins.ftl
@@ -17,10 +17,10 @@
   under the License.
 -->
 <#setting booleanFormat="1,0">
-StNuBoMeMaHaHxSeCoCxEnInDiNo
+StNuBoHaHxSeCoCxEnInFuDiNo
 <#list [
   "a", 1, false,
-  testmethod, testmacro,
+  testfunction, testmacro,
   {"a":1}, [1], testcollection, testcollectionEx,
   testnode,
   bean, bean.m, bean.mOverloaded
@@ -28,8 +28,6 @@ StNuBoMeMaHaHxSeCoCxEnInDiNo
   ${x?isString} <#t>
   ${x?isNumber} <#t>
   ${x?isBoolean} <#t>
-  ${x?isMethod} <#t>
-  ${x?isMacro} <#t>
   ${x?isHash} <#t>
   ${x?isHashEx} <#t>
   ${x?isSequence} <#t>
@@ -37,6 +35,7 @@ StNuBoMeMaHaHxSeCoCxEnInDiNo
   ${x?isCollectionEx} <#t>
   ${x?isEnumerable} <#t>
   ${x?isIndexable} <#t>
+  ${x?isFunction} <#t>
   ${x?isDirective} <#t>
   ${x?isNode}<#lt>
 </#list>


Mime
View raw message