Example usage for org.objectweb.asm Opcodes ACC_DEPRECATED

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

Introduction

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

Prototype

int ACC_DEPRECATED

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

Click Source Link

Usage

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

License:Open Source License

/**
 * Returns {@code true} if the class is deprecated; returns {@code false} otherwise.
 * //from w w w  .  j  ava 2s. co  m
 * @param input the input stream
 * @return {@code true} if the class is deprecated, {@code false} otherwise
 * @throws IOException if an error occurs while reading the input stream
 */

private static boolean isClassDeprecated(InputStream input) throws IOException {
    try {
        ClassReader reader = new ClassReader(input);
        ClassNode cn = new ClassNode();
        reader.accept(cn, ClassReader.SKIP_FRAMES);
        return (cn.access & Opcodes.ACC_DEPRECATED) == Opcodes.ACC_DEPRECATED;
    } finally {
        input.close(); //VERY IMPORTANT, as ASM does not close the stream
    }
}

From source file:org.evosuite.symbolic.instrument.AccessFlags.java

License:Open Source License

static boolean isDeprecated(int access) {
    return is(access, Opcodes.ACC_DEPRECATED);
}

From source file:org.sonar.java.bytecode.asm.AsmAccessFlags.java

License:Open Source License

public static boolean isDeprecated(int accessFlags) {
    return (accessFlags & Opcodes.ACC_DEPRECATED) != 0;
}

From source file:org.springsource.loaded.test.infra.ClassPrinter.java

License:Apache License

private String toAccessForClass(int flags) {
    StringBuilder sb = new StringBuilder();
    if ((flags & Opcodes.ACC_PUBLIC) != 0) {
        sb.append("public ");
    }/*from  ww w .j  a v a  2  s .  c  o m*/
    if ((flags & Opcodes.ACC_PRIVATE) != 0) {
        sb.append("private ");
    }
    if ((flags & Opcodes.ACC_PROTECTED) != 0) {
        sb.append("protected ");
    }
    if ((flags & Opcodes.ACC_STATIC) != 0) {
        sb.append("static ");
    }
    if ((flags & Opcodes.ACC_FINAL) != 0) {
        sb.append("final ");
    }
    if ((flags & Opcodes.ACC_SYNCHRONIZED) != 0) {
        sb.append("synchronized ");
    }
    if ((flags & Opcodes.ACC_BRIDGE) != 0) {
        sb.append("bridge ");
    }
    if ((flags & Opcodes.ACC_VARARGS) != 0) {
        sb.append("varargs ");
    }
    if ((flags & Opcodes.ACC_NATIVE) != 0) {
        sb.append("native ");
    }
    if ((flags & Opcodes.ACC_ABSTRACT) != 0) {
        sb.append("abstract ");
    }
    if ((flags & Opcodes.ACC_SYNTHETIC) != 0) {
        sb.append("synthetic ");
    }
    if ((flags & Opcodes.ACC_DEPRECATED) != 0) {
        sb.append("deprecated ");
    }
    if ((flags & Opcodes.ACC_INTERFACE) != 0) {
        sb.append("interface ");
    }
    return sb.toString().trim();
}

From source file:org.springsource.loaded.test.infra.ClassPrinter.java

License:Apache License

public static String toAccessForMember(int flags) {
    StringBuilder sb = new StringBuilder();
    if ((flags & Opcodes.ACC_PUBLIC) != 0) {
        sb.append("public ");
    }// w  w w.  j a va2  s . com
    if ((flags & Opcodes.ACC_PRIVATE) != 0) {
        sb.append("private ");
    }
    if ((flags & Opcodes.ACC_STATIC) != 0) {
        sb.append("static ");
    }
    if ((flags & Opcodes.ACC_PROTECTED) != 0) {
        sb.append("protected ");
    }
    if ((flags & Opcodes.ACC_FINAL) != 0) {
        sb.append("final ");
    }
    if ((flags & Opcodes.ACC_SUPER) != 0) {
        sb.append("super ");
    }
    if ((flags & Opcodes.ACC_INTERFACE) != 0) {
        sb.append("interface ");
    }
    if ((flags & Opcodes.ACC_ABSTRACT) != 0) {
        sb.append("abstract ");
    }
    if ((flags & Opcodes.ACC_SYNTHETIC) != 0) {
        sb.append("synthetic ");
    }
    if ((flags & Opcodes.ACC_ANNOTATION) != 0) {
        sb.append("annotation ");
    }
    if ((flags & Opcodes.ACC_ENUM) != 0) {
        sb.append("enum ");
    }
    if ((flags & Opcodes.ACC_DEPRECATED) != 0) {
        sb.append("deprecated ");
    }
    return sb.toString().trim();
}

From source file:org.teavm.parsing.Parser.java

License:Apache License

public static void parseModifiers(int access, ElementHolder member) {
    if ((access & Opcodes.ACC_PRIVATE) != 0) {
        member.setLevel(AccessLevel.PRIVATE);
    } else if ((access & Opcodes.ACC_PROTECTED) != 0) {
        member.setLevel(AccessLevel.PROTECTED);
    } else if ((access & Opcodes.ACC_PUBLIC) != 0) {
        member.setLevel(AccessLevel.PUBLIC);
    }// ww w .  j  a  v  a  2  s  .  co  m

    if ((access & Opcodes.ACC_ABSTRACT) != 0) {
        member.getModifiers().add(ElementModifier.ABSTRACT);
    }
    if ((access & Opcodes.ACC_ANNOTATION) != 0) {
        member.getModifiers().add(ElementModifier.ANNOTATION);
    }
    if ((access & Opcodes.ACC_BRIDGE) != 0) {
        member.getModifiers().add(ElementModifier.BRIDGE);
    }
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        member.getModifiers().add(ElementModifier.DEPRECATED);
    }
    if ((access & Opcodes.ACC_ENUM) != 0) {
        member.getModifiers().add(ElementModifier.ENUM);
    }
    if ((access & Opcodes.ACC_FINAL) != 0) {
        member.getModifiers().add(ElementModifier.FINAL);
    }
    if ((access & Opcodes.ACC_INTERFACE) != 0) {
        member.getModifiers().add(ElementModifier.INTERFACE);
    }
    if ((access & Opcodes.ACC_NATIVE) != 0) {
        member.getModifiers().add(ElementModifier.NATIVE);
    }
    if ((access & Opcodes.ACC_STATIC) != 0) {
        member.getModifiers().add(ElementModifier.STATIC);
    }
    if ((access & Opcodes.ACC_STRICT) != 0) {
        member.getModifiers().add(ElementModifier.STRICT);
    }
    if ((access & Opcodes.ACC_SUPER) != 0) {
        member.getModifiers().add(ElementModifier.SUPER);
    }
    if ((access & Opcodes.ACC_SYNCHRONIZED) != 0) {
        member.getModifiers().add(ElementModifier.SYNCHRONIZED);
    }
    if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
        member.getModifiers().add(ElementModifier.SYNTHETIC);
    }
    if ((access & Opcodes.ACC_TRANSIENT) != 0) {
        member.getModifiers().add(ElementModifier.TRANSIENT);
    }
    if ((access & Opcodes.ACC_VARARGS) != 0) {
        member.getModifiers().add(ElementModifier.VARARGS);
    }
    if ((access & Opcodes.ACC_VOLATILE) != 0) {
        member.getModifiers().add(ElementModifier.VOLATILE);
    }
}