Search in sources :

Example 11 with SourceLineAnnotation

use of edu.umd.cs.findbugs.SourceLineAnnotation in project fb-contrib by mebigfatguy.

the class FieldCouldBeLocal method sawOpcode.

/**
 * implements the visitor to add SourceLineAnnotations for fields in constructors and static initializers.
 *
 * @param seen
 *            the opcode of the currently visited instruction
 */
@Override
public void sawOpcode(int seen) {
    if ((seen == Const.GETFIELD) || (seen == Const.PUTFIELD)) {
        String fieldName = getNameConstantOperand();
        FieldInfo fi = localizableFields.get(fieldName);
        if (fi != null) {
            SourceLineAnnotation sla = SourceLineAnnotation.fromVisitedInstruction(this);
            fi.setSrcLineAnnotation(sla);
        }
    }
}
Also used : SourceLineAnnotation(edu.umd.cs.findbugs.SourceLineAnnotation) ToString(com.mebigfatguy.fbcontrib.utils.ToString)

Aggregations

SourceLineAnnotation (edu.umd.cs.findbugs.SourceLineAnnotation)11 BugInstance (edu.umd.cs.findbugs.BugInstance)6 Method (org.apache.bcel.classfile.Method)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 JavaClass (org.apache.bcel.classfile.JavaClass)3 QMethod (com.mebigfatguy.fbcontrib.utils.QMethod)2 StopOpcodeParsingException (com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException)2 FieldAnnotation (edu.umd.cs.findbugs.FieldAnnotation)2 AbstractMap (java.util.AbstractMap)2 BitSet (java.util.BitSet)2 HashSet (java.util.HashSet)2 FQField (com.mebigfatguy.fbcontrib.utils.FQField)1 ToString (com.mebigfatguy.fbcontrib.utils.ToString)1 OpcodeStack (edu.umd.cs.findbugs.OpcodeStack)1 XField (edu.umd.cs.findbugs.ba.XField)1 ArrayDeque (java.util.ArrayDeque)1 Nullable (javax.annotation.Nullable)1 AnnotationEntry (org.apache.bcel.classfile.AnnotationEntry)1 ConstantPool (org.apache.bcel.classfile.ConstantPool)1