Search in sources :

Example 86 with OpcodeStack

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

the class AbstractCollectionScanningDetector method visitClassContext.

/**
 * implements the visitor to create and clear the stack, and report missing class errors
 *
 * @param classContext
 *            the context object of the currently parsed class
 */
@Override
public void visitClassContext(ClassContext classContext) {
    if (collectionClass == null) {
        return;
    }
    try {
        stack = new OpcodeStack();
        super.visitClassContext(classContext);
    } finally {
        stack = null;
    }
}
Also used : OpcodeStack(edu.umd.cs.findbugs.OpcodeStack)

Example 87 with OpcodeStack

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

the class ArrayIndexOutOfBounds method visitClassContext.

@Override
public void visitClassContext(ClassContext classContext) {
    try {
        stack = new OpcodeStack();
        initializedRegs = new BitSet();
        modifyRegs = new BitSet();
        nullStoreToLocation = new HashMap<Integer, Integer>();
        super.visitClassContext(classContext);
    } finally {
        stack = null;
        initializedRegs = null;
        modifyRegs = null;
        nullStoreToLocation = null;
    }
}
Also used : ConstantInteger(org.apache.bcel.classfile.ConstantInteger) OpcodeStack(edu.umd.cs.findbugs.OpcodeStack) BitSet(java.util.BitSet)

Example 88 with OpcodeStack

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

the class BloatedAssignmentScope method visitClassContext.

/**
 * implements the visitor to create and the clear the register to location map
 *
 * @param classContext
 *            the context object of the currently parsed class
 */
@Override
public void visitClassContext(ClassContext classContext) {
    try {
        ignoreRegs = new BitSet();
        tryBlocks = new BitSet();
        catchHandlers = new BitSet();
        switchTargets = new BitSet();
        monitorSyncPCs = new ArrayList<>(5);
        stack = new OpcodeStack();
        super.visitClassContext(classContext);
    } finally {
        ignoreRegs = null;
        tryBlocks = null;
        catchHandlers = null;
        switchTargets = null;
        monitorSyncPCs = null;
        stack = null;
    }
}
Also used : OpcodeStack(edu.umd.cs.findbugs.OpcodeStack) BitSet(java.util.BitSet)

Example 89 with OpcodeStack

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

the class BloatedSynchronizedBlock method visitClassContext.

@Override
public void visitClassContext(ClassContext classContext) {
    try {
        stack = new OpcodeStack();
        unsafeAliases = new BitSet();
        branchInfo = new HashMap<>();
        super.visitClassContext(classContext);
    } finally {
        stack = null;
        unsafeAliases = null;
        branchInfo = null;
    }
}
Also used : OpcodeStack(edu.umd.cs.findbugs.OpcodeStack) BitSet(java.util.BitSet)

Example 90 with OpcodeStack

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

the class ClassEnvy method visitClassContext.

/**
 * overrides the visitor to collect package and class names
 *
 * @param classContext
 *            the context object that holds the JavaClass being parsed
 */
@Override
public void visitClassContext(final ClassContext classContext) {
    try {
        JavaClass cls = classContext.getJavaClass();
        packageName = cls.getPackageName();
        clsName = cls.getClassName();
        stack = new OpcodeStack();
        super.visitClassContext(classContext);
    } finally {
        stack = null;
        clsAccessCount = null;
    }
}
Also used : JavaClass(org.apache.bcel.classfile.JavaClass) OpcodeStack(edu.umd.cs.findbugs.OpcodeStack)

Aggregations

OpcodeStack (edu.umd.cs.findbugs.OpcodeStack)95 JavaClass (org.apache.bcel.classfile.JavaClass)20 BitSet (java.util.BitSet)15 BugInstance (edu.umd.cs.findbugs.BugInstance)7 HashMap (java.util.HashMap)4 Map (java.util.Map)3 Field (org.apache.bcel.classfile.Field)3 StopOpcodeParsingException (com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException)2 FieldAnnotation (edu.umd.cs.findbugs.FieldAnnotation)2 XField (edu.umd.cs.findbugs.ba.XField)2 AnnotationEntry (org.apache.bcel.classfile.AnnotationEntry)2 Method (org.apache.bcel.classfile.Method)2 ToString (com.mebigfatguy.fbcontrib.utils.ToString)1 ClassDescriptor (edu.umd.cs.findbugs.classfile.ClassDescriptor)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 ConstantInteger (org.apache.bcel.classfile.ConstantInteger)1