Package groovy.lang

Class GroovyClassLoader.ClassCollector

java.lang.Object
groovy.lang.GroovyClassLoader.ClassCollector
All Implemented Interfaces:
CompilationUnit.ClassgenCallback
Enclosing class:
GroovyClassLoader

public static class GroovyClassLoader.ClassCollector extends Object implements CompilationUnit.ClassgenCallback
Collects classes defined during a compilation unit callback.
  • Constructor Details

    • ClassCollector

      protected ClassCollector(GroovyClassLoader.InnerLoader cl, CompilationUnit unit, SourceUnit su)
      Creates a class collector for the supplied compilation state.
      Parameters:
      cl - the defining loader used for generated classes
      unit - the compilation unit producing classes
      su - the primary source unit for the compilation round
  • Method Details

    • getDefiningClassLoader

      public GroovyClassLoader getDefiningClassLoader()
      Returns the loader used to define generated classes.
      Returns:
      the defining class loader
    • createClass

      protected Class createClass(byte[] code, ClassNode classNode)
      Defines a generated class from bytecode produced for a class node.
      Parameters:
      code - the generated bytecode
      classNode - the corresponding class node
      Returns:
      the defined class
    • onClassNode

      protected Class onClassNode(org.objectweb.asm.ClassWriter classWriter, ClassNode classNode)
      Converts the generated class writer output into a defined class.
      Parameters:
      classWriter - the ASM writer containing generated bytecode
      classNode - the corresponding class node
      Returns:
      the defined class
    • call

      public void call(org.objectweb.asm.ClassVisitor classWriter, ClassNode classNode)
      Specified by:
      call in interface CompilationUnit.ClassgenCallback
    • getLoadedClasses

      public Collection getLoadedClasses()
      Returns the classes defined during the current compilation callback.
      Returns:
      the generated classes in definition order