Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 836de2657 -> cfd379605


Got rid of o.a.f.core.mode.Constants, moved the constants to respectable 
TemplateModel subinterfaces.


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

Branch: refs/heads/3
Commit: cfd3796051265a43e70266dc4c4580c3617cb851
Parents: 836de26
Author: ddekany <ddek...@apache.org>
Authored: Tue Aug 8 14:50:58 2017 +0200
Committer: ddekany <ddek...@apache.org>
Committed: Tue Aug 8 14:50:58 2017 +0200

----------------------------------------------------------------------
 ...a8DefaultObjectWrapperBridgeMethodsTest.java |   6 +-
 .../impl/Java8DefaultObjectWrapperTest.java     |  10 +-
 .../core/TemplateConfigurationTest.java         |   1 -
 .../impl/AbstractParallelIntrospectionTest.java |   4 +-
 .../model/impl/DefaultObjectWrapperTest.java    |  10 +-
 .../core/model/impl/EnumModelsTest.java         |   4 +-
 .../core/model/impl/StaticModelsTest.java       |   4 +-
 .../freemarker/core/model/ConstantsTest.java    |   4 +-
 .../TwoNestedContentParamsDirective.java        |   4 +-
 .../apache/freemarker/core/ASTExpDefault.java   |   5 +-
 .../freemarker/core/ASTExpDynamicKeyName.java   |   3 +-
 .../freemarker/core/BuiltInsForSequences.java   |   3 +-
 .../apache/freemarker/core/_CallableUtils.java  |  16 +-
 .../core/model/ArgumentArrayLayout.java         |   4 +-
 .../apache/freemarker/core/model/Constants.java | 163 -------------------
 .../core/model/EmptyCollectionExModel.java      |  41 +++++
 .../freemarker/core/model/EmptyHashModel.java   |  55 +++++++
 .../core/model/EmptyIteratorModel.java          |  36 ++++
 .../core/model/EmptyKeyValuePairIterator.java   |  36 ++++
 .../core/model/EmptySequenceModel.java          |  36 ++++
 .../core/model/GeneralPurposeNothing.java       |   6 +-
 .../core/model/TemplateCollectionModel.java     |   2 +
 .../core/model/TemplateHashModel.java           |   4 +-
 .../core/model/TemplateHashModelEx2.java        |   4 +-
 .../core/model/TemplateModelIterator.java       |   3 +
 .../core/model/TemplateNumberModel.java         |   5 +
 .../core/model/TemplateSequenceModel.java       |   2 +
 .../model/impl/OverloadedFixArgsMethods.java    |   4 +-
 .../model/impl/OverloadedVarArgsMethods.java    |   4 +-
 .../core/model/impl/SimpleMethod.java           |   4 +-
 30 files changed, 269 insertions(+), 214 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/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 095dc37..62bb7af 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
@@ -23,7 +23,7 @@ import static org.junit.Assert.*;
 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._CallableUtils;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.junit.Test;
 
@@ -56,10 +56,10 @@ public class Java8DefaultObjectWrapperBridgeMethodsTest {
         JavaMethodModel m1 = (JavaMethodModel) wrapped.get("m1");
         assertEquals(
                 BridgeMethodsBean.M1_RETURN_VALUE,
-                "" + m1.execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE));
+                "" + m1.execute(_CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE));
 
         JavaMethodModel m2 = (JavaMethodModel) wrapped.get("m2");
-        assertNull(m2.execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE));
+        assertNull(m2.execute(_CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE));
     }
     
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/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 c2bfad5..cf628ad 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
@@ -23,7 +23,7 @@ import static org.junit.Assert.*;
 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._CallableUtils;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateNumberModel;
@@ -129,7 +129,7 @@ public class Java8DefaultObjectWrapperTest {
             assertEquals(
                     Java8DefaultMethodsBean.NORMAL_ACTION_RETURN_VALUE,
                     ((TemplateScalarModel) action.execute(
-                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
+                            _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
                             .getAsString());
         }
         
@@ -140,7 +140,7 @@ public class Java8DefaultObjectWrapperTest {
             assertEquals(
                     Java8DefaultMethodsBean.NORMAL_ACTION_RETURN_VALUE,
                     ((TemplateScalarModel) action.execute(
-                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
+                            _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
                             .getAsString());
         }
         {
@@ -150,7 +150,7 @@ public class Java8DefaultObjectWrapperTest {
             assertEquals(
                     Java8DefaultMethodsBean.DEFAULT_METHOD_ACTION_RETURN_VALUE,
                     ((TemplateScalarModel) action.execute(
-                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
+                            _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
                             .getAsString());
         }
         {
@@ -160,7 +160,7 @@ public class Java8DefaultObjectWrapperTest {
             assertEquals(
                     
Java8DefaultMethodsBean.OVERRIDDEN_DEFAULT_METHOD_ACTION_RETURN_VALUE,
                     ((TemplateScalarModel) action.execute(
-                            Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
+                            _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
                             .getAsString());
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
 
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
index 6d16893..2c85fc4 100644
--- 
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
+++ 
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TemplateConfigurationTest.java
@@ -139,7 +139,6 @@ public class TemplateConfigurationTest {
         NON_DEFAULT_TZ = tz;
     }
 
-
     private static final TimeZone NON_DEFAULT_SQL_TZ;
     static {
         TimeZone defaultTZ = DEFAULT_CFG.getSQLDateAndTimeTimeZone();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/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 7d2b3fc..cbccd66 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
@@ -22,7 +22,7 @@ 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._CallableUtils;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModelException;
 import org.apache.freemarker.core.model.TemplateNumberModel;
@@ -117,7 +117,7 @@ public abstract class AbstractParallelIntrospectionTest 
extends TestCase {
             JavaMethodModel pv = (JavaMethodModel) h.get("m" + mIdx);
             final int expected = objIdx * 1000 + mIdx;
             final int got = ((TemplateNumberModel) pv.execute(
-                    Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
+                    _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
                     .getAsNumber().intValue();
             if (got != expected) {
                 throw new AssertionError("Method assertion failed; " +

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/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 9ac550c..a1dfba6 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
@@ -45,9 +45,9 @@ 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._CallableUtils;
 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;
@@ -193,7 +193,7 @@ public class DefaultObjectWrapperTest {
         {
             // Check method calls, and also if the return value is wrapped 
with the overidden "wrap".
             final TemplateModel mr = ((JavaMethodModel) bean.get("m")).execute(
-                    Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE);
+                    _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE);
             assertEquals(Collections.singletonList(1), ow.unwrap(mr));
             assertTrue(DefaultListAdapter.class.isInstance(mr));
         }
@@ -586,7 +586,7 @@ public class DefaultObjectWrapperTest {
 
         TemplateHashModel api = (TemplateHashModel) iteratorAdapter.getAPI();
         assertFalse(((TemplateBooleanModel) ((JavaMethodModel)
-                
api.get("hasNext")).execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
+                
api.get("hasNext")).execute(_CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE))
                 .getAsBoolean());
     }
 
@@ -677,7 +677,7 @@ public class DefaultObjectWrapperTest {
 
         TemplateHashModel api = (TemplateHashModel) enumAdapter.getAPI();
         assertFalse(((TemplateBooleanModel) ((JavaMethodModel) 
api.get("hasMoreElements"))
-                .execute(Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE)).getAsBoolean());
+                .execute(_CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE)).getAsBoolean());
     }
 
     @Test
@@ -734,7 +734,7 @@ public class DefaultObjectWrapperTest {
         TemplateHashModel apiModel = (TemplateHashModel) 
((TemplateModelWithAPISupport) normalModel).getAPI();
         JavaMethodModel sizeMethod = (JavaMethodModel) apiModel.get("size");
         TemplateNumberModel r = (TemplateNumberModel) sizeMethod.execute(
-                Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE);
+                _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE);
         assertEquals(expectedSize, r.getAsNumber().intValue());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/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 9336388..7dc7879 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
@@ -23,7 +23,7 @@ import static org.junit.Assert.*;
 
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.NonTemplateCallPlace;
-import org.apache.freemarker.core.model.Constants;
+import org.apache.freemarker.core._CallableUtils;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
@@ -59,7 +59,7 @@ public class EnumModelsTest {
         assertEquals(((TemplateScalarModel) a).getAsString(), "ts:A");
         JavaMethodModel nameMethod = (JavaMethodModel) ((TemplateHashModel) 
a).get("name");
         assertEquals(((TemplateScalarModel) nameMethod.execute(
-                Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE)).getAsString(),
+                _CallableUtils.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/cfd37960/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 f888b2c..2487105 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
@@ -24,7 +24,7 @@ import static org.junit.Assert.*;
 
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.NonTemplateCallPlace;
-import org.apache.freemarker.core.model.Constants;
+import org.apache.freemarker.core._CallableUtils;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
@@ -66,7 +66,7 @@ public class StaticModelsTest {
         TemplateModel m = s.get("m");
         assertTrue(m instanceof JavaMethodModel);
         assertEquals(((TemplateScalarModel) ((JavaMethodModel) m).execute(
-                Constants.EMPTY_TEMPLATE_MODEL_ARRAY, 
NonTemplateCallPlace.INSTANCE)).getAsString(),
+                _CallableUtils.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/cfd37960/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/org/apache/freemarker/core/model/ConstantsTest.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/org/apache/freemarker/core/model/ConstantsTest.java
 
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/org/apache/freemarker/core/model/ConstantsTest.java
index 0817bf9..032adf1 100644
--- 
a/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/org/apache/freemarker/core/model/ConstantsTest.java
+++ 
b/freemarker-core-test/src/test/java/org/apache/freemarker/core/model/impl/org/apache/freemarker/core/model/ConstantsTest.java
@@ -3,7 +3,7 @@ package 
org.apache.freemarker.core.model.impl.org.apache.freemarker.core.model;
 import java.io.IOException;
 
 import org.apache.freemarker.core.TemplateException;
-import org.apache.freemarker.core.model.Constants;
+import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.test.TemplateTest;
 import org.junit.Test;
 
@@ -11,7 +11,7 @@ public final class ConstantsTest extends TemplateTest {
 
     @Test
     public void testEmptyHash() throws IOException, TemplateException {
-        addToDataModel("h", Constants.EMPTY_HASH);
+        addToDataModel("h", TemplateHashModel.EMPTY_HASH);
         assertOutput("{<#list h as k ,v>x</#list>}", "{}");
         assertOutput("{<#list h?keys as k>x</#list>}", "{}");
         assertOutput("{<#list h?values as k>x</#list>}", "{}");

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/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 e2d7ffb..c6bc49e 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
@@ -26,9 +26,9 @@ import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.TemplateException;
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
 import org.apache.freemarker.core.CallPlace;
-import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateDirectiveModel;
 import org.apache.freemarker.core.model.TemplateModel;
+import org.apache.freemarker.core.model.TemplateNumberModel;
 import org.apache.freemarker.core.model.impl.SimpleNumber;
 
 public class TwoNestedContentParamsDirective extends TestTemplateCallableModel 
implements TemplateDirectiveModel {
@@ -43,7 +43,7 @@ public class TwoNestedContentParamsDirective extends 
TestTemplateCallableModel i
     public void execute(TemplateModel[] args, CallPlace callPlace, Writer out, 
Environment env)
             throws TemplateException, IOException {
         callPlace.executeNestedContent(
-                new TemplateModel[] { Constants.ONE, new SimpleNumber(2) },
+                new TemplateModel[] { TemplateNumberModel.ONE, new 
SimpleNumber(2) },
                 out, env);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDefault.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDefault.java 
b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDefault.java
index 35b7816..fe1e842 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDefault.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDefault.java
@@ -20,7 +20,6 @@
 package org.apache.freemarker.core;
 
 
-import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateHashModelEx;
 import org.apache.freemarker.core.model.TemplateModel;
@@ -54,11 +53,11 @@ class ASTExpDefault extends ASTExpression {
                }
                @Override
         public TemplateCollectionModel keys() {
-                       return Constants.EMPTY_COLLECTION;
+                       return TemplateCollectionModel.EMPTY_COLLECTION;
                }
                @Override
         public TemplateCollectionModel values() {
-                       return Constants.EMPTY_COLLECTION;
+                       return TemplateCollectionModel.EMPTY_COLLECTION;
                }
                
        }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDynamicKeyName.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDynamicKeyName.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDynamicKeyName.java
index c6dae95..416019c 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDynamicKeyName.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpDynamicKeyName.java
@@ -19,7 +19,6 @@
 
 package org.apache.freemarker.core;
 
-import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateNumberModel;
@@ -238,7 +237,7 @@ final class ASTExpDynamicKeyName extends ASTExpression {
     }
 
     private TemplateModel emptyResult(boolean seq) {
-        return seq ? Constants.EMPTY_SEQUENCE : 
TemplateScalarModel.EMPTY_STRING;
+        return seq ? TemplateSequenceModel.EMPTY_SEQUENCE : 
TemplateScalarModel.EMPTY_STRING;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java
index d8cfc91..6757998 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/BuiltInsForSequences.java
@@ -28,7 +28,6 @@ import java.util.Date;
 
 import org.apache.freemarker.core.arithmetic.ArithmeticEngine;
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
-import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.TemplateBooleanModel;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
 import org.apache.freemarker.core.model.TemplateDateModel;
@@ -429,7 +428,7 @@ class BuiltInsForSequences {
                             ? findInSeq(target)
                             : findInCol(target);
                 }
-                return foundAtIdx == -1 ? Constants.MINUS_ONE : new 
SimpleNumber(foundAtIdx);
+                return foundAtIdx == -1 ? TemplateNumberModel.MINUS_ONE : new 
SimpleNumber(foundAtIdx);
             }
 
             @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/_CallableUtils.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/_CallableUtils.java 
b/freemarker-core/src/main/java/org/apache/freemarker/core/_CallableUtils.java
index 89bf91b..b1e02ab 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/_CallableUtils.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/_CallableUtils.java
@@ -26,7 +26,7 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.freemarker.core.model.ArgumentArrayLayout;
-import org.apache.freemarker.core.model.Constants;
+import org.apache.freemarker.core.model.TemplateHashModel;
 import org.apache.freemarker.core.model.TemplateCallableModel;
 import org.apache.freemarker.core.model.TemplateDirectiveModel;
 import org.apache.freemarker.core.model.TemplateFunctionModel;
@@ -45,6 +45,8 @@ import org.apache.freemarker.core.util._CollectionUtil;
 // methods for this functionality (checking arguments). Need to clean this up.
 public final class _CallableUtils {
 
+    public static final TemplateModel[] EMPTY_TEMPLATE_MODEL_ARRAY = new 
TemplateModel[0];
+
     private _CallableUtils() {
         //
     }
@@ -66,18 +68,18 @@ public final class _CallableUtils {
     private static TemplateModel[] 
getArgumentArrayWithNoArguments(ArgumentArrayLayout argsLayout) {
         int totalLength = argsLayout != null ? argsLayout.getTotalLength() : 0;
         if (totalLength == 0) {
-            return Constants.EMPTY_TEMPLATE_MODEL_ARRAY;
+            return EMPTY_TEMPLATE_MODEL_ARRAY;
         } else {
             TemplateModel[] args = new TemplateModel[totalLength];
 
             int positionalVarargsArgumentIndex = 
argsLayout.getPositionalVarargsArgumentIndex();
             if (positionalVarargsArgumentIndex != -1) {
-                args[positionalVarargsArgumentIndex] = 
Constants.EMPTY_SEQUENCE;
+                args[positionalVarargsArgumentIndex] = 
TemplateSequenceModel.EMPTY_SEQUENCE;
             }
 
             int namedVarargsArgumentIndex = 
argsLayout.getNamedVarargsArgumentIndex();
             if (namedVarargsArgumentIndex != -1) {
-                args[namedVarargsArgumentIndex] = Constants.EMPTY_SEQUENCE;
+                args[namedVarargsArgumentIndex] = 
TemplateSequenceModel.EMPTY_SEQUENCE;
             }
             
             return args;
@@ -197,7 +199,7 @@ public final class _CallableUtils {
                 execArgs[i] = positionalArg.eval(env);
             }
         } else {
-            execArgs = Constants.EMPTY_TEMPLATE_MODEL_ARRAY;
+            execArgs = EMPTY_TEMPLATE_MODEL_ARRAY;
         }
         return execArgs;
     }
@@ -223,7 +225,7 @@ public final class _CallableUtils {
             int posVarargsLength = positionalArgs != null ? 
positionalArgs.length - predefPosArgCnt : 0;
             TemplateSequenceModel varargsSeq;
             if (posVarargsLength <= 0) {
-                varargsSeq = Constants.EMPTY_SEQUENCE;
+                varargsSeq = TemplateSequenceModel.EMPTY_SEQUENCE;
             } else {
                 NativeSequence nativeSeq = new 
NativeSequence(posVarargsLength);
                 varargsSeq = nativeSeq;
@@ -299,7 +301,7 @@ public final class _CallableUtils {
             }
         }
         if (namedVarargsArgumentIndex != -1) {
-            execArgs[namedVarargsArgumentIndex] = namedVarargsHash != null ? 
namedVarargsHash : Constants.EMPTY_HASH;
+            execArgs[namedVarargsArgumentIndex] = namedVarargsHash != null ? 
namedVarargsHash : TemplateHashModel.EMPTY_HASH;
         }
         return execArgs;
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/ArgumentArrayLayout.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/ArgumentArrayLayout.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/ArgumentArrayLayout.java
index cc63aaf..78e7d46 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/ArgumentArrayLayout.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/ArgumentArrayLayout.java
@@ -54,12 +54,12 @@ import org.apache.freemarker.core.util.StringToIndexMap;
  *     If there's a positional varargs argument, then 1 element for the 
positional varargs parameter (whose value
  *     will be a {@link TemplateSequenceModel}), at index {@link 
#getPositionalVarargsArgumentIndex()}. This must not
  *     be left {@code null} in the argument array. In case there are 0 
positional varargs, the caller must set it to
- *     an empty {@link TemplateSequenceModel} (like {@link 
Constants#EMPTY_SEQUENCE}).
+ *     an empty {@link TemplateSequenceModel} (like {@link 
TemplateSequenceModel#EMPTY_SEQUENCE}).
  * <li>
  *     If there's a named varargs argument, then 1 element for the positional 
varargs parameter (whose value will be
  *     a {@link TemplateHashModelEx2}), at index {@link 
#getNamedVarargsArgumentIndex()}. This must not be left
  *     {@code null} in the argument array. In case there are 0 named varargs, 
the caller must set it to an empty
- *     {@link TemplateHashModelEx2} (like {@link Constants#EMPTY_HASH}).
+ *     {@link TemplateHashModelEx2} (like {@link 
TemplateHashModel#EMPTY_HASH}).
  * </ol>
  * <p>
  * The length of the argument array (allocated by the caller of {@code 
execute}) is {@link #getTotalLength()}}, or

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/Constants.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/Constants.java 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/Constants.java
deleted file mode 100644
index 5e29b6d..0000000
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/Constants.java
+++ /dev/null
@@ -1,163 +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.model;
-
-import java.io.Serializable;
-import java.util.NoSuchElementException;
-
-import 
org.apache.freemarker.core.model.TemplateHashModelEx2.KeyValuePairIterator;
-import org.apache.freemarker.core.model.impl.SimpleNumber;
-
-/**
- * Frequently used constant {@link TemplateModel} values.
- * 
- * <p>These constants should be stored in the {@link TemplateModel}
- * sub-interfaces, but for bacward compatibility they are stored here instead.
- * Starting from FreeMarker 2.4 they should be copyed (not moved!) into the
- * {@link TemplateModel} sub-interfaces, and this class should be marked as
- * deprecated.</p>
- */
-public class Constants {
-
-    public static final TemplateBooleanModel TRUE = TemplateBooleanModel.TRUE;
-
-    public static final TemplateBooleanModel FALSE = 
TemplateBooleanModel.FALSE;
-    
-    public static final TemplateScalarModel EMPTY_STRING = 
(TemplateScalarModel) TemplateScalarModel.EMPTY_STRING;
-
-    public static final TemplateNumberModel ZERO = new SimpleNumber(0);
-    
-    public static final TemplateNumberModel ONE = new SimpleNumber(1);
-    
-    public static final TemplateNumberModel MINUS_ONE = new SimpleNumber(-1);
-    
-    public static final TemplateModelIterator EMPTY_ITERATOR = new 
EmptyIteratorModel();
-
-    public static final TemplateModel[] EMPTY_TEMPLATE_MODEL_ARRAY = new 
TemplateModel[0];
-
-    private static class EmptyIteratorModel implements TemplateModelIterator, 
Serializable {
-
-        @Override
-        public TemplateModel next() throws TemplateModelException {
-            throw new TemplateModelException("The collection has no more 
elements.");
-        }
-
-        @Override
-        public boolean hasNext() throws TemplateModelException {
-            return false;
-        }
-        
-    }
-
-    public static final TemplateCollectionModelEx EMPTY_COLLECTION = new 
EmptyCollectionExModel();
-    
-    private static class EmptyCollectionExModel implements 
TemplateCollectionModelEx, Serializable {
-
-        @Override
-        public int size() throws TemplateModelException {
-            return 0;
-        }
-
-        @Override
-        public boolean isEmpty() throws TemplateModelException {
-            return true;
-        }
-
-        @Override
-        public TemplateModelIterator iterator() throws TemplateModelException {
-            return EMPTY_ITERATOR;
-        }
-        
-    }
-    
-    public static final TemplateSequenceModel EMPTY_SEQUENCE = new 
EmptySequenceModel();
-    
-    private static class EmptySequenceModel implements TemplateSequenceModel, 
Serializable {
-        
-        @Override
-        public TemplateModel get(int index) throws TemplateModelException {
-            return null;
-        }
-    
-        @Override
-        public int size() throws TemplateModelException {
-            return 0;
-        }
-        
-    }
-    
-    public static final TemplateHashModelEx EMPTY_HASH = new EmptyHashModel();
-    
-    private static class EmptyHashModel implements TemplateHashModelEx2, 
Serializable {
-        
-        @Override
-        public int size() throws TemplateModelException {
-            return 0;
-        }
-
-        @Override
-        public TemplateCollectionModel keys() throws TemplateModelException {
-            return EMPTY_COLLECTION;
-        }
-
-        @Override
-        public TemplateCollectionModel values() throws TemplateModelException {
-            return EMPTY_COLLECTION;
-        }
-
-        @Override
-        public TemplateModel get(String key) throws TemplateModelException {
-            return null;
-        }
-
-        @Override
-        public boolean isEmpty() throws TemplateModelException {
-            return true;
-        }
-
-        @Override
-        public KeyValuePairIterator keyValuePairIterator() throws 
TemplateModelException {
-            return EMPTY_KEY_VALUE_PAIR_ITERATOR;
-        }
-    }
-
-    public static final KeyValuePairIterator EMPTY_KEY_VALUE_PAIR_ITERATOR = 
EmptyKeyValuePairIterator.INSTANCE;
-
-    private static class EmptyKeyValuePairIterator implements 
TemplateHashModelEx2.KeyValuePairIterator {
-
-        static final EmptyKeyValuePairIterator INSTANCE = new 
EmptyKeyValuePairIterator();
-
-        private EmptyKeyValuePairIterator() {
-            //
-        }
-
-        @Override
-        public boolean hasNext() throws TemplateModelException {
-            return false;
-        }
-
-        @Override
-        public TemplateHashModelEx2.KeyValuePair next() throws 
TemplateModelException {
-            throw new NoSuchElementException("Can't retrieve element from 
empty key-value pair iterator.");
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyCollectionExModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyCollectionExModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyCollectionExModel.java
new file mode 100644
index 0000000..06f3366
--- /dev/null
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyCollectionExModel.java
@@ -0,0 +1,41 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+
+class EmptyCollectionExModel implements TemplateCollectionModelEx, 
Serializable {
+
+    @Override
+    public int size() throws TemplateModelException {
+        return 0;
+    }
+
+    @Override
+    public boolean isEmpty() throws TemplateModelException {
+        return true;
+    }
+
+    @Override
+    public TemplateModelIterator iterator() throws TemplateModelException {
+        return TemplateModelIterator.EMPTY_ITERATOR;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyHashModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyHashModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyHashModel.java
new file mode 100644
index 0000000..a8aa2b7
--- /dev/null
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyHashModel.java
@@ -0,0 +1,55 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+
+class EmptyHashModel implements TemplateHashModelEx2, Serializable {
+
+    @Override
+    public int size() throws TemplateModelException {
+        return 0;
+    }
+
+    @Override
+    public TemplateCollectionModel keys() throws TemplateModelException {
+        return TemplateCollectionModel.EMPTY_COLLECTION;
+    }
+
+    @Override
+    public TemplateCollectionModel values() throws TemplateModelException {
+        return TemplateCollectionModel.EMPTY_COLLECTION;
+    }
+
+    @Override
+    public TemplateModel get(String key) throws TemplateModelException {
+        return null;
+    }
+
+    @Override
+    public boolean isEmpty() throws TemplateModelException {
+        return true;
+    }
+
+    @Override
+    public KeyValuePairIterator keyValuePairIterator() throws 
TemplateModelException {
+        return EmptyKeyValuePairIterator.EMPTY_KEY_VALUE_PAIR_ITERATOR;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyIteratorModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyIteratorModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyIteratorModel.java
new file mode 100644
index 0000000..be0f0ea
--- /dev/null
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyIteratorModel.java
@@ -0,0 +1,36 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+
+class EmptyIteratorModel implements TemplateModelIterator, Serializable {
+
+    @Override
+    public TemplateModel next() throws TemplateModelException {
+        throw new TemplateModelException("The collection has no more 
elements.");
+    }
+
+    @Override
+    public boolean hasNext() throws TemplateModelException {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyKeyValuePairIterator.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyKeyValuePairIterator.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyKeyValuePairIterator.java
new file mode 100644
index 0000000..37073a3
--- /dev/null
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptyKeyValuePairIterator.java
@@ -0,0 +1,36 @@
+/*
+ * 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.model;
+
+import java.util.NoSuchElementException;
+
+class EmptyKeyValuePairIterator implements 
TemplateHashModelEx2.KeyValuePairIterator {
+
+    @Override
+    public boolean hasNext() throws TemplateModelException {
+        return false;
+    }
+
+    @Override
+    public TemplateHashModelEx2.KeyValuePair next() throws 
TemplateModelException {
+        throw new NoSuchElementException("Can't retrieve element from empty 
key-value pair iterator.");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptySequenceModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptySequenceModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptySequenceModel.java
new file mode 100644
index 0000000..5f352af
--- /dev/null
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/EmptySequenceModel.java
@@ -0,0 +1,36 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+
+class EmptySequenceModel implements TemplateSequenceModel, Serializable {
+
+    @Override
+    public TemplateModel get(int index) throws TemplateModelException {
+        return null;
+    }
+
+    @Override
+    public int size() throws TemplateModelException {
+        return 0;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/GeneralPurposeNothing.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/GeneralPurposeNothing.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/GeneralPurposeNothing.java
index ffc2ad2..285021c 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/GeneralPurposeNothing.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/GeneralPurposeNothing.java
@@ -82,17 +82,17 @@ implements TemplateBooleanModel, TemplateScalarModel, 
TemplateSequenceModel, Tem
 
     @Override
     public TemplateCollectionModel keys() {
-        return Constants.EMPTY_COLLECTION;
+        return TemplateCollectionModel.EMPTY_COLLECTION;
     }
 
     @Override
     public TemplateCollectionModel values() {
-        return Constants.EMPTY_COLLECTION;
+        return TemplateCollectionModel.EMPTY_COLLECTION;
     }
 
     @Override
     public KeyValuePairIterator keyValuePairIterator() throws 
TemplateModelException {
-        return Constants.EMPTY_KEY_VALUE_PAIR_ITERATOR;
+        return EmptyKeyValuePairIterator.EMPTY_KEY_VALUE_PAIR_ITERATOR;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateCollectionModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateCollectionModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateCollectionModel.java
index e870c2f..705f82a 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateCollectionModel.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateCollectionModel.java
@@ -40,6 +40,8 @@ import java.util.Collection;
  */
 public interface TemplateCollectionModel extends TemplateModel {
 
+    TemplateCollectionModelEx EMPTY_COLLECTION = new EmptyCollectionExModel();
+
     /**
      * Retrieves a template model iterator that is used to iterate over the 
elements in this collection.
      */

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java
index 647055a..f60ce79 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModel.java
@@ -26,7 +26,9 @@ package org.apache.freemarker.core.model;
  * <p>In templates they are used like {@code myHash.myKey} or {@code 
myHash[myDynamicKey]}. 
  */
 public interface TemplateHashModel extends TemplateModel {
-    
+
+    TemplateHashModelEx2 EMPTY_HASH = new EmptyHashModel();
+
     /**
      * Gets a <tt>TemplateModel</tt> from the hash.
      *

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModelEx2.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModelEx2.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModelEx2.java
index ef62f86..b3807f2 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModelEx2.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateHashModelEx2.java
@@ -55,7 +55,9 @@ public interface TemplateHashModelEx2 extends 
TemplateHashModelEx {
      * type, can throw {@link TemplateModelException}-s, and has no {@code 
remove()} method. 
      */
     interface KeyValuePairIterator {
-        
+
+        TemplateHashModelEx2.KeyValuePairIterator 
EMPTY_KEY_VALUE_PAIR_ITERATOR = new EmptyKeyValuePairIterator();
+
         /**
          * Similar to {@link Iterator#hasNext()}.
          */

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateModelIterator.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateModelIterator.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateModelIterator.java
index 9d1e241..04c8de1 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateModelIterator.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateModelIterator.java
@@ -25,6 +25,8 @@ package org.apache.freemarker.core.model;
  */
 public interface TemplateModelIterator {
 
+    TemplateModelIterator EMPTY_ITERATOR = new EmptyIteratorModel();
+
     /**
      * Returns the next model.
      * @throws TemplateModelException if the next model can not be retrieved
@@ -36,4 +38,5 @@ public interface TemplateModelIterator {
      * @return whether there are any more items to iterate over.
      */
     boolean hasNext() throws TemplateModelException;
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
index ba1240d..c1df97f 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
@@ -20,6 +20,7 @@
 package org.apache.freemarker.core.model;
 
 import org.apache.freemarker.core.arithmetic.ArithmeticEngine;
+import org.apache.freemarker.core.model.impl.SimpleNumber;
 
 /**
  * "number" template language data type; an object that stores a number. 
There's only one numerical type as far as the
@@ -32,6 +33,10 @@ import 
org.apache.freemarker.core.arithmetic.ArithmeticEngine;
  */
 public interface TemplateNumberModel extends TemplateModel {
 
+    TemplateNumberModel ZERO = new SimpleNumber(0);
+    TemplateNumberModel ONE = new SimpleNumber(1);
+    TemplateNumberModel MINUS_ONE = new SimpleNumber(-1);
+
     /**
      * Returns the numeric value. The return value must not be {@code null}.
      *

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateSequenceModel.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateSequenceModel.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateSequenceModel.java
index 8ca3944..0533fcf 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateSequenceModel.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/TemplateSequenceModel.java
@@ -30,6 +30,8 @@ package org.apache.freemarker.core.model;
  */
 public interface TemplateSequenceModel extends TemplateModel {
 
+    TemplateSequenceModel EMPTY_SEQUENCE = new EmptySequenceModel();
+
     /**
      * Retrieves the i-th template model in this sequence.
      * 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
index 4a8b69b..2f1a506 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedFixArgsMethods.java
@@ -18,7 +18,7 @@
  */
 package org.apache.freemarker.core.model.impl;
 
-import org.apache.freemarker.core.model.Constants;
+import org.apache.freemarker.core._CallableUtils;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
@@ -47,7 +47,7 @@ class OverloadedFixArgsMethods extends 
OverloadedMethodsSubset {
     throws TemplateModelException {
         if (tmArgs == null) {
             // null is treated as empty args
-            tmArgs = Constants.EMPTY_TEMPLATE_MODEL_ARRAY;
+            tmArgs = _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY;
         }
         final int argCount = tmArgs.length;
         final Class<?>[][] unwrappingHintsByParamCount = 
getUnwrappingHintsByParamCount();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
index 8085693..8b325ed 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/OverloadedVarArgsMethods.java
@@ -20,7 +20,7 @@ package org.apache.freemarker.core.model.impl;
 
 import java.lang.reflect.Array;
 
-import org.apache.freemarker.core.model.Constants;
+import org.apache.freemarker.core._CallableUtils;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
@@ -139,7 +139,7 @@ class OverloadedVarArgsMethods extends 
OverloadedMethodsSubset {
     throws TemplateModelException {
         if (tmArgs == null) {
             // null is treated as empty args
-            tmArgs = Constants.EMPTY_TEMPLATE_MODEL_ARRAY;
+            tmArgs = _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY;
         }
         final int argsLen = tmArgs.length;
         final Class<?>[][] unwrappingHintsByParamCount = 
getUnwrappingHintsByParamCount();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/cfd37960/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
----------------------------------------------------------------------
diff --git 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
index 678b9ed..cebcaf8 100644
--- 
a/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
+++ 
b/freemarker-core/src/main/java/org/apache/freemarker/core/model/impl/SimpleMethod.java
@@ -21,11 +21,11 @@ package org.apache.freemarker.core.model.impl;
 import java.lang.reflect.Array;
 import java.lang.reflect.Member;
 
+import org.apache.freemarker.core._CallableUtils;
 import org.apache.freemarker.core._DelayedFTLTypeDescription;
 import org.apache.freemarker.core._DelayedOrdinal;
 import org.apache.freemarker.core._ErrorDescriptionBuilder;
 import org.apache.freemarker.core._TemplateModelException;
-import org.apache.freemarker.core.model.Constants;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
 import org.apache.freemarker.core.model.TemplateMarkupOutputModel;
 import org.apache.freemarker.core.model.TemplateModel;
@@ -52,7 +52,7 @@ class SimpleMethod {
     
     Object[] unwrapArguments(TemplateModel[] args, DefaultObjectWrapper 
wrapper) throws TemplateModelException {
         if (args == null) {
-            args = Constants.EMPTY_TEMPLATE_MODEL_ARRAY;
+            args = _CallableUtils.EMPTY_TEMPLATE_MODEL_ARRAY;
         }
         boolean isVarArg = _MethodUtil.isVarargs(member);
         int typesLen = argTypes.length;

Reply via email to