Package com.sun.tools.classfile

Examples of com.sun.tools.classfile.ClassFile


    void verifyBytecode(VarargsMethod selected) {
        bytecodeCheckCount++;
        File compiledTest = new File("Test.class");
        try {
            ClassFile cf = ClassFile.read(compiledTest);
            Method testMethod = null;
            for (Method m : cf.methods) {
                if (m.getName(cf.constant_pool).equals("test")) {
                    testMethod = m;
                    break;
View Full Code Here


    void verifyBytecode(VarargsMethod selected, JavaSource source) {
        bytecodeCheckCount++;
        File compiledTest = new File("Test.class");
        try {
            ClassFile cf = ClassFile.read(compiledTest);
            Method testMethod = null;
            for (Method m : cf.methods) {
                if (m.getName(cf.constant_pool).equals("test")) {
                    testMethod = m;
                    break;
View Full Code Here

    void verifyMethodHandleInvocationDescriptors(File f) {
        System.err.println("verify: " + f);
        try {
            int count = 0;
            ClassFile cf = ClassFile.read(f);
            Method testMethod = null;
            for (Method m : cf.methods) {
                if (m.getName(cf.constant_pool).equals(TEST_METHOD_NAME)) {
                    testMethod = m;
                    break;
View Full Code Here

    /** Check the SourceFileAttribute is the simple name of the original source file. */
    void verifySourceFileAttribute(File f) {
        System.err.println("verify: " + f);
        try {
            ClassFile cf = ClassFile.read(f);
            SourceFile_attribute sfa = (SourceFile_attribute) cf.getAttribute(Attribute.SourceFile);
            String found = sfa.getSourceFile(cf.constant_pool);
            String expect = f.getName().replaceAll("([$.].*)?\\.class", ".java");
            if (!expect.equals(found)) {
                error("bad value found: " + found + ", expected: " + expect);
            }
View Full Code Here

        if (name.startsWith("META-INF") || !name.endsWith(".class"))
            return false;
        //String className = name.substring(0, name.length() - 6).replace("/", ".");
        //System.err.println("check " + className);
        InputStream in = jar.getInputStream(entry);
        ClassFile cf = ClassFile.read(in);
        in.close();
        for (int i = 0; i < cf.methods.length; i++) {
            Method m = cf.methods[i];
            if (m.access_flags.is(AccessFlags.ACC_NATIVE)) {
                // System.err.println(className);
View Full Code Here

        if (name.startsWith("META-INF") || !name.endsWith(".class"))
            return false;
        //String className = name.substring(0, name.length() - 6).replace("/", ".");
        //System.err.println("check " + className);
        InputStream in = jar.getInputStream(entry);
        ClassFile cf = ClassFile.read(in);
        for (int i = 0; i < cf.methods.length; i++) {
            Method m = cf.methods[i];
            if (m.access_flags.is(AccessFlags.ACC_NATIVE)) {
                // System.err.println(className);
                return true;
View Full Code Here

        }
        indent(-1);
    }

    protected void write(int cpx) {
        ClassFile classFile = classWriter.getClassFile();
        if (cpx == 0) {
            print("#0");
            return;
        }
View Full Code Here

                return "(unknown tag " + tag + ")";
        }
    }

    String stringValue(int constant_pool_index) {
        ClassFile classFile = classWriter.getClassFile();
        try {
            return stringValue(classFile.constant_pool.get(constant_pool_index));
        } catch (ConstantPool.InvalidIndex e) {
            return report(e);
        }
View Full Code Here

            return visitRef(info, p);
        }

        public String visitString(CONSTANT_String_info info, Void p) {
            try {
                ClassFile classFile = classWriter.getClassFile();
                int string_index = info.string_index;
                return stringValue(classFile.constant_pool.getUTF8Info(string_index));
            } catch (ConstantPoolException e) {
                return report(e);
            }
View Full Code Here

    static void addMembers(File destDir, Map<ClassFile, List<Method>> members) {
        String[] names = { "B.class", "C.class", "D.class" };
        try {
            for (String name : names) {
                File f = new File(destDir, name);
                ClassFile cf = ClassFile.read(f);
                members.put(cf, readMethod(cf, "m"));
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new Error("error reading classes");
View Full Code Here

TOP

Related Classes of com.sun.tools.classfile.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.