Search in sources :

Example 36 with OpcodeStack

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

the class CharsetIssues method visitClassContext.

/**
 * implements the visitor to make sure the class is at least 1.4, and if so continues, reseting the opcode stack
 *
 * @param classContext
 *            the currently parsed java class
 */
@Override
public void visitClassContext(ClassContext classContext) {
    try {
        classVersion = classContext.getJavaClass().getMajor();
        if (classVersion >= Const.MAJOR_1_4) {
            stack = new OpcodeStack();
            super.visitClassContext(classContext);
        }
    } finally {
        stack = null;
    }
}
Also used : OpcodeStack(edu.umd.cs.findbugs.OpcodeStack)

Example 37 with OpcodeStack

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

the class InefficientStringBuffering method visitClassContext.

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

Example 38 with OpcodeStack

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

the class JPAIssues method visitClassContext.

/**
 * implements the visitor to find @Entity classes that have both generated @Ids and have implemented hashCode/equals. Also looks for eager one to many join
 * fetches as that leads to 1+n queries.
 *
 * @param clsContext
 *            the context object of the currently parsed class
 */
@Override
public void visitClassContext(ClassContext clsContext) {
    try {
        cls = clsContext.getJavaClass();
        catalogClass(cls);
        if (isEntity) {
            if (hasHCEquals && hasId && hasGeneratedValue) {
                bugReporter.reportBug(new BugInstance(this, BugType.JPAI_HC_EQUALS_ON_MANAGED_ENTITY.name(), LOW_PRIORITY).addClass(cls));
            }
            if (hasEagerOneToMany && !hasFetch) {
                bugReporter.reportBug(new BugInstance(this, BugType.JPAI_INEFFICIENT_EAGER_FETCH.name(), LOW_PRIORITY).addClass(cls));
            }
        }
        if (!transactionalMethods.isEmpty()) {
            stack = new OpcodeStack();
            super.visitClassContext(clsContext);
        }
    } finally {
        transactionalMethods = null;
        stack = null;
    }
}
Also used : OpcodeStack(edu.umd.cs.findbugs.OpcodeStack) BugInstance(edu.umd.cs.findbugs.BugInstance)

Example 39 with OpcodeStack

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

the class ListUsageIssues method visitClassContext.

@Override
public void visitClassContext(ClassContext classContext) {
    try {
        stack = new OpcodeStack();
        clsVersion = classContext.getJavaClass().getMajor();
        super.visitClassContext(classContext);
    } finally {
        stack = null;
    }
}
Also used : OpcodeStack(edu.umd.cs.findbugs.OpcodeStack)

Example 40 with OpcodeStack

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

the class ImproperPropertiesUse method visitClassContext.

/**
 * implements the listener to set up and tear down the opcode stack
 *
 * @param classContext
 *            the context object of the currently parsed class
 */
@Override
public void visitClassContext(ClassContext classContext) {
    try {
        stack = new OpcodeStack();
        super.visitClassContext(classContext);
    } finally {
        stack = null;
    }
}
Also used : 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