Package org.jruby.util

Examples of org.jruby.util.JRubyClassLoader


            }
        } finally {
            br.close();
        }

        DumpingInvocationMethodFactory dumper = new DumpingInvocationMethodFactory(args[1], new JRubyClassLoader(ClassLoader.getSystemClassLoader()));

        for (String name : classNames) {
            MethodClumper clumper = new MethodClumper();
           
            try {
View Full Code Here


            int read = 0;
            while ((read = in.read(buf)) != -1) {
                baos.write(buf, 0, read);
            }
            buf = baos.toByteArray();
            JRubyClassLoader jcl = runtime.getJRubyClassLoader();
            ClassReader cr = new ClassReader(buf);
            String className = cr.getClassName().replace('/', '.');

            Class clazz = null;
            try {
                clazz = jcl.loadClass(className);
            } catch (ClassNotFoundException cnfe) {
                clazz = jcl.defineClass(className, buf);
            }
           
            // if it's a compiled JRuby script, instantiate and run it
            if (Script.class.isAssignableFrom(clazz)) {
                Script script = (Script)clazz.newInstance();
View Full Code Here

            ((ASMifierClassVisitor)cv).print(new PrintWriter(System.out));
            return createHandle(classLoader, method, false);
        } else {
            byte[] bytes = ((ClassWriter)cv).toByteArray();
       
            Class handleClass = (classLoader != null ? classLoader : new JRubyClassLoader(JRubyClassLoader.class.getClassLoader())).defineClass(name, bytes);

            try {
                return (Handle)handleClass.newInstance();
            } catch (Exception e) {
                throw new RuntimeException(e);
View Full Code Here

    public InvocationCallbackFactory(Ruby runtime, final Class type, ClassLoader classLoader) {
        this.type = type;
        if (classLoader instanceof JRubyClassLoader) {
            this.classLoader = (JRubyClassLoader)classLoader;
        } else {
           this.classLoader = new JRubyClassLoader(classLoader);
        }
        this.typePath = p(type);
        this.runtime = runtime;
       
        SecurityManager sm = System.getSecurityManager();
View Full Code Here

            return runInterpreter(scriptNode);
        }
    }
   
    private Script tryCompile(Node node) {
        return tryCompile(node, new JRubyClassLoader(getJRubyClassLoader()));
    }
View Full Code Here

    }

    public synchronized JRubyClassLoader getJRubyClassLoader() {
        // FIXME: Get rid of laziness and handle restricted access elsewhere
        if (!Ruby.isSecurityRestricted() && jrubyClassLoader == null) {
            jrubyClassLoader = new JRubyClassLoader(config.getLoader());
        }
       
        return jrubyClassLoader;
    }
View Full Code Here

            context.setFile(filename);
            context.preNodeEval(objectClass, self, filename);
           
            Node scriptNode = parseFile(in, filename, null);
           
            Script script = tryCompile(scriptNode, new JRubyClassLoader(jrubyClassLoader));
            if (script == null) {
                System.err.println("Error, could not compile; pass -J-Djruby.jit.logging.verbose=true for more details");
            }

            runScript(script);
View Full Code Here

     */
    public InvocationMethodFactory(ClassLoader classLoader) {
        if (classLoader instanceof JRubyClassLoader) {
            this.classLoader = (JRubyClassLoader)classLoader;
        } else {
           this.classLoader = new JRubyClassLoader(classLoader);
        }
    }
View Full Code Here

        }
    }

    public static Class createHandleClass(JRubyClassLoader classLoader, Method method, String name) {
        byte[] bytes = createHandleBytes(method, name);
        return (classLoader != null ? classLoader : new JRubyClassLoader(JRubyClassLoader.class.getClassLoader())).defineClass(name, bytes);
    }
View Full Code Here

            int read = 0;
            while ((read = in.read(buf)) != -1) {
                baos.write(buf, 0, read);
            }
            buf = baos.toByteArray();
            JRubyClassLoader jcl = runtime.getJRubyClassLoader();
            OneShotClassLoader oscl = new OneShotClassLoader(jcl);
           
            ClassReader cr = new ClassReader(buf);
            String className = cr.getClassName().replace('/', '.');
View Full Code Here

TOP

Related Classes of org.jruby.util.JRubyClassLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.