freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [4/4] incubator-freemarker git commit: Replaced some old style for loops with foreach (mostly just for arrays)
Date Fri, 17 Feb 2017 16:34:55 GMT
Replaced some old style for loops with foreach (mostly just for arrays)


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

Branch: refs/heads/3
Commit: 4b680d2058c89396e4691b4496baf24a420cb5ee
Parents: 693a94c
Author: ddekany <ddekany@apache.org>
Authored: Fri Feb 17 17:34:46 2017 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Fri Feb 17 17:34:46 2017 +0100

----------------------------------------------------------------------
 .../apache/freemarker/core/Configuration.java   |   9 +-
 .../org/apache/freemarker/core/ast/BuiltIn.java |   9 +-
 .../freemarker/core/ast/BuiltinVariable.java    |  11 +-
 .../freemarker/core/ast/Configurable.java       |  50 ++++----
 .../apache/freemarker/core/ast/Environment.java |  10 +-
 .../core/ast/OptInTemplateClassResolver.java    |   6 +-
 .../freemarker/core/ast/ParseException.java     | 113 +++++++++----------
 .../freemarker/core/ast/PropertySetting.java    |  15 ++-
 .../apache/freemarker/core/ast/TextBlock.java   |   3 +-
 .../core/ast/_ErrorDescriptionBuilder.java      |  15 ++-
 .../ast/_ObjectBuilderSettingEvaluator.java     |   3 +-
 .../core/model/impl/beans/ArgumentTypes.java    |   4 +-
 .../core/model/impl/beans/BeansWrapper.java     |   3 +-
 .../model/impl/beans/ClassIntrospector.java     |  17 ++-
 .../core/model/impl/beans/StaticModel.java      |  11 +-
 .../core/model/impl/beans/_BeansAPI.java        |   4 +-
 .../core/model/impl/beans/_EnumModels.java      |   4 +-
 .../core/model/impl/beans/_MethodUtil.java      |   4 +-
 .../core/model/impl/dom/NodeListModel.java      |   3 +-
 .../core/model/impl/dom/NodeModel.java          |  13 +--
 .../impl/FileTemplateLoader.java                |   3 +-
 .../freemarker/core/util/_StringUtil.java       |  11 +-
 .../freemarker/servlet/jsp/JspTagModelBase.java |   3 +-
 .../freemarker/servlet/jsp/TaglibFactory.java   |   3 +-
 .../core/model/impl/beans/TypeFlagsTest.java    |   4 +-
 .../servlet/jsp/TaglibMethodUtilTest.java       |   4 +-
 26 files changed, 154 insertions(+), 181 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/Configuration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/Configuration.java b/src/main/java/org/apache/freemarker/core/Configuration.java
index 94026ec..73350b6 100644
--- a/src/main/java/org/apache/freemarker/core/Configuration.java
+++ b/src/main/java/org/apache/freemarker/core/Configuration.java
@@ -529,7 +529,7 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
      * and {@link #setObjectWrapper(ObjectWrapper)}. When the user configures FreeMarker from Spring XML, he has no
      * control over the order, so it has to work on both ways.
      */
-    private HashMap/*<String, Object>*/ rewrappableSharedVariables = null;
+    private HashMap<String, Object> rewrappableSharedVariables = null;
     
     private String defaultEncoding = _SecurityUtil.getSystemProperty("file.encoding", "utf-8");
     private ConcurrentMap localeToCharsetMap = new ConcurrentHashMap();
@@ -2622,11 +2622,10 @@ public class Configuration extends Configurable implements Cloneable, ParserConf
 
     private void setSharedVariablesFromRewrappableSharedVariables() throws TemplateModelException {
         if (rewrappableSharedVariables == null) return;
-        for (Iterator it = rewrappableSharedVariables.entrySet().iterator(); it.hasNext(); ) {
-            Map.Entry/*<String, Object>*/ ent = (Entry) it.next();
-            String name = (String) ent.getKey();
+        for (Entry<String, Object> ent : rewrappableSharedVariables.entrySet()) {
+            String name = ent.getKey();
             Object value = ent.getValue();
-            
+
             TemplateModel valueAsTM;
             if (value instanceof TemplateModel) {
                 valueAsTM = (TemplateModel) value;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/BuiltIn.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/BuiltIn.java b/src/main/java/org/apache/freemarker/core/ast/BuiltIn.java
index 4845198..c48ebca 100644
--- a/src/main/java/org/apache/freemarker/core/ast/BuiltIn.java
+++ b/src/main/java/org/apache/freemarker/core/ast/BuiltIn.java
@@ -325,7 +325,7 @@ abstract class BuiltIn extends Expression implements Cloneable {
                     "Help (latest version): http://freemarker.org/docs/ref_builtins.html; "
                     + "you're using FreeMarker ").append(Configuration.getVersion()).append(".\n" 
                     + "The alphabetical list of built-ins:");
-            List names = new ArrayList(BUILT_INS_BY_NAME.keySet().size());
+            List<String> names = new ArrayList<>(BUILT_INS_BY_NAME.keySet().size());
             names.addAll(BUILT_INS_BY_NAME.keySet());
             Collections.sort(names);
             char lastLetter = 0;
@@ -338,10 +338,9 @@ abstract class BuiltIn extends Expression implements Cloneable {
             }
             
             boolean first = true;
-            for (Iterator it = names.iterator(); it.hasNext(); ) {
-                String correctName = (String) it.next();
+            for (String correctName : names) {
                 int correctNameNamingConvetion = _StringUtil.getIdentifierNamingConvention(correctName);
-                if (shownNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION 
+                if (shownNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION
                         ? correctNameNamingConvetion != Configuration.LEGACY_NAMING_CONVENTION
                         : correctNameNamingConvetion != Configuration.CAMEL_CASE_NAMING_CONVENTION) {
                     if (first) {
@@ -349,7 +348,7 @@ abstract class BuiltIn extends Expression implements Cloneable {
                     } else {
                         buf.append(", ");
                     }
-                    
+
                     char firstChar = correctName.charAt(0);
                     if (firstChar != lastLetter) {
                         lastLetter = firstChar;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java b/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
index 2504cfb..4781b05 100644
--- a/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
+++ b/src/main/java/org/apache/freemarker/core/ast/BuiltinVariable.java
@@ -148,12 +148,11 @@ final class BuiltinVariable extends Expression {
             
             sb.append("\nThe allowed special variable names are: ");
             boolean first = true;
-            for (int i = 0; i < SPEC_VAR_NAMES.length; i++) {
-                final String correctName = SPEC_VAR_NAMES[i];
-                int correctNameNamingConvetion = _StringUtil.getIdentifierNamingConvention(correctName);
-                if (shownNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION 
-                        ? correctNameNamingConvetion != Configuration.LEGACY_NAMING_CONVENTION
-                        : correctNameNamingConvetion != Configuration.CAMEL_CASE_NAMING_CONVENTION) {
+            for (final String correctName : SPEC_VAR_NAMES) {
+                int correctNameNamingConvention = _StringUtil.getIdentifierNamingConvention(correctName);
+                if (shownNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION
+                        ? correctNameNamingConvention != Configuration.LEGACY_NAMING_CONVENTION
+                        : correctNameNamingConvention != Configuration.CAMEL_CASE_NAMING_CONVENTION) {
                     if (first) {
                         first = false;
                     } else {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/Configurable.java b/src/main/java/org/apache/freemarker/core/ast/Configurable.java
index ad73956..d481944 100644
--- a/src/main/java/org/apache/freemarker/core/ast/Configurable.java
+++ b/src/main/java/org/apache/freemarker/core/ast/Configurable.java
@@ -2369,22 +2369,21 @@ public class Configurable {
                 } else if ("allows_nothing".equals(value) || "allowsNothing".equals(value)) {
                     setNewBuiltinClassResolver(TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
                 } else if (value.indexOf(":") != -1) {
-                    List segments = parseAsSegmentedList(value);
+                    List<KeyValuePair<List<String>>> segments = parseAsSegmentedList(value);
                     Set allowedClasses = null;
-                    List trustedTemplates = null;
-                    for (int i = 0; i < segments.size(); i++) {
-                        KeyValuePair kv = (KeyValuePair) segments.get(i);
-                        String segmentKey = (String) kv.getKey();
-                        List segmentValue = (List) kv.getValue();
+                    List<String> trustedTemplates = null;
+                    for (KeyValuePair<List<String>> segment : segments) {
+                        String segmentKey = segment.getKey();
+                        List<String> segmentValue = segment.getValue();
                         if (segmentKey.equals(ALLOWED_CLASSES)) {
-                            allowedClasses = new HashSet(segmentValue); 
+                            allowedClasses = new HashSet(segmentValue);
                         } else if (segmentKey.equals(TRUSTED_TEMPLATES)) {
                             trustedTemplates = segmentValue;
                         } else {
                             throw new ParseException(
                                     "Unrecognized list segment key: " + _StringUtil.jQuote(segmentKey) +
-                                    ". Supported keys are: \"" + ALLOWED_CLASSES + "\", \"" +
-                                    TRUSTED_TEMPLATES + "\"", 0, 0);
+                                            ". Supported keys are: \"" + ALLOWED_CLASSES + "\", \"" +
+                                            TRUSTED_TEMPLATES + "\"", 0, 0);
                         }
                     }
                     setNewBuiltinClassResolver(
@@ -2581,9 +2580,8 @@ public class Configurable {
     public void setSettings(Properties props) throws TemplateException {
         final _SettingEvaluationEnvironment prevEnv = _SettingEvaluationEnvironment.startScope();
         try {
-            for (Iterator it = props.keySet().iterator(); it.hasNext(); ) {
-                String key = (String) it.next();
-                setSetting(key, props.getProperty(key).trim()); 
+            for (String key : props.stringPropertyNames()) {
+                setSetting(key, props.getProperty(key).trim());
             }
         } finally {
             _SettingEvaluationEnvironment.endScope(prevEnv);
@@ -2745,11 +2743,11 @@ public class Configurable {
         if (parent != null) parent.doAutoImportsAndIncludes(env);
     }
 
-    protected ArrayList parseAsList(String text) throws ParseException {
+    protected List<String> parseAsList(String text) throws ParseException {
         return new SettingStringParser(text).parseAsList();
     }
 
-    protected ArrayList parseAsSegmentedList(String text)
+    protected List<KeyValuePair<List<String>>> parseAsSegmentedList(String text)
     throws ParseException {
         return new SettingStringParser(text).parseAsSegmentedList();
     }
@@ -2758,20 +2756,20 @@ public class Configurable {
         return new SettingStringParser(text).parseAsImportList();
     }
     
-    private static class KeyValuePair {
-        private final Object key;
-        private final Object value;
+    private static class KeyValuePair<V> {
+        private final String key;
+        private final V value;
         
-        KeyValuePair(Object key, Object value) {
+        KeyValuePair(String key, V value) {
             this.key = key;
             this.value = value;
         }
-        
-        Object getKey() {
+
+        String getKey() {
             return key;
         }
-        
-        Object getValue() {
+
+        V getValue() {
             return value;
         }
     }
@@ -2790,9 +2788,9 @@ public class Configurable {
             this.ln = text.length();
         }
 
-        ArrayList parseAsSegmentedList() throws ParseException {
-            ArrayList segments = new ArrayList();
-            ArrayList currentSegment = null;
+        List<KeyValuePair<List<String>>> parseAsSegmentedList() throws ParseException {
+            List<KeyValuePair<List<String>>> segments = new ArrayList();
+            List<String> currentSegment = null;
             
             char c;
             while (true) {
@@ -2803,7 +2801,7 @@ public class Configurable {
                 
                 if (c == ':') {
                     currentSegment = new ArrayList();
-                    segments.add(new KeyValuePair(item, currentSegment));
+                    segments.add(new KeyValuePair<List<String>>(item, currentSegment));
                 } else {
                     if (currentSegment == null) {
                         throw new ParseException(

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/Environment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/Environment.java b/src/main/java/org/apache/freemarker/core/ast/Environment.java
index 8f473af..fcafa66 100644
--- a/src/main/java/org/apache/freemarker/core/ast/Environment.java
+++ b/src/main/java/org/apache/freemarker/core/ast/Environment.java
@@ -34,7 +34,6 @@ import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.IdentityHashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -71,11 +70,11 @@ import org.apache.freemarker.core.templateresolver.TemplateResolver;
 import org.apache.freemarker.core.templateresolver._CacheAPI;
 import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateNameFormat;
 import org.apache.freemarker.core.templateresolver.impl.DefaultTemplateNameFormatFM2;
+import org.apache.freemarker.core.util.UndeclaredThrowableException;
 import org.apache.freemarker.core.util._DateUtil;
 import org.apache.freemarker.core.util._DateUtil.DateToISO8601CalendarFactory;
 import org.apache.freemarker.core.util._NullWriter;
 import org.apache.freemarker.core.util._StringUtil;
-import org.apache.freemarker.core.util.UndeclaredThrowableException;
 import org.slf4j.Logger;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -749,8 +748,7 @@ public final class Environment extends Configurable {
                 catchAllParamValue = null;
             }
 
-            for (Iterator it = namedArgs.entrySet().iterator(); it.hasNext();) {
-                final Map.Entry argNameAndValExp = (Map.Entry) it.next();
+             for (Map.Entry argNameAndValExp : (Set<Map.Entry>) namedArgs.entrySet()) {
                 final String argName = (String) argNameAndValExp.getKey();
                 final boolean isArgNameDeclared = macro.hasArgNamed(argName);
                 if (isArgNameDeclared || catchAllParamName != null) {
@@ -2721,8 +2719,8 @@ public final class Environment extends Configurable {
     }
 
     void importMacros(Template template) {
-        for (Iterator it = template.getMacros().values().iterator(); it.hasNext();) {
-            visitMacroDef((Macro) it.next());
+        for (Object macro : template.getMacros().values()) {
+            visitMacroDef((Macro) macro);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/OptInTemplateClassResolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/OptInTemplateClassResolver.java b/src/main/java/org/apache/freemarker/core/ast/OptInTemplateClassResolver.java
index 41aa62d..eaa6adf 100644
--- a/src/main/java/org/apache/freemarker/core/ast/OptInTemplateClassResolver.java
+++ b/src/main/java/org/apache/freemarker/core/ast/OptInTemplateClassResolver.java
@@ -66,15 +66,15 @@ public class OptInTemplateClassResolver implements TemplateClassResolver {
      *     This parameter can be <code>null</code> (means no trusted templates).
      */
     public OptInTemplateClassResolver(
-            Set allowedClasses, List trustedTemplates) {
+            Set allowedClasses, List<String> trustedTemplates) {
         this.allowedClasses = allowedClasses != null ? allowedClasses : Collections.EMPTY_SET;
         if (trustedTemplates != null) {
             trustedTemplateNames = new HashSet();
             trustedTemplatePrefixes = new ArrayList();
             
-            Iterator it = trustedTemplates.iterator();
+            Iterator<String> it = trustedTemplates.iterator();
             while (it.hasNext()) {
-                String li = (String) it.next();
+                String li = it.next();
                 if (li.startsWith("/")) li = li.substring(1);
                 if (li.endsWith("*")) {
                     trustedTemplatePrefixes.add(li.substring(0, li.length() - 1));

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/ParseException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/ParseException.java b/src/main/java/org/apache/freemarker/core/ast/ParseException.java
index 620fbe0..26ba8e4 100644
--- a/src/main/java/org/apache/freemarker/core/ast/ParseException.java
+++ b/src/main/java/org/apache/freemarker/core/ast/ParseException.java
@@ -422,63 +422,62 @@ public class ParseException extends IOException implements FMParserConstants {
         final int kind = nextToken.kind;
         if (kind == EOF) {
             Set/*<String>*/ endNames = new HashSet();
-            for (int i = 0; i < expectedTokenSequences.length; i++) {
-                int[] sequence = expectedTokenSequences[i];
-                for (int j = 0; j < sequence.length; j++) {
-                    switch (sequence[j]) {
-                    case END_FOREACH:
-                        endNames.add( "#foreach");
-                        break;
-                    case END_LIST:
-                        endNames.add( "#list");
-                        break;
-                    case END_SWITCH:
-                        endNames.add( "#switch");
-                        break;
-                    case END_IF:
-                        endNames.add( "#if");
-                        break;
-                    case END_COMPRESS:
-                        endNames.add( "#compress");
-                        break;
-                    case END_MACRO:
-                        endNames.add( "#macro");
-                    case END_FUNCTION:
-                        endNames.add( "#function");
-                        break;
-                    case END_TRANSFORM:
-                        endNames.add( "#transform");
-                        break;
-                    case END_ESCAPE:
-                        endNames.add( "#escape");
-                        break;
-                    case END_NOESCAPE:
-                        endNames.add( "#noescape");
-                        break;
-                    case END_ASSIGN:
-                        endNames.add( "#assign");
-                        break;
-                    case END_LOCAL:
-                        endNames.add( "#local");
-                        break;
-                    case END_GLOBAL:
-                        endNames.add( "#global");
-                        break;
-                    case END_ATTEMPT:
-                        endNames.add( "#attempt");
-                        break;
-                    case CLOSING_CURLY_BRACKET:
-                        endNames.add( "\"{\"");
-                        break;
-                    case CLOSE_BRACKET:
-                        endNames.add( "\"[\"");
-                        break;
-                    case CLOSE_PAREN:
-                        endNames.add( "\"(\"");
-                        break;
-                    case UNIFIED_CALL_END:
-                        endNames.add( "@...");
-                        break;
+            for (int[] sequence : expectedTokenSequences) {
+                for (int aSequence : sequence) {
+                    switch (aSequence) {
+                        case END_FOREACH:
+                            endNames.add("#foreach");
+                            break;
+                        case END_LIST:
+                            endNames.add("#list");
+                            break;
+                        case END_SWITCH:
+                            endNames.add("#switch");
+                            break;
+                        case END_IF:
+                            endNames.add("#if");
+                            break;
+                        case END_COMPRESS:
+                            endNames.add("#compress");
+                            break;
+                        case END_MACRO:
+                            endNames.add("#macro");
+                        case END_FUNCTION:
+                            endNames.add("#function");
+                            break;
+                        case END_TRANSFORM:
+                            endNames.add("#transform");
+                            break;
+                        case END_ESCAPE:
+                            endNames.add("#escape");
+                            break;
+                        case END_NOESCAPE:
+                            endNames.add("#noescape");
+                            break;
+                        case END_ASSIGN:
+                            endNames.add("#assign");
+                            break;
+                        case END_LOCAL:
+                            endNames.add("#local");
+                            break;
+                        case END_GLOBAL:
+                            endNames.add("#global");
+                            break;
+                        case END_ATTEMPT:
+                            endNames.add("#attempt");
+                            break;
+                        case CLOSING_CURLY_BRACKET:
+                            endNames.add("\"{\"");
+                            break;
+                        case CLOSE_BRACKET:
+                            endNames.add("\"[\"");
+                            break;
+                        case CLOSE_PAREN:
+                            endNames.add("\"(\"");
+                            break;
+                        case UNIFIED_CALL_END:
+                            endNames.add("@...");
+                            break;
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/PropertySetting.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/PropertySetting.java b/src/main/java/org/apache/freemarker/core/ast/PropertySetting.java
index b31808a..a7083b7 100644
--- a/src/main/java/org/apache/freemarker/core/ast/PropertySetting.java
+++ b/src/main/java/org/apache/freemarker/core/ast/PropertySetting.java
@@ -86,19 +86,18 @@ final class PropertySetting extends TemplateElement {
                 }
                 
                 boolean first = true;
-                for (int i = 0; i < SETTING_NAMES.length; i++) {
-                    String correctName = SETTING_NAMES[i];
-                    int correctNameNamingConvetion = _StringUtil.getIdentifierNamingConvention(correctName);
-                    if (shownNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION 
-                            ? correctNameNamingConvetion != Configuration.LEGACY_NAMING_CONVENTION
-                            : correctNameNamingConvetion != Configuration.CAMEL_CASE_NAMING_CONVENTION) {
+                for (String correctName : SETTING_NAMES) {
+                    int correctNameNamingConvention = _StringUtil.getIdentifierNamingConvention(correctName);
+                    if (shownNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION
+                            ? correctNameNamingConvention != Configuration.LEGACY_NAMING_CONVENTION
+                            : correctNameNamingConvention != Configuration.CAMEL_CASE_NAMING_CONVENTION) {
                         if (first) {
                             first = false;
                         } else {
                             sb.append(", ");
                         }
-                    
-                        sb.append(SETTING_NAMES[i]);
+
+                        sb.append(correctName);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/TextBlock.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/TextBlock.java b/src/main/java/org/apache/freemarker/core/ast/TextBlock.java
index e6cd638..cc1ad9c 100644
--- a/src/main/java/org/apache/freemarker/core/ast/TextBlock.java
+++ b/src/main/java/org/apache/freemarker/core/ast/TextBlock.java
@@ -316,8 +316,7 @@ public final class TextBlock extends TemplateElement {
         if (isIgnorable(true)) {
             return false;
         }
-        for (int i = 0; i < text.length; i++) {
-            char c = text[i];
+        for (char c : text) {
             if (c == '\n' || c == '\r') {
                 return false;
             }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/ast/_ErrorDescriptionBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/ast/_ErrorDescriptionBuilder.java b/src/main/java/org/apache/freemarker/core/ast/_ErrorDescriptionBuilder.java
index eb022b5..1477e17 100644
--- a/src/main/java/org/apache/freemarker/core/ast/_ErrorDescriptionBuilder.java
+++ b/src/main/java/org/apache/freemarker/core/ast/_ErrorDescriptionBuilder.java
@@ -142,8 +142,8 @@ public class _ErrorDescriptionBuilder {
                 int dst = 0;
                 if (tip != null) allTips[dst++] = tip; 
                 if (tips != null) {
-                    for (int i = 0; i < tips.length; i++) {
-                        allTips[dst++] = tips[i]; 
+                    for (Object t : tips) {
+                        allTips[dst++] = t;
                     }
                 }
                 if (extraTip != null) allTips[dst++] = extraTip; 
@@ -209,9 +209,8 @@ public class _ErrorDescriptionBuilder {
     }
 
     private void appendParts(StringBuilder sb, Object[] parts) {
-        Template template = this.template != null ? this.template : (blamed != null ? blamed.getTemplate() : null); 
-        for (int i = 0; i < parts.length; i++) {
-            Object partObj = parts[i];
+        Template template = this.template != null ? this.template : (blamed != null ? blamed.getTemplate() : null);
+        for (Object partObj : parts) {
             if (partObj instanceof Object[]) {
                 appendParts(sb, (Object[]) partObj);
             } else {
@@ -220,14 +219,14 @@ public class _ErrorDescriptionBuilder {
                 if (partStr == null) {
                     partStr = "null";
                 }
-                
+
                 if (template != null) {
                     if (partStr.length() > 4
                             && partStr.charAt(0) == '<'
                             && (
-                                    (partStr.charAt(1) == '#' || partStr.charAt(1) == '@')
+                            (partStr.charAt(1) == '#' || partStr.charAt(1) == '@')
                                     || (partStr.charAt(1) == '/') && (partStr.charAt(2) == '#' || partStr.charAt(2) == '@')
-                               )
+                    )
                             && partStr.charAt(partStr.length() - 1) == '>') {
                         if (template.getActualTagSyntax() == Configuration.SQUARE_BRACKET_TAG_SYNTAX) {
                             sb.append('[');

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/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
index 984babe..06ccd7d 100644
--- a/src/main/java/org/apache/freemarker/core/ast/_ObjectBuilderSettingEvaluator.java
+++ b/src/main/java/org/apache/freemarker/core/ast/_ObjectBuilderSettingEvaluator.java
@@ -715,8 +715,7 @@ public class _ObjectBuilderSettingEvaluator {
         try {
             PropertyDescriptor[] propDescs = Introspector.getBeanInfo(cl).getPropertyDescriptors();
             beanPropSetters = new HashMap(propDescs.length * 4 / 3, 1.0f);
-            for (int i = 0; i < propDescs.length; i++) {
-                PropertyDescriptor propDesc = propDescs[i];
+            for (PropertyDescriptor propDesc : propDescs) {
                 final Method writeMethod = propDesc.getWriteMethod();
                 if (writeMethod != null) {
                     beanPropSetters.put(propDesc.getName(), writeMethod);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/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 c52294a..de31367 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
@@ -81,8 +81,8 @@ final class ArgumentTypes {
     @Override
     public int hashCode() {
         int hash = 0;
-        for (int i = 0; i < types.length; ++i) {
-            hash ^= types[i].hashCode();
+        for (Class<?> type : types) {
+            hash ^= type.hashCode();
         }
         return hash;
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/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 3b4d3a8..14b0f80 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
@@ -1297,8 +1297,7 @@ public class BeansWrapper implements RichObjectWrapper, WriteProtectable {
             boolean isComponentTypeNumerical = false;  // will be filled on demand
             boolean isComponentTypeList = false;  // will be filled on demand
             int i = 0;
-            for (Iterator<?> it = list.iterator(); it.hasNext(); ) {
-                Object listItem = it.next();
+            for (Object listItem : list) {
                 if (listItem != null && !componentType.isInstance(listItem)) {
                     // Type conversion is needed. If we can't do it, we just let it fail at Array.set later.
                     if (!isComponentTypeExamined) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/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 4805db4..6f3516c 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
@@ -291,9 +291,7 @@ class ClassIntrospector {
 
     private void addFieldsToClassIntrospectionData(Map<Object, Object> introspData, Class<?> clazz)
             throws SecurityException {
-        Field[] fields = clazz.getFields();
-        for (int i = 0; i < fields.length; i++) {
-            Field field = fields[i];
+        for (Field field : clazz.getFields()) {
             if ((field.getModifiers() & Modifier.STATIC) == 0) {
                 introspData.put(field.getName(), field);
             }
@@ -436,8 +434,8 @@ class ClassIntrospector {
                 introspData.put(CONSTRUCTORS_KEY, new SimpleMethod(ctor, ctor.getParameterTypes()));
             } else if (ctors.length > 1) {
                 OverloadedMethods overloadedCtors = new OverloadedMethods(bugfixed);
-                for (int i = 0; i < ctors.length; i++) {
-                    overloadedCtors.addConstructor(ctors[i]);
+                for (Constructor<?> ctor : ctors) {
+                    overloadedCtors.addConstructor(ctor);
                 }
                 introspData.put(CONSTRUCTORS_KEY, overloadedCtors);
             }
@@ -461,8 +459,7 @@ class ClassIntrospector {
         if (Modifier.isPublic(clazz.getModifiers())) {
             try {
                 Method[] methods = clazz.getMethods();
-                for (int i = 0; i < methods.length; i++) {
-                    Method method = methods[i];
+                for (Method method : methods) {
                     MethodSignature sig = new MethodSignature(method);
                     // Contrary to intuition, a class can actually have several
                     // different methods with same signature *but* different
@@ -477,7 +474,7 @@ class ClassIntrospector {
                     // C.class will have both "Object m()" and "Integer m()" methods.
                     List<Method> methodList = accessibles.get(sig);
                     if (methodList == null) {
-                     // TODO Collection.singletonList is more efficient, though read only.
+                        // TODO Collection.singletonList is more efficient, though read only.
                         methodList = new LinkedList<>();
                         accessibles.put(sig, methodList);
                     }
@@ -492,8 +489,8 @@ class ClassIntrospector {
         }
 
         Class<?>[] interfaces = clazz.getInterfaces();
-        for (int i = 0; i < interfaces.length; i++) {
-            discoverAccessibleMethods(interfaces[i], accessibles);
+        for (Class<?> anInterface : interfaces) {
+            discoverAccessibleMethods(anInterface, accessibles);
         }
         Class<?> superclass = clazz.getSuperclass();
         if (superclass != null) {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/model/impl/beans/StaticModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/StaticModel.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/StaticModel.java
index f022300..024e454 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/StaticModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/StaticModel.java
@@ -115,8 +115,7 @@ final class StaticModel implements TemplateHashModelEx {
         }
 
         Field[] fields = clazz.getFields();
-        for (int i = 0; i < fields.length; ++i) {
-            Field field = fields[i];
+        for (Field field : fields) {
             int mod = field.getModifiers();
             if (Modifier.isPublic(mod) && Modifier.isStatic(mod)) {
                 if (Modifier.isFinal(mod))
@@ -126,7 +125,8 @@ final class StaticModel implements TemplateHashModelEx {
                         map.put(field.getName(), wrapper.getOuterIdentity().wrap(field.get(null)));
                     } catch (IllegalAccessException e) {
                         // Intentionally ignored
-                    } else
+                    }
+                else
                     // This is a special flagging value: Field in the map means
                     // that this is a non-final field, and it must be evaluated
                     // on each get() call.
@@ -135,8 +135,7 @@ final class StaticModel implements TemplateHashModelEx {
         }
         if (wrapper.getExposureLevel() < BeansWrapper.EXPOSE_PROPERTIES_ONLY) {
             Method[] methods = clazz.getMethods();
-            for (int i = 0; i < methods.length; ++i) {
-                Method method = methods[i];
+            for (Method method : methods) {
                 int mod = method.getModifiers();
                 if (Modifier.isPublic(mod) && Modifier.isStatic(mod)
                         && wrapper.getClassIntrospector().isAllowedToExpose(method)) {
@@ -154,7 +153,7 @@ final class StaticModel implements TemplateHashModelEx {
                         if (obj != null) {
                             if (LOG.isInfoEnabled()) {
                                 LOG.info("Overwriting value [" + obj + "] for " +
-                                        " key '" + name + "' with [" + method + 
+                                        " key '" + name + "' with [" + method +
                                         "] in static model for " + clazz.getName());
                             }
                         }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/model/impl/beans/_BeansAPI.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/_BeansAPI.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/_BeansAPI.java
index bac89a5..a8c6680 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/_BeansAPI.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/_BeansAPI.java
@@ -65,9 +65,7 @@ public class _BeansAPI {
                 = new ArrayList<>();
         final List<ReflectionCallableMemberDescriptor> varArgsMemberDescs
                 = new ArrayList<>();
-        final Constructor<?>[] constrs = pClass.getConstructors();
-        for (int i = 0; i < constrs.length; i++) {
-            Constructor<?> constr = constrs[i];
+        for (Constructor<?> constr : pClass.getConstructors()) {
             ReflectionCallableMemberDescriptor memberDesc = new ReflectionCallableMemberDescriptor(constr, constr.getParameterTypes());
             if (!_MethodUtil.isVarargs(constr)) {
                 fixedArgMemberDescs.add(memberDesc);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/model/impl/beans/_EnumModels.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/_EnumModels.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/_EnumModels.java
index 932bf61..573757b 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/_EnumModels.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/_EnumModels.java
@@ -45,8 +45,8 @@ public class _EnumModels extends ClassBasedModelFactory {
             return null;
         }
         Map map = new LinkedHashMap();
-        for (int i = 0; i < obj.length; i++) {
-            Enum value = (Enum) obj[i];
+        for (Object anObj : obj) {
+            Enum value = (Enum) anObj;
             map.put(value.name(), value);
         }
         return new SimpleMapModel(map, getWrapper());

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java b/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
index ae99450..3271371 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/beans/_MethodUtil.java
@@ -175,8 +175,8 @@ public final class _MethodUtil {
             collectAssignables(sc, c2, s);
         }
         Class[] itf = c1.getInterfaces();
-        for (int i = 0; i < itf.length; ++i) {
-            collectAssignables(itf[i], c2, s);
+        for (Class anItf : itf) {
+            collectAssignables(anItf, c2, s);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java b/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
index 73097bf..2575bc5 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeListModel.java
@@ -204,8 +204,7 @@ class NodeListModel extends SimpleSequence implements TemplateHashModel, _Unexpe
 
     @Override
     public Object[] explainTypeError(Class[] expectedClasses) {
-        for (int i = 0; i < expectedClasses.length; i++) {
-            Class expectedClass = expectedClasses[i];
+        for (Class expectedClass : expectedClasses) {
             if (TemplateScalarModel.class.isAssignableFrom(expectedClass)
                     || TemplateDateModel.class.isAssignableFrom(expectedClass)
                     || TemplateNumberModel.class.isAssignableFrom(expectedClass)

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeModel.java b/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeModel.java
index 3d108a1..2aca51d 100644
--- a/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeModel.java
+++ b/src/main/java/org/apache/freemarker/core/model/impl/dom/NodeModel.java
@@ -771,17 +771,16 @@ implements TemplateNodeModelEx, TemplateHashModel, TemplateSequenceModel,
     
     @Override
     public Object[] explainTypeError(Class[] expectedClasses) {
-        for (int i = 0; i < expectedClasses.length; i++) {
-            Class expectedClass = expectedClasses[i];
+        for (Class expectedClass : expectedClasses) {
             if (TemplateDateModel.class.isAssignableFrom(expectedClass)
                     || TemplateNumberModel.class.isAssignableFrom(expectedClass)
                     || TemplateBooleanModel.class.isAssignableFrom(expectedClass)) {
-                return new Object[] {
+                return new Object[]{
                         "XML node values are always strings (text), that is, they can't be used as number, "
-                        + "date/time/datetime or boolean without explicit conversion (such as "
-                        + "someNode?number, someNode?datetime.xs, someNode?date.xs, someNode?time.xs, "
-                        + "someNode?boolean).",
-                        };
+                                + "date/time/datetime or boolean without explicit conversion (such as "
+                                + "someNode?number, someNode?datetime.xs, someNode?date.xs, someNode?time.xs, "
+                                + "someNode?boolean).",
+                };
             }
         }
         return null;

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java b/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
index d048070..360dd60 100644
--- a/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
+++ b/src/main/java/org/apache/freemarker/core/templateresolver/impl/FileTemplateLoader.java
@@ -233,8 +233,7 @@ public class FileTemplateLoader implements TemplateLoader {
         
                 if (!identicalNameFound) {
                     // If we find a similarly named file that only differs in case, then this is a file-not-found.
-                    for (int i = 0; i < listing.length; i++) {
-                        final String listingEntry = listing[i];
+                    for (final String listingEntry : listing) {
                         if (fileName.equalsIgnoreCase(listingEntry)) {
                             if (LOG.isDebugEnabled()) {
                                 LOG.debug("Emulating file-not-found because of letter case differences to the "

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/core/util/_StringUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/core/util/_StringUtil.java b/src/main/java/org/apache/freemarker/core/util/_StringUtil.java
index a63f299..201b2ac 100644
--- a/src/main/java/org/apache/freemarker/core/util/_StringUtil.java
+++ b/src/main/java/org/apache/freemarker/core/util/_StringUtil.java
@@ -213,9 +213,8 @@ public class _StringUtil {
      * For efficiently copying very short char arrays.
      */
     private static int shortArrayCopy(char[] src, char[] dst, int dstOffset) {
-        int ln = src.length;
-        for (int i = 0; i < ln; i++) {
-            dst[dstOffset++] = src[i];
+        for (char aSrc : src) {
+            dst[dstOffset++] = aSrc;
         }
         return dstOffset;
     }
@@ -360,9 +359,8 @@ public class _StringUtil {
             if (safeInURL(c, keepSlash)) {
                 if (encStart != -1) {
                     byte[] o = s.substring(encStart, i).getBytes(charset);
-                    for (int j = 0; j < o.length; j++) {
+                    for (byte bc : o) {
                         b.append('%');
-                        byte bc = o[j];
                         int c1 = bc & 0x0F;
                         int c2 = (bc >> 4) & 0x0F;
                         b.append((char) (c2 < 10 ? c2 + '0' : c2 - 10 + 'A'));
@@ -379,9 +377,8 @@ public class _StringUtil {
         }
         if (encStart != -1) {
             byte[] o = s.substring(encStart, i).getBytes(charset);
-            for (int j = 0; j < o.length; j++) {
+            for (byte bc : o) {
                 b.append('%');
-                byte bc = o[j];
                 int c1 = bc & 0x0F;
                 int c2 = (bc >> 4) & 0x0F;
                 b.append((char) (c2 < 10 ? c2 + '0' : c2 - 10 + 'A'));

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java b/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
index 61b965e..e96f89b 100644
--- a/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
+++ b/src/main/java/org/apache/freemarker/servlet/jsp/JspTagModelBase.java
@@ -55,8 +55,7 @@ class JspTagModelBase {
         this.tagClass = tagClass;
         BeanInfo bi = Introspector.getBeanInfo(tagClass);
         PropertyDescriptor[] pda = bi.getPropertyDescriptors();
-        for (int i = 0; i < pda.length; i++) {
-            PropertyDescriptor pd = pda[i];
+        for (PropertyDescriptor pd : pda) {
             Method m = pd.getWriteMethod();
             if (m != null) {
                 propertySetters.put(pd.getName(), m);

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java b/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
index 096f2f3..d65890b 100644
--- a/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
+++ b/src/main/java/org/apache/freemarker/servlet/jsp/TaglibFactory.java
@@ -754,8 +754,7 @@ public class TaglibFactory implements TemplateHashModel {
             if (tldFiles == null) {
                 throw new IOException("Can't list this directory for some reason: " + dir);
             }
-            for (int i = 0; i < tldFiles.length; i++) {
-                final File file = tldFiles[i];
+            for (final File file : tldFiles) {
                 addTldLocationFromTld(new FileTldLocation(file));
             }
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/test/java/org/apache/freemarker/core/model/impl/beans/TypeFlagsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/core/model/impl/beans/TypeFlagsTest.java b/src/test/java/org/apache/freemarker/core/model/impl/beans/TypeFlagsTest.java
index c784e95..0730b3a 100644
--- a/src/test/java/org/apache/freemarker/core/model/impl/beans/TypeFlagsTest.java
+++ b/src/test/java/org/apache/freemarker/core/model/impl/beans/TypeFlagsTest.java
@@ -662,8 +662,8 @@ public class TypeFlagsTest extends TestCase {
                 assertEquals(expectedTypeFlags[i], actualParamTypes[i]);
             }
         } else {
-            for (int i = 0; i < expectedTypeFlags.length; i++) {
-                assertEquals(expectedTypeFlags[i], 0);
+            for (int expectedTypeFlag : expectedTypeFlags) {
+                assertEquals(expectedTypeFlag, 0);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b680d20/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java b/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java
index 6a4a295..e4a0a3b 100644
--- a/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java
+++ b/src/test/java/org/apache/freemarker/servlet/jsp/TaglibMethodUtilTest.java
@@ -98,8 +98,8 @@ public class TaglibMethodUtilTest {
 
         public static double sum(double [] a) { 
             double sum = 0.0;
-            for (int i = 0; i < a.length; i++) {
-                sum += a[i];
+            for (double i : a) {
+                sum += i;
             }
             return sum;
         }


Mime
View raw message