title: Deprecated property in Velocity
body: <p>I have written pretty basic Velocity template which uses <code>#foreach</code> directive. When I run it, I get the following message in the log:</p>
  
  <blockquote>
    <p>[warn] The directive.foreach.iterator.name property has been
    deprecated. It will be removed (along with $velocityHasNext itself )
    in Velocity 2.0.  Instead, please use $foreach.hasNext to access this
    value from now on.</p>
  </blockquote>
  
  <p>But the problem is that <strong>I don't use this property</strong>, at least explicitly. I just use <code>#foreach</code> loop in its basic form, exactly as shown in the <a href="http://velocity.apache.org/engine/devel/user-guide.html#Loops" rel="nofollow">user guide</a>.</p>
  
  <p>Below is the simple code which yields this log warning. Velocity version is 1.7.</p>
  
  <pre><code>final Properties properties = new Properties();
  VelocityEngine velocityEngine = new VelocityEngine();
  velocityEngine.init(properties);
  
  StringWriter stringWriter = new StringWriter();
  Map&lt;String, Object&gt; velocityVars = new HashMap&lt;&gt;();
  List&lt;Date&gt; dates = new ArrayList&lt;&gt;(); 
  dates.add(new Date()); 
  dates.add(new Date());
  velocityVars.put("dates", dates);
  VelocityContext velocityContext = new VelocityContext(velocityVars);
  
  String template =
                  "foo\n" +
                  "#foreach($d in $dates)\n" +
                  "  $d\n" +
                  "#end \n" +
                  "bar";
  
  velocityEngine.evaluate(velocityContext, stringWriter, "blah", template);
  System.out.println(stringWriter.toString());
  </code></pre>
  
  <p>So the question is - why is this warning logged and how do I structure my code to prevent it from appearing?</p>