Java Code Examples for org.apache.bcel.Const#ACONST_NULL

The following examples show how to use org.apache.bcel.Const#ACONST_NULL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreferZeroLengthArrays.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void sawOpcode(int seen) {

    switch (seen) {
    case Const.ACONST_NULL:
        nullOnTOS = true;
        return;
    case Const.ARETURN:
        if (nullOnTOS) {
            SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this,
                    getPC());
            if (sourceLineAnnotation != null) {
                found.add(sourceLineAnnotation);
            }
        }
        break;
    default:
        break;
    }
    nullOnTOS = false;
}
 
Example 2
Source File: FinalizerNullsFields.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void sawOpcode(int seen) {
    if (state == 0 && seen == Const.ALOAD_0) {
        state++;
    } else if (state == 1 && seen == Const.ACONST_NULL) {
        state++;
    } else if (state == 2 && seen == Const.PUTFIELD) {
        bugAccumulator.accumulateBug(
                new BugInstance(this, "FI_FINALIZER_NULLS_FIELDS", NORMAL_PRIORITY).addClassAndMethod(this)
                        .addReferencedField(this), this);
        sawFieldNulling = true;
        state = 0;
    } else if (seen == Const.RETURN) {
        state = 0;
    } else {
        state = 0;
        sawAnythingElse = true;
    }
}
 
Example 3
Source File: TypeReturnNull.java    From spotbugs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void sawOpcode(int seen) {
    if (seen == Const.ARETURN && getPrevOpcode(1) == Const.ACONST_NULL) {
        accumulateBug();
    }
}