Example usage for org.objectweb.asm Opcodes ACC_ENUM

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

Introduction

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

Prototype

int ACC_ENUM

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

Click Source Link

Usage

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 isEnum() {
    return (getModifiers() & Opcodes.ACC_ENUM) != 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 . j a  v a 2 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.evosuite.symbolic.instrument.AccessFlags.java

License:Open Source License

static boolean isEnum(int access) {
    return is(access, Opcodes.ACC_ENUM);
}

From source file:org.freud.analysed.classbytecode.parser.asm.AsmClassByteCode.java

License:Apache License

@Override
public boolean isEnum() {
    return isAccessModifier(Opcodes.ACC_ENUM);
}

From source file:org.freud.analysed.classbytecode.parser.asm.AsmField.java

License:Apache License

@Override
public boolean isEnumField() {
    return isAccessModifier(Opcodes.ACC_ENUM);
}

From source file:org.kantega.revoc.instrumentation.CoverageClassVisitor.java

License:Apache License

public boolean isEnum() {
    return (access & Opcodes.ACC_ENUM) != 0;
}

From source file:org.openjdk.jmh.generators.asm.ASMClassInfo.java

License:Open Source License

@Override
public boolean isEnum() {
    return (access & Opcodes.ACC_ENUM) > 0;
}

From source file:org.openspotlight.bundle.language.java.asm.TypeExtractorVisitor.java

License:Open Source License

/**
 * {@inheritDoc}//  w ww  .  ja  v  a  2 s .co m
 */
public void visit(int version, int access, String name, String signature, String superName,
        String[] interfaces) {
    type = new TypeDefinition();

    Pair<String, String> packageAndTypeName = getPackageAndTypeNames(name);
    type.setPackageName(packageAndTypeName.getK1());
    type.setTypeName(packageAndTypeName.getK2());

    if ((access & Opcodes.ACC_INTERFACE) > 0) {
        type.setType(JavaTypes.INTERFACE);
    } else if ((access & Opcodes.ACC_ENUM) > 0) {
        type.setType(JavaTypes.ENUM);
    } else if ((access & Opcodes.ACC_ANNOTATION) > 0) {
        type.setType(JavaTypes.ANNOTATION);
    } else {
        type.setType(JavaTypes.CLASS);
    }
    type.setAccess(access);

    if ((access & Opcodes.ACC_PRIVATE) > 0) {
        type.setPrivate(true);
    }

    if (superName != null) {
        Pair<String, String> superPackageAndTypeName = getPackageAndTypeNames(superName);
        SimpleTypeReference superType = new SimpleTypeReference(superPackageAndTypeName.getK1(),
                superPackageAndTypeName.getK2());
        type.setExtendsDef(superType);
    }

    for (String interfaceName : interfaces) {
        Pair<String, String> interfacePackageAndTypeName = getPackageAndTypeNames(interfaceName);
        SimpleTypeReference interfaceType = new SimpleTypeReference(interfacePackageAndTypeName.getK1(),
                interfacePackageAndTypeName.getK2());
        type.getImplementsDef().add(interfaceType);
    }
}

From source file:org.rascalmpl.library.lang.java.m3.internal.JarConverter.java

License:Open Source License

@SuppressWarnings("unchecked")
public void convert(ISourceLocation jarLoc, IEvaluatorContext ctx) {

    this.loc = jarLoc;
    this.jarFile = extractJarName(jarLoc);
    this.ClassFile = extractClassName(jarLoc);
    this.LogPath = this.ClassFile.replace(".class", "");
    String packageName;/*from   w  w w  .  ja v  a 2 s .c om*/

    // System.out.println(this.ClassFile);
    packageName = LogPath.substring(0, LogPath.lastIndexOf("/"));
    if (this.LogPath.contains("$")) {
        this.LogPath = LogPath.replace("$", "/");
    }
    try {
        ClassReader cr = new ClassReader(URIResolverRegistry.getInstance().getInputStream(jarLoc));
        ClassNode cn = new ClassNode();

        cr.accept(cn, ClassReader.SKIP_DEBUG);

        this.className = cn.name.replace("$", "/");
        classIsEnum = false;
        if ((cn.access & Opcodes.ACC_INTERFACE) != 0)
            classScheme = "java+interface";
        else if ((cn.access & Opcodes.ACC_ENUM) != 0) {
            classScheme = "java+enum";
            classIsEnum = true;
        } else
            this.classScheme = "java+class";

        this.insert(this.containment, values.sourceLocation(classScheme, "", "/" + className),
                values.sourceLocation("java+compilationUnit", "", "/jar:///" + jarFile));
        this.insert(this.containment, values.sourceLocation("java+package", "", "/" + packageName),
                values.sourceLocation("java+compilationUnit", "", "/jar:///" + jarFile));
        this.insert(this.containment, values.sourceLocation("java+compilationUnit", "", "/jar:///" + jarFile),
                values.sourceLocation("java+class", "", "/" + LogPath));

        // <|java+package:///Main|,|java+compilationUnit:///src/Main/BaseInt.java|>,

        this.insert(this.declarations, values.sourceLocation(classScheme, "", "/" + className),
                values.sourceLocation(jarFile + "!" + ClassFile));

        if (cn.superName != null && !(cn.superName.equalsIgnoreCase("java/lang/Object")
                || cn.superName.equalsIgnoreCase("java/lang/Enum"))) {
            this.insert(this.extendsRelations, values.sourceLocation(classScheme, "", "/" + className),
                    values.sourceLocation(classScheme, "", cn.superName));
        }

        for (int fs = 0; fs < 15; fs++) {
            if ((cn.access & (0x0001 << fs)) != 0) {
                IConstructor cons = mapFieldAccesCode(0x0001 << fs, CLASSE);
                if (cons != null)
                    this.insert(this.modifiers, values.sourceLocation(classScheme, "", "/" + className), cons);
            }
        }

        // Deprecated method emit type annotation dependency Deprecated.
        if ((cn.access & 0x20000) == 0x20000)
            this.insert(this.annotations, values.sourceLocation(classScheme, "", "/" + className),
                    values.sourceLocation("java+interface", "", "/java/lang/Deprecated"));

        // @implements={<|java+class:///m3startv2/viaInterface|,|java+interface:///m3startv2/m3Interface|>},
        for (int i = 0; i < cn.interfaces.size(); ++i) {
            String iface = (String) cn.interfaces.get(i);
            // System.out.println(iface);
            this.insert(this.implementsRelations, values.sourceLocation(classScheme, "", "/" + className),
                    values.sourceLocation("java+interface", "", "/" + iface));
        }

        for (int fs = 0; fs < cn.innerClasses.size(); fs++) {
            InnerClassNode a = (InnerClassNode) cn.innerClasses.get(fs);
            String parsedName = a.name.replace("$", "/");
            this.insert(this.containment, values.sourceLocation(classScheme, "", "/" + className),
                    values.sourceLocation(classScheme, "", "/" + parsedName));
        }

        emitMethods(cn.methods);
        emitFields(cn.fields);

    } catch (IOException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        throw new RuntimeException("Should not happen", e);
    }
}