예제 #1
0
 public Class loadClass(
     String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve)
     throws ClassNotFoundException, CompilationFailedException {
   Class c = findLoadedClass(name);
   if (c != null) return c;
   return delegate.loadClass(name, lookupScriptFiles, preferClassOverScript, resolve);
 }
예제 #2
0
    protected Class createClass(byte[] code, ClassNode classNode) {
      BytecodeProcessor bytecodePostprocessor = unit.getConfiguration().getBytecodePostprocessor();
      byte[] fcode = code;
      if (bytecodePostprocessor != null) {
        fcode = bytecodePostprocessor.processBytecode(classNode.getName(), fcode);
      }
      GroovyClassLoader cl = getDefiningClassLoader();
      Class theClass =
          cl.defineClass(
              classNode.getName(), fcode, 0, fcode.length, unit.getAST().getCodeSource());
      this.loadedClasses.add(theClass);

      if (generatedClass == null) {
        ModuleNode mn = classNode.getModule();
        SourceUnit msu = null;
        if (mn != null) msu = mn.getContext();
        ClassNode main = null;
        if (mn != null) main = (ClassNode) mn.getClasses().get(0);
        if (msu == su && main == classNode) generatedClass = theClass;
      }

      return theClass;
    }
예제 #3
0
 public void addURL(URL url) {
   delegate.addURL(url);
 }
예제 #4
0
 public void setResourceLoader(GroovyResourceLoader resourceLoader) {
   delegate.setResourceLoader(resourceLoader);
 }
예제 #5
0
 public Class parseClass(GroovyCodeSource codeSource, boolean shouldCache)
     throws CompilationFailedException {
   return delegate.parseClass(codeSource, shouldCache);
 }
예제 #6
0
 public GroovyResourceLoader getResourceLoader() {
   return delegate.getResourceLoader();
 }
예제 #7
0
 public URL[] getURLs() {
   return delegate.getURLs();
 }
예제 #8
0
 public URL getResource(String name) {
   return delegate.getResource(name);
 }
예제 #9
0
 public InputStream getResourceAsStream(String name) {
   return delegate.getResourceAsStream(name);
 }
예제 #10
0
 public Class[] getLoadedClasses() {
   return delegate.getLoadedClasses();
 }
예제 #11
0
 public Enumeration findResources(String name) throws IOException {
   return delegate.findResources(name);
 }
예제 #12
0
 public URL findResource(String name) {
   return delegate.findResource(name);
 }
예제 #13
0
 public void clearCache() {
   delegate.clearCache();
 }
예제 #14
0
 public void addClasspath(String path) {
   delegate.addClasspath(path);
 }