Package org.jboss.forge.furnace.proxy.javassist

Examples of org.jboss.forge.furnace.proxy.javassist.CtClass


        } catch (NotFoundException e) {
            throw new RuntimeException(e);
        }

        for (int i = 0; i < interfaces.length; i++) {
            CtClass intf = interfaces[i];
            map.put(intf.getName(), intf);
            getDeclaredInterfaces(intf, map);
        }

        return map;
    }
View Full Code Here


    private Map getAllMultiInterfaces(MultiType type) {
        Map map = new HashMap();

        Iterator iter = type.interfaces.values().iterator();
        while (iter.hasNext()) {
            CtClass intf = (CtClass)iter.next();
            map.put(intf.getName(), intf);
            getAllInterfaces(intf, map);
        }

        return map;
    }
View Full Code Here

            case DRETURN:
                verifyAssignable(Type.DOUBLE, simplePop(frame));
                break;
            case ARETURN:
                try {
                    CtClass returnType = Descriptor.getReturnType(method.getDescriptor(), classPool);
                    verifyAssignable(Type.get(returnType), simplePop(frame));
                } catch (NotFoundException e) {
                   throw new RuntimeException(e);
                }
                break;
View Full Code Here

            throw new BadBytecode("Could not find class [pos = " + lastPos + "]: " + name);
        }
    }

    private Type[] paramTypesFromDesc(String desc) throws BadBytecode {
        CtClass classes[] = null;
        try {
            classes = Descriptor.getParameterTypes(desc, classPool);
        } catch (NotFoundException e) {
            throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage());
        }
View Full Code Here

        return types;
    }

    private Type returnTypeFromDesc(String desc) throws BadBytecode {
        CtClass clazz = null;
        try {
            clazz = Descriptor.getReturnType(desc, classPool);
        } catch (NotFoundException e) {
            throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage());
        }
View Full Code Here

        if (type.getSize() == 2)
            frame.setLocal(index + 1, Type.TOP);
    }

    private Type resolveClassInfo(String info) throws BadBytecode {
        CtClass clazz = null;
        try {
            if (info.charAt(0) == '[') {
                clazz = Descriptor.toCtClass(info, classPool);
            } else {
                clazz = classPool.get(info);
View Full Code Here

        return Type.get(clazz);
    }

    private Type typeFromDesc(String desc) throws BadBytecode {
        CtClass clazz = null;
        try {
            clazz = Descriptor.toCtClass(desc, classPool);
        } catch (NotFoundException e) {
            throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage());
        }
View Full Code Here

        this.component = component;
        this.dims = dims;
    }

    public CtClass getCtClass() {
        CtClass clazz = component.getCtClass();
        if (clazz == null)
            return null;

        ClassPool pool = clazz.getClassPool();
        if (pool == null)
            pool = ClassPool.getDefault();

        String name = arrayName(clazz.getName(), dims);

        try {
            return pool.get(name);
        } catch (NotFoundException e) {
            throw new RuntimeException(e);
View Full Code Here

     */
    public static CtClass commonSuperClassEx(CtClass one, CtClass two) throws NotFoundException {
        if (one == two)
            return one;
        else if (one.isArray() && two.isArray()) {
            CtClass ele1 = one.getComponentType();
            CtClass ele2 = two.getComponentType();
            CtClass element = commonSuperClassEx(ele1, ele2);
            if (element == ele1)
                return one;
            else if (element == ele2)
                return two;
            else
                return one.getClassPool().get(element == null ? "java.lang.Object"
                                                : element.getName() + "[]");
        }
        else if (one.isPrimitive() || two.isPrimitive())
            return null;    // TOP
        else if (one.isArray() || two.isArray())    // but !(one.isArray() && two.isArray())
            return one.getClassPool().get("java.lang.Object");
View Full Code Here

    /**
     * Finds the most specific common super class of the given classes.
     * This method is a copy from org.jboss.forge.furnace.proxy.javassist.bytecode.analysis.Type.
     */
    public static CtClass commonSuperClass(CtClass one, CtClass two) throws NotFoundException {
        CtClass deep = one;
        CtClass shallow = two;
        CtClass backupShallow = shallow;
        CtClass backupDeep = deep;

        // Phase 1 - Find the deepest hierarchy, set deep and shallow correctly
        for (;;) {
            // In case we get lucky, and find a match early
            if (eq(deep, shallow) && deep.getSuperclass() != null)
                return deep;

            CtClass deepSuper = deep.getSuperclass();
            CtClass shallowSuper = shallow.getSuperclass();

            if (shallowSuper == null) {
                // right, now reset shallow
                shallow = backupShallow;
                break;
View Full Code Here

TOP

Related Classes of org.jboss.forge.furnace.proxy.javassist.CtClass

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.