@ Override public void report ( ) { for ( Map . Entry < FQMethod , MethodInfo > entry : Statistics . getStatistics ( ) ) { MethodInfo mi = entry . getValue ( ) ; int declaredAccess = mi . getDeclaredAccess ( ) ; if ( ( declaredAccess & Const . ACC_PRIVATE ) != 0 ) { continue ; } if ( mi . wasCalledPublicly ( ) || ! mi . wasCalled ( ) ) { continue ; } FQMethod key = entry . getKey ( ) ; String methodName = key . getMethodName ( ) ; if ( isGetterSetter ( methodName , key . getSignature ( ) ) ) { continue ; } if ( isOverlyPermissive ( declaredAccess ) && ! isConstrainedByInterface ( key ) ) { try { String clsName = key . getClassName ( ) ; if ( ! isDerived ( Repository . lookupClass ( clsName ) , key ) ) { BugInstance bi = new BugInstance ( this , BugType . OPM_OVERLY_PERMISSIVE_METHOD . name ( ) , LOW_PRIORITY ) . addClass ( clsName ) . addMethod ( clsName , key . getMethodName ( ) , key . getSignature ( ) , ( declaredAccess & Const . ACC_STATIC ) != 0 ) ; String descr = String . format ( "- Method declared %s but could be declared %s" , getDeclaredAccessValue ( declaredAccess ) , getRequiredAccessValue ( mi ) ) ; bi . addString ( descr ) ; bugReporter . reportBug ( bi ) ; } } catch ( ClassNotFoundException cnfe ) { bugReporter . reportMissingClass ( cnfe ) ; } } } }
after collecting all method calls build a report of all methods that have been called but in a way that is less permissive then is defined .