freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [2/2] incubator-freemarker git commit: Configuration-related int constants were replaced with enums:
Date Mon, 22 May 2017 21:01:13 GMT
Configuration-related int constants were replaced with enums:

- FM2 Configuration.${c}_NAMING_CONVENTION with NamingConvention.${c}
- FM2 Configuration.${c}_TAG_SYNTAX with TagSyntax.${c}
- FM2 Configuration.${c}_AUTO_ESCAPING_POLICY with AutoEscapingPolicy.${c}


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

Branch: refs/heads/3
Commit: 99ac69739f6439ce8dd6143f7eb0046e885998e5
Parents: be55689
Author: ddekany <ddekany@apache.org>
Authored: Mon May 22 18:08:54 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Mon May 22 23:01:02 2017 +0200

----------------------------------------------------------------------
 FM3-CHANGE-LOG.txt                              |   5 +
 .../core/ActualNamingConvetionTest.java         |  17 ++--
 .../freemarker/core/ActualTagSyntaxTest.java    |  34 +++----
 .../apache/freemarker/core/CamelCaseTest.java   |  28 ++---
 .../freemarker/core/CoercionToTextualTest.java  |   2 +-
 .../freemarker/core/ConfigurableTest.java       |   4 +-
 .../freemarker/core/ConfigurationTest.java      |  51 ++++------
 .../core/InterpretSettingInheritanceTest.java   |  10 +-
 .../core/ObjectBuilderSettingsTest.java         |   2 +-
 .../freemarker/core/OutputFormatTest.java       |  32 +++---
 .../core/ParsingErrorMessagesTest.java          |   2 +-
 .../freemarker/core/SpecialVariableTest.java    |   8 +-
 .../core/TagSyntaxVariationsTest.java           |   8 +-
 .../core/TemplateConfigurationTest.java         |  16 +--
 .../apache/freemarker/core/ASTDirSetting.java   |  16 +--
 .../apache/freemarker/core/ASTExpBuiltIn.java   |  18 ++--
 .../freemarker/core/ASTExpBuiltInVariable.java  |  18 ++--
 .../freemarker/core/AutoEscapingPolicy.java     |  44 ++++++++
 .../apache/freemarker/core/Configuration.java   | 102 +++++++++----------
 ...utableParsingAndProcessingConfiguration.java |  77 ++++++--------
 .../core/MutableProcessingConfiguration.java    |  11 +-
 .../freemarker/core/NamingConvention.java       |  29 ++++++
 .../core/OutputFormatBoundBuiltIn.java          |   4 +-
 .../freemarker/core/ParsingConfiguration.java   |  55 ++++------
 .../org/apache/freemarker/core/TagSyntax.java   |  29 ++++++
 .../org/apache/freemarker/core/Template.java    |  24 ++---
 .../freemarker/core/TemplateConfiguration.java  |  18 ++--
 ...emplateParsingConfigurationWithFallback.java |   6 +-
 .../core/_ErrorDescriptionBuilder.java          |   2 +-
 .../core/_ObjectBuilderSettingEvaluator.java    |   5 +-
 .../freemarker/core/util/_StringUtil.java       |  14 +--
 freemarker-core/src/main/javacc/FTL.jj          |  89 +++++++---------
 32 files changed, 412 insertions(+), 368 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/FM3-CHANGE-LOG.txt
----------------------------------------------------------------------
diff --git a/FM3-CHANGE-LOG.txt b/FM3-CHANGE-LOG.txt
index 9600281..f0823ab 100644
--- a/FM3-CHANGE-LOG.txt
+++ b/FM3-CHANGE-LOG.txt
@@ -245,3 +245,8 @@ the FreeMarer 3 changelog here:
             new DefaultObjectWrapper.Builder(Configuration.VERSION_3_0_0)
                     .extensions(DOMDefaultObjectWrapperExtension.INSTANCE)
                     .build())
+
+- Configuration-related int constants were replaced with enums:
+  - FM2 Configuration.${c}_NAMING_CONVENTION with NamingConvention.${c}
+  - FM2 Configuration.${c}_TAG_SYNTAX with TagSyntax.${c}
+  - FM2 Configuration.${c}_AUTO_ESCAPING_POLICY with AutoEscapingPolicy.${c}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualNamingConvetionTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualNamingConvetionTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualNamingConvetionTest.java
index 57e40fa..69a95c9 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualNamingConvetionTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualNamingConvetionTest.java
@@ -32,32 +32,33 @@ public class ActualNamingConvetionTest {
     public void testUndetectable() throws IOException {
         final String ftl = "<#if true>${x?size}</#if>";
         assertEquals(getActualNamingConvention(ftl,
-                ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION), ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION);
+                NamingConvention.AUTO_DETECT), NamingConvention.AUTO_DETECT);
         assertEquals(getActualNamingConvention(ftl,
-                ParsingConfiguration.LEGACY_NAMING_CONVENTION), ParsingConfiguration.LEGACY_NAMING_CONVENTION);
+                NamingConvention.LEGACY), NamingConvention.LEGACY);
         assertEquals(getActualNamingConvention(ftl,
-                ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION), ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
+                NamingConvention.CAMEL_CASE), NamingConvention.CAMEL_CASE);
     }
 
     @Test
     public void testLegacyDetected() throws IOException {
         final String ftl = "${x?upper_case}";
         assertEquals(getActualNamingConvention(ftl,
-                ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION), ParsingConfiguration.LEGACY_NAMING_CONVENTION);
+                NamingConvention.AUTO_DETECT), NamingConvention.LEGACY);
         assertEquals(getActualNamingConvention(ftl,
-                ParsingConfiguration.LEGACY_NAMING_CONVENTION), ParsingConfiguration.LEGACY_NAMING_CONVENTION);
+                NamingConvention.LEGACY), NamingConvention.LEGACY);
     }
 
     @Test
     public void testCamelCaseDetected() throws IOException {
         final String ftl = "${x?upperCase}";
         assertEquals(getActualNamingConvention(ftl,
-                ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION), ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
+                NamingConvention.AUTO_DETECT), NamingConvention.CAMEL_CASE);
         assertEquals(getActualNamingConvention(ftl,
-                ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION), ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
+                NamingConvention.CAMEL_CASE), NamingConvention.CAMEL_CASE);
     }
 
-    private int getActualNamingConvention(String ftl, int namingConvention) throws IOException {
+    private NamingConvention getActualNamingConvention(String ftl, NamingConvention namingConvention)
+            throws IOException {
         return new Template(null, ftl,
                 new TestConfigurationBuilder().namingConvention(namingConvention).build())
                 .getActualNamingConvention();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualTagSyntaxTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualTagSyntaxTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualTagSyntaxTest.java
index 88f0646..02d7f3d 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualTagSyntaxTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ActualTagSyntaxTest.java
@@ -19,7 +19,7 @@
 
 package org.apache.freemarker.core;
 
-import static org.apache.freemarker.core.ParsingConfiguration.*;
+import static org.apache.freemarker.core.TagSyntax.*;
 import static org.junit.Assert.*;
 
 import java.io.IOException;
@@ -31,35 +31,35 @@ public class ActualTagSyntaxTest {
 
     @Test
     public void testWithFtlHeader() throws IOException {
-        testWithFtlHeader(AUTO_DETECT_TAG_SYNTAX);
-        testWithFtlHeader(ANGLE_BRACKET_TAG_SYNTAX);
-        testWithFtlHeader(SQUARE_BRACKET_TAG_SYNTAX);
+        testWithFtlHeader(AUTO_DETECT);
+        testWithFtlHeader(ANGLE_BRACKET);
+        testWithFtlHeader(SQUARE_BRACKET);
     }
     
-    private void testWithFtlHeader(int cfgTagSyntax) throws IOException {
-        assertEquals(getActualTagSyntax("[#ftl]foo", cfgTagSyntax), SQUARE_BRACKET_TAG_SYNTAX);
-        assertEquals(getActualTagSyntax("<#ftl>foo", cfgTagSyntax), ANGLE_BRACKET_TAG_SYNTAX);
+    private void testWithFtlHeader(TagSyntax cfgTagSyntax) throws IOException {
+        assertEquals(getActualTagSyntax("[#ftl]foo", cfgTagSyntax), SQUARE_BRACKET);
+        assertEquals(getActualTagSyntax("<#ftl>foo", cfgTagSyntax), ANGLE_BRACKET);
     }
     
     @Test
     public void testUndecidable() throws IOException {
-        assertEquals(getActualTagSyntax("foo", AUTO_DETECT_TAG_SYNTAX), ANGLE_BRACKET_TAG_SYNTAX);
-        assertEquals(getActualTagSyntax("foo", ANGLE_BRACKET_TAG_SYNTAX), ANGLE_BRACKET_TAG_SYNTAX);
-        assertEquals(getActualTagSyntax("foo", SQUARE_BRACKET_TAG_SYNTAX), SQUARE_BRACKET_TAG_SYNTAX);
+        assertEquals(getActualTagSyntax("foo", AUTO_DETECT), ANGLE_BRACKET);
+        assertEquals(getActualTagSyntax("foo", ANGLE_BRACKET), ANGLE_BRACKET);
+        assertEquals(getActualTagSyntax("foo", SQUARE_BRACKET), SQUARE_BRACKET);
     }
 
     @Test
     public void testDecidableWithoutFtlHeader() throws IOException {
-        assertEquals(getActualTagSyntax("foo<#if true></#if>", AUTO_DETECT_TAG_SYNTAX), ANGLE_BRACKET_TAG_SYNTAX);
-        assertEquals(getActualTagSyntax("foo<#if true></#if>", ANGLE_BRACKET_TAG_SYNTAX), ANGLE_BRACKET_TAG_SYNTAX);
-        assertEquals(getActualTagSyntax("foo<#if true></#if>", SQUARE_BRACKET_TAG_SYNTAX), SQUARE_BRACKET_TAG_SYNTAX);
+        assertEquals(getActualTagSyntax("foo<#if true></#if>", AUTO_DETECT), ANGLE_BRACKET);
+        assertEquals(getActualTagSyntax("foo<#if true></#if>", ANGLE_BRACKET), ANGLE_BRACKET);
+        assertEquals(getActualTagSyntax("foo<#if true></#if>", SQUARE_BRACKET), SQUARE_BRACKET);
         
-        assertEquals(getActualTagSyntax("foo[#if true][/#if]", AUTO_DETECT_TAG_SYNTAX), SQUARE_BRACKET_TAG_SYNTAX);
-        assertEquals(getActualTagSyntax("foo[#if true][/#if]", ANGLE_BRACKET_TAG_SYNTAX), ANGLE_BRACKET_TAG_SYNTAX);
-        assertEquals(getActualTagSyntax("foo[#if true][/#if]", SQUARE_BRACKET_TAG_SYNTAX), SQUARE_BRACKET_TAG_SYNTAX);
+        assertEquals(getActualTagSyntax("foo[#if true][/#if]", AUTO_DETECT), SQUARE_BRACKET);
+        assertEquals(getActualTagSyntax("foo[#if true][/#if]", ANGLE_BRACKET), ANGLE_BRACKET);
+        assertEquals(getActualTagSyntax("foo[#if true][/#if]", SQUARE_BRACKET), SQUARE_BRACKET);
     }
     
-    private int getActualTagSyntax(String ftl, int cfgTagSyntax) throws IOException {
+    private TagSyntax getActualTagSyntax(String ftl, TagSyntax cfgTagSyntax) throws IOException {
         return new Template(
                 null, ftl,
                 new TestConfigurationBuilder().tagSyntax(cfgTagSyntax).build()).getActualTagSyntax();

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/CamelCaseTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CamelCaseTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CamelCaseTest.java
index 95572ad..d2f3fa0 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CamelCaseTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CamelCaseTest.java
@@ -120,21 +120,21 @@ public class CamelCaseTest extends TemplateTest {
         assertErrorContains("<#ftl strip_whitespace=true>${.fooBar}", "naming convention");
 
         setConfiguration(new TestConfigurationBuilder()
-                .namingConvention(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION)
+                .namingConvention(NamingConvention.CAMEL_CASE)
                 .outputEncoding(StandardCharsets.UTF_8)
                 .build());
         assertErrorContains("<#ftl strip_whitespace=true>", "naming convention");
         assertOutput("<#ftl stripWhitespace=true>${.outputEncoding}", StandardCharsets.UTF_8.name());
         
         setConfiguration(new TestConfigurationBuilder()
-                .namingConvention(ParsingConfiguration.LEGACY_NAMING_CONVENTION)
+                .namingConvention(NamingConvention.LEGACY)
                 .outputEncoding(StandardCharsets.UTF_8)
                 .build());
         assertErrorContains("<#ftl stripWhitespace=true>", "naming convention");
         assertOutput("<#ftl strip_whitespace=true>${.output_encoding}", StandardCharsets.UTF_8.name());
         
         setConfiguration(new TestConfigurationBuilder()
-                .namingConvention(ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION)
+                .namingConvention(NamingConvention.AUTO_DETECT)
                 .outputEncoding(StandardCharsets.UTF_8)
                 .build());
         assertOutput("<#ftl stripWhitespace=true>${.outputEncoding}", StandardCharsets.UTF_8.name());
@@ -187,7 +187,7 @@ public class CamelCaseTest extends TemplateTest {
 
     @Test
     public void stringLiteralInterpolation() throws IOException, TemplateException {
-        assertEquals(ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION, getConfiguration().getNamingConvention());
+        assertEquals(NamingConvention.AUTO_DETECT, getConfiguration().getNamingConvention());
         addToDataModel("x", "x");
         
         assertOutput("${'-${x?upperCase}-'} ${x?upperCase}", "-X- X");
@@ -217,7 +217,7 @@ public class CamelCaseTest extends TemplateTest {
     
     @Test
     public void evalAndInterpret() throws IOException, TemplateException {
-        assertEquals(ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION, getConfiguration().getNamingConvention());
+        assertEquals(NamingConvention.AUTO_DETECT, getConfiguration().getNamingConvention());
         // The naming convention detected doesn't affect the enclosing template's naming convention.
         // - ?eval:
         assertOutput("${\"'x'?upperCase\"?eval}${'x'?upper_case}", "XX");
@@ -253,7 +253,7 @@ public class CamelCaseTest extends TemplateTest {
 
     private void setConfigurationToLegacyCaseNamingConvention() {
         setConfiguration(new TestConfigurationBuilder()
-                .namingConvention(ParsingConfiguration.LEGACY_NAMING_CONVENTION)
+                .namingConvention(NamingConvention.LEGACY)
                 .build());
     }
 
@@ -275,7 +275,7 @@ public class CamelCaseTest extends TemplateTest {
 
     private void setConfigurationToCamelCaseNamingConvention() {
         setConfiguration(new TestConfigurationBuilder()
-                .namingConvention(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION)
+                .namingConvention(NamingConvention.CAMEL_CASE)
                 .build());
     }
 
@@ -297,7 +297,7 @@ public class CamelCaseTest extends TemplateTest {
     private void assertContainsBothNamingStyles(Set<String> names, NamePairAssertion namePairAssertion) {
         Set<String> underscoredNamesWithCamelCasePair = new HashSet<>();
         for (String name : names) {
-            if (_StringUtil.getIdentifierNamingConvention(name) == ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION) {
+            if (_StringUtil.getIdentifierNamingConvention(name) == NamingConvention.CAMEL_CASE) {
                 String underscoredName = correctIsoBIExceptions(_StringUtil.camelCaseToUnderscored(name)); 
                 assertTrue(
                         "Missing underscored variation \"" + underscoredName + "\" for \"" + name + "\".",
@@ -308,7 +308,7 @@ public class CamelCaseTest extends TemplateTest {
             }
         }
         for (String name : names) {
-            if (_StringUtil.getIdentifierNamingConvention(name) == ParsingConfiguration.LEGACY_NAMING_CONVENTION) {
+            if (_StringUtil.getIdentifierNamingConvention(name) == NamingConvention.LEGACY) {
                 assertTrue("Missing camel case variation for \"" + name + "\".",
                         underscoredNamesWithCamelCasePair.contains(name));
             }
@@ -323,7 +323,7 @@ public class CamelCaseTest extends TemplateTest {
     public void camelCaseDirectives() throws IOException, TemplateException {
         camelCaseDirectives(false);
         setConfiguration(new TestConfigurationBuilder()
-                .tagSyntax(ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX)
+                .tagSyntax(TagSyntax.AUTO_DETECT)
                 .build());
         camelCaseDirectives(true);
     }
@@ -364,11 +364,11 @@ public class CamelCaseTest extends TemplateTest {
     }
     
     private void explicitNamingConvention(boolean squared) throws IOException, TemplateException {
-        int tagSyntax = squared ? ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX
-                : ParsingConfiguration.ANGLE_BRACKET_TAG_SYNTAX;
+        TagSyntax tagSyntax = squared ? TagSyntax.AUTO_DETECT
+                : TagSyntax.ANGLE_BRACKET;
         setConfiguration(new TestConfigurationBuilder()
                 .tagSyntax(tagSyntax)
-                .namingConvention(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION)
+                .namingConvention(NamingConvention.CAMEL_CASE)
                 .build());
 
         assertErrorContains(
@@ -396,7 +396,7 @@ public class CamelCaseTest extends TemplateTest {
 
         setConfiguration(new TestConfigurationBuilder()
                 .tagSyntax(tagSyntax)
-                .namingConvention(ParsingConfiguration.LEGACY_NAMING_CONVENTION)
+                .namingConvention(NamingConvention.LEGACY)
                 .build());
 
         assertErrorContains(

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/CoercionToTextualTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CoercionToTextualTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CoercionToTextualTest.java
index 91d3749..1e945fe 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/CoercionToTextualTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/CoercionToTextualTest.java
@@ -57,7 +57,7 @@ public class CoercionToTextualTest extends TemplateTest {
     public void testEscBuiltin() throws IOException, TemplateException {
         setConfiguration(createDefaultConfigurationBuilder()
                 .outputFormat(HTMLOutputFormat.INSTANCE)
-                .autoEscapingPolicy(ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY)
+                .autoEscapingPolicy(AutoEscapingPolicy.DISABLE)
                 .booleanFormat("<y>,<n>")
                 .build());
         assertOutput("${'a<b'?esc}", "a&lt;b");

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurableTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurableTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurableTest.java
index ebcc465..5301f14 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurableTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurableTest.java
@@ -96,7 +96,7 @@ public class ConfigurableTest {
             String fieldName = field.getName();
             if (fieldName.endsWith("_KEY")) {
                 String keyFieldValue = (String) field.get(null);
-                assertNotEquals(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION,
+                assertNotEquals(NamingConvention.CAMEL_CASE,
                         _StringUtil.getIdentifierNamingConvention(keyFieldValue));
                 assertEquals(fieldName.substring(0, fieldName.length() - 4).toLowerCase(), keyFieldValue);
                 
@@ -109,7 +109,7 @@ public class ConfigurableTest {
                 
                 try {
                     String keyCCFieldValue = (String) confClass.getField(fieldName + "_CAMEL_CASE").get(null);
-                    assertNotEquals(ParsingConfiguration.LEGACY_NAMING_CONVENTION,
+                    assertNotEquals(NamingConvention.LEGACY,
                             _StringUtil.getIdentifierNamingConvention(keyCCFieldValue));
                     assertEquals(keyFieldValue, _StringUtil.camelCaseToUnderscored(keyCCFieldValue));
                 } catch (NoSuchFieldException e) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
index dcefa3f..87f1c21 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ConfigurationTest.java
@@ -547,38 +547,31 @@ public class ConfigurationTest extends TestCase {
     public void testSetAutoEscaping() throws Exception {
        Configuration.Builder cfgB = new Configuration.Builder(Configuration.VERSION_3_0_0);
     
-       assertEquals(ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       assertEquals(AutoEscapingPolicy.ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
 
-       cfgB.setAutoEscapingPolicy(ParsingConfiguration.ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY);
-       assertEquals(ParsingConfiguration.ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       cfgB.setAutoEscapingPolicy(AutoEscapingPolicy.ENABLE_IF_SUPPORTED);
+       assertEquals(AutoEscapingPolicy.ENABLE_IF_SUPPORTED, cfgB.getAutoEscapingPolicy());
 
-       cfgB.setAutoEscapingPolicy(ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY);
-       assertEquals(ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       cfgB.setAutoEscapingPolicy(AutoEscapingPolicy.ENABLE_IF_DEFAULT);
+       assertEquals(AutoEscapingPolicy.ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
 
-       cfgB.setAutoEscapingPolicy(ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY);
-       assertEquals(ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       cfgB.setAutoEscapingPolicy(AutoEscapingPolicy.DISABLE);
+       assertEquals(AutoEscapingPolicy.DISABLE, cfgB.getAutoEscapingPolicy());
        
        cfgB.setSetting(Configuration.ExtendableBuilder.AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE, "enableIfSupported");
-       assertEquals(ParsingConfiguration.ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       assertEquals(AutoEscapingPolicy.ENABLE_IF_SUPPORTED, cfgB.getAutoEscapingPolicy());
 
        cfgB.setSetting(Configuration.ExtendableBuilder.AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE, "enable_if_supported");
-       assertEquals(ParsingConfiguration.ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       assertEquals(AutoEscapingPolicy.ENABLE_IF_SUPPORTED, cfgB.getAutoEscapingPolicy());
        
        cfgB.setSetting(Configuration.ExtendableBuilder.AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE, "enableIfDefault");
-       assertEquals(ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       assertEquals(AutoEscapingPolicy.ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
 
        cfgB.setSetting(Configuration.ExtendableBuilder.AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE, "enable_if_default");
-       assertEquals(ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+       assertEquals(AutoEscapingPolicy.ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
        
        cfgB.setSetting(Configuration.ExtendableBuilder.AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE, "disable");
-       assertEquals(ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
-       
-       try {
-           cfgB.setAutoEscapingPolicy(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
-           fail();
-       } catch (IllegalArgumentException e) {
-           // Expected
-       }
+       assertEquals(AutoEscapingPolicy.DISABLE, cfgB.getAutoEscapingPolicy());
     }
 
     public void testSetOutputFormat() throws Exception {
@@ -1180,16 +1173,16 @@ public class ConfigurationTest extends TestCase {
     public void testNamingConventionSetSetting() throws ConfigurationException {
         Configuration.Builder cfg = new Configuration.Builder(Configuration.VERSION_3_0_0);
 
-        assertEquals(ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION, cfg.getNamingConvention());
+        assertEquals(NamingConvention.AUTO_DETECT, cfg.getNamingConvention());
         
         cfg.setSetting("naming_convention", "legacy");
-        assertEquals(ParsingConfiguration.LEGACY_NAMING_CONVENTION, cfg.getNamingConvention());
+        assertEquals(NamingConvention.LEGACY, cfg.getNamingConvention());
         
         cfg.setSetting("naming_convention", "camel_case");
-        assertEquals(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION, cfg.getNamingConvention());
+        assertEquals(NamingConvention.CAMEL_CASE, cfg.getNamingConvention());
         
         cfg.setSetting("naming_convention", "auto_detect");
-        assertEquals(ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION, cfg.getNamingConvention());
+        assertEquals(NamingConvention.AUTO_DETECT, cfg.getNamingConvention());
     }
 
     public void testLazyImportsSetSetting() throws ConfigurationException {
@@ -1400,9 +1393,9 @@ public class ConfigurationTest extends TestCase {
     public void testGetSupportedBuiltInDirectiveNames() {
         Configuration cfg = new Configuration.Builder(Configuration.VERSION_3_0_0).build();
         
-        Set<String> allNames = cfg.getSupportedBuiltInDirectiveNames(ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION);
-        Set<String> lNames = cfg.getSupportedBuiltInDirectiveNames(ParsingConfiguration.LEGACY_NAMING_CONVENTION);
-        Set<String> cNames = cfg.getSupportedBuiltInDirectiveNames(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
+        Set<String> allNames = cfg.getSupportedBuiltInDirectiveNames(NamingConvention.AUTO_DETECT);
+        Set<String> lNames = cfg.getSupportedBuiltInDirectiveNames(NamingConvention.LEGACY);
+        Set<String> cNames = cfg.getSupportedBuiltInDirectiveNames(NamingConvention.CAMEL_CASE);
         
         checkNamingConventionNameSets(allNames, lNames, cNames);
         
@@ -1415,9 +1408,9 @@ public class ConfigurationTest extends TestCase {
     public void testGetSupportedBuiltInNames() {
         Configuration cfg = new Configuration.Builder(Configuration.VERSION_3_0_0).build();
         
-        Set<String> allNames = cfg.getSupportedBuiltInNames(ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION);
-        Set<String> lNames = cfg.getSupportedBuiltInNames(ParsingConfiguration.LEGACY_NAMING_CONVENTION);
-        Set<String> cNames = cfg.getSupportedBuiltInNames(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
+        Set<String> allNames = cfg.getSupportedBuiltInNames(NamingConvention.AUTO_DETECT);
+        Set<String> lNames = cfg.getSupportedBuiltInNames(NamingConvention.LEGACY);
+        Set<String> cNames = cfg.getSupportedBuiltInNames(NamingConvention.CAMEL_CASE);
         
         checkNamingConventionNameSets(allNames, lNames, cNames);
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/InterpretSettingInheritanceTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/InterpretSettingInheritanceTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/InterpretSettingInheritanceTest.java
index 2d061d7..dd4f899 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/InterpretSettingInheritanceTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/InterpretSettingInheritanceTest.java
@@ -42,7 +42,7 @@ public class InterpretSettingInheritanceTest  extends TemplateTest {
     @Test
     public void tagSyntaxTest() throws IOException, TemplateException {
         setConfiguration(new TestConfigurationBuilder()
-                .tagSyntax(ParsingConfiguration.ANGLE_BRACKET_TAG_SYNTAX)
+                .tagSyntax(TagSyntax.ANGLE_BRACKET)
                 .build());
         assertOutput(FTL_S_A_S, OUT_A_S_WHEN_SYNTAX_IS_A);
         assertOutput(FTL_S_S_A, OUT_S_A_WHEN_SYNTAX_IS_A);
@@ -50,7 +50,7 @@ public class InterpretSettingInheritanceTest  extends TemplateTest {
         assertOutput(FTL_A_S_A, OUT_S_A_WHEN_SYNTAX_IS_A);
 
         setConfiguration(new TestConfigurationBuilder()
-                .tagSyntax(ParsingConfiguration.SQUARE_BRACKET_TAG_SYNTAX)
+                .tagSyntax(TagSyntax.SQUARE_BRACKET)
                 .build());
         assertOutput(FTL_S_A_S, OUT_A_S_WHEN_SYNTAX_IS_S);
         assertOutput(FTL_S_S_A, OUT_S_A_WHEN_SYNTAX_IS_S);
@@ -58,7 +58,7 @@ public class InterpretSettingInheritanceTest  extends TemplateTest {
         assertOutput(FTL_A_S_A, OUT_S_A_WHEN_SYNTAX_IS_S);
 
         setConfiguration(new TestConfigurationBuilder()
-                .tagSyntax(ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX)
+                .tagSyntax(TagSyntax.AUTO_DETECT)
                 .build());
         assertOutput(FTL_S_A_S, OUT_A_S_WHEN_SYNTAX_IS_A);
         assertOutput(FTL_S_S_A, OUT_S_A_WHEN_SYNTAX_IS_S);
@@ -89,13 +89,13 @@ public class InterpretSettingInheritanceTest  extends TemplateTest {
     @Test
     public void evalTest() throws IOException, TemplateException {
         setConfiguration(new TestConfigurationBuilder()
-                .tagSyntax(ParsingConfiguration.ANGLE_BRACKET_TAG_SYNTAX)
+                .tagSyntax(TagSyntax.ANGLE_BRACKET)
                 .build());
         assertOutput("<@'\"[#if true]s[/#if]<#if true>a</#if>\"?interpret'?eval />", OUT_S_A_WHEN_SYNTAX_IS_A);
         assertOutput("[#ftl][@'\"[#if true]s[/#if]<#if true>a</#if>\"?interpret'?eval /]", OUT_S_A_WHEN_SYNTAX_IS_A);
 
         setConfiguration(new TestConfigurationBuilder()
-                .tagSyntax(ParsingConfiguration.SQUARE_BRACKET_TAG_SYNTAX)
+                .tagSyntax(TagSyntax.SQUARE_BRACKET)
                 .build());
         assertOutput("[@'\"[#if true]s[/#if]<#if true>a</#if>\"?interpret'?eval /]", OUT_S_A_WHEN_SYNTAX_IS_S);
         assertOutput("<#ftl><@'\"[#if true]s[/#if]<#if true>a</#if>\"?interpret'?eval />", OUT_S_A_WHEN_SYNTAX_IS_S);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/ObjectBuilderSettingsTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ObjectBuilderSettingsTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ObjectBuilderSettingsTest.java
index 49534fa..7c0d841 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ObjectBuilderSettingsTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ObjectBuilderSettingsTest.java
@@ -911,7 +911,7 @@ public class ObjectBuilderSettingsTest {
         assertEqualsEvaled(123, "org.apache.freemarker.core.ObjectBuilderSettingsTest$TestStaticFields.CONST");
         
         // With shorthand class name:
-        assertEqualsEvaled(ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX, "Configuration.AUTO_DETECT_TAG_SYNTAX");
+        assertEqualsEvaled(TagSyntax.AUTO_DETECT, "TagSyntax.AUTO_DETECT");
         
         try {
             _ObjectBuilderSettingEvaluator.eval(

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/OutputFormatTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/OutputFormatTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/OutputFormatTest.java
index eedb4d1..d78c558 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/OutputFormatTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/OutputFormatTest.java
@@ -18,7 +18,7 @@
  */
 package org.apache.freemarker.core;
 
-import static org.apache.freemarker.core.ParsingConfiguration.*;
+import static org.apache.freemarker.core.AutoEscapingPolicy.*;
 import static org.junit.Assert.*;
 
 import java.io.IOException;
@@ -189,7 +189,7 @@ public class OutputFormatTest extends TemplateTest {
         ConditionalTemplateConfigurationFactory tcfNoAutoEsc = new ConditionalTemplateConfigurationFactory(
                 new FileNameGlobMatcher("t.*"),
                 new TemplateConfiguration.Builder()
-                        .autoEscapingPolicy(DISABLE_AUTO_ESCAPING_POLICY)
+                        .autoEscapingPolicy(DISABLE)
                         .build());
 
         {
@@ -289,34 +289,34 @@ public class OutputFormatTest extends TemplateTest {
         addTemplate("tWithHeaderTrue", "<#ftl autoEsc=true>${'a&b'}");
         
         TestConfigurationBuilder cfgB = createDefaultConfigurationBuilder().outputFormat(XMLOutputFormat.INSTANCE);
-        assertEquals(ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+        assertEquals(ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
 
         for (boolean cfgAutoEscaping : new boolean[] { true, false }) {
             if (!cfgAutoEscaping) {
-                cfgB.setAutoEscapingPolicy(DISABLE_AUTO_ESCAPING_POLICY);
+                cfgB.setAutoEscapingPolicy(DISABLE);
             }
             setConfiguration(cfgB.build());
 
             {
                 Template t = getConfiguration().getTemplate("t");
                 if (cfgAutoEscaping) {
-                    assertEquals(ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, t.getAutoEscapingPolicy());
+                    assertEquals(ENABLE_IF_DEFAULT, t.getAutoEscapingPolicy());
                     assertOutput(t, "a&amp;b");
                 } else {
-                    assertEquals(DISABLE_AUTO_ESCAPING_POLICY, t.getAutoEscapingPolicy());
+                    assertEquals(DISABLE, t.getAutoEscapingPolicy());
                     assertOutput(t, "a&b");
                 }
             }
             
             {
                 Template t = getConfiguration().getTemplate("tWithHeaderFalse");
-                assertEquals(DISABLE_AUTO_ESCAPING_POLICY, t.getAutoEscapingPolicy());
+                assertEquals(DISABLE, t.getAutoEscapingPolicy());
                 assertOutput(t, "a&b");
             }
             
             {
                 Template t = getConfiguration().getTemplate("tWithHeaderTrue");
-                assertEquals(ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY, t.getAutoEscapingPolicy());
+                assertEquals(ENABLE_IF_SUPPORTED, t.getAutoEscapingPolicy());
                 assertOutput(t, "a&amp;b");
             }
 
@@ -364,7 +364,7 @@ public class OutputFormatTest extends TemplateTest {
                 assertOutput(commonAutoEscFtl, "&amp;");
             } else {
                 setConfiguration(createDefaultConfigurationBuilder()
-                        .autoEscapingPolicy(DISABLE_AUTO_ESCAPING_POLICY)
+                        .autoEscapingPolicy(DISABLE)
                         .build());
                 assertOutput(commonAutoEscFtl, "&");
             }
@@ -781,19 +781,19 @@ public class OutputFormatTest extends TemplateTest {
         TestConfigurationBuilder cfgB = createDefaultConfigurationBuilder();
         cfgB.setRegisteredCustomOutputFormats(ImmutableList.<OutputFormat>of(
                 SeldomEscapedOutputFormat.INSTANCE, DummyOutputFormat.INSTANCE));
-        assertEquals(ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, cfgB.getAutoEscapingPolicy());
+        assertEquals(ENABLE_IF_DEFAULT, cfgB.getAutoEscapingPolicy());
         
         String commonFTL = "${'.'} ${.autoEsc?c}";
         String notEsced = ". false";
         String esced = "\\. true";
 
-        for (int autoEscPolicy : new int[] {
-                ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY,
-                ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY,
-                DISABLE_AUTO_ESCAPING_POLICY }) {
+        for (AutoEscapingPolicy autoEscPolicy : new AutoEscapingPolicy[] {
+                ENABLE_IF_DEFAULT,
+                ENABLE_IF_SUPPORTED,
+                DISABLE }) {
             cfgB.setAutoEscapingPolicy(autoEscPolicy);
             
-            String sExpted = autoEscPolicy == ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY ? esced : notEsced;
+            String sExpted = autoEscPolicy == ENABLE_IF_SUPPORTED ? esced : notEsced;
             cfgB.setOutputFormat(SeldomEscapedOutputFormat.INSTANCE);
             setConfiguration(cfgB.build());
             assertOutput(commonFTL, sExpted);
@@ -802,7 +802,7 @@ public class OutputFormatTest extends TemplateTest {
             assertOutput("<#ftl outputFormat='seldomEscaped'>" + commonFTL, sExpted);
             assertOutput("<#outputFormat 'seldomEscaped'>" + commonFTL + "</#outputFormat>", sExpted);
             
-            String dExpted = autoEscPolicy == DISABLE_AUTO_ESCAPING_POLICY ? notEsced : esced;
+            String dExpted = autoEscPolicy == DISABLE ? notEsced : esced;
             cfgB.setOutputFormat(DummyOutputFormat.INSTANCE);
             setConfiguration(cfgB.build());
             assertOutput(commonFTL, dExpted);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/ParsingErrorMessagesTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ParsingErrorMessagesTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ParsingErrorMessagesTest.java
index 8f20d6c..c8b1f7d 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/ParsingErrorMessagesTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/ParsingErrorMessagesTest.java
@@ -30,7 +30,7 @@ import org.junit.Test;
 public class ParsingErrorMessagesTest {
 
     private Configuration cfg = new TestConfigurationBuilder()
-            .tagSyntax(ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX)
+            .tagSyntax(TagSyntax.AUTO_DETECT)
             .build();
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/SpecialVariableTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/SpecialVariableTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/SpecialVariableTest.java
index 7e17fc7..99aae83 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/SpecialVariableTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/SpecialVariableTest.java
@@ -64,8 +64,8 @@ public class SpecialVariableTest extends TemplateTest {
     public void testAutoEsc() throws Exception {
         Configuration.Builder cfgB = new Configuration.Builder(Configuration.VERSION_3_0_0);
 
-        for (int autoEscaping : new int[] {
-                ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY, ParsingConfiguration.ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY }) {
+        for (AutoEscapingPolicy autoEscaping : new AutoEscapingPolicy[] {
+                AutoEscapingPolicy.ENABLE_IF_DEFAULT, AutoEscapingPolicy.ENABLE_IF_SUPPORTED }) {
             cfgB.setAutoEscapingPolicy(autoEscaping);
             cfgB.setOutputFormat(HTMLOutputFormat.INSTANCE);
             setConfiguration(cfgB.build());
@@ -81,7 +81,7 @@ public class SpecialVariableTest extends TemplateTest {
             assertOutput("${.autoEsc?c}", "false");
         }
         
-        cfgB.setAutoEscapingPolicy(ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY);
+        cfgB.setAutoEscapingPolicy(AutoEscapingPolicy.DISABLE);
         cfgB.setOutputFormat(HTMLOutputFormat.INSTANCE);
         setConfiguration(cfgB.build());
         assertOutput("${.autoEsc?c}", "false");
@@ -95,7 +95,7 @@ public class SpecialVariableTest extends TemplateTest {
         setConfiguration(cfgB.build());
         assertOutput("${.autoEsc?c}", "false");
 
-        cfgB.setAutoEscapingPolicy(ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY);
+        cfgB.setAutoEscapingPolicy(AutoEscapingPolicy.ENABLE_IF_DEFAULT);
         setConfiguration(cfgB.build());
         assertOutput(
                 "${.autoEsc?c} "

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java
----------------------------------------------------------------------
diff --git a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java
index fa21c76..7b2473b 100644
--- a/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java
+++ b/freemarker-core-test/src/test/java/org/apache/freemarker/core/TagSyntaxVariationsTest.java
@@ -70,8 +70,8 @@ public class TagSyntaxVariationsTest extends TestCase {
             for (int angOrSqu = 0; angOrSqu < 2; angOrSqu++) {
                 Configuration cfg = new TestConfigurationBuilder()
                         .tagSyntax(angOrSqu == 0
-                                ? ParsingConfiguration.ANGLE_BRACKET_TAG_SYNTAX
-                                : ParsingConfiguration.SQUARE_BRACKET_TAG_SYNTAX)
+                                ? TagSyntax.ANGLE_BRACKET
+                                : TagSyntax.SQUARE_BRACKET)
                         .build();
 
                 String dir_xxx = angOrSqu == 0 ? dir_ang : dir_squ;
@@ -108,7 +108,7 @@ public class TagSyntaxVariationsTest extends TestCase {
 
             {
                 Configuration cfg = new TestConfigurationBuilder()
-                        .tagSyntax(ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX)
+                        .tagSyntax(TagSyntax.AUTO_DETECT)
                         .build();
                 for (int perm = 0; perm < 4; perm++) {
                     // All 4 permutations
@@ -123,7 +123,7 @@ public class TagSyntaxVariationsTest extends TestCase {
 
             {
                 Configuration cfg = new TestConfigurationBuilder()
-                        .tagSyntax(ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX)
+                        .tagSyntax(TagSyntax.AUTO_DETECT)
                         .build();
                 // Permutations
                 for (int angOrSquStart = 0; angOrSquStart < 2; angOrSquStart++) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/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 5b1cda9..e4d4390 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
@@ -178,11 +178,11 @@ public class TemplateConfigurationTest {
 
         // Parser-only settings:
         SETTING_ASSIGNMENTS.put("templateLanguage", TemplateLanguage.STATIC_TEXT);
-        SETTING_ASSIGNMENTS.put("tagSyntax", ParsingConfiguration.SQUARE_BRACKET_TAG_SYNTAX);
-        SETTING_ASSIGNMENTS.put("namingConvention", ParsingConfiguration.LEGACY_NAMING_CONVENTION);
+        SETTING_ASSIGNMENTS.put("tagSyntax", TagSyntax.SQUARE_BRACKET);
+        SETTING_ASSIGNMENTS.put("namingConvention", NamingConvention.LEGACY);
         SETTING_ASSIGNMENTS.put("whitespaceStripping", false);
         SETTING_ASSIGNMENTS.put("strictSyntaxMode", false);
-        SETTING_ASSIGNMENTS.put("autoEscapingPolicy", ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY);
+        SETTING_ASSIGNMENTS.put("autoEscapingPolicy", AutoEscapingPolicy.DISABLE);
         SETTING_ASSIGNMENTS.put("outputFormat", HTMLOutputFormat.INSTANCE);
         SETTING_ASSIGNMENTS.put("recognizeStandardFileExtensions", false);
         SETTING_ASSIGNMENTS.put("tabSize", 1);
@@ -541,7 +541,7 @@ public class TemplateConfigurationTest {
         
         {
             TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
-            tcb.setTagSyntax(ParsingConfiguration.SQUARE_BRACKET_TAG_SYNTAX);
+            tcb.setTagSyntax(TagSyntax.SQUARE_BRACKET);
             TemplateConfiguration tc = tcb.build();
             assertOutputWithoutAndWithTC(tc, "[#if true]y[/#if]", "[#if true]y[/#if]", "y");
             testedProps.add(Configuration.ExtendableBuilder.TAG_SYNTAX_KEY_CAMEL_CASE);
@@ -549,7 +549,7 @@ public class TemplateConfigurationTest {
         
         {
             TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
-            tcb.setNamingConvention(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
+            tcb.setNamingConvention(NamingConvention.CAMEL_CASE);
             TemplateConfiguration tc = tcb.build();
             assertOutputWithoutAndWithTC(tc, "<#if true>y<#elseif false>n</#if>", "y", null);
             testedProps.add(Configuration.ExtendableBuilder.NAMING_CONVENTION_KEY_CAMEL_CASE);
@@ -584,7 +584,7 @@ public class TemplateConfigurationTest {
         {
             TemplateConfiguration.Builder tcb = new TemplateConfiguration.Builder();
             tcb.setOutputFormat(XMLOutputFormat.INSTANCE);
-            tcb.setAutoEscapingPolicy(ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY);
+            tcb.setAutoEscapingPolicy(AutoEscapingPolicy.DISABLE);
             TemplateConfiguration tc = tcb.build();
             assertOutputWithoutAndWithTC(tc, "${'a&b'}", "a&b", "a&b");
             testedProps.add(Configuration.ExtendableBuilder.AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE);
@@ -789,7 +789,7 @@ public class TemplateConfigurationTest {
 
             {
                 // Force camelCase:
-                tcb.setNamingConvention(ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION);
+                tcb.setNamingConvention(NamingConvention.CAMEL_CASE);
 
                 TemplateConfiguration tc = tcb.build();
 
@@ -799,7 +799,7 @@ public class TemplateConfigurationTest {
 
             {
                 // Force legacy:
-                tcb.setNamingConvention(ParsingConfiguration.LEGACY_NAMING_CONVENTION);
+                tcb.setNamingConvention(NamingConvention.LEGACY);
 
                 TemplateConfiguration tc = tcb.build();
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirSetting.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
index 68a0672..a2c077f 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTDirSetting.java
@@ -72,19 +72,19 @@ final class ASTDirSetting extends ASTDirective {
                 sb.append(_StringUtil.jQuote(key)).append(".");
                 sb.append(" The allowed setting names are: ");
 
-                int shownNamingConvention;
+                NamingConvention shownNamingConvention;
                 {
-                    int namingConvention = tokenManager.namingConvention;
-                    shownNamingConvention = namingConvention != ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION
-                            ? namingConvention : ParsingConfiguration.LEGACY_NAMING_CONVENTION /* [2.4] CAMEL_CASE */;
+                    NamingConvention namingConvention = tokenManager.namingConvention;
+                    shownNamingConvention = namingConvention != NamingConvention.AUTO_DETECT
+                            ? namingConvention : NamingConvention.LEGACY /* [2.4] CAMEL_CASE */;
                 }
                 
                 boolean first = true;
                 for (String correctName : SETTING_NAMES) {
-                    int correctNameNamingConvention = _StringUtil.getIdentifierNamingConvention(correctName);
-                    if (shownNamingConvention == ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION
-                            ? correctNameNamingConvention != ParsingConfiguration.LEGACY_NAMING_CONVENTION
-                            : correctNameNamingConvention != ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION) {
+                    NamingConvention correctNameNamingConvention = _StringUtil.getIdentifierNamingConvention(correctName);
+                    if (shownNamingConvention == NamingConvention.CAMEL_CASE
+                            ? correctNameNamingConvention != NamingConvention.LEGACY
+                            : correctNameNamingConvention != NamingConvention.CAMEL_CASE) {
                         if (first) {
                             first = false;
                         } else {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltIn.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltIn.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltIn.java
index be559f6..5a276a5 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltIn.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltIn.java
@@ -327,20 +327,20 @@ abstract class ASTExpBuiltIn extends ASTExpression implements Cloneable {
             names.addAll(BUILT_INS_BY_NAME.keySet());
             Collections.sort(names);
             char lastLetter = 0;
-            
-            int shownNamingConvention;
+
+            NamingConvention shownNamingConvention;
             {
-                int namingConvention = tokenManager.namingConvention;
-                shownNamingConvention = namingConvention != ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION
-                        ? namingConvention : ParsingConfiguration.LEGACY_NAMING_CONVENTION /* [2.4] CAMEL_CASE */;
+                NamingConvention namingConvention = tokenManager.namingConvention;
+                shownNamingConvention = namingConvention != NamingConvention.AUTO_DETECT
+                        ? namingConvention : NamingConvention.LEGACY /* [2.4] CAMEL_CASE */;
             }
             
             boolean first = true;
             for (String correctName : names) {
-                int correctNameNamingConvetion = _StringUtil.getIdentifierNamingConvention(correctName);
-                if (shownNamingConvention == ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION
-                        ? correctNameNamingConvetion != ParsingConfiguration.LEGACY_NAMING_CONVENTION
-                        : correctNameNamingConvetion != ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION) {
+                NamingConvention correctNameNamingConvetion = _StringUtil.getIdentifierNamingConvention(correctName);
+                if (shownNamingConvention == NamingConvention.CAMEL_CASE
+                        ? correctNameNamingConvetion != NamingConvention.LEGACY
+                        : correctNameNamingConvetion != NamingConvention.CAMEL_CASE) {
                     if (first) {
                         first = false;
                     } else {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
index ece2099..0dda491 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/ASTExpBuiltInVariable.java
@@ -119,12 +119,12 @@ final class ASTExpBuiltInVariable extends ASTExpression {
             StringBuilder sb = new StringBuilder();
             sb.append("Unknown special variable name: ");
             sb.append(_StringUtil.jQuote(name)).append(".");
-            
-            int shownNamingConvention;
+
+            NamingConvention shownNamingConvention;
             {
-                int namingConvention = tokenManager.namingConvention;
-                shownNamingConvention = namingConvention != ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION
-                        ? namingConvention : ParsingConfiguration.LEGACY_NAMING_CONVENTION /* [2.4] CAMEL_CASE */;
+                NamingConvention namingConvention = tokenManager.namingConvention;
+                shownNamingConvention = namingConvention != NamingConvention.AUTO_DETECT
+                        ? namingConvention : NamingConvention.LEGACY /* [2.4] CAMEL_CASE */;
             }
             
             {
@@ -145,10 +145,10 @@ final class ASTExpBuiltInVariable extends ASTExpression {
             sb.append("\nThe allowed special variable names are: ");
             boolean first = true;
             for (final String correctName : SPEC_VAR_NAMES) {
-                int correctNameNamingConvention = _StringUtil.getIdentifierNamingConvention(correctName);
-                if (shownNamingConvention == ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION
-                        ? correctNameNamingConvention != ParsingConfiguration.LEGACY_NAMING_CONVENTION
-                        : correctNameNamingConvention != ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION) {
+                NamingConvention correctNameNamingConvention = _StringUtil.getIdentifierNamingConvention(correctName);
+                if (shownNamingConvention == NamingConvention.CAMEL_CASE
+                        ? correctNameNamingConvention != NamingConvention.LEGACY
+                        : correctNameNamingConvention != NamingConvention.CAMEL_CASE) {
                     if (first) {
                         first = false;
                     } else {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/AutoEscapingPolicy.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/AutoEscapingPolicy.java b/freemarker-core/src/main/java/org/apache/freemarker/core/AutoEscapingPolicy.java
new file mode 100644
index 0000000..c221559
--- /dev/null
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/AutoEscapingPolicy.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;
+
+import org.apache.freemarker.core.outputformat.MarkupOutputFormat;
+import org.apache.freemarker.core.outputformat.OutputFormat;
+
+/**
+ * Used as the value of the {@link ParsingConfiguration#getAutoEscapingPolicy() autoEscapingPolicy} setting.
+ */
+public enum AutoEscapingPolicy {
+
+    /**
+     * Don't enable auto-escaping, regardless of what the {@link OutputFormat} is. Note that a {@code
+     * <#ftl auto_esc=true>} in the template will override this.
+     */
+    DISABLE,
+
+    /**
+     * Enable auto-escaping if the output format supports it and {@link MarkupOutputFormat#isAutoEscapedByDefault()} is
+     * {@code true}.
+     */
+    ENABLE_IF_DEFAULT,
+
+    /** Enable auto-escaping if the {@link OutputFormat} supports it. */
+    ENABLE_IF_SUPPORTED
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
index 710cad3..05643a0 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/Configuration.java
@@ -74,6 +74,7 @@ import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateNameForma
 import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateResolver;
 import org.apache.freemarker.core.templateresolver.impl.MruCacheStorage;
 import org.apache.freemarker.core.templateresolver.impl.SoftCacheStorage;
+import org.apache.freemarker.core.util.BugException;
 import org.apache.freemarker.core.util.CaptureOutput;
 import org.apache.freemarker.core.util.CommonBuilder;
 import org.apache.freemarker.core.util.HtmlEscape;
@@ -242,10 +243,10 @@ public final class Configuration
     // ParsingConfiguration settings:
 
     private final TemplateLanguage templateLanguage;
-    private final int tagSyntax;
-    private final int namingConvention;
+    private final TagSyntax tagSyntax;
+    private final NamingConvention namingConvention;
     private final boolean whitespaceStripping;
-    private final int autoEscapingPolicy;
+    private final AutoEscapingPolicy autoEscapingPolicy;
     private final OutputFormat outputFormat;
     private final Boolean recognizeStandardFileExtensions;
     private final int tabSize;
@@ -581,7 +582,7 @@ public final class Configuration
 
     /**
      * When auto-escaping should be enabled depending on the current {@linkplain OutputFormat output format};
-     * default is {@link ParsingConfiguration#ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY}. Note that the default output
+     * default is {@link AutoEscapingPolicy#ENABLE_IF_DEFAULT}. Note that the default output
      * format, {@link UndefinedOutputFormat}, is a non-escaping format, so there auto-escaping will be off.
      * Note that the templates can turn auto-escaping on/off locally with directives like {@code <#ftl auto_esc=...>},
      * which will ignore the policy.
@@ -614,13 +615,13 @@ public final class Configuration
      * {@linkplain #getTemplateConfigurations() template configurations setting}. This setting is also overridden by
      * the standard file extensions; see them at {@link #getRecognizeStandardFileExtensions()}.
      *
-     * @see Configuration.Builder#setAutoEscapingPolicy(int)
-     * @see TemplateConfiguration.Builder#setAutoEscapingPolicy(int)
+     * @see Configuration.Builder#setAutoEscapingPolicy(AutoEscapingPolicy)
+     * @see TemplateConfiguration.Builder#setAutoEscapingPolicy(AutoEscapingPolicy)
      * @see Configuration.Builder#setOutputFormat(OutputFormat)
      * @see TemplateConfiguration.Builder#setOutputFormat(OutputFormat)
      */
     @Override
-    public int getAutoEscapingPolicy() {
+    public AutoEscapingPolicy getAutoEscapingPolicy() {
         return autoEscapingPolicy;
     }
 
@@ -779,7 +780,7 @@ public final class Configuration
     }
 
     @Override
-    public int getTagSyntax() {
+    public TagSyntax getTagSyntax() {
         return tagSyntax;
     }
 
@@ -795,20 +796,8 @@ public final class Configuration
         return true;
     }
 
-    // [FM3] Use enum; won't be needed
-    static void validateNamingConventionValue(int namingConvention) {
-        if (namingConvention != ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION
-                && namingConvention != ParsingConfiguration.LEGACY_NAMING_CONVENTION
-                && namingConvention != ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION) {
-            throw new IllegalArgumentException("\"naming_convention\" can only be set to one of these: "
-                    + "Configuration.AUTO_DETECT_NAMING_CONVENTION, "
-                    + "or Configuration.LEGACY_NAMING_CONVENTION"
-                    + "or Configuration.CAMEL_CASE_NAMING_CONVENTION");
-        }
-    }
-
     @Override
-    public int getNamingConvention() {
+    public NamingConvention getNamingConvention() {
         return namingConvention;
     }
 
@@ -1466,7 +1455,7 @@ public final class Configuration
     }
     
     /**
-     * Same as {@link #getSupportedBuiltInNames(int)} with argument {@link #getNamingConvention()}.
+     * Same as {@link #getSupportedBuiltInNames(NamingConvention)} with argument {@link #getNamingConvention()}.
      * 
      * @since 2.3.20
      */
@@ -1480,30 +1469,31 @@ public final class Configuration
      * to be future-proof, it's an instance method. 
      * 
      * @param namingConvention
-     *            One of {@link ParsingConfiguration#AUTO_DETECT_NAMING_CONVENTION},
-     *            {@link ParsingConfiguration#LEGACY_NAMING_CONVENTION}, and
-     *            {@link ParsingConfiguration#CAMEL_CASE_NAMING_CONVENTION}. If it's
-     *            {@link ParsingConfiguration#AUTO_DETECT_NAMING_CONVENTION} then the union
+     *            One of {@link NamingConvention#AUTO_DETECT},
+     *            {@link NamingConvention#LEGACY}, and
+     *            {@link NamingConvention#CAMEL_CASE}. If it's
+     *            {@link NamingConvention#AUTO_DETECT} then the union
      *            of the names in all the naming conventions is returned.
      * 
      * @since 2.3.24
      */
-    public Set<String> getSupportedBuiltInNames(int namingConvention) {
+    public Set<String> getSupportedBuiltInNames(NamingConvention namingConvention) {
         Set<String> names;
-        if (namingConvention == ParsingConfiguration.AUTO_DETECT_NAMING_CONVENTION) {
+        if (namingConvention == NamingConvention.AUTO_DETECT) {
             names = ASTExpBuiltIn.BUILT_INS_BY_NAME.keySet();
-        } else if (namingConvention == ParsingConfiguration.LEGACY_NAMING_CONVENTION) {
+        } else if (namingConvention == NamingConvention.LEGACY) {
             names = ASTExpBuiltIn.SNAKE_CASE_NAMES;
-        } else if (namingConvention == ParsingConfiguration.CAMEL_CASE_NAMING_CONVENTION) {
+        } else if (namingConvention == NamingConvention.CAMEL_CASE) {
             names = ASTExpBuiltIn.CAMEL_CASE_NAMES;
         } else {
-            throw new IllegalArgumentException("Unsupported naming convention constant: " + namingConvention);
+            throw new BugException("Unsupported naming convention constant: " + namingConvention);
         }
         return Collections.unmodifiableSet(names);
     }
     
     /**
-     * Same as {@link #getSupportedBuiltInDirectiveNames(int)} with argument {@link #getNamingConvention()}.
+     * Same as {@link #getSupportedBuiltInDirectiveNames(NamingConvention)} with argument
+     * {@link #getNamingConvention()}.
      * 
      * @since 2.3.21
      */
@@ -1516,23 +1506,23 @@ public final class Configuration
      * <tt>&lt;#directiveName ...&gt;</tt>.
      * 
      * @param namingConvention
-     *            One of {@link ParsingConfiguration#AUTO_DETECT_NAMING_CONVENTION},
-     *            {@link ParsingConfiguration#LEGACY_NAMING_CONVENTION}, and
-     *            {@link ParsingConfiguration#CAMEL_CASE_NAMING_CONVENTION}. If it's
-     *            {@link ParsingConfiguration#AUTO_DETECT_NAMING_CONVENTION} then the union
+     *            One of {@link NamingConvention#AUTO_DETECT},
+     *            {@link NamingConvention#LEGACY}, and
+     *            {@link NamingConvention#CAMEL_CASE}. If it's
+     *            {@link NamingConvention#AUTO_DETECT} then the union
      *            of the names in all the naming conventions is returned. 
      * 
      * @since 2.3.24
      */
-    public Set<String> getSupportedBuiltInDirectiveNames(int namingConvention) {
-        if (namingConvention == AUTO_DETECT_NAMING_CONVENTION) {
+    public Set<String> getSupportedBuiltInDirectiveNames(NamingConvention namingConvention) {
+        if (namingConvention == NamingConvention.AUTO_DETECT) {
             return ASTDirective.ALL_BUILT_IN_DIRECTIVE_NAMES;
-        } else if (namingConvention == LEGACY_NAMING_CONVENTION) {
+        } else if (namingConvention == NamingConvention.LEGACY) {
             return ASTDirective.LEGACY_BUILT_IN_DIRECTIVE_NAMES;
-        } else if (namingConvention == CAMEL_CASE_NAMING_CONVENTION) {
+        } else if (namingConvention == NamingConvention.CAMEL_CASE) {
             return ASTDirective.CAMEL_CASE_BUILT_IN_DIRECTIVE_NAMES;
         } else {
-            throw new IllegalArgumentException("Unsupported naming convention constant: " + namingConvention);
+            throw new BugException("Unsupported naming convention constant: " + namingConvention);
         }
     }
     
@@ -1732,11 +1722,11 @@ public final class Configuration
                     setWhitespaceStripping(_StringUtil.getYesNo(value));
                 } else if (AUTO_ESCAPING_POLICY_KEY_SNAKE_CASE.equals(name) || AUTO_ESCAPING_POLICY_KEY_CAMEL_CASE.equals(name)) {
                     if ("enable_if_default".equals(value) || "enableIfDefault".equals(value)) {
-                        setAutoEscapingPolicy(ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY);
+                        setAutoEscapingPolicy(AutoEscapingPolicy.ENABLE_IF_DEFAULT);
                     } else if ("enable_if_supported".equals(value) || "enableIfSupported".equals(value)) {
-                        setAutoEscapingPolicy(ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY);
+                        setAutoEscapingPolicy(AutoEscapingPolicy.ENABLE_IF_SUPPORTED);
                     } else if ("disable".equals(value)) {
-                        setAutoEscapingPolicy(DISABLE_AUTO_ESCAPING_POLICY);
+                        setAutoEscapingPolicy(AutoEscapingPolicy.DISABLE);
                     } else {
                         throw new ConfigurationSettingValueException( name, value,
                                 "No such predefined auto escaping policy name");
@@ -1860,21 +1850,21 @@ public final class Configuration
                     }
                 } else if (TAG_SYNTAX_KEY_SNAKE_CASE.equals(name) || TAG_SYNTAX_KEY_CAMEL_CASE.equals(name)) {
                     if ("auto_detect".equals(value) || "autoDetect".equals(value)) {
-                        setTagSyntax(AUTO_DETECT_TAG_SYNTAX);
+                        setTagSyntax(TagSyntax.AUTO_DETECT);
                     } else if ("angle_bracket".equals(value) || "angleBracket".equals(value)) {
-                        setTagSyntax(ANGLE_BRACKET_TAG_SYNTAX);
+                        setTagSyntax(TagSyntax.ANGLE_BRACKET);
                     } else if ("square_bracket".equals(value) || "squareBracket".equals(value)) {
-                        setTagSyntax(SQUARE_BRACKET_TAG_SYNTAX);
+                        setTagSyntax(TagSyntax.SQUARE_BRACKET);
                     } else {
                         throw new ConfigurationSettingValueException(name, value, "No such predefined tag syntax name");
                     }
                 } else if (NAMING_CONVENTION_KEY_SNAKE_CASE.equals(name) || NAMING_CONVENTION_KEY_CAMEL_CASE.equals(name)) {
                     if ("auto_detect".equals(value) || "autoDetect".equals(value)) {
-                        setNamingConvention(AUTO_DETECT_NAMING_CONVENTION);
+                        setNamingConvention(NamingConvention.AUTO_DETECT);
                     } else if ("legacy".equals(value)) {
-                        setNamingConvention(LEGACY_NAMING_CONVENTION);
+                        setNamingConvention(NamingConvention.LEGACY);
                     } else if ("camel_case".equals(value) || "camelCase".equals(value)) {
-                        setNamingConvention(CAMEL_CASE_NAMING_CONVENTION);
+                        setNamingConvention(NamingConvention.CAMEL_CASE);
                     } else {
                         throw new ConfigurationSettingValueException(name, value,
                                 "No such predefined naming convention name.");
@@ -2339,8 +2329,8 @@ public final class Configuration
         }
 
         @Override
-        protected int getDefaultTagSyntax() {
-            return ANGLE_BRACKET_TAG_SYNTAX;
+        protected TagSyntax getDefaultTagSyntax() {
+            return TagSyntax.ANGLE_BRACKET;
         }
 
         @Override
@@ -2349,8 +2339,8 @@ public final class Configuration
         }
 
         @Override
-        protected int getDefaultNamingConvention() {
-            return AUTO_DETECT_NAMING_CONVENTION;
+        protected NamingConvention getDefaultNamingConvention() {
+            return NamingConvention.AUTO_DETECT;
         }
 
         @Override
@@ -2413,8 +2403,8 @@ public final class Configuration
         }
 
         @Override
-        protected int getDefaultAutoEscapingPolicy() {
-            return ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY;
+        protected AutoEscapingPolicy getDefaultAutoEscapingPolicy() {
+            return AutoEscapingPolicy.ENABLE_IF_DEFAULT;
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
index 00a387d..a053d92 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableParsingAndProcessingConfiguration.java
@@ -33,10 +33,10 @@ public abstract class MutableParsingAndProcessingConfiguration<
         implements ParsingAndProcessingConfiguration {
 
     private TemplateLanguage templateLanguage;
-    private Integer tagSyntax;
-    private Integer namingConvention;
+    private TagSyntax tagSyntax;
+    private NamingConvention namingConvention;
     private Boolean whitespaceStripping;
-    private Integer autoEscapingPolicy;
+    private AutoEscapingPolicy autoEscapingPolicy;
     private Boolean recognizeStandardFileExtensions;
     private OutputFormat outputFormat;
     private Charset sourceEncoding;
@@ -48,28 +48,19 @@ public abstract class MutableParsingAndProcessingConfiguration<
 
     /**
      * Setter pair of {@link #getTagSyntax()}.
+     *
+     * @param tagSyntax
+     *         Can't be {@code null}
      */
-    public void setTagSyntax(int tagSyntax) {
-        valideTagSyntaxValue(tagSyntax);
+    public void setTagSyntax(TagSyntax tagSyntax) {
+        _NullArgumentException.check("tagSyntax", tagSyntax);
         this.tagSyntax = tagSyntax;
     }
 
-    // [FM3] Use enum; won't be needed
-    static void valideTagSyntaxValue(int tagSyntax) {
-        if (tagSyntax != ParsingConfiguration.AUTO_DETECT_TAG_SYNTAX
-                && tagSyntax != ParsingConfiguration.SQUARE_BRACKET_TAG_SYNTAX
-                && tagSyntax != ParsingConfiguration.ANGLE_BRACKET_TAG_SYNTAX) {
-            throw new IllegalArgumentException(
-                    "\"tagSyntax\" can only be set to one of these: "
-                    + "Configuration.AUTO_DETECT_TAG_SYNTAX, Configuration.ANGLE_BRACKET_SYNTAX, "
-                    + "or Configuration.SQUARE_BRACKET_SYNTAX");
-        }
-    }
-
     /**
-     * Fluent API equivalent of {@link #tagSyntax(int)}
+     * Fluent API equivalent of {@link #tagSyntax(TagSyntax)}
      */
-    public SelfT tagSyntax(int tagSyntax) {
+    public SelfT tagSyntax(TagSyntax tagSyntax) {
         setTagSyntax(tagSyntax);
         return self();
     }
@@ -83,7 +74,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
     }
 
     @Override
-    public int getTagSyntax() {
+    public TagSyntax getTagSyntax() {
         return isTagSyntaxSet() ? tagSyntax : getDefaultTagSyntax();
     }
 
@@ -91,7 +82,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
      * Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
      * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
      */
-    protected abstract int getDefaultTagSyntax();
+    protected abstract TagSyntax getDefaultTagSyntax();
 
     @Override
     public boolean isTagSyntaxSet() {
@@ -140,16 +131,19 @@ public abstract class MutableParsingAndProcessingConfiguration<
 
     /**
      * Setter pair of {@link #getNamingConvention()}.
+     *
+     * @param namingConvention
+     *         Can't be {@code null}
      */
-    public void setNamingConvention(int namingConvention) {
-        Configuration.validateNamingConventionValue(namingConvention);
+    public void setNamingConvention(NamingConvention namingConvention) {
+        _NullArgumentException.check("namingConvention", namingConvention);
         this.namingConvention = namingConvention;
     }
 
     /**
-     * Fluent API equivalent of {@link #setNamingConvention(int)}
+     * Fluent API equivalent of {@link #setNamingConvention(NamingConvention)}
      */
-    public SelfT namingConvention(int namingConvention) {
+    public SelfT namingConvention(NamingConvention namingConvention) {
         setNamingConvention(namingConvention);
         return self();
     }
@@ -163,10 +157,10 @@ public abstract class MutableParsingAndProcessingConfiguration<
     }
 
     /**
-     * The getter pair of {@link #setNamingConvention(int)}.
+     * The getter pair of {@link #setNamingConvention(NamingConvention)}.
      */
     @Override
-    public int getNamingConvention() {
+    public NamingConvention getNamingConvention() {
          return isNamingConventionSet() ? namingConvention
                 : getDefaultNamingConvention();
     }
@@ -175,7 +169,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
      * Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
      * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
      */
-    protected abstract int getDefaultNamingConvention();
+    protected abstract NamingConvention getDefaultNamingConvention();
 
     /**
      * Tells if this setting is set directly in this object or its value is inherited from the parent parsing configuration..
@@ -233,28 +227,15 @@ public abstract class MutableParsingAndProcessingConfiguration<
     /**
      * * Setter pair of {@link #getAutoEscapingPolicy()}.
      */
-    public void setAutoEscapingPolicy(int autoEscapingPolicy) {
-        validateAutoEscapingPolicyValue(autoEscapingPolicy);
+    public void setAutoEscapingPolicy(AutoEscapingPolicy autoEscapingPolicy) {
+        _NullArgumentException.check("autoEscapingPolicy", autoEscapingPolicy);
         this.autoEscapingPolicy = autoEscapingPolicy;
     }
 
-    // [FM3] Use enum; won't be needed
-    static void validateAutoEscapingPolicyValue(int autoEscapingPolicy) {
-        if (autoEscapingPolicy != ParsingConfiguration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY
-                && autoEscapingPolicy != ParsingConfiguration.ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY
-                && autoEscapingPolicy != ParsingConfiguration.DISABLE_AUTO_ESCAPING_POLICY) {
-            throw new IllegalArgumentException(
-                    "\"tagSyntax\" can only be set to one of these: "
-                            + "Configuration.ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY,"
-                            + "Configuration.ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY, "
-                            + "or Configuration.DISABLE_AUTO_ESCAPING_POLICY");
-        }
-    }
-
     /**
-     * Fluent API equivalent of {@link #setAutoEscapingPolicy(int)}
+     * Fluent API equivalent of {@link #setAutoEscapingPolicy(AutoEscapingPolicy)}
      */
-    public SelfT autoEscapingPolicy(int autoEscapingPolicy) {
+    public SelfT autoEscapingPolicy(AutoEscapingPolicy autoEscapingPolicy) {
         setAutoEscapingPolicy(autoEscapingPolicy);
         return self();
     }
@@ -268,10 +249,10 @@ public abstract class MutableParsingAndProcessingConfiguration<
     }
 
     /**
-     * The getter pair of {@link #setAutoEscapingPolicy(int)}.
+     * The getter pair of {@link #setAutoEscapingPolicy(AutoEscapingPolicy)}.
      */
     @Override
-    public int getAutoEscapingPolicy() {
+    public AutoEscapingPolicy getAutoEscapingPolicy() {
          return isAutoEscapingPolicySet() ? autoEscapingPolicy : getDefaultAutoEscapingPolicy();
     }
 
@@ -279,7 +260,7 @@ public abstract class MutableParsingAndProcessingConfiguration<
      * Returns the value the getter method returns when the setting is not set, possibly by inheriting the setting value
      * from another {@link ParsingConfiguration}, or throws {@link SettingValueNotSetException}.
      */
-    protected abstract int getDefaultAutoEscapingPolicy();
+    protected abstract AutoEscapingPolicy getDefaultAutoEscapingPolicy();
 
     /**
      * Tells if this setting is set directly in this object or its value is inherited from the parent parsing configuration..

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
index c5c4c82..6fc904f 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/MutableProcessingConfiguration.java
@@ -1636,10 +1636,10 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
      *   <li><p>{@code "auto_escaping"}:
      *       See {@link Configuration#getAutoEscapingPolicy()}
      *       <br>String value: {@code "enable_if_default"} or {@code "enableIfDefault"} for
-     *       {@link ParsingConfiguration#ENABLE_IF_DEFAULT_AUTO_ESCAPING_POLICY},
+     *       {@link AutoEscapingPolicy#ENABLE_IF_DEFAULT},
      *       {@code "enable_if_supported"} or {@code "enableIfSupported"} for
-     *       {@link ParsingConfiguration#ENABLE_IF_SUPPORTED_AUTO_ESCAPING_POLICY}
-     *       {@code "disable"} for {@link ParsingConfiguration#DISABLE_AUTO_ESCAPING_POLICY}.
+     *       {@link AutoEscapingPolicy#ENABLE_IF_SUPPORTED}
+     *       {@code "disable"} for {@link AutoEscapingPolicy#DISABLE}.
      *       
      *   <li><p>{@code "sourceEncoding"}:
      *       See {@link Configuration#getSourceEncoding()}; since 2.3.26 also accepts value "JVM default"
@@ -1796,7 +1796,7 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
      *            The keys and values can be any kind of expression, like even object builder expressions.
      *            The resulting Java object will be a {@link Map} that keeps the item order ({@link LinkedHashMap} as
      *            of this writing).
-     *        <li>A reference to a public static filed, like {@code Configuration.AUTO_DETECT_TAG_SYNTAX} or
+     *        <li>A reference to a public static filed, like {@code Configuration.AUTO_DETECT} or
      *            {@code com.example.MyClass.MY_CONSTANT}.
      *        <li>An object builder expression. That is, object builder expressions can be nested into each other. 
      *      </ul>
@@ -1815,7 +1815,8 @@ public abstract class MutableProcessingConfiguration<SelfT extends MutableProces
      *     {@link AndMatcher}, {@link OrMatcher}, {@link NotMatcher}, {@link ConditionalTemplateConfigurationFactory},
      *     {@link MergingTemplateConfigurationFactory}, {@link FirstMatchTemplateConfigurationFactory},
      *     {@link HTMLOutputFormat}, {@link XMLOutputFormat}, {@link RTFOutputFormat}, {@link PlainTextOutputFormat},
-     *     {@link UndefinedOutputFormat}, {@link Configuration}, {@link TemplateLanguage}.
+     *     {@link UndefinedOutputFormat}, {@link Configuration}, {@link TemplateLanguage}, {@link NamingConvention},
+     *     {@link TagSyntax}.
      *   </li>
      *   <li>
      *     <p>{@link TimeZone} objects can be created like {@code TimeZone("UTC")}, despite that there's no a such

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/NamingConvention.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/NamingConvention.java b/freemarker-core/src/main/java/org/apache/freemarker/core/NamingConvention.java
new file mode 100644
index 0000000..5c347c5
--- /dev/null
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/NamingConvention.java
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+/**
+ * Used as the value of the {@link ParsingConfiguration#getNamingConvention()} namingConvention} setting.
+ */
+public enum NamingConvention  {
+    AUTO_DETECT,
+    LEGACY,
+    CAMEL_CASE;
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/99ac6973/freemarker-core/src/main/java/org/apache/freemarker/core/OutputFormatBoundBuiltIn.java
----------------------------------------------------------------------
diff --git a/freemarker-core/src/main/java/org/apache/freemarker/core/OutputFormatBoundBuiltIn.java b/freemarker-core/src/main/java/org/apache/freemarker/core/OutputFormatBoundBuiltIn.java
index c67f2c0..4193ca6 100644
--- a/freemarker-core/src/main/java/org/apache/freemarker/core/OutputFormatBoundBuiltIn.java
+++ b/freemarker-core/src/main/java/org/apache/freemarker/core/OutputFormatBoundBuiltIn.java
@@ -25,9 +25,9 @@ import org.apache.freemarker.core.util._NullArgumentException;
 abstract class OutputFormatBoundBuiltIn extends SpecialBuiltIn {
     
     protected OutputFormat outputFormat;
-    protected int autoEscapingPolicy;
+    protected AutoEscapingPolicy autoEscapingPolicy;
     
-    void bindToOutputFormat(OutputFormat outputFormat, int autoEscapingPolicy) {
+    void bindToOutputFormat(OutputFormat outputFormat, AutoEscapingPolicy autoEscapingPolicy) {
         _NullArgumentException.check(outputFormat);
         this.outputFormat = outputFormat;
         this.autoEscapingPolicy = autoEscapingPolicy;


Mime
View raw message