Java Code Examples for com.sun.tools.classfile.Code_attribute

Following code examples demonstrate how to use com.sun.tools.classfile.Code_attributefrom java. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.sun.tools.classfile.Code_attributeand various code implementation of this class.

    }

    void checkClassFile(File file)
            throws IOException, ConstantPoolException, InvalidDescriptor, InvalidIndex {
        ClassFile classFile = ClassFile.read(file);
        ConstantPool constantPool = classFile.constant_pool;

        for (Method method : classFile.methods) {
            if (method.getName(constantPool).equals("arrMethod")) {
                Code_attribute code = (Code_attribute) method.attributes
                        .get(Attribute.Code);
                if (code.max_locals > 4)
                    throw new AssertionError("Too many locals for method arrMethod");
            }
        }
    } 


Advertisement
Javadoc
See JVMS, section 4.8.3.

This is NOT part of any supported API. If you write code th

at depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Read More
Advertisement