Example usage for com.google.gwt.dev.asm ClassReader SKIP_CODE

List of usage examples for com.google.gwt.dev.asm ClassReader SKIP_CODE

Introduction

In this page you can find the example usage for com.google.gwt.dev.asm ClassReader SKIP_CODE.

Prototype

int SKIP_CODE

To view the source code for com.google.gwt.dev.asm ClassReader SKIP_CODE.

Click Source Link

Document

Flag to skip method code.

Usage

From source file:com.google.web.bindery.requestfactory.server.RequestFactoryInterfaceValidator.java

License:Apache License

/**
 * Load the classfile for the given binary name and apply the provided
 * visitor.//w  w w .j  a  va 2 s .  c o m
 * 
 * @return <code>true</code> if the visitor was successfully visited
 */
private boolean visit(ErrorContext logger, String internalName, ClassVisitor visitor) {
    assert Name.isInternalName(internalName) : "internalName";
    logger.spam("Visiting " + internalName);
    InputStream inputStream = null;
    try {
        inputStream = loader.getResourceAsStream(internalName + ".class");
        if (inputStream == null) {
            logger.poison("Could not find class file for " + internalName);
            return false;
        }
        ClassReader reader = new ClassReader(inputStream);
        reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
        return true;
    } catch (IOException e) {
        logger.poison("Unable to open " + internalName, e);
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException ignored) {
            }
        }
    }
    return false;
}