Package: org.codehaus.groovy.classgen

## [Java] Class ReturnAdder

- org.codehaus.groovy.classgen.ReturnAdder

-     public class ReturnAdder
      extends Object

  Utility class to add return statements.

  Extracted from Verifier as it can be useful for some AST transformations.

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `interface` | `ReturnAdder.ReturnStatementListener` | Listener notified when a synthetic return statement is created.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ReturnAdder()` Creates a new return adder that adds return statements to methods.
    `ReturnAdder(ReturnAdder.ReturnStatementListener listener)` Creates a new return adder with a listener.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static void` | `addReturnIfNeeded(MethodNode node)` Adds return statements to a method whenever an implicit return is detected.
    `` | `public void` | `visitMethod(MethodNode node)` Adds return statements to given method whenever an implicit return is detected.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### public ReturnAdder()

      Creates a new return adder that adds return statements to methods.

    - #### public ReturnAdder(ReturnAdder.ReturnStatementListener listener)

      Creates a new return adder with a listener. Returns are not actually added when using a listener; instead, the listener is notified of what return statements would be added.

      Parameters:
        `listener` - the listener to notify of return statement additions

  - ### Method Detail

    - #### @Deprecated
      public static void addReturnIfNeeded(MethodNode node)

      Adds return statements to a method whenever an implicit return is detected.

      deprecated:
        Use visitMethod(MethodNode) instead.
      Parameters:
        `node` - the method to process

    - #### public void visitMethod(MethodNode node)

      Adds return statements to given method whenever an implicit return is detected.

      Parameters:
        `node` - the method node to visit and add returns to