freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [15/54] [partial] incubator-freemarker git commit: Unifying the o.a.f.core and o.a.f.core.ast
Date Thu, 23 Feb 2017 21:35:42 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/ast/_ObjectBuilderSettingEvaluator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/_ObjectBuilderSettingEvaluator.java b/src/main/java/org/apache/freemarker/core/ast/_ObjectBuilderSettingEvaluator.java
deleted file mode 100644
index a814168..0000000
--- a/src/main/java/org/apache/freemarker/core/ast/_ObjectBuilderSettingEvaluator.java
+++ /dev/null
@@ -1,1058 +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.ast;
-
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.Version;
-import org.apache.freemarker.core.model.TemplateHashModel;
-import org.apache.freemarker.core.model.TemplateMethodModelEx;
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
-import org.apache.freemarker.core.model.impl.SimpleObjectWrapper;
-import org.apache.freemarker.core.model.impl.beans.BeansWrapper;
-import org.apache.freemarker.core.templateresolver.AndMatcher;
-import org.apache.freemarker.core.templateresolver.ConditionalTemplateConfigurationFactory;
-import org.apache.freemarker.core.templateresolver.FileExtensionMatcher;
-import org.apache.freemarker.core.templateresolver.FileNameGlobMatcher;
-import org.apache.freemarker.core.templateresolver.FirstMatchTemplateConfigurationFactory;
-import org.apache.freemarker.core.templateresolver.MergingTemplateConfigurationFactory;
-import org.apache.freemarker.core.templateresolver.NotMatcher;
-import org.apache.freemarker.core.templateresolver.OrMatcher;
-import org.apache.freemarker.core.templateresolver.PathGlobMatcher;
-import org.apache.freemarker.core.templateresolver.PathRegexMatcher;
-import org.apache.freemarker.core.util.FTLUtil;
-import org.apache.freemarker.core.util.GenericParseException;
-import org.apache.freemarker.core.util.WriteProtectable;
-import org.apache.freemarker.core.util._ClassUtil;
-import org.apache.freemarker.core.util._StringUtil;
-
-/**
- * Don't use this; used internally by FreeMarker, might changes without notice.
- * 
- * Evaluates object builder expressions used in configuration {@link Properties}.
- * It should be replaced with FTL later (when it was improved to be practical for this), so the syntax should be
- * a subset of the future FTL syntax. This is also why this syntax is restrictive; it shouldn't accept anything that
- * FTL will not.
- */
-// Java 5: use generics for expectedClass
-// Java 5: Introduce ObjectBuilder interface
-public class _ObjectBuilderSettingEvaluator {
-    
-    private static final String INSTANCE_FIELD_NAME = "INSTANCE";
-
-    private static final String BUILD_METHOD_NAME = "build";
-
-    private static final String BUILDER_CLASS_POSTFIX = "Builder";
-
-    private static Map<String,String> SHORTHANDS;
-    
-    private static final Object VOID = new Object();
-
-    private final String src;
-    private final Class expectedClass;
-    private final boolean allowNull;
-    private final _SettingEvaluationEnvironment env;
-
-    // Parser state:
-    private int pos;
-    
-    private _ObjectBuilderSettingEvaluator(
-            String src, int pos, Class expectedClass, boolean allowNull, _SettingEvaluationEnvironment env) {
-        this.src = src;
-        this.pos = pos;
-        this.expectedClass = expectedClass;
-        this.allowNull = allowNull;
-        this.env = env;
-    }
-
-    public static Object eval(String src, Class expectedClass, boolean allowNull, _SettingEvaluationEnvironment env)
-            throws _ObjectBuilderSettingEvaluationException,
-            ClassNotFoundException, InstantiationException, IllegalAccessException {
-        return new _ObjectBuilderSettingEvaluator(src, 0, expectedClass, allowNull, env).eval();
-    }
-
-    /**
-     * Used for getting a list of setting assignments (like {@code (x=1, y=2)}) from an existing string, and apply it on
-     * an existing bean.
-     * 
-     * @return The location of the next character to process.
-     */
-    public static int configureBean(
-            String argumentListSrc, int posAfterOpenParen, Object bean, _SettingEvaluationEnvironment env)
-            throws _ObjectBuilderSettingEvaluationException,
-            ClassNotFoundException, InstantiationException, IllegalAccessException {
-        return new _ObjectBuilderSettingEvaluator(
-                argumentListSrc, posAfterOpenParen, bean.getClass(), true, env).configureBean(bean);
-    }
-    
-    private Object eval() throws _ObjectBuilderSettingEvaluationException,
-            ClassNotFoundException, InstantiationException, IllegalAccessException {
-        Object value;
-        
-        skipWS();
-        value = ensureEvaled(fetchValue(false, true, false, true));
-        skipWS();
-        
-        if (pos != src.length()) {
-            throw new _ObjectBuilderSettingEvaluationException("end-of-expression", src, pos);
-        }
-        
-        if (value == null && !allowNull) {
-            throw new _ObjectBuilderSettingEvaluationException("Value can't be null.");
-        }
-        if (value != null && !expectedClass.isInstance(value)) {
-            throw new _ObjectBuilderSettingEvaluationException("The resulting object (of class "
-                    + value.getClass() + ") is not a(n) " + expectedClass.getName() + ".");
-        }
-        
-        return value;
-    }
-    
-    private int configureBean(Object bean) throws _ObjectBuilderSettingEvaluationException,
-            ClassNotFoundException, InstantiationException, IllegalAccessException {
-        final PropertyAssignmentsExpression propAssignments = new PropertyAssignmentsExpression(bean);
-        fetchParameterListInto(propAssignments);
-        skipWS();
-        propAssignments.eval();
-        return pos;
-    }
-
-    private Object ensureEvaled(Object value) throws _ObjectBuilderSettingEvaluationException {
-        return value instanceof SettingExpression ? ((SettingExpression) value).eval() : value;
-    }
-
-    private Object fetchBuilderCall(boolean optional, boolean topLevel)
-            throws _ObjectBuilderSettingEvaluationException {
-        int startPos = pos;
-        
-        BuilderCallExpression exp = new BuilderCallExpression();
-        // We need the canBeStaticField/mustBeStaticFiled complication to deal with legacy syntax where parentheses
-        // weren't required for constructor calls.
-        exp.canBeStaticField = true;
-        
-        final String fetchedClassName = fetchClassName(optional);
-        {
-            if (fetchedClassName == null) {
-                if (!optional) {
-                    throw new _ObjectBuilderSettingEvaluationException("class name", src, pos);
-                }
-                return VOID;
-            }
-            exp.className = shorthandToFullQualified(fetchedClassName);
-            if (!fetchedClassName.equals(exp.className)) {
-                exp.canBeStaticField = false;
-            }
-        }
-        
-        skipWS();
-        
-        char openParen = fetchOptionalChar("(");
-        // Only the top-level expression can omit the "(...)"
-        if (openParen == 0 && !topLevel) {
-            if (fetchedClassName.indexOf('.') != -1) {
-                exp.mustBeStaticField = true;
-            } else {
-                pos = startPos;
-                return VOID;
-            }
-        }
-    
-        if (openParen != 0) {
-            fetchParameterListInto(exp);
-            exp.canBeStaticField = false;
-        }
-        
-        return exp;
-    }
-
-    private void fetchParameterListInto(ExpressionWithParameters exp) throws _ObjectBuilderSettingEvaluationException {
-        skipWS();
-        if (fetchOptionalChar(")") != ')') { 
-            do {
-                skipWS();
-                
-                Object paramNameOrValue = fetchValue(false, false, true, false);
-                if (paramNameOrValue != VOID) {
-                    skipWS();
-                    if (paramNameOrValue instanceof Name) {
-                        exp.namedParamNames.add(((Name) paramNameOrValue).name);
-                        
-                        skipWS();
-                        fetchRequiredChar("=");
-                        skipWS();
-                        
-                        Object paramValue = fetchValue(false, false, true, true);
-                        exp.namedParamValues.add(ensureEvaled(paramValue));
-                    } else {
-                        if (!exp.namedParamNames.isEmpty()) {
-                            throw new _ObjectBuilderSettingEvaluationException(
-                                    "Positional parameters must precede named parameters");
-                        }
-                        if (!exp.getAllowPositionalParameters()) {
-                            throw new _ObjectBuilderSettingEvaluationException(
-                                    "Positional parameters not supported here");
-                        }
-                        exp.positionalParamValues.add(ensureEvaled(paramNameOrValue));
-                    }
-                    
-                    skipWS();
-                }
-            } while (fetchRequiredChar(",)") == ',');
-        }
-    }
-
-    private Object fetchValue(boolean optional, boolean topLevel, boolean resultCoerced, boolean resolveVariables)
-            throws _ObjectBuilderSettingEvaluationException {
-        if (pos < src.length()) {
-            Object val = fetchNumberLike(true, resultCoerced);
-            if (val != VOID) {
-                return val;
-            }
-    
-            val = fetchStringLiteral(true);
-            if (val != VOID) {
-                return val;
-            }
-
-            val = fetchListLiteral(true);
-            if (val != VOID) {
-                return val;
-            }
-
-            val = fetchMapLiteral(true);
-            if (val != VOID) {
-                return val;
-            }
-            
-            val = fetchBuilderCall(true, topLevel);
-            if (val != VOID) {
-                return val;
-            }
-            
-            String name = fetchSimpleName(true);
-            if (name != null) {
-                val = keywordToValueOrVoid(name);
-                if (val != VOID) {
-                    return val;
-                }
-                
-                if (resolveVariables) {
-                    // Not supported currently...
-                    throw new _ObjectBuilderSettingEvaluationException("Can't resolve variable reference: " + name);
-                } else {
-                    return new Name(name);
-                }
-            }
-        }
-        
-        if (optional) {
-            return VOID;
-        } else {
-            throw new _ObjectBuilderSettingEvaluationException("value or name", src, pos);
-        }
-    }
-
-    private boolean isKeyword(String name) {
-        return keywordToValueOrVoid(name) != VOID;
-    }
-    
-    private Object keywordToValueOrVoid(String name) {
-        if (name.equals("true")) return Boolean.TRUE;
-        if (name.equals("false")) return Boolean.FALSE;
-        if (name.equals("null")) return null;
-        return VOID;
-    }
-
-    private String fetchSimpleName(boolean optional) throws _ObjectBuilderSettingEvaluationException {
-        char c = pos < src.length() ? src.charAt(pos) : 0;
-        if (!isIdentifierStart(c)) {
-            if (optional) {
-                return null;
-            } else {
-                throw new _ObjectBuilderSettingEvaluationException("class name", src, pos);
-            }
-        }
-        int startPos = pos;
-        pos++;
-        
-        seekClassNameEnd: while (true) {
-            if (pos == src.length()) {
-                break seekClassNameEnd;
-            }
-            c = src.charAt(pos);
-            if (!isIdentifierMiddle(c)) {
-                break seekClassNameEnd;
-            }
-            pos++;
-        }
-        
-        return src.substring(startPos, pos);
-    }
-
-    private String fetchClassName(boolean optional) throws _ObjectBuilderSettingEvaluationException {
-        int startPos = pos;
-        StringBuilder sb = new StringBuilder();
-        do {
-            String name = fetchSimpleName(true);
-            if (name == null) {
-                if (!optional) {
-                    throw new _ObjectBuilderSettingEvaluationException("name", src, pos);
-                } else {
-                    pos = startPos;
-                    return null;
-                }
-            }
-            sb.append(name);
-            
-            skipWS();
-            
-            if (pos >= src.length() || src.charAt(pos) != '.') {
-                break;
-            }
-            sb.append('.');
-            pos++;
-            
-            skipWS();
-        } while (true);
-        
-        String className = sb.toString();
-        if (isKeyword(className)) {
-            pos = startPos;
-            return null;
-        }
-        return className;
-    }
-
-    private Object fetchNumberLike(boolean optional, boolean resultCoerced)
-            throws _ObjectBuilderSettingEvaluationException {
-        int startPos = pos;
-        boolean isVersion = false;
-        boolean hasDot = false;
-        seekTokenEnd: while (true) {
-            if (pos == src.length()) {
-                break seekTokenEnd;
-            }
-            char c = src.charAt(pos);
-            if (c == '.') {
-                if (hasDot) {
-                    // More than one dot
-                    isVersion = true;
-                } else {
-                    hasDot = true;
-                }
-            } else if (!(isASCIIDigit(c) || c == '-')) {
-                break seekTokenEnd;
-            }
-            pos++;
-        }
-        
-        if (startPos == pos) {
-            if (optional) {
-                return VOID;
-            } else {
-                throw new _ObjectBuilderSettingEvaluationException("number-like", src, pos);
-            }
-        }
-        
-        String numStr = src.substring(startPos, pos);
-        if (isVersion) {
-            try {
-                return new Version(numStr);
-            } catch (IllegalArgumentException e) {
-                throw new _ObjectBuilderSettingEvaluationException("Malformed version number: " + numStr, e);
-            }
-        } else {
-            // For example, in 1.0f, numStr is "1.0", and typePostfix is "f".
-            String typePostfix = null;
-            seekTypePostfixEnd: while (true) {
-                if (pos == src.length()) {
-                    break seekTypePostfixEnd;
-                }
-                char c = src.charAt(pos);
-                if (Character.isLetter(c)) {
-                    if (typePostfix == null) {
-                        typePostfix = String.valueOf(c);
-                    } else {
-                        typePostfix += c; 
-                    }
-                } else {
-                    break seekTypePostfixEnd;
-                }
-                pos++;
-            }
-            
-            try {
-                if (numStr.endsWith(".")) {
-                    throw new NumberFormatException("A number can't end with a dot");
-                }
-                if (numStr.startsWith(".") || numStr.startsWith("-.")  || numStr.startsWith("+.")) {
-                    throw new NumberFormatException("A number can't start with a dot");
-                }
-
-                if (typePostfix == null) {
-                    // Auto-detect type
-                    if (numStr.indexOf('.') == -1) {
-                        BigInteger biNum = new BigInteger(numStr);
-                        final int bitLength = biNum.bitLength();  // Doesn't include sign bit
-                        if (bitLength <= 31) {
-                            return Integer.valueOf(biNum.intValue());
-                        } else if (bitLength <= 63) {
-                            return Long.valueOf(biNum.longValue());
-                        } else {
-                            return biNum;
-                        }
-                    } else {
-                        if (resultCoerced) {
-                            // The FTL way (BigDecimal is loseless, and it will be coerced to the target type later):
-                            return new BigDecimal(numStr);
-                        } else {
-                            // The Java way (lossy but familiar):
-                            return Double.valueOf(numStr);
-                        }
-                    }
-                } else { // Has explicitly specified type
-                    if (typePostfix.equalsIgnoreCase("l")) {
-                        return Long.valueOf(numStr);
-                    } else if (typePostfix.equalsIgnoreCase("bi")) {
-                        return new BigInteger(numStr);
-                    } else if (typePostfix.equalsIgnoreCase("bd")) {
-                        return new BigDecimal(numStr);
-                    } else if (typePostfix.equalsIgnoreCase("d")) {
-                        return Double.valueOf(numStr);
-                    } else if (typePostfix.equalsIgnoreCase("f")) {
-                        return Float.valueOf(numStr);
-                    } else {
-                        throw new _ObjectBuilderSettingEvaluationException(
-                                "Unrecognized number type postfix: " + typePostfix);
-                    }
-                }
-                
-            } catch (NumberFormatException e) {
-                throw new _ObjectBuilderSettingEvaluationException("Malformed number: " + numStr, e);
-            }
-        }
-    }
-
-    private Object fetchStringLiteral(boolean optional) throws _ObjectBuilderSettingEvaluationException {
-        int startPos = pos;
-        char q = 0;
-        boolean afterEscape = false;
-        boolean raw = false;
-        seekTokenEnd: while (true) {
-            if (pos == src.length()) {
-                if (q != 0) {
-                    // We had an open quotation
-                    throw new _ObjectBuilderSettingEvaluationException(String.valueOf(q), src, pos);
-                }
-                break seekTokenEnd;
-            }
-            char c = src.charAt(pos);
-            if (q == 0) {
-                if (c == 'r' && (pos + 1 < src.length())) {
-                    // Maybe it's like r"foo\bar"
-                    raw = true;
-                    c = src.charAt(pos + 1);
-                }
-                if (c == '\'') {
-                    q = '\'';
-                } else if (c == '"') {
-                    q = '"';
-                } else {
-                    break seekTokenEnd;
-                }
-                if (raw) {
-                    // because of the preceding "r"
-                    pos++;
-                }
-            } else {
-                if (!afterEscape) {
-                    if (c == '\\' && !raw) {
-                        afterEscape = true;
-                    } else if (c == q) {
-                        break seekTokenEnd;
-                    } else if (c == '{') {
-                        char prevC = src.charAt(pos - 1);
-                        if (prevC == '$' || prevC == '#') {
-                            throw new _ObjectBuilderSettingEvaluationException(
-                                    "${...} and #{...} aren't allowed here.");
-                        }
-                    }
-                } else {
-                    afterEscape = false;
-                }
-            }
-            pos++;
-        }
-        if (startPos == pos) {
-            if (optional) {
-                return VOID;
-            } else {
-                throw new _ObjectBuilderSettingEvaluationException("string literal", src, pos);
-            }
-        }
-            
-        final String sInside = src.substring(startPos + (raw ? 2 : 1), pos);
-        try {
-            pos++; // skip closing quotation mark
-            return raw ? sInside : FTLUtil.unescapeStringLiteralPart(sInside);
-        } catch (GenericParseException e) {
-            throw new _ObjectBuilderSettingEvaluationException("Malformed string literal: " + sInside, e);
-        }
-    }
-
-    private Object fetchListLiteral(boolean optional) throws _ObjectBuilderSettingEvaluationException {
-        if (pos == src.length() || src.charAt(pos) != '[') {
-            if (!optional) {
-                throw new _ObjectBuilderSettingEvaluationException("[", src, pos);
-            }
-            return VOID;
-        }
-        pos++;
-        
-        ListExpression listExp = new ListExpression();
-        
-        while (true) {
-            skipWS();
-            
-            if (fetchOptionalChar("]") != 0) {
-                return listExp;
-            }
-            if (listExp.itemCount() != 0) {
-                fetchRequiredChar(",");
-                skipWS();
-            }
-            
-            listExp.addItem(fetchValue(false, false, false, true));
-            
-            skipWS();
-        }
-    }
-
-    private Object fetchMapLiteral(boolean optional) throws _ObjectBuilderSettingEvaluationException {
-        if (pos == src.length() || src.charAt(pos) != '{') {
-            if (!optional) {
-                throw new _ObjectBuilderSettingEvaluationException("{", src, pos);
-            }
-            return VOID;
-        }
-        pos++;
-        
-        MapExpression mapExp = new MapExpression();
-        
-        while (true) {
-            skipWS();
-            
-            if (fetchOptionalChar("}") != 0) {
-                return mapExp;
-            }
-            if (mapExp.itemCount() != 0) {
-                fetchRequiredChar(",");
-                skipWS();
-            }
-            
-            Object key = fetchValue(false, false, false, true);
-            skipWS();
-            fetchRequiredChar(":");
-            skipWS();
-            Object value = fetchValue(false, false, false, true);
-            mapExp.addItem(new KeyValuePair(key, value));
-            
-            skipWS();
-        }
-    }
-    
-    private void skipWS() {
-        while (true) {
-            if (pos == src.length()) {
-                return;
-            }
-            char c = src.charAt(pos);
-            if (!Character.isWhitespace(c)) {
-                return;
-            }
-            pos++;
-        }
-    }
-
-    private char fetchOptionalChar(String expectedChars) throws _ObjectBuilderSettingEvaluationException {
-        return fetchChar(expectedChars, true);
-    }
-    
-    private char fetchRequiredChar(String expectedChars) throws _ObjectBuilderSettingEvaluationException {
-        return fetchChar(expectedChars, false);
-    }
-    
-    private char fetchChar(String expectedChars, boolean optional) throws _ObjectBuilderSettingEvaluationException {
-        char c = pos < src.length() ? src.charAt(pos) : 0;
-        if (expectedChars.indexOf(c) != -1) {
-            pos++;
-            return c;
-        } else if (optional) {
-            return 0;
-        } else {
-            StringBuilder sb = new StringBuilder();
-            for (int i = 0; i < expectedChars.length(); i++) {
-                if (i != 0) {
-                    sb.append(" or ");
-                }
-                sb.append(_StringUtil.jQuote(expectedChars.substring(i, i + 1)));
-            }
-            throw new _ObjectBuilderSettingEvaluationException(
-                    sb.toString(),
-                    src, pos);
-        }
-    }
-    
-    private boolean isASCIIDigit(char c) {
-        return c >= '0' && c <= '9';
-    }
-
-    private boolean isIdentifierStart(char c) {
-        return Character.isLetter(c) || c == '_' || c == '$';
-    }
-
-    private boolean isIdentifierMiddle(char c) {
-        return isIdentifierStart(c) || isASCIIDigit(c);
-    }
-
-    private static synchronized String shorthandToFullQualified(String className) {
-        if (SHORTHANDS == null) {
-            SHORTHANDS = new HashMap/*<String,String>*/();
-            
-            addWithSimpleName(SHORTHANDS, DefaultObjectWrapper.class);
-            addWithSimpleName(SHORTHANDS, BeansWrapper.class);
-            addWithSimpleName(SHORTHANDS, SimpleObjectWrapper.class);
-
-            addWithSimpleName(SHORTHANDS, TemplateConfiguration.class);
-            
-            addWithSimpleName(SHORTHANDS, PathGlobMatcher.class);
-            addWithSimpleName(SHORTHANDS, FileNameGlobMatcher.class);
-            addWithSimpleName(SHORTHANDS, FileExtensionMatcher.class);
-            addWithSimpleName(SHORTHANDS, PathRegexMatcher.class);
-            addWithSimpleName(SHORTHANDS, AndMatcher.class);
-            addWithSimpleName(SHORTHANDS, OrMatcher.class);
-            addWithSimpleName(SHORTHANDS, NotMatcher.class);
-            
-            addWithSimpleName(SHORTHANDS, ConditionalTemplateConfigurationFactory.class);
-            addWithSimpleName(SHORTHANDS, MergingTemplateConfigurationFactory.class);
-            addWithSimpleName(SHORTHANDS, FirstMatchTemplateConfigurationFactory.class);
-
-            addWithSimpleName(SHORTHANDS, HTMLOutputFormat.class);
-            addWithSimpleName(SHORTHANDS, XMLOutputFormat.class);
-            addWithSimpleName(SHORTHANDS, RTFOutputFormat.class);
-            addWithSimpleName(SHORTHANDS, PlainTextOutputFormat.class);
-            addWithSimpleName(SHORTHANDS, UndefinedOutputFormat.class);
-            
-            addWithSimpleName(SHORTHANDS, Locale.class);
-            String tzbClassName = _TimeZoneBuilder.class.getName();
-            SHORTHANDS.put("TimeZone", tzbClassName.substring(0, tzbClassName.length() - 7));
-
-            // For accessing static fields:
-            addWithSimpleName(SHORTHANDS, Configuration.class);
-        }
-        String fullClassName = SHORTHANDS.get(className);
-        return fullClassName == null ? className : fullClassName;
-    }
-    
-    private static void addWithSimpleName(Map map, Class<?> pClass) {
-        map.put(pClass.getSimpleName(), pClass.getName());
-    }
-
-    private void setJavaBeanProperties(Object bean,
-            List/*<String>*/ namedParamNames, List/*<Object>*/ namedParamValues)
-            throws _ObjectBuilderSettingEvaluationException {
-        if (namedParamNames.isEmpty()) {
-            return;
-        }
-        
-        final Class cl = bean.getClass();
-        Map/*<String,Method>*/ beanPropSetters;
-        try {
-            PropertyDescriptor[] propDescs = Introspector.getBeanInfo(cl).getPropertyDescriptors();
-            beanPropSetters = new HashMap(propDescs.length * 4 / 3, 1.0f);
-            for (PropertyDescriptor propDesc : propDescs) {
-                final Method writeMethod = propDesc.getWriteMethod();
-                if (writeMethod != null) {
-                    beanPropSetters.put(propDesc.getName(), writeMethod);
-                }
-            }
-        } catch (Exception e) {
-            throw new _ObjectBuilderSettingEvaluationException("Failed to inspect " + cl.getName() + " class", e);
-        }
-
-        TemplateHashModel beanTM = null;
-        for (int i = 0; i < namedParamNames.size(); i++) {
-            String name = (String) namedParamNames.get(i);
-            if (!beanPropSetters.containsKey(name)) {
-                throw new _ObjectBuilderSettingEvaluationException(
-                        "The " + cl.getName() + " class has no writeable JavaBeans property called "
-                        + _StringUtil.jQuote(name) + ".");
-            }
-            
-            Method beanPropSetter = (Method) beanPropSetters.put(name, null);
-            if (beanPropSetter == null) {
-                    throw new _ObjectBuilderSettingEvaluationException(
-                            "JavaBeans property " + _StringUtil.jQuote(name) + " is set twice.");
-            }
-            
-            try {
-                if (beanTM == null) {
-                    TemplateModel wrappedObj = env.getObjectWrapper().wrap(bean);
-                    if (!(wrappedObj instanceof TemplateHashModel)) {
-                        throw new _ObjectBuilderSettingEvaluationException(
-                                "The " + cl.getName() + " class is not a wrapped as TemplateHashModel.");
-                    }
-                    beanTM = (TemplateHashModel) wrappedObj;
-                }
-                
-                TemplateModel m = beanTM.get(beanPropSetter.getName());
-                if (m == null) {
-                    throw new _ObjectBuilderSettingEvaluationException(
-                            "Can't find " + beanPropSetter + " as FreeMarker method.");
-                }
-                if (!(m instanceof TemplateMethodModelEx)) {
-                    throw new _ObjectBuilderSettingEvaluationException(
-                            _StringUtil.jQuote(beanPropSetter.getName()) + " wasn't a TemplateMethodModelEx.");
-                }
-                List/*TemplateModel*/ args = new ArrayList();
-                args.add(env.getObjectWrapper().wrap(namedParamValues.get(i)));
-                ((TemplateMethodModelEx) m).exec(args);
-            } catch (Exception e) {
-                throw new _ObjectBuilderSettingEvaluationException(
-                        "Failed to set " + _StringUtil.jQuote(name), e);
-            }
-        }
-    }
-
-    private static class Name {
-        
-        public Name(String name) {
-            this.name = name;
-        }
-
-        private final String name;
-    }
-    
-    private abstract static class SettingExpression {
-        abstract Object eval() throws _ObjectBuilderSettingEvaluationException;
-    }
-    
-    private abstract class ExpressionWithParameters extends SettingExpression {
-        protected List positionalParamValues = new ArrayList();
-        protected List/*<String>*/ namedParamNames = new ArrayList();
-        protected List/*<Object>*/ namedParamValues = new ArrayList();
-        
-        protected abstract boolean getAllowPositionalParameters();
-    }
-    
-    private class ListExpression extends SettingExpression {
-        
-        private List<Object> items = new ArrayList();
-        
-        void addItem(Object item) {
-            items.add(item);
-        }
-
-        public int itemCount() {
-            return items.size();
-        }
-
-        @Override
-        Object eval() throws _ObjectBuilderSettingEvaluationException {
-            ArrayList res = new ArrayList(items.size());
-            for (Object item : items) {
-                res.add(ensureEvaled(item));
-            }
-            return res;
-        }
-        
-    }
-    
-    private class MapExpression extends SettingExpression {
-        
-        private List<KeyValuePair> items = new ArrayList();
-        
-        void addItem(KeyValuePair item) {
-            items.add(item);
-        }
-
-        public int itemCount() {
-            return items.size();
-        }
-
-        @Override
-        Object eval() throws _ObjectBuilderSettingEvaluationException {
-            LinkedHashMap res = new LinkedHashMap(items.size() * 4 / 3, 1f);
-            for (KeyValuePair item : items) {
-                Object key = ensureEvaled(item.key);
-                if (key == null) {
-                    throw new _ObjectBuilderSettingEvaluationException("Map can't use null as key.");
-                }
-                res.put(key, ensureEvaled(item.value));
-            }
-            return res;
-        }
-        
-    }
-    
-    private static class KeyValuePair {
-        private final Object key;
-        private final Object value;
-        
-        public KeyValuePair(Object key, Object value) {
-            this.key = key;
-            this.value = value;
-        }
-    }
-    
-    private class BuilderCallExpression extends ExpressionWithParameters {
-        private String className;
-        private boolean canBeStaticField;
-        private boolean mustBeStaticField;
-        
-        @Override
-        Object eval() throws _ObjectBuilderSettingEvaluationException {
-            if (mustBeStaticField) {
-                if (!canBeStaticField) {
-                    throw new BugException();
-                }
-                return getStaticFieldValue(className);
-            }
-            
-            Class cl;
-            
-            boolean clIsBuilderClass;
-            try {
-                cl = _ClassUtil.forName(className + BUILDER_CLASS_POSTFIX);
-                clIsBuilderClass = true;
-            } catch (ClassNotFoundException e) {
-                clIsBuilderClass = false;
-                try {
-                    cl = _ClassUtil.forName(className);
-                } catch (Exception e2) {
-                    boolean failedToGetAsStaticField;
-                    if (canBeStaticField) {
-                        // Try to interpret className as static filed: 
-                        try {
-                            return getStaticFieldValue(className);
-                        } catch (_ObjectBuilderSettingEvaluationException e3) {
-                            // Suppress it
-                            failedToGetAsStaticField = true;
-                        }
-                    } else {
-                        failedToGetAsStaticField = false;
-                    }
-                    throw new _ObjectBuilderSettingEvaluationException(
-                            "Failed to get class " + _StringUtil.jQuote(className)
-                            + (failedToGetAsStaticField ? " (also failed to resolve name as static field)" : "")
-                            + ".",
-                            e2);
-                }
-            }
-            
-            if (!clIsBuilderClass && hasNoParameters()) {
-                try {
-                    Field f = cl.getField(INSTANCE_FIELD_NAME);
-                    if ((f.getModifiers() & (Modifier.PUBLIC | Modifier.STATIC))
-                            == (Modifier.PUBLIC | Modifier.STATIC)) {
-                        return f.get(null);
-                    }
-                } catch (NoSuchFieldException e) {
-                    // Expected
-                } catch (Exception e) {
-                    throw new _ObjectBuilderSettingEvaluationException(
-                            "Error when trying to access " + _StringUtil.jQuote(className) + "."
-                            + INSTANCE_FIELD_NAME, e);
-                }
-            }
-            
-            // Create the object to return or its builder:
-            Object constructorResult = callConstructor(cl);
-            
-            // Named parameters will set JavaBeans properties:
-            setJavaBeanProperties(constructorResult, namedParamNames, namedParamValues);
-
-            final Object result;
-            if (clIsBuilderClass) {
-                result = callBuild(constructorResult);
-            } else {
-                if (constructorResult instanceof WriteProtectable) {
-                    ((WriteProtectable) constructorResult).writeProtect();
-                }
-                result = constructorResult;
-            }
-            
-            return result;
-        }
-        
-        private Object getStaticFieldValue(String dottedName) throws _ObjectBuilderSettingEvaluationException {
-            int lastDotIdx = dottedName.lastIndexOf('.');
-            if (lastDotIdx == -1) {
-                throw new IllegalArgumentException();
-            }
-            String className = shorthandToFullQualified(dottedName.substring(0, lastDotIdx));
-            String fieldName = dottedName.substring(lastDotIdx + 1);
-
-            Class<?> cl;
-            try {
-                cl = _ClassUtil.forName(className);
-            } catch (Exception e) {
-                throw new _ObjectBuilderSettingEvaluationException(
-                        "Failed to get field's parent class, " + _StringUtil.jQuote(className) + ".",
-                        e);
-            }
-            
-            Field field;
-            try {
-                field = cl.getField(fieldName);
-            } catch (Exception e) {
-                throw new _ObjectBuilderSettingEvaluationException(
-                        "Failed to get field " + _StringUtil.jQuote(fieldName) + " from class "
-                        + _StringUtil.jQuote(className) + ".",
-                        e);
-            }
-            
-            if ((field.getModifiers() & Modifier.STATIC) == 0) {
-                throw new _ObjectBuilderSettingEvaluationException("Referred field isn't static: " + field);
-            }
-            if ((field.getModifiers() & Modifier.PUBLIC) == 0) {
-                throw new _ObjectBuilderSettingEvaluationException("Referred field isn't public: " + field);
-            }
-
-            if (field.getName().equals(INSTANCE_FIELD_NAME)) {
-                throw new _ObjectBuilderSettingEvaluationException(
-                        "The " + INSTANCE_FIELD_NAME + " field is only accessible through pseudo-constructor call: "
-                        + className + "()");
-            }
-            
-            try {
-                return field.get(null);
-            } catch (Exception e) {
-                throw new _ObjectBuilderSettingEvaluationException("Failed to get field value: " + field, e);
-            }
-        }
-
-        private Object callConstructor(Class cl)
-                throws _ObjectBuilderSettingEvaluationException {
-            if (hasNoParameters()) {
-                // No need to create ObjectWrapper
-                try {
-                    return cl.newInstance();
-                } catch (Exception e) {
-                    throw new _ObjectBuilderSettingEvaluationException(
-                            "Failed to call " + cl.getName() + " 0-argument constructor", e);
-                }
-            } else {
-                BeansWrapper ow = env.getObjectWrapper();
-                List/*<TemplateModel>*/ tmArgs = new ArrayList(positionalParamValues.size());
-                for (int i = 0; i < positionalParamValues.size(); i++) {
-                    try {
-                        tmArgs.add(ow.wrap(positionalParamValues.get(i)));
-                    } catch (TemplateModelException e) {
-                        throw new _ObjectBuilderSettingEvaluationException("Failed to wrap arg #" + (i + 1), e);
-                    }
-                }
-                try {
-                    return ow.newInstance(cl, tmArgs);
-                } catch (Exception e) {
-                    throw new _ObjectBuilderSettingEvaluationException(
-                            "Failed to call " + cl.getName() + " constructor", e);
-                }
-            }
-        }
-
-        private Object callBuild(Object constructorResult)
-                throws _ObjectBuilderSettingEvaluationException {
-            final Class cl = constructorResult.getClass();
-            Method buildMethod; 
-            try {
-                buildMethod = constructorResult.getClass().getMethod(BUILD_METHOD_NAME, (Class[]) null);
-            } catch (NoSuchMethodException e) {
-                throw new _ObjectBuilderSettingEvaluationException("The " + cl.getName()
-                        + " builder class must have a public " + BUILD_METHOD_NAME + "() method", e);
-            } catch (Exception e) {
-                throw new _ObjectBuilderSettingEvaluationException("Failed to get the " + BUILD_METHOD_NAME
-                        + "() method of the " + cl.getName() + " builder class", e);
-            }
-            
-            try {
-                return buildMethod.invoke(constructorResult, (Object[]) null);
-            } catch (Exception e) {
-                Throwable cause;
-                if (e instanceof InvocationTargetException) {
-                    cause = ((InvocationTargetException) e).getTargetException();
-                } else {
-                    cause = e;
-                }
-                throw new _ObjectBuilderSettingEvaluationException("Failed to call " + BUILD_METHOD_NAME
-                        + "() method on " + cl.getName() + " instance", cause);
-            }
-        }
-
-        private boolean hasNoParameters() {
-            return positionalParamValues.isEmpty() && namedParamValues.isEmpty();
-        }
-
-        @Override
-        protected boolean getAllowPositionalParameters() {
-            return true;
-        }
-        
-    }
-    
-    private class PropertyAssignmentsExpression extends ExpressionWithParameters {
-        
-        private final Object bean;
-        
-        public PropertyAssignmentsExpression(Object bean) {
-            this.bean = bean;
-        }
-
-        @Override
-        Object eval() throws _ObjectBuilderSettingEvaluationException {
-            setJavaBeanProperties(bean, namedParamNames, namedParamValues);
-            return bean;
-        }
-
-        @Override
-        protected boolean getAllowPositionalParameters() {
-            return false;
-        }
-        
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/ast/_ParserConfigurationWithInheritedFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/_ParserConfigurationWithInheritedFormat.java b/src/main/java/org/apache/freemarker/core/ast/_ParserConfigurationWithInheritedFormat.java
deleted file mode 100644
index f10d76a..0000000
--- a/src/main/java/org/apache/freemarker/core/ast/_ParserConfigurationWithInheritedFormat.java
+++ /dev/null
@@ -1,84 +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.ast;
-
-import org.apache.freemarker.core.Version;
-
-/**
- * For internal use only; don't depend on this, there's no backward compatibility guarantee at all!
- */ 
-public final class _ParserConfigurationWithInheritedFormat implements ParserConfiguration {
-
-    private final OutputFormat outputFormat;
-    private final Integer autoEscapingPolicy;
-    private final ParserConfiguration wrappedPCfg;
-
-    public _ParserConfigurationWithInheritedFormat(ParserConfiguration wrappedPCfg, OutputFormat outputFormat,
-            Integer autoEscapingPolicy) {
-        this.outputFormat = outputFormat;
-        this.autoEscapingPolicy = autoEscapingPolicy;
-        this.wrappedPCfg = wrappedPCfg;
-    }
-
-    @Override
-    public boolean getWhitespaceStripping() {
-        return wrappedPCfg.getWhitespaceStripping();
-    }
-
-    @Override
-    public int getTagSyntax() {
-        return wrappedPCfg.getTagSyntax();
-    }
-
-    @Override
-    public OutputFormat getOutputFormat() {
-        return outputFormat != null ? outputFormat : wrappedPCfg.getOutputFormat();
-    }
-
-    @Override
-    public boolean getRecognizeStandardFileExtensions() {
-        return false;
-    }
-
-    @Override
-    public int getNamingConvention() {
-        return wrappedPCfg.getNamingConvention();
-    }
-
-    @Override
-    public Version getIncompatibleImprovements() {
-        return wrappedPCfg.getIncompatibleImprovements();
-    }
-
-    @Override
-    public int getAutoEscapingPolicy() {
-        return autoEscapingPolicy != null ? autoEscapingPolicy.intValue() : wrappedPCfg.getAutoEscapingPolicy();
-    }
-
-    @Override
-    public ArithmeticEngine getArithmeticEngine() {
-        return wrappedPCfg.getArithmeticEngine();
-    }
-
-    @Override
-    public int getTabSize() {
-        return wrappedPCfg.getTabSize();
-    }
-    
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/ast/_SettingEvaluationEnvironment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/_SettingEvaluationEnvironment.java b/src/main/java/org/apache/freemarker/core/ast/_SettingEvaluationEnvironment.java
deleted file mode 100644
index 1f61224..0000000
--- a/src/main/java/org/apache/freemarker/core/ast/_SettingEvaluationEnvironment.java
+++ /dev/null
@@ -1,62 +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.ast;
-
-import java.util.Properties;
-
-import org.apache.freemarker.core.Configuration;
-import org.apache.freemarker.core.model.impl.beans.BeansWrapper;
-
-/**
- * Don't use this; used internally by FreeMarker, might changes without notice.
- * The runtime environment used during the evaluation of configuration {@link Properties}.
- */
-public class _SettingEvaluationEnvironment {
-    
-    private static final ThreadLocal CURRENT = new ThreadLocal();
-
-    private BeansWrapper objectWrapper;
-    
-    public static _SettingEvaluationEnvironment getCurrent() {
-        Object r = CURRENT.get();
-        if (r != null) {
-            return (_SettingEvaluationEnvironment) r;
-        }
-        return new _SettingEvaluationEnvironment();
-    }
-    
-    public static _SettingEvaluationEnvironment startScope() {
-        Object previous = CURRENT.get();
-        CURRENT.set(new _SettingEvaluationEnvironment());
-        return (_SettingEvaluationEnvironment) previous;
-    }
-    
-    public static void endScope(_SettingEvaluationEnvironment previous) {
-        CURRENT.set(previous);
-    }
-
-    public BeansWrapper getObjectWrapper() {
-        if (objectWrapper == null) {
-            objectWrapper = new BeansWrapper(Configuration.VERSION_3_0_0);
-        }
-        return objectWrapper;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/ast/_TemplateModelException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/_TemplateModelException.java b/src/main/java/org/apache/freemarker/core/ast/_TemplateModelException.java
deleted file mode 100644
index cfe7307..0000000
--- a/src/main/java/org/apache/freemarker/core/ast/_TemplateModelException.java
+++ /dev/null
@@ -1,133 +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.ast;
-
-import org.apache.freemarker.core.model.TemplateModel;
-import org.apache.freemarker.core.model.TemplateModelException;
-import org.apache.freemarker.core.util._ClassUtil;
-
-public class _TemplateModelException extends TemplateModelException {
-
-    // Note: On Java 5 we will use `String descPart1, Object... furtherDescParts` instead of `Object[] descriptionParts`
-    //       and `String description`. That's why these are at the end of the parameter list.
-    
-    // -----------------------------------------------------------------------------------------------------------------
-    // Permutation group:
-    
-    public _TemplateModelException(String description) {
-        super(description);
-    }
-
-    // -----------------------------------------------------------------------------------------------------------------
-    // Permutation group:
-
-    public _TemplateModelException(Throwable cause, String description) {
-        this(cause, null, description);
-    }
-
-    public _TemplateModelException(Environment env, String description) {
-        this((Throwable) null, env, description);
-    }
-    
-    public _TemplateModelException(Throwable cause, Environment env) {
-        this(cause, env, (String) null);
-    }
-
-    public _TemplateModelException(Throwable cause) {
-        this(cause, null, (String) null);
-    }
-    
-    public _TemplateModelException(Throwable cause, Environment env, String description) {
-        super(cause, env, description, true);
-    }
-
-    // -----------------------------------------------------------------------------------------------------------------
-    // Permutation group:
-    
-    public _TemplateModelException(_ErrorDescriptionBuilder description) {
-        this(null, description);
-    }
-
-    public _TemplateModelException(Environment env, _ErrorDescriptionBuilder description) {
-        this(null, env, description);
-    }
-
-    public _TemplateModelException(Throwable cause, Environment env, _ErrorDescriptionBuilder description) {
-        super(cause, env, description, true);
-    }
-
-    // -----------------------------------------------------------------------------------------------------------------
-    // Permutation group:
-    
-    public _TemplateModelException(Object... descriptionParts) {
-        this((Environment) null, descriptionParts);
-    }
-
-    public _TemplateModelException(Environment env, Object... descriptionParts) {
-        this((Throwable) null, env, descriptionParts);
-    }
-
-    public _TemplateModelException(Throwable cause, Object... descriptionParts) {
-        this(cause, null, descriptionParts);
-    }
-
-    public _TemplateModelException(Throwable cause, Environment env, Object... descriptionParts) {
-        super(cause, env, new _ErrorDescriptionBuilder(descriptionParts), true);
-    }
-
-    // -----------------------------------------------------------------------------------------------------------------
-    // Permutation group:
-    
-    public _TemplateModelException(Expression blamed, Object... descriptionParts) {
-        this(blamed, null, descriptionParts);
-    }
-
-    public _TemplateModelException(Expression blamed, Environment env, Object... descriptionParts) {
-        this(blamed, null, env, descriptionParts);
-    }
-
-    public _TemplateModelException(Expression blamed, Throwable cause, Environment env, Object... descriptionParts) {
-        super(cause, env, new _ErrorDescriptionBuilder(descriptionParts).blame(blamed), true);
-    }
-
-    // -----------------------------------------------------------------------------------------------------------------
-    // Permutation group:
-    
-    public _TemplateModelException(Expression blamed, String description) {
-        this(blamed, null, description);
-    }
-
-    public _TemplateModelException(Expression blamed, Environment env, String description) {
-        this(blamed, null, env, description);
-    }
-
-    public _TemplateModelException(Expression blamed, Throwable cause, Environment env, String description) {
-        super(cause, env, new _ErrorDescriptionBuilder(description).blame(blamed), true);
-    }
-
-    static Object[] modelHasStoredNullDescription(Class expected, TemplateModel model) {
-        return new Object[] {
-                "The FreeMarker value exists, but has nothing inside it; the TemplateModel object (class: ",
-                model.getClass().getName(), ") has returned a null",
-                (expected != null ? new Object[] { " instead of a ", _ClassUtil.getShortClassName(expected) } : ""),
-                ". This is possibly a bug in the non-FreeMarker code that builds the data-model." };
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/ast/_TimeZoneBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/_TimeZoneBuilder.java b/src/main/java/org/apache/freemarker/core/ast/_TimeZoneBuilder.java
deleted file mode 100644
index abd9fba..0000000
--- a/src/main/java/org/apache/freemarker/core/ast/_TimeZoneBuilder.java
+++ /dev/null
@@ -1,43 +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.ast;
-
-import java.util.TimeZone;
-
-/**
- * For internal use only; don't depend on this, there's no backward compatibility guarantee at all!
- */
-public class _TimeZoneBuilder {
-
-    private final String timeZoneId;
-
-    public _TimeZoneBuilder(String timeZoneId) {
-        this.timeZoneId = timeZoneId;
-    }
-
-    public TimeZone build() {
-        TimeZone timeZone = TimeZone.getTimeZone(timeZoneId);
-        if (timeZone.getID().equals("GMT") && !timeZoneId.equals("GMT") && !timeZoneId.equals("UTC")
-                && !timeZoneId.equals("GMT+00") && !timeZoneId.equals("GMT+00:00") && !timeZoneId.equals("GMT+0000")) {
-            throw new IllegalArgumentException("Unrecognized time zone: " + timeZoneId);
-        }
-        return timeZone;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/ast/_UnexpectedTypeErrorExplainerTemplateModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/_UnexpectedTypeErrorExplainerTemplateModel.java b/src/main/java/org/apache/freemarker/core/ast/_UnexpectedTypeErrorExplainerTemplateModel.java
deleted file mode 100644
index 2e3a50c..0000000
--- a/src/main/java/org/apache/freemarker/core/ast/_UnexpectedTypeErrorExplainerTemplateModel.java
+++ /dev/null
@@ -1,36 +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.ast;
-
-import org.apache.freemarker.core.model.TemplateModel;
-
-/**
- * Don't use this; used internally by FreeMarker, might changes without notice.
- * 
- * <p>Implemented by {@link TemplateModel}-s that can explain why they don't implement a certain type. 
- * */
-public interface _UnexpectedTypeErrorExplainerTemplateModel extends TemplateModel {
-
-    /**
-     * @return A single {@link _ErrorDescriptionBuilder} tip, or {@code null}.
-     */
-    Object[] explainTypeError(Class[]/*<? extends TemplateModel>*/ expectedClasses);
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/ast/package.html
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/package.html b/src/main/java/org/apache/freemarker/core/ast/package.html
deleted file mode 100644
index 6e29779..0000000
--- a/src/main/java/org/apache/freemarker/core/ast/package.html
+++ /dev/null
@@ -1,26 +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.
--->
-<html>
-<head>
-</head>
-<body>
-<p>[TODO] This was the {@code freemarker.core} on FM2; move most it over to o.a.f.core, leave the parser and AST
-here.</p> 
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/debug/DebuggedEnvironment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/debug/DebuggedEnvironment.java b/src/main/java/org/apache/freemarker/core/debug/DebuggedEnvironment.java
index 3e481a4..41aee06 100644
--- a/src/main/java/org/apache/freemarker/core/debug/DebuggedEnvironment.java
+++ b/src/main/java/org/apache/freemarker/core/debug/DebuggedEnvironment.java
@@ -23,7 +23,7 @@ import java.rmi.RemoteException;
 
 /**
  * Represents the debugger-side mirror of a debugged 
- * {@link org.apache.freemarker.core.ast.Environment} object in the remote VM. This interface
+ * {@link org.apache.freemarker.core.Environment} object in the remote VM. This interface
  * extends {@link DebugModel}, and the properties of the Environment are exposed
  * as hash keys on it. Specifically, the following keys are supported:
  * "currentNamespace", "dataModel", "globalNamespace", "knownVariables", 
@@ -32,7 +32,7 @@ import java.rmi.RemoteException;
  * <p>The debug model for the configuration supports key "sharedVariables".
  * <p>Additionally, all of the debug models for environment, template, and 
  * configuration also support all the setting keys of 
- * {@link org.apache.freemarker.core.ast.Configurable} objects. 
+ * {@link org.apache.freemarker.core.Configurable} objects. 
 
  */
 public interface DebuggedEnvironment extends DebugModel {
@@ -44,7 +44,7 @@ public interface DebuggedEnvironment extends DebugModel {
     
     /**
      * Stops the processing of the environment after it was stopped on
-     * a breakpoint. Causes a {@link org.apache.freemarker.core.ast.StopException} to be
+     * a breakpoint. Causes a {@link org.apache.freemarker.core.StopException} to be
      * thrown in the processing thread in the remote VM. 
      */
     public void stop() throws RemoteException;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java b/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
index e3be688..a949b71 100644
--- a/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
+++ b/src/main/java/org/apache/freemarker/core/debug/impl/DebuggerService.java
@@ -23,8 +23,8 @@ import java.rmi.RemoteException;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.Template;
-import org.apache.freemarker.core.ast.Environment;
 import org.apache.freemarker.core.util._SecurityUtil;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggedEnvironmentImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggedEnvironmentImpl.java b/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggedEnvironmentImpl.java
index 370ee6f..fdfa0e1 100644
--- a/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggedEnvironmentImpl.java
+++ b/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggedEnvironmentImpl.java
@@ -32,10 +32,10 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.freemarker.core.Configurable;
 import org.apache.freemarker.core.Configuration;
+import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.Template;
-import org.apache.freemarker.core.ast.Configurable;
-import org.apache.freemarker.core.ast.Environment;
 import org.apache.freemarker.core.debug.DebugModel;
 import org.apache.freemarker.core.debug.DebuggedEnvironment;
 import org.apache.freemarker.core.model.TemplateCollectionModel;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggerService.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggerService.java b/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggerService.java
index cc2f55b..50886fa 100644
--- a/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggerService.java
+++ b/src/main/java/org/apache/freemarker/core/debug/impl/RmiDebuggerService.java
@@ -35,11 +35,11 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.Template;
-import org.apache.freemarker.core.ast._DebugBreak;
-import org.apache.freemarker.core.ast.Environment;
-import org.apache.freemarker.core.ast.TemplateElement;
-import org.apache.freemarker.core.ast._CoreAPI;
+import org.apache.freemarker.core._ASTElement;
+import org.apache.freemarker.core._CoreAPI;
+import org.apache.freemarker.core._ASTDebugBreak;
 import org.apache.freemarker.core.debug.Breakpoint;
 import org.apache.freemarker.core.debug.DebuggerListener;
 import org.apache.freemarker.core.debug.EnvironmentSuspendedEvent;
@@ -186,35 +186,35 @@ extends
     }
 
     private static void insertDebugBreak(Template t, Breakpoint breakpoint) {
-        TemplateElement te = findTemplateElement(t.getRootTreeNode(), breakpoint.getLine());
+        _ASTElement te = findTemplateElement(t.getRootTreeNode(), breakpoint.getLine());
         if (te == null) {
             return;
         }
-        TemplateElement parent = _CoreAPI.getParentElement(te);
-        _DebugBreak db = new _DebugBreak(te);
+        _ASTElement parent = _CoreAPI.getParentElement(te);
+        _ASTDebugBreak db = new _ASTDebugBreak(te);
         // TODO: Ensure there always is a parent by making sure
-        // that the root element in the template is always a MixedContent
+        // that the root element in the template is always a ASTImplicitParent
         // Also make sure it doesn't conflict with anyone's code.
         parent.setChildAt(parent.getIndex(te), db);
     }
 
-    private static TemplateElement findTemplateElement(TemplateElement te, int line) {
+    private static _ASTElement findTemplateElement(_ASTElement te, int line) {
         if (te.getBeginLine() > line || te.getEndLine() < line) {
             return null;
         }
         // Find the narrowest match
         List childMatches = new ArrayList();
         for (Enumeration children = te.children(); children.hasMoreElements(); ) {
-            TemplateElement child = (TemplateElement) children.nextElement();
-            TemplateElement childmatch = findTemplateElement(child, line);
+            _ASTElement child = (_ASTElement) children.nextElement();
+            _ASTElement childmatch = findTemplateElement(child, line);
             if (childmatch != null) {
                 childMatches.add(childmatch);
             }
         }
         //find a match that exactly matches the begin/end line
-        TemplateElement bestMatch = null;
+        _ASTElement bestMatch = null;
         for (int i = 0; i < childMatches.size(); i++) {
-            TemplateElement e = (TemplateElement) childMatches.get(i);
+            _ASTElement e = (_ASTElement) childMatches.get(i);
 
             if ( bestMatch == null ) {
                 bestMatch = e;
@@ -277,14 +277,14 @@ extends
     }
 
     private void removeDebugBreak(Template t, Breakpoint breakpoint) {
-        TemplateElement te = findTemplateElement(t.getRootTreeNode(), breakpoint.getLine());
+        _ASTElement te = findTemplateElement(t.getRootTreeNode(), breakpoint.getLine());
         if (te == null) {
             return;
         }
-        _DebugBreak db = null;
+        _ASTDebugBreak db = null;
         while (te != null) {
-            if (te instanceof _DebugBreak) {
-                db = (_DebugBreak) te;
+            if (te instanceof _ASTDebugBreak) {
+                db = (_ASTDebugBreak) te;
                 break;
             }
             te = _CoreAPI.getParentElement(te);
@@ -292,7 +292,7 @@ extends
         if (db == null) {
             return;
         }
-        TemplateElement parent = _CoreAPI.getParentElement(db); 
+        _ASTElement parent = _CoreAPI.getParentElement(db); 
         parent.setChildAt(parent.getIndex(db), _CoreAPI.getChildElement(db, 0));
     }
     
@@ -333,12 +333,12 @@ extends
         }
     }
     
-    private void removeDebugBreaks(TemplateElement te) {
+    private void removeDebugBreaks(_ASTElement te) {
         int count = te.getChildCount();
         for (int i = 0; i < count; ++i) {
-            TemplateElement child = _CoreAPI.getChildElement(te, i);
-            while (child instanceof _DebugBreak) {
-                TemplateElement dbchild = _CoreAPI.getChildElement(child, 0); 
+            _ASTElement child = _CoreAPI.getChildElement(te, i);
+            while (child instanceof _ASTDebugBreak) {
+                _ASTElement dbchild = _CoreAPI.getChildElement(child, 0); 
                 te.setChildAt(i, dbchild);
                 child = dbchild;
             }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveBody.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveBody.java b/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveBody.java
index 6ca6d45..a901795 100644
--- a/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveBody.java
+++ b/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveBody.java
@@ -26,7 +26,7 @@ import org.apache.freemarker.core.TemplateException;
 
 /**
  * Represents the nested content of a directive ({@link TemplateDirectiveModel}) invocation. An implementation of this 
- * class is passed to {@link TemplateDirectiveModel#execute(org.apache.freemarker.core.ast.Environment, 
+ * class is passed to {@link TemplateDirectiveModel#execute(org.apache.freemarker.core.Environment, 
  * java.util.Map, TemplateModel[], TemplateDirectiveBody)}. The implementation of the method is 
  * free to invoke it for any number of times, with any writer.
  *

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveModel.java b/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveModel.java
index c4d2bb9..19e242b 100644
--- a/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/TemplateDirectiveModel.java
@@ -22,8 +22,8 @@ package org.apache.freemarker.core.model;
 import java.io.IOException;
 import java.util.Map;
 
+import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.TemplateException;
-import org.apache.freemarker.core.ast.Environment;
 import org.apache.freemarker.core.util.DeepUnwrap;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/TemplateMethodModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/TemplateMethodModel.java b/src/main/java/org/apache/freemarker/core/model/TemplateMethodModel.java
index a18f6d9..77792d1 100644
--- a/src/main/java/org/apache/freemarker/core/model/TemplateMethodModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/TemplateMethodModel.java
@@ -25,7 +25,7 @@ package org.apache.freemarker.core.model;
 
 import java.util.List;
 
-import org.apache.freemarker.core.ast.Environment;
+import org.apache.freemarker.core.Environment;
 
 /**
  * "method" template language data type: Objects that act like functions. The name comes from that their original

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/TemplateMethodModelEx.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/TemplateMethodModelEx.java b/src/main/java/org/apache/freemarker/core/model/TemplateMethodModelEx.java
index acb5632..5a40bb9 100644
--- a/src/main/java/org/apache/freemarker/core/model/TemplateMethodModelEx.java
+++ b/src/main/java/org/apache/freemarker/core/model/TemplateMethodModelEx.java
@@ -21,7 +21,7 @@ package org.apache.freemarker.core.model;
 
 import java.util.List;
 
-import org.apache.freemarker.core.ast.Environment;
+import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.util.DeepUnwrap;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java b/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
index 35c0af7..b0b43fa 100644
--- a/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
+++ b/src/main/java/org/apache/freemarker/core/model/TemplateModelException.java
@@ -19,9 +19,9 @@
 
 package org.apache.freemarker.core.model;
 
+import org.apache.freemarker.core.Environment;
 import org.apache.freemarker.core.TemplateException;
-import org.apache.freemarker.core.ast.Environment;
-import org.apache.freemarker.core.ast._ErrorDescriptionBuilder;
+import org.apache.freemarker.core._ErrorDescriptionBuilder;
 
 /**
  * {@link TemplateModel} methods throw this exception if the requested data can't be retrieved.  

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java b/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
index c54fe00..97b870c 100644
--- a/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/TemplateNumberModel.java
@@ -19,7 +19,7 @@
 
 package org.apache.freemarker.core.model;
 
-import org.apache.freemarker.core.ast.ArithmeticEngine;
+import org.apache.freemarker.core.ArithmeticEngine;
 
 /**
  * "number" template language data type; an object that stores a number. There's only one numerical type as far as the

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java b/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java
new file mode 100644
index 0000000..47c07ab
--- /dev/null
+++ b/src/main/java/org/apache/freemarker/core/model/impl/CollectionAndSequence.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.freemarker.core.model.impl;
+
+import java.util.ArrayList;
+
+import org.apache.freemarker.core.model.TemplateCollectionModel;
+import org.apache.freemarker.core.model.TemplateModel;
+import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.model.TemplateModelIterator;
+import org.apache.freemarker.core.model.TemplateSequenceModel;
+
+/**
+ * Add sequence capabilities to an existing collection, or
+ * vice versa. Used by ?keys and ?values built-ins.
+ */
+// [FM3] FTL sequence should extend FTL collection, so we shouldn't need that direction, only the other.
+final public class CollectionAndSequence implements TemplateCollectionModel, TemplateSequenceModel {
+    private TemplateCollectionModel collection;
+    private TemplateSequenceModel sequence;
+    private ArrayList data;
+
+    public CollectionAndSequence(TemplateCollectionModel collection) {
+        this.collection = collection;
+    }
+
+    public CollectionAndSequence(TemplateSequenceModel sequence) {
+        this.sequence = sequence;
+    }
+
+    @Override
+    public TemplateModelIterator iterator() throws TemplateModelException {
+        if (collection != null) {
+            return collection.iterator();
+        } else {
+            return new SequenceIterator(sequence);
+        }
+    }
+
+    @Override
+    public TemplateModel get(int i) throws TemplateModelException {
+        if (sequence != null) {
+            return sequence.get(i);
+        } else {
+            initSequence();
+            return (TemplateModel) data.get(i);
+        }
+    }
+
+    @Override
+    public int size() throws TemplateModelException {
+        if (sequence != null) {
+            return sequence.size();
+        } else {
+            initSequence();
+            return data.size();
+        }
+    }
+
+    private void initSequence() throws TemplateModelException {
+        if (data == null) {
+            data = new ArrayList();
+            TemplateModelIterator it = collection.iterator();
+            while (it.hasNext()) {
+                data.add(it.next());
+            }
+        }
+    }
+
+    private static class SequenceIterator
+    implements TemplateModelIterator {
+        private final TemplateSequenceModel sequence;
+        private final int size;
+        private int index = 0;
+
+        SequenceIterator(TemplateSequenceModel sequence) throws TemplateModelException {
+            this.sequence = sequence;
+            size = sequence.size();
+            
+        }
+        @Override
+        public TemplateModel next() throws TemplateModelException {
+            return sequence.get(index++);
+        }
+
+        @Override
+        public boolean hasNext() {
+            return index < size;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java b/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
index d63cafe..fe163ed 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/DefaultMapAdapter.java
@@ -23,8 +23,8 @@ import java.io.Serializable;
 import java.util.Map;
 import java.util.SortedMap;
 
-import org.apache.freemarker.core.ast._DelayedJQuote;
-import org.apache.freemarker.core.ast._TemplateModelException;
+import org.apache.freemarker.core._DelayedJQuote;
+import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateCollectionModel;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java b/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
index 511295c..4345f70 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/DefaultNonListCollectionAdapter.java
@@ -23,8 +23,8 @@ import java.io.Serializable;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.freemarker.core.ast._DelayedShortClassName;
-import org.apache.freemarker.core.ast._TemplateModelException;
+import org.apache.freemarker.core._DelayedShortClassName;
+import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java b/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
index cb26b4a..b4b59e3 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/SimpleHash.java
@@ -27,8 +27,8 @@ import java.util.Map;
 import java.util.SortedMap;
 import java.util.TreeMap;
 
-import org.apache.freemarker.core.ast._DelayedJQuote;
-import org.apache.freemarker.core.ast._TemplateModelException;
+import org.apache.freemarker.core._DelayedJQuote;
+import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateBooleanModel;
 import org.apache.freemarker.core.model.TemplateCollectionModel;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/beans/ArgumentTypes.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/ArgumentTypes.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/ArgumentTypes.java
index 2bb82a2..abac620 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/ArgumentTypes.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/ArgumentTypes.java
@@ -24,9 +24,9 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
-import org.apache.freemarker.core.ast.BugException;
 import org.apache.freemarker.core.model.TemplateModel;
 import org.apache.freemarker.core.model.TemplateModelException;
+import org.apache.freemarker.core.util.BugException;
 import org.apache.freemarker.core.util._ClassUtil;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/beans/BeanModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/BeanModel.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/BeanModel.java
index d800b0c..5c2db2b 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/BeanModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/BeanModel.java
@@ -33,10 +33,9 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.freemarker.core._CoreLogs;
-import org.apache.freemarker.core.ast.CollectionAndSequence;
-import org.apache.freemarker.core.ast._DelayedFTLTypeDescription;
-import org.apache.freemarker.core.ast._DelayedJQuote;
-import org.apache.freemarker.core.ast._TemplateModelException;
+import org.apache.freemarker.core._DelayedFTLTypeDescription;
+import org.apache.freemarker.core._DelayedJQuote;
+import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.TemplateCollectionModel;
@@ -47,6 +46,7 @@ import org.apache.freemarker.core.model.TemplateModelIterator;
 import org.apache.freemarker.core.model.TemplateModelWithAPISupport;
 import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
+import org.apache.freemarker.core.model.impl.CollectionAndSequence;
 import org.apache.freemarker.core.model.impl.SimpleScalar;
 import org.apache.freemarker.core.model.impl.SimpleSequence;
 import org.apache.freemarker.core.util._StringUtil;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/beans/BeansWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/BeansWrapper.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/BeansWrapper.java
index 8182797..eded99c 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/BeansWrapper.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/BeansWrapper.java
@@ -41,11 +41,10 @@ import java.util.Set;
 import org.apache.freemarker.core.Configuration;
 import org.apache.freemarker.core.Version;
 import org.apache.freemarker.core._CoreLogs;
+import org.apache.freemarker.core._DelayedFTLTypeDescription;
+import org.apache.freemarker.core._DelayedShortClassName;
 import org.apache.freemarker.core._TemplateAPI;
-import org.apache.freemarker.core.ast.BugException;
-import org.apache.freemarker.core.ast._DelayedFTLTypeDescription;
-import org.apache.freemarker.core.ast._DelayedShortClassName;
-import org.apache.freemarker.core.ast._TemplateModelException;
+import org.apache.freemarker.core._TemplateModelException;
 import org.apache.freemarker.core.model.AdapterTemplateModel;
 import org.apache.freemarker.core.model.ObjectWrapper;
 import org.apache.freemarker.core.model.ObjectWrapperAndUnwrapper;
@@ -63,6 +62,7 @@ import org.apache.freemarker.core.model.TemplateScalarModel;
 import org.apache.freemarker.core.model.TemplateSequenceModel;
 import org.apache.freemarker.core.model.WrapperTemplateModel;
 import org.apache.freemarker.core.model.impl.DefaultObjectWrapper;
+import org.apache.freemarker.core.util.BugException;
 import org.apache.freemarker.core.util.UndeclaredThrowableException;
 import org.apache.freemarker.core.util.WriteProtectable;
 import org.apache.freemarker.core.util._ClassUtil;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/7d784b2b/src/main/java/org/apache/freemarker/core/model/impl/beans/ClassIntrospector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/ClassIntrospector.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/ClassIntrospector.java
index 2b33fb4..d1cf191 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/ClassIntrospector.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/ClassIntrospector.java
@@ -45,9 +45,9 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.freemarker.core._CoreLogs;
-import org.apache.freemarker.core.ast.BugException;
 import org.apache.freemarker.core.model.impl.beans.BeansWrapper.MethodAppearanceDecision;
 import org.apache.freemarker.core.model.impl.beans.BeansWrapper.MethodAppearanceDecisionInput;
+import org.apache.freemarker.core.util.BugException;
 import org.apache.freemarker.core.util._NullArgumentException;
 import org.slf4j.Logger;
 



Mime
View raw message