Hello,
I just did a migration of velocity 1.6 engine to 2.2. on a system that
runs a lot of untethered velocity code from various sources. I ran into
a few compatibilty quirks that may be worth mentioning in the
documentation. Perhaps I missed some of them in which case I should have
looked better. Here they are:
* In at least 1.6 the variable $true could be used as the right side
(value) in a #set, in a conditional statement #if and passed as a
method argument. In these cases it was regarded as boolean true.
Some code relied on this quirk or did not notice mistyping true with
$true. It was obviously a quirk because $true could not actually be
given a value or 'printed', this would result in an error. This
problem is easily fixable by overriding VelocityContext.get to catch
these oddities.
* References by name such as the one below do not work anymore if the
$map implements the java Map interface indirectly.
#set($map.foo = 'bar')
The reason is the MapSetExecutor doesn't check the interfaces
implementation of supers.
* Obscure and fairly irrelevant: #set(${$foo} = 'bar') did not throw
an exception
That's it!
Regards,
Laurens van der Klis