Example usage for org.objectweb.asm Opcodes ACC_INTERFACE

List of usage examples for org.objectweb.asm Opcodes ACC_INTERFACE

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ACC_INTERFACE.

Prototype

int ACC_INTERFACE

To view the source code for org.objectweb.asm Opcodes ACC_INTERFACE.

Click Source Link

Usage

From source file:org.compass.core.config.binding.metadata.AsmClassMetaData.java

License:Apache License

public void visit(int version, int access, String name, String signature, String supername,
        String[] interfaces) {//from  w ww .j  ava 2s.co  m
    this.className = ClassUtils.convertResourcePathToClassName(name);
    this.isInterface = ((access & Opcodes.ACC_INTERFACE) != 0);
    this.isAbstract = ((access & Opcodes.ACC_ABSTRACT) != 0);
    if (supername != null) {
        this.superClassName = ClassUtils.convertResourcePathToClassName(supername);
    }
    this.interfaces = new String[interfaces.length];
    for (int i = 0; i < interfaces.length; i++) {
        this.interfaces[i] = ClassUtils.convertResourcePathToClassName(interfaces[i]);
    }
}

From source file:org.eclipse.objectteams.otredyn.bytecode.AbstractBoundClass.java

License:Open Source License

/**
 * Is the class a interface?/*from   w  ww.  j a v  a 2  s  .  c o m*/
 * @return
 */
public boolean isInterface() {
    parseBytecode();
    return (this.modifiers & Opcodes.ACC_INTERFACE) != 0;
}

From source file:org.eclipse.pde.api.tools.internal.builder.ReferenceExtractor.java

License:Open Source License

@Override
public void visit(int version, int access, String name, String signature, String superName,
        String[] interfaces) {/*from  ww w.  ja v a  2s  .  c om*/
    this.fVersion = version;
    this.classname = this.processName(name);
    if (ApiPlugin.DEBUG_REFERENCE_EXTRACTOR) {
        System.out.println("Starting visit of type: [" + this.fType.getName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
    }
    this.enterMember(this.fType);
    // if there is a signature we get more information from it, so we don't
    // need to do both
    if (signature != null) {
        this.processSignature(name, signature, IReference.REF_PARAMETERIZED_TYPEDECL, TYPE);
    } else {
        if ((access & Opcodes.ACC_INTERFACE) != 0) {
            // the type is an interface and we need to treat the interfaces
            // set as extends, not implements
            Type supertype = null;
            for (int i = 0; i < interfaces.length; i++) {
                supertype = Type.getObjectType(interfaces[i]);
                this.addTypeReference(supertype, IReference.REF_EXTENDS);
                this.fSuperStack.add(supertype.getClassName());
            }
        } else {
            Type supertype = null;
            if (superName != null) {
                supertype = Type.getObjectType(superName);
                this.addTypeReference(supertype, IReference.REF_EXTENDS);
                this.fSuperStack.add(supertype.getClassName());
            }
            for (int i = 0; i < interfaces.length; i++) {
                supertype = Type.getObjectType(interfaces[i]);
                this.addTypeReference(supertype, IReference.REF_IMPLEMENTS);
            }
        }
    }
}

From source file:org.eclipse.pde.api.tools.internal.model.ApiType.java

License:Open Source License

@Override
public boolean isClass() {
    return (getModifiers() & (Opcodes.ACC_ANNOTATION | Opcodes.ACC_ENUM | Opcodes.ACC_INTERFACE)) == 0;
}

From source file:org.eclipse.pde.api.tools.internal.model.ApiType.java

License:Open Source License

@Override
public boolean isInterface() {
    return (getModifiers() & Opcodes.ACC_INTERFACE) != 0;
}

From source file:org.eclipse.pde.api.tools.internal.util.Util.java

License:Open Source License

/**
 * Returns if the flags are for a class/*from   w  w  w  .  jav a2  s . c o m*/
 * 
 * @param accessFlags the given access flags
 * @return
 */
public static boolean isClass(int accessFlags) {
    return (accessFlags & (Opcodes.ACC_ENUM | Opcodes.ACC_ANNOTATION | Opcodes.ACC_INTERFACE)) == 0;
}

From source file:org.eclipse.sisu.scanners.QualifiedTypeVisitor.java

License:Open Source License

@Override
public void visit(final int version, final int access, final String name, final String signature,
        final String superName, final String[] interfaces) {
    if ((access & (Opcodes.ACC_INTERFACE | Opcodes.ACC_ABSTRACT | Opcodes.ACC_SYNTHETIC)) == 0) {
        clazzName = name; // concrete type
    }//from   www . ja va  2 s  .c o m
}

From source file:org.evomaster.clientJava.instrumentation.ComputeClassWriter.java

License:Open Source License

@Override
protected String getCommonSuperClass(final String type1, final String type2) {
    try {//from   w  ww. j  ava 2s.  c o  m
        ClassReader info1;
        ClassReader info2;
        try {
            info1 = typeInfo(type1);
        } catch (NullPointerException e) {
            // May happen if class is not found
            throw new RuntimeException("Class not found: " + type1 + ": " + e.toString(), e);
        }
        try {
            info2 = typeInfo(type2);
        } catch (NullPointerException e) {
            // May happen if class is not found
            throw new RuntimeException("Class not found: " + type2 + ": " + e.toString(), e);
        }

        if ((info1.getAccess() & Opcodes.ACC_INTERFACE) != 0) {
            if (typeImplements(type2, info2, type1)) {
                return type1;
            }
            if ((info2.getAccess() & Opcodes.ACC_INTERFACE) != 0) {
                if (typeImplements(type1, info1, type2)) {
                    return type2;
                }
            }
            return "java/lang/Object";
        }
        if ((info2.getAccess() & Opcodes.ACC_INTERFACE) != 0) {
            if (typeImplements(type1, info1, type2)) {
                return type2;
            } else {
                return "java/lang/Object";
            }
        }
        StringBuilder b1 = typeAncestors(type1, info1);
        StringBuilder b2 = typeAncestors(type2, info2);
        String result = "java/lang/Object";
        int end1 = b1.length();
        int end2 = b2.length();
        while (true) {
            int start1 = b1.lastIndexOf(";", end1 - 1);
            int start2 = b2.lastIndexOf(";", end2 - 1);
            if (start1 != -1 && start2 != -1 && end1 - start1 == end2 - start2) {
                String p1 = b1.substring(start1 + 1, end1);
                String p2 = b2.substring(start2 + 1, end2);
                if (p1.equals(p2)) {
                    result = p1;
                    end1 = start1;
                    end2 = start2;
                } else {
                    return result;
                }
            } else {
                return result;
            }
        }
    } catch (IOException e) {
        throw new RuntimeException(e.toString());
    } catch (NullPointerException e) {
        // May happen if class is not found
        throw new RuntimeException(e.toString());
    }
}

From source file:org.evosuite.classpath.ResourceList.java

License:Open Source License

private static boolean isClassAnInterface(InputStream input) throws IOException {
    try {//from   ww  w . j  a va  2  s. c  om
        ClassReader reader = new ClassReader(input);
        ClassNode cn = new ClassNode();
        reader.accept(cn, ClassReader.SKIP_FRAMES);
        return (cn.access & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE;
    } finally {
        input.close(); //VERY IMPORTANT, as ASM does not close the stream
    }
}

From source file:org.evosuite.continuous.project.ProjectGraph.java

License:Open Source License

/**
 * Is the given class name representing an interface in the SUT?
 * @param className/*from ww  w.j a  v a  2 s . c o  m*/
 * @return
 * @throws IllegalArgumentException
 */
public boolean isInterface(String className) throws IllegalArgumentException {
    checkClass(className);
    ClassNode node = getClassNode(className);
    if ((node.access & Opcodes.ACC_INTERFACE) == Opcodes.ACC_INTERFACE)
        return true;

    return false;
}