Package javassist.bytecode

Examples of javassist.bytecode.BadBytecode


    private Type getType(String name) throws BadBytecode {
        try {
            return Type.get(classPool.get(name));
        } catch (NotFoundException e) {
            throw new BadBytecode("Could not find class [pos = " + lastPos + "]: " + name);
        }
    }
View Full Code Here


    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());
        }

        if (classes == null)
            throw new BadBytecode("Could not obtain parameters for descriptor [pos = " + lastPos + "]: " + desc);

        Type[] types = new Type[classes.length];
        for (int i = 0; i < types.length; i++)
            types[i] = Type.get(classes[i]);
View Full Code Here

    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());
        }

        if (clazz == null)
            throw new BadBytecode("Could not obtain return type for descriptor [pos = " + lastPos + "]: " + desc);

        return Type.get(clazz);
    }
View Full Code Here

            } else {
                clazz = classPool.get(info);
            }

        } catch (NotFoundException e) {
            throw new BadBytecode("Could not find class in descriptor [pos = " + lastPos + "]: " + e.getMessage());
        }

        if (clazz == null)
            throw new BadBytecode("Could not obtain type for descriptor [pos = " + lastPos + "]: " + info);

        return Type.get(clazz);
    }
View Full Code Here

    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());
        }

        if (clazz == null)
            throw new BadBytecode("Could not obtain type for descriptor [pos = " + lastPos + "]: " + desc);

        return Type.get(clazz);
    }
View Full Code Here

        return Type.get(clazz);
    }

    private void verifyAssignable(Type expected, Type type) throws BadBytecode {
        if (! expected.isAssignableFrom(type))
            throw new BadBytecode("Expected type: " + expected + " Got: " + type + " [pos = " + lastPos + "]");
    }
View Full Code Here

     *
     * @param className     dot-separated name unless the type is an array type.
     */
    static void setType(TypeData td, String className, ClassPool cp) throws BadBytecode {
        if (td == TypeTag.TOP)
            throw new BadBytecode("unset variable");
        else
            td.setType(className, cp);
    }
View Full Code Here

        public String getName() {
            return name;
        }

        protected void setType(String s, ClassPool cp) throws BadBytecode {
            throw new BadBytecode("conflict: " + name + " and " + s);
        }
View Full Code Here

                }
                else
                    return false;
            }
            catch (NotFoundException e) {
                throw new BadBytecode("cannot find " + e.getMessage());
            }
        }
View Full Code Here

                    return name.substring(2, name.length() - 1).replace('/', '.');                   
                else if (c == '[')
                    return name.substring(1);
            }
   
            throw new BadBytecode("bad array type for AALOAD: "
                                  + name);
        }
View Full Code Here

TOP

Related Classes of javassist.bytecode.BadBytecode

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.