@ Override public void visitCode ( Code obj ) { String nameAndSignature = getMethod ( ) . getName ( ) + getMethod ( ) . getSignature ( ) ; if ( SignatureBuilder . SIG_READ_OBJECT . equals ( nameAndSignature ) ) { inReadObject = true ; inWriteObject = false ; } else if ( SIG_WRITE_OBJECT . equals ( nameAndSignature ) ) { inReadObject = false ; inWriteObject = true ; } if ( inReadObject || inWriteObject ) { state = State . SEEN_NOTHING ; super . visitCode ( obj ) ; if ( state != State . SEEN_INVALID ) { bugReporter . reportBug ( new BugInstance ( this , BugType . NCS_NEEDLESS_CUSTOM_SERIALIZATION . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( this , 1 ) ) ; } } }
overrides the method to check for either readObject or writeObject methods and if so reset the stack