private boolean hasOverloadedMethod ( ) { Method thisMethod = getMethod ( ) ; String name = thisMethod . getName ( ) ; String sig = thisMethod . getSignature ( ) ; int numArgs = SignatureUtils . getNumParameters ( sig ) ; for ( Method m : cls . getMethods ( ) ) { if ( m . getName ( ) . equals ( name ) ) { if ( ! m . getSignature ( ) . equals ( sig ) && ( numArgs == SignatureUtils . getNumParameters ( m . getSignature ( ) ) ) ) { return true ; } } } return false ; }
looks to see if this method has an overloaded method in actuality this isn t precise and returns true for methods that are named the same and have same number of args This will miss some cases but in practicality doesn t matter .