Examples of BCClass


Examples of serp.bytecode.BCClass

            .doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(_project,
                parentLoader));
        BCClassLoader enhLoader = AccessController
            .doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(_enhProject,
                parentLoader));
        BCClass bc = _project.loadClass(getClassName(meta));
        bc.declareInterface(iface);
        ClassMetaData sup = meta.getPCSuperclassMetaData();
        if (sup != null) {
            bc.setSuperclass(sup.getInterfaceImpl());
            enhLoader = AccessController
                .doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(
                    _enhProject, AccessController
                        .doPrivileged(J2DoPrivHelper.getClassLoaderAction(sup
                            .getInterfaceImpl()))));
        }

        FieldMetaData[] fields = meta.getDeclaredFields();
        Set<Method> methods = new HashSet<Method>();
        for (int i = 0; i < fields.length; i++)
            addField(bc, iface, fields[i], methods);
        invalidateNonBeanMethods(bc, iface, methods);

        // first load the base Class<?> as the enhancer requires the class
        // to be available
        try {
            meta.setInterfaceImpl(Class.forName(bc.getName(), true, loader));
        } catch (Throwable t) {
            throw new InternalException(_loc.get("interface-load", iface,
                loader), t).setFatal(true);
        }
        // copy the BCClass<?> into the enhancer project.
        bc = _enhProject.loadClass(new ByteArrayInputStream(bc.toByteArray()),
            loader);
        PCEnhancer enhancer = new PCEnhancer(_repos, bc, meta);

        int result = enhancer.run();
        if (result != PCEnhancer.ENHANCE_PC)
            throw new InternalException(_loc.get("interface-badenhance",
                iface)).setFatal(true);
        try {
            // load the Class<?> for real.
            impl = Class.forName(bc.getName(), true, enhLoader);
        } catch (Throwable t) {
            throw new InternalException(_loc.get("interface-load2", iface,
                enhLoader), t).setFatal(true);
        }
        // cache the generated impl.
View Full Code Here

Examples of serp.bytecode.BCClass

            ClassLoader l = GeneratedClasses.getMostDerivedLoader(type,
                ProxyBean.class);
            Class pcls = loadBuildTimeProxy(type, l);
            if (pcls == null) {
                // TODO Move this to J2DOPrivHelper?
                BCClass bc = AccessController
                    .doPrivileged(new PrivilegedAction<BCClass>() {
                        public BCClass run() {
                            return generateProxyBeanBytecode(type, true);
                        }
                    });
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.