Groovy Documentation

## org.codehaus.groovy.classgen
[Java] Class ReturnAdder

    java.lang.Object
      org.codehaus.groovy.classgen.ReturnAdder

    public class ReturnAdder
    extends java.lang.Object

Utility class to add return statements. Extracted from Verifier as it can be useful for some AST transformations

Nested Class Summary
`static interface` | `ReturnAdder.ReturnStatementListener` Implement this method in order to be notified whenever a return statement is generated.

Constructor Summary
`ReturnAdder()`
`ReturnAdder(ReturnAdder.ReturnStatementListener listener)`

Method Summary
`static void` | `addReturnIfNeeded(MethodNode node)` Adds return statements in method code whenever an implicit return is detected.
`void` | `visitMethod(MethodNode node)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### ReturnAdder

    public ReturnAdder()

### ReturnAdder

    public ReturnAdder(ReturnAdder.ReturnStatementListener listener)

Method Detail

### addReturnIfNeeded

    public static void addReturnIfNeeded(MethodNode node)

  Adds return statements in method code whenever an implicit return is detected.
  deprecated:
    Use visitMethod(org.codehaus.groovy.ast.MethodNode) instead
  Parameters:
    `node` - the method node where to add return statements

### visitMethod

    public void visitMethod(MethodNode node)

Groovy Documentation