@Override
    public void sawOpcode(int seen) {
        try {
            stack.precomputation(this);

            if ((seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKEINTERFACE)) {
                String clsName = getClassConstantOperand();
                String methodName = getNameConstantOperand();
                String signature = getSigConstantOperand();

                if ("add".equals(methodName) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(signature) && isImplementationOf(clsName, setCls)) {
                    if (stack.getStackDepth() > 1) {
                        OpcodeStack.Item item = stack.getStackItem(0);
                        JavaClass entryCls = item.getJavaClass();
                        if (isImplementationOf(entryCls, collectionCls)) {
                            bugReporter.reportBug(new BugInstance(this, BugType.DSOC_DUBIOUS_SET_OF_COLLECTIONS.name(), NORMAL_PRIORITY).addClass(this)
                                    .addMethod(this).addSourceLine(this));
                        }
                    }
                } else if ("put".equals(methodName) && SignatureBuilder.SIG_TWO_OBJECTS_TO_OBJECT.equals(signature) && isImplementationOf(clsName, setCls)
                        && (stack.getStackDepth() > 2)) {
                    OpcodeStack.Item item = stack.getStackItem(1);
                    JavaClass entryCls = item.getJavaClass();
                    if (isImplementationOf(entryCls, collectionCls)) {
                        bugReporter.reportBug(new BugInstance(this, BugType.DSOC_DUBIOUS_SET_OF_COLLECTIONS.name(), NORMAL_PRIORITY).addClass(this)
                                .addMethod(this).addSourceLine(this));
                    }
                }
            }
        } catch (ClassNotFoundException cnfe) {
            bugReporter.reportMissingClass(cnfe);
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
@ Override public void sawOpcode ( int seen ) { try { stack . precomputation ( this ) ; if ( ( seen == Const . INVOKEVIRTUAL ) || ( seen == Const . INVOKEINTERFACE ) ) { String clsName = getClassConstantOperand ( ) ; String methodName = getNameConstantOperand ( ) ; String signature = getSigConstantOperand ( ) ; if ( "add" . equals ( methodName ) && SignatureBuilder . SIG_OBJECT_TO_BOOLEAN . equals ( signature ) && isImplementationOf ( clsName , setCls ) ) { if ( stack . getStackDepth ( ) > 1 ) { OpcodeStack . Item item = stack . getStackItem ( 0 ) ; JavaClass entryCls = item . getJavaClass ( ) ; if ( isImplementationOf ( entryCls , collectionCls ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . DSOC_DUBIOUS_SET_OF_COLLECTIONS . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } } } else if ( "put" . equals ( methodName ) && SignatureBuilder . SIG_TWO_OBJECTS_TO_OBJECT . equals ( signature ) && isImplementationOf ( clsName , setCls ) && ( stack . getStackDepth ( ) > 2 ) ) { OpcodeStack . Item item = stack . getStackItem ( 1 ) ; JavaClass entryCls = item . getJavaClass ( ) ; if ( isImplementationOf ( entryCls , collectionCls ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . DSOC_DUBIOUS_SET_OF_COLLECTIONS . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this ) ) ; } } } } catch ( ClassNotFoundException cnfe ) { bugReporter . reportMissingClass ( cnfe ) ; } finally { stack . sawOpcode ( this , seen ) ; } }
implements the visitor look for adds to sets or puts to maps where the element to be added is a collection.

@param seen
the opcode of the currently parsed instruction