Claude Brisson reopened VELOCITY-926:

When a naming collision occurs, there is a side effect which is that in 1.7, 
global context values become default values for *missing* macro arguments.

Two people reported usecases where backward compatibility was broken because of 
this 1.7 _undocumented feature_, so it's worth addressing.

The plan is to deprecate the 2.1 flag 
{{velocimacro.arguments.preserve_literals}} in favor of a new 
{{velocimacro.enable_bc_mode}} flag which would :

* preserve arguments literals
* allow global values as defaults for missing arguments
* also allow a macro to set to null a reference in the global context by 
setting one of its arguments to null (setting a global reference this way is 
allowed in 2.x but not for null values)

> Regression: Macro arguments names cannot collide with external references 
> names
> -------------------------------------------------------------------------------
>                 Key: VELOCITY-926
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-926
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 2.0, 2.1
>            Reporter: Claude Brisson
>            Assignee: Claude Brisson
>            Priority: Major
>             Fix For: 2.2
> Consider the following example:
> {code}
> #macro( test $foo $bar )
>   $foo $bar
> #end
> #set($foo = 'foo')
> #set($bar = 'bar')
> #test( $bar, $foo )
> {code}
> The expected result would be "{{bar foo}}", but since 2.0 we get the 
> incorrect result "{{bar bar}}", as if the first inner {{$foo}} macro argument 
> was overwritting the second argument evaluation.

This message was sent by Atlassian Jira

To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to