Пример #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);
 }