Velocity template not showing results from Java method call

We can call methods of any Java class from Apache Velocity. Now if that method happens to return a List<String>, and then process that list with #foreach, then we should be aware that in Velocity the result will be something like [foo, bar] instead of ["foo", "bar"]. We will get an array of texts and not an array of strings. If we assume that we get strings and try to manipulate them that way, let’s say by calling toUpperCase() on them Velocity may just decide to ignore that method call on a thing that doesn’t have that method and show nothing as a result. No error messages either. Making it quite hard to figure out what went wrong. At least this happened in my case.