Class BytecodeGroovyClassLoader

java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
groovy.lang.GroovyClassLoader
org.jbehave.core.configuration.groovy.BytecodeGroovyClassLoader
All Implemented Interfaces:
Closeable, AutoCloseable

public class BytecodeGroovyClassLoader extends groovy.lang.GroovyClassLoader
Groovy does not cache the bytecode sequences for generated classes. BytecodeReadingParanamer needs these to get paramater names from classes The Groovy compiler does create the debug tables, and they are the same as the ones made for a native Java class, so this derived GroovyClassLoader fills in for the missing functionality from the base GroovyClassLoader.

Groovy allows a mechanism via a system property to force the dump of bytecode to a (temp) directory, but caching the bytecode avoids having to clean up temp directories after the run.

  • Constructor Details

    • BytecodeGroovyClassLoader

      public BytecodeGroovyClassLoader()
  • Method Details

    • getResourceAsStream

      public InputStream getResourceAsStream(String name)
      Overrides:
      getResourceAsStream in class URLClassLoader
    • createCollector

      protected groovy.lang.GroovyClassLoader.ClassCollector createCollector(org.codehaus.groovy.control.CompilationUnit unit, org.codehaus.groovy.control.SourceUnit su)
      Overrides:
      createCollector in class groovy.lang.GroovyClassLoader