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:edu.umd.cs.findbugs.classfile.analysis.ClassNameAndSuperclassInfo.java

License:Open Source License

public boolean isDeprecated() {
    return isFlagSet(Opcodes.ACC_DEPRECATED);
}

From source file:edu.umd.cs.findbugs.classfile.analysis.FieldInfo.java

License:Open Source License

@Override
public boolean isDeprecated() {
    return checkFlag(Opcodes.ACC_DEPRECATED);
}

From source file:net.sf.clirr.core.internal.asm.AsmField.java

License:Open Source License

public boolean isDeprecated() {
    return checkFlag(Opcodes.ACC_DEPRECATED);
}

From source file:org.codehaus.groovy.classgen.ExtendedVerifier.java

License:Apache License

private static void visitDeprecation(AnnotatedNode node, AnnotationNode visited) {
    if (visited.getClassNode().isResolved()
            && visited.getClassNode().getName().equals("java.lang.Deprecated")) {
        if (node instanceof MethodNode) {
            MethodNode mn = (MethodNode) node;
            mn.setModifiers(mn.getModifiers() | Opcodes.ACC_DEPRECATED);
        } else if (node instanceof FieldNode) {
            FieldNode fn = (FieldNode) node;
            fn.setModifiers(fn.getModifiers() | Opcodes.ACC_DEPRECATED);
        } else if (node instanceof ClassNode) {
            ClassNode cn = (ClassNode) node;
            cn.setModifiers(cn.getModifiers() | Opcodes.ACC_DEPRECATED);
        }// w w  w .  j a  v a  2 s  . c  o m
    }
}

From source file:org.codehaus.groovy.eclipse.dsl.contributions.MethodContributionElement.java

License:Open Source License

protected int opcode() {
    int modifiers = isStatic ? Opcodes.ACC_STATIC : Opcodes.ACC_PUBLIC;
    modifiers |= isDeprecated ? Opcodes.ACC_DEPRECATED : 0;
    return modifiers;
}

From source file:org.codehaus.groovy.eclipse.editor.highlighting.SemanticReferenceRequestor.java

License:Apache License

private boolean isDeprecated(AnnotatedNode declaration) {
    int flags;//from   w  w w.j  av a 2 s  .  c  o m

    if (declaration instanceof ClassNode) {
        flags = ((ClassNode) declaration).getModifiers();
    } else if (declaration instanceof MethodNode) {
        flags = ((MethodNode) declaration).getModifiers();
    } else if (declaration instanceof FieldNode) {
        flags = ((FieldNode) declaration).getModifiers();
    } else {
        flags = 0;
    }

    return (flags & Opcodes.ACC_DEPRECATED) != 0;
}

From source file:org.eclipse.jdt.core.groovy.tests.search.AbstractInferencingTest.java

License:Apache License

private boolean hasDeprecatedFlag(AnnotatedNode declaration) {
    int flags;//w  w  w.j a  v a2s  . co  m

    if (declaration instanceof PropertyNode) {
        declaration = ((PropertyNode) declaration).getField();
    }
    if (declaration instanceof ClassNode) {
        flags = ((ClassNode) declaration).getModifiers();
    } else if (declaration instanceof MethodNode) {
        flags = ((MethodNode) declaration).getModifiers();
    } else if (declaration instanceof FieldNode) {
        flags = ((FieldNode) declaration).getModifiers();
    } else {
        flags = 0;
    }

    return (flags & Opcodes.ACC_DEPRECATED) != 0;
}

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

License:Open Source License

@Override
public void visit(int version, int access, String name, String signature, String superName,
        String[] interfaces) {/*from   w w w  .  j  a v a2  s .c o m*/
    StringBuffer simpleSig = new StringBuffer();
    simpleSig.append('L');
    simpleSig.append(name);
    simpleSig.append(';');
    String enclosingName = null;
    int index = name.lastIndexOf('$');
    if (index > -1) {
        enclosingName = name.substring(0, index).replace('/', '.');
    }
    int laccess = access;
    // TODO: inner types should be have enclosing type as parent instead of
    // component
    if ((laccess & Opcodes.ACC_DEPRECATED) != 0) {
        laccess &= ~Opcodes.ACC_DEPRECATED;
        laccess |= ClassFileConstants.AccDeprecated;
    }
    fType = new ApiType(fComponent, name.replace('/', '.'), simpleSig.toString(), signature, laccess,
            enclosingName, fFile);
    if (superName != null) {
        fType.setSuperclassName(superName.replace('/', '.'));
    }
    if (interfaces != null && interfaces.length > 0) {
        String[] names = new String[interfaces.length];
        for (int i = 0; i < names.length; i++) {
            names[i] = interfaces[i].replace('/', '.');
        }
        fType.setSuperInterfaceNames(names);
    }
    super.visit(version, laccess, name, signature, superName, interfaces);
}

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

License:Open Source License

@Override
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
    int laccess = access;
    if ((access & Opcodes.ACC_DEPRECATED) != 0) {
        laccess &= ~Opcodes.ACC_DEPRECATED;
        laccess |= ClassFileConstants.AccDeprecated;
    }/*from w  w  w.j  ava 2s  .  co  m*/
    fType.addField(name, desc, signature, laccess, value);
    return null;
}

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

License:Open Source License

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    String[] names = null;//w  ww.  java2s .c  o  m
    int laccess = access;
    if ((laccess & Opcodes.ACC_DEPRECATED) != 0) {
        laccess &= ~Opcodes.ACC_DEPRECATED;
        laccess |= ClassFileConstants.AccDeprecated;
    }
    if (exceptions != null && exceptions.length > 0) {
        names = new String[exceptions.length];
        for (int i = 0; i < names.length; i++) {
            names[i] = exceptions[i].replace('/', '.');
        }
    }
    final ApiMethod method = fType.addMethod(name, desc, signature, laccess, names);
    return new MethodVisitor(Opcodes.ASM5, super.visitMethod(laccess, name, desc, signature, exceptions)) {
        @Override
        public AnnotationVisitor visitAnnotation(String sig, boolean visible) {
            if (visible && "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".equals(sig)) { //$NON-NLS-1$
                method.isPolymorphic();
            }
            return super.visitAnnotation(sig, visible);
        }

        @Override
        public AnnotationVisitor visitAnnotationDefault() {
            return new AnnotationDefaultVisitor(method);
        }
    };
}