Package org.apache.groovy.contracts.classgen.asm

# Class ContractClosureWriter

java.lang.Object
org.apache.groovy.contracts.classgen.asm.ContractClosureWriter

public class ContractClosureWriter extends Object

Replaces annotation closures with closure implementation classes.

Attention: large parts of this class have been backported from Groovy 1.8 and customized for usage in groovy-contracts.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ContractClosureWriter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ClassNode`
  `createClosureClass(ClassNode classNode, MethodNode methodNode, ClosureExpression expression, boolean addOldVariable, boolean addResultVariable, int mods)`
  Generates a synthetic closure implementation class for the supplied contract closure.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ContractClosureWriter

    public ContractClosureWriter()

- ## Method Details

  - ### createClosureClass

    public ClassNode createClosureClass(ClassNode classNode, MethodNode methodNode, ClosureExpression expression, boolean addOldVariable, boolean addResultVariable, int mods)
    Generates a synthetic closure implementation class for the supplied contract closure.
    Parameters:
      `classNode` - the declaring class
      `methodNode` - the owning method or constructor, or `null` for class invariants
      `expression` - the rewritten closure body
      `addOldVariable` - whether to expose the `old` map parameter
      `addResultVariable` - whether to expose the `result` parameter
      `mods` - the access modifiers to apply to the generated class
    Returns:
      the generated closure implementation class