Package org.mozilla.javascript

Examples of org.mozilla.javascript.GeneratedClassLoader.defineClass()


                final String clazzName = (String) classes[i];
                final byte[] clazzBytes = (byte[]) classes[i+1];

                store.write(clazzName.replace('.', '/') + ".class", clazzBytes);

                Class<?> c = loader.defineClass(clazzName, clazzBytes);
                loader.linkClass(c);

                if (i == 0) {
                    clazz = c;
                }
View Full Code Here


            nameEnd = path.length();
        }
        String name = path.substring(nameStart, nameEnd);
        try {
            GeneratedClassLoader loader = SecurityController.createLoader(cx.getApplicationClassLoader(), securityDomain);
            Class<?> clazz = loader.defineClass(name, data);
            loader.linkClass(clazz);
            if (!Script.class.isAssignableFrom(clazz)) {
                throw Context.reportRuntimeError("msg.must.implement.Script");
            }
            return (Script) clazz.newInstance();
View Full Code Here

            nameEnd = path.length();
        }
        String name = path.substring(nameStart, nameEnd);
        try {
            GeneratedClassLoader loader = SecurityController.createLoader(cx.getApplicationClassLoader(), securityDomain);
            Class<?> clazz = loader.defineClass(name, data);
            loader.linkClass(clazz);
            if (!Script.class.isAssignableFrom(clazz)) {
                throw Context.reportRuntimeError("msg.must.implement.Script");
            }
            return (Script) clazz.newInstance();
View Full Code Here

            nameEnd = path.length();
        }
        String name = path.substring(nameStart, nameEnd);
        try {
            GeneratedClassLoader loader = SecurityController.createLoader(cx.getApplicationClassLoader(), securityDomain);
            Class<?> clazz = loader.defineClass(name, data);
            loader.linkClass(clazz);
            if (!Script.class.isAssignableFrom(clazz)) {
                throw Context.reportRuntimeError("msg.must.implement.Script");
            }
            return (Script) clazz.newInstance();
View Full Code Here

                final String clazzName = (String) classes[i];
                final byte[] clazzBytes = (byte[]) classes[i+1];

                store.write(clazzName.replace('.', '/') + ".class", clazzBytes);

                Class c = loader.defineClass(clazzName, clazzBytes);
                loader.linkClass(c);

                if (i == 0) {
                    clazz = c;
                }
View Full Code Here

        else {
            staticDomain = null;
        }
        GeneratedClassLoader loader = SecurityController.createLoader(null,
                staticDomain);
        Class<?> result = loader.defineClass(className, classBytes);
        loader.linkClass(result);
        return result;
    }

    private static String toStringOrNull(Object name) {
View Full Code Here

            nameEnd = path.length();
        }
        String name = path.substring(nameStart, nameEnd);
        try {
            GeneratedClassLoader loader = SecurityController.createLoader(cx.getApplicationClassLoader(), securityDomain);
            Class<?> clazz = loader.defineClass(name, data);
            loader.linkClass(clazz);
            if (!Script.class.isAssignableFrom(clazz)) {
                throw Context.reportRuntimeError("msg.must.implement.Script");
            }
            return (Script) clazz.newInstance();
View Full Code Here

        String className = moduleName.replaceAll("/", ".");
        ClassLoader rhinoLoader = getClass().getClassLoader();
        GeneratedClassLoader loader;
        loader = SecurityController.createLoader(rhinoLoader, securityDomain);

        Class<?> clazz = loader.defineClass(className, bytes);
        loader.linkClass(clazz);
        if (!Script.class.isAssignableFrom(clazz)) {
            throw new ClassCastException("Module must be a Rhino script class");
        }
View Full Code Here

        byte[] classBytes = (byte[]) compiled[1];
        ClassLoader rhinoLoader = getClass().getClassLoader();
        GeneratedClassLoader loader;
        try {
            loader = SecurityController.createLoader(rhinoLoader, sctx.getSecurityDomain());
            Class cl = loader.defineClass(className, classBytes);
            loader.linkClass(cl);
            return (Script) cl.newInstance();
        } catch (SecurityException e) {
            throw new ScriptException(e);
        } catch (IllegalArgumentException e) {
View Full Code Here

            nameEnd = path.length();
        }
        String name = path.substring(nameStart, nameEnd);
        try {
            GeneratedClassLoader loader = SecurityController.createLoader(cx.getApplicationClassLoader(), securityDomain);
            Class<?> clazz = loader.defineClass(name, data);
            loader.linkClass(clazz);
            if (!Script.class.isAssignableFrom(clazz)) {
                throw Context.reportRuntimeError("msg.must.implement.Script");
            }
            return (Script) clazz.newInstance();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.