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

Examples of org.jboss.forge.furnace.proxy.javassist.bytecode.ClassFile


     * Returns the source file containing the expression.
     *
     * @return null if this information is not available.
     */
    public String getFileName() {
        ClassFile cf = thisClass.getClassFile2();
        if (cf == null)
            return null;
        else
            return cf.getSourceFile();
    }
View Full Code Here


            return;
        }

        DataInputStream in = new DataInputStream(
                                         new FileInputStream(args[0]));
        ClassFile w = new ClassFile(in);
        PrintWriter out = new PrintWriter(System.out, true);
        out.println("*** constant pool ***");
        w.getConstPool().print(out);
        out.println();
        out.println("*** members ***");
        ClassFilePrinter.print(w, out);
    }
View Full Code Here

     * <p>This method may return <code>null</code>.
     *
     * @return a <code>Collection&lt;String&gt;</code> object.
     */
    public synchronized Collection getRefClasses() {
        ClassFile cf = getClassFile2();
        if (cf != null) {
            ClassMap cm = new ClassMap() {
                public void put(String oldname, String newname) {
                    put0(oldname, newname);
                }

                public Object get(Object jvmClassName) {
                    String n = toJavaName((String)jvmClassName);
                    put0(n, n);
                    return null;
                }

                public void fix(String name) {}
            };
            cf.getRefClasses(cm);
            return cm.values();
        }
        else
            return null;
    }
View Full Code Here

        super.setModifiers(mod);
        updateInnerEntry(mod, getName(), this, true);
    }

    private static void updateInnerEntry(int mod, String name, CtClass clazz, boolean outer) {
        ClassFile cf = clazz.getClassFile2();
        InnerClassesAttribute ica = (InnerClassesAttribute)cf.getAttribute(
                                                InnerClassesAttribute.tag);
        if (ica == null)
            return;

        int n = ica.tableLength();
View Full Code Here

        if (isInterface || superclass == null)
            superName = null;
        else
            superName = superclass.getName();

        classfile = new ClassFile(isInterface, name, superName);
        if (isInterface && superclass != null)
            classfile.setInterfaces(new String[] { superclass.getName() });

        setModifiers(Modifier.setPublic(getModifiers()));
        hasConstructor = isInterface;
View Full Code Here

        getCount = 0;
    }

    CtClassType(InputStream ins, ClassPool cp) throws IOException {
        this((String)null, cp);
        classfile = new ClassFile(new DataInputStream(ins));
        qualifiedName = classfile.getName();
    }
View Full Code Here

        return accessors;
    }

    public ClassFile getClassFile2() {
        ClassFile cfile = classfile;
        if (cfile != null)
            return cfile;

        classPool.compress();
        if (rawClassfile != null) {
            try {
                classfile = new ClassFile(new DataInputStream(
                                            new ByteArrayInputStream(rawClassfile)));
                rawClassfile = null;
                getCount = GET_THRESHOLD;
                return classfile;
            }
            catch (IOException e) {
                throw new RuntimeException(e.toString(), e);
            }
        }

        InputStream fin = null;
        try {
            fin = classPool.openClassfile(getName());
            if (fin == null)
                throw new NotFoundException(getName());

            fin = new BufferedInputStream(fin);
            ClassFile cf = new ClassFile(new DataInputStream(fin));
            if (!cf.getName().equals(qualifiedName))
                throw new RuntimeException("cannot find " + qualifiedName + ": "
                        + cf.getName() + " found in "
                        + qualifiedName.replace('.', '/') + ".class");

            classfile = cf;
            return cf;
        }
View Full Code Here

        int i;
        String cname = clazz.getName();
        if (this == clazz || getName().equals(cname))
            return true;

        ClassFile file = getClassFile2();
        String supername = file.getSuperclass();
        if (supername != null && supername.equals(cname))
            return true;

        String[] ifs = file.getInterfaces();
        int num = ifs.length;
        for (i = 0; i < num; ++i)
            if (ifs[i].equals(cname))
                return true;
View Full Code Here

        if (name.equals(oldname))
            return;

        // check this in advance although classNameChanged() below does.
        classPool.checkNotFrozen(name);
        ClassFile cf = getClassFile2();
        super.setName(name);
        cf.setName(name);
        nameReplaced();
        classPool.classNameChanged(oldname, this);
    }
View Full Code Here

            = (SignatureAttribute)getClassFile2().getAttribute(SignatureAttribute.tag);
        return sa == null ? null : sa.getSignature();
    }

    public void setGenericSignature(String sig) {
        ClassFile cf = getClassFile();
        SignatureAttribute sa = new SignatureAttribute(cf.getConstPool(), sig);
        cf.addAttribute(sa);
    }
View Full Code Here

TOP

Related Classes of org.jboss.forge.furnace.proxy.javassist.bytecode.ClassFile

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.