freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject incubator-freemarker git commit: Removed Template.templateLanguageVersion, as we solely rely on incompatibleImprovements instead. Some minor cleanup elsewhere.
Date Thu, 06 Apr 2017 09:07:23 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/3 88baea20c -> 5dfdcb3e0


Removed Template.templateLanguageVersion, as we solely rely on incompatibleImprovements instead.
Some minor cleanup elsewhere.


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

Branch: refs/heads/3
Commit: 5dfdcb3e07e4bced4fa9d4c531a53d84b6e32c9b
Parents: 88baea2
Author: ddekany <ddekany@apache.org>
Authored: Thu Apr 6 11:07:11 2017 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Thu Apr 6 11:07:11 2017 +0200

----------------------------------------------------------------------
 .../org/apache/freemarker/core/Template.java    | 21 +------
 src/main/javacc/FTL.jj                          |  2 +-
 src/manual/en_US/FM3-CHANGE-LOG.txt             |  1 +
 .../core/TemplateLanguageVersionTest.java       | 59 --------------------
 4 files changed, 4 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5dfdcb3e/src/main/java/org/apache/freemarker/core/Template.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/Template.java b/src/main/java/org/apache/freemarker/core/Template.java
index dcde5d9..c28346d 100644
--- a/src/main/java/org/apache/freemarker/core/Template.java
+++ b/src/main/java/org/apache/freemarker/core/Template.java
@@ -39,7 +39,6 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
-import java.util.Vector;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.freemarker.core.arithmetic.ArithmeticEngine;
@@ -85,10 +84,10 @@ public class Template extends MutableProcessingConfiguration<Template>
implement
     private static final int READER_BUFFER_SIZE = 8192;
     
     private Map macros = new HashMap();
-    private List imports = new Vector();
+    private List imports = new ArrayList();
     private ASTElement rootElement;
     private Charset sourceEncoding;
-    String defaultNS;
+    private String defaultNS;
     private Serializable customLookupCondition;
     private int actualTagSyntax;
     private int actualNamingConvention;
@@ -100,7 +99,6 @@ public class Template extends MutableProcessingConfiguration<Template>
implement
     private final ParserConfiguration parserConfiguration;
     private Map prefixToNamespaceURILookup = new HashMap();
     private Map namespaceURIToPrefixLookup = new HashMap();
-    private Version templateLanguageVersion;
 
     private final Object lock = new Object();
     private final ConcurrentHashMap<CustomStateKey, Object> customStateMap = new ConcurrentHashMap<>(0);
@@ -114,7 +112,6 @@ public class Template extends MutableProcessingConfiguration<Template>
implement
         _NullArgumentException.check("cfg", cfg);
         this.name = name;
         this.sourceName = sourceName;
-        templateLanguageVersion = normalizeTemplateLanguageVersion(cfg.getIncompatibleImprovements());
         if (customParserConfiguration instanceof TemplateConfiguration.Builder) {
             throw new IllegalArgumentException("Using TemplateConfiguration.Builder as Template
constructor "
                     + "argument is not allowed; the TemplateConfiguration that it has built
is needed instead.");
@@ -336,11 +333,6 @@ public class Template extends MutableProcessingConfiguration<Template>
implement
         return template;
     }
 
-    private static Version normalizeTemplateLanguageVersion(Version incompatibleImprovements)
{
-        _CoreAPI.checkVersionNotNullAndSupported(incompatibleImprovements);
-        return Configuration.VERSION_3_0_0;
-    }
-
     /**
      * Executes template, using the data-model provided, writing the generated output to
the supplied {@link Writer}.
      * 
@@ -568,15 +560,6 @@ public class Template extends MutableProcessingConfiguration<Template>
implement
     public ParserConfiguration getParserConfiguration() {
         return parserConfiguration;
     }
-    
-    /**
-     * Return the template language (FTL) version used by this template.
-     * For now (2.3.21) this is the same as {@link Configuration#getIncompatibleImprovements()},
except
-     * that it's normalized to the lowest version where the template language was changed.
-     */
-    Version getTemplateLanguageVersion() {
-        return templateLanguageVersion;
-    }
 
     /**
      * @param sourceEncoding

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5dfdcb3e/src/main/javacc/FTL.jj
----------------------------------------------------------------------
diff --git a/src/main/javacc/FTL.jj b/src/main/javacc/FTL.jj
index 0e79431..ee3ac75 100644
--- a/src/main/javacc/FTL.jj
+++ b/src/main/javacc/FTL.jj
@@ -3901,7 +3901,7 @@ void HeaderElement() :
                                         + "charset is known by the runtime environment):
" + vs,
                                         exp);
                             } catch (Exception e) {
-                                throw new ParseException("Failed resolve charset name: "
+ vs, exp, e
+                                throw new ParseException("Failed to resolve charset name:
" + vs, exp, e
                                         .getCause());
                             }
                             if (template.getSourceEncoding() != null

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5dfdcb3e/src/manual/en_US/FM3-CHANGE-LOG.txt
----------------------------------------------------------------------
diff --git a/src/manual/en_US/FM3-CHANGE-LOG.txt b/src/manual/en_US/FM3-CHANGE-LOG.txt
index ccf69b1..bc23af2 100644
--- a/src/manual/en_US/FM3-CHANGE-LOG.txt
+++ b/src/manual/en_US/FM3-CHANGE-LOG.txt
@@ -195,3 +195,4 @@ the FreeMarer 3 changelog here:
   - In "object builder expressions" Charset values can now be constructed like `Charset("ISO-8859-5")`.
     Note that as the type of the settings have changed, now you can't just write something
like
     `TemplateConfiguration(sourceEncoding = "UTF-8")`, but `TemplateConfiguration(sourceEncoding
= Charset("UTF-8"))`.
+- Removed Template.templateLanguageVersion, as we solely rely on incompatibleImprovements
instead.

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/5dfdcb3e/src/test/java/org/apache/freemarker/core/TemplateLanguageVersionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/TemplateLanguageVersionTest.java b/src/test/java/org/apache/freemarker/core/TemplateLanguageVersionTest.java
deleted file mode 100644
index 2adadc0..0000000
--- a/src/test/java/org/apache/freemarker/core/TemplateLanguageVersionTest.java
+++ /dev/null
@@ -1,59 +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;
-
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-
-import org.apache.freemarker.core.templateresolver.impl.StringTemplateLoader;
-import org.apache.freemarker.test.util.TestUtil;
-import org.junit.Test;
-public class TemplateLanguageVersionTest {
-
-    @Test
-    public void testDefaultVersion() throws IOException {
-        testDefaultWithVersion(Configuration.VERSION_3_0_0, Configuration.VERSION_3_0_0);
-        try {
-            testDefaultWithVersion(TestUtil.getClosestFutureVersion(), Configuration.VERSION_3_0_0);
-            fail("Maybe you need to update this test for the new FreeMarker version");
-        } catch (IllegalArgumentException e) {
-            assertThat(e.getMessage(), containsString("version"));
-        }
-    }
-
-    private void testDefaultWithVersion(Version cfgV, Version ftlV) throws IOException {
-        Configuration cfg = createConfiguration(cfgV);
-        Template t = new Template("adhoc", "foo", cfg);
-        assertEquals(ftlV, t.getTemplateLanguageVersion());
-        t = cfg.getTemplate("test.ftl");
-        assertEquals(ftlV, t.getTemplateLanguageVersion());
-    }
-    
-    private Configuration createConfiguration(Version version) {
-        Configuration cfg = new Configuration(version);
-        StringTemplateLoader stl = new StringTemplateLoader();
-        stl.putTemplate("test.ftl", "foo");
-        cfg.setTemplateLoader(stl);
-        return cfg;
-    }
-    
-}


Mime
View raw message