@ Override public void visitCode ( Code obj ) { try { Method m = getMethod ( ) ; if ( ( ! m . isPublic ( ) && ! m . isProtected ( ) ) || m . isAbstract ( ) || m . isSynthetic ( ) ) { return ; } CodeInfo superCode = superclassCode . remove ( curMethodInfo ) ; if ( superCode != null ) { if ( sameAccess ( getMethod ( ) . getAccessFlags ( ) , superCode . getAccess ( ) ) && codeEquals ( obj , superCode . getCode ( ) ) ) { bugReporter . reportBug ( new BugInstance ( this , BugType . COM_COPIED_OVERRIDDEN_METHOD . name ( ) , NORMAL_PRIORITY ) . addClass ( this ) . addMethod ( this ) . addSourceLine ( classContext , this , getPC ( ) ) ) ; return ; } if ( ( getMethod ( ) . getAccessFlags ( ) & Const . ACC_SYNCHRONIZED ) != ( superCode . getAccess ( ) & Const . ACC_SYNCHRONIZED ) ) { return ; } parmTypes = getMethod ( ) . getArgumentTypes ( ) ; nextParmIndex = 0 ; nextParmOffset = getMethod ( ) . isStatic ( ) ? 0 : 1 ; sawAload0 = nextParmOffset == 0 ; sawParentCall = false ; super . visitCode ( obj ) ; } } catch ( StopOpcodeParsingException e ) { // method is unique } }
overrides the visitor to find code blocks of methods that are the same as its parents