Eric Milles created GROOVY-8275: ----------------------------------- Summary: Newify transform docs missing support for local variable declaration Key: GROOVY-8275 URL: https://issues.apache.org/jira/browse/GROOVY-8275 Project: Groovy Issue Type: Documentation Components: xforms Reporter: Eric Milles Priority: Minor
Javadocs and online documentation for the Newify AST transform is not quite clear in a couple instances. 1) Online docs http://groovy-lang.org/metaprogramming.html#xform-Newify Ruby-style section could be more clear IMO if the {{([Tree,Leaf])}} were removed since it only enables the Python-style expressions. 2) Javadoc and online docs do not mention that {{@Newify}} can be applied to a local variable declaration, like: {{@Newify def o = Object.new()}}. 3) The scoping of the transform is pretty clear for the class, method and field/property cases. However for the local variable case, it appears that the transform applies throughout the containing scope of the local variable. That is, I can use the extra constructors anywhere in the block to re-initialize the variable. {{@Newify def o = Object.new(); ... o = Object.new() ...}}. Is this the intended behavior? My intuition was that the initializer expression was the only place the transform applied, like in the case of a field. -- This message was sent by Atlassian JIRA (v6.4.14#64029)