Class ContractClosureWriter
java.lang.Object
org.apache.groovy.contracts.classgen.asm.ContractClosureWriter
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 -
Method Summary
Modifier and TypeMethodDescriptioncreateClosureClass(ClassNode classNode, MethodNode methodNode, ClosureExpression expression, boolean addOldVariable, boolean addResultVariable, int mods) Generates a synthetic closure implementation class for the supplied contract closure.
-
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 classmethodNode- the owning method or constructor, ornullfor class invariantsexpression- the rewritten closure bodyaddOldVariable- whether to expose theoldmap parameteraddResultVariable- whether to expose theresultparametermods- the access modifiers to apply to the generated class- Returns:
- the generated closure implementation class
-