[ https://issues.apache.org/jira/browse/GROOVY-8835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-8835. ------------------------------- Resolution: Fixed Assignee: Paul King Fix Version/s: 2.5.3 3.0.0-alpha-4 Thanks for the suggestion. I agree it makes sense to elide the operation token for the EmptyExpression case. At the moment I have done it only for ASSIGN. > AstNodeToScriptVisitor - no token needed for EmptyStatement initialization > -------------------------------------------------------------------------- > > Key: GROOVY-8835 > URL: https://issues.apache.org/jira/browse/GROOVY-8835 > Project: Groovy > Issue Type: Bug > Components: Groovy Console, Swing > Affects Versions: 2.5.2 > Reporter: Anton Pryamostanov > Assignee: Paul King > Priority: Minor > Labels: inspect > Fix For: 3.0.0-alpha-4, 2.5.3 > > > Consider the following example: > {code:java} > package groovy > import groovy.inspect.swingui.AstNodeToScriptVisitor > import org.codehaus.groovy.ast.expr.EmptyExpression > import org.codehaus.groovy.ast.tools.GeneralUtils > class SandBox { > static void main(String[] args) { > new SandBox().someMethod() > } > void someMethod() { > StringWriter stringWriter = new StringWriter() > GeneralUtils.declS(GeneralUtils.varX("someVariableName"), new > EmptyExpression()).visit(new AstNodeToScriptVisitor(stringWriter)) > System.out.println("Output: > "+stringWriter.getBuffer().toString().replace("\$", "")) > } > } > {code} > Actual result: > {code} > Output: java.lang.Object someVariableName = > {code} > Expected result: > {code} > Output: java.lang.Object someVariableName > {code} > When DeclarationExpression (or possibly other BinaryExpression) is > initialized with EmptyExpression as "right" expression, > *AstNodeToScriptVisitor* should not output the token ("=" in this example), > as there is no corresponding expression printed after the token. -- This message was sent by Atlassian JIRA (v7.6.3#76005)