@ Override public void visitCode ( Code obj ) { Method m = getMethod ( ) ; if ( m . isSynthetic ( ) ) { return ; } String signature = m . getSignature ( ) ; if ( ! signature . endsWith ( ")Ljava/lang/Object;" ) ) { return ; } stack . resetForMethodEntry ( this ) ; returnTypes . clear ( ) ; super . visitCode ( obj ) ; if ( returnTypes . size ( ) <= 1 ) { return ; } String methodName = m . getName ( ) ; try { boolean isInherited = SignatureUtils . isInheritedMethod ( currentClass , methodName , signature ) ; int priority = NORMAL_PRIORITY ; for ( JavaClass cls : returnTypes . keySet ( ) ) { if ( ( cls != null ) && Values . DOTTED_JAVA_LANG_OBJECT . equals ( cls . getClassName ( ) ) ) { priority = LOW_PRIORITY ; break ; } } JavaClass cls = findCommonType ( returnTypes . keySet ( ) ) ; BugInstance bug ; if ( isInherited ) { bug = new BugInstance ( this , BugType . URV_INHERITED_METHOD_WITH_RELATED_TYPES . name ( ) , priority ) . addClass ( this ) . addMethod ( this ) ; if ( cls != null ) { bug . addString ( cls . getClassName ( ) ) ; } } else if ( cls == null ) { bug = new BugInstance ( this , BugType . URV_UNRELATED_RETURN_VALUES . name ( ) , priority ) . addClass ( this ) . addMethod ( this ) ; } else { bug = new BugInstance ( this , BugType . URV_CHANGE_RETURN_TYPE . name ( ) , priority ) . addClass ( this ) . addMethod ( this ) ; bug . addString ( cls . getClassName ( ) ) ; } for ( Integer pc : returnTypes . values ( ) ) { bug . addSourceLine ( this , pc . intValue ( ) ) ; } bugReporter . reportBug ( bug ) ; } catch ( ClassNotFoundException cnfe ) { bugReporter . reportMissingClass ( cnfe ) ; } }
implements the visitor to see if the method returns Object and if the method is defined in a superclass or interface .