private void findAndRemoveMethod(String methodName, String... arguments) {
    // Maybe there's an easier way to do this with mClass.findMethodBySignature(), but I'm not an expert on Psi*
    PsiMethod[] methods = psiClass.findMethodsByName(methodName, false);

    for (PsiMethod method : methods) {
      PsiParameterList parameterList = method.getParameterList();

      if (parameterList.getParametersCount() == arguments.length) {
        boolean shouldDelete = true;

        PsiParameter[] parameters = parameterList.getParameters();

        for (int i = 0; i < arguments.length; i++) {
          if (!parameters[i].getType().getCanonicalText().equals(arguments[i])) {
            shouldDelete = false;
          }
        }

        if (shouldDelete) {
          method.delete();
        }
      }
    }
  }
private void findAndRemoveMethod(String methodName, String... arguments) {
    
    PsiMethod[] methods = psiClass.findMethodsByName(methodName, false);

    for (PsiMethod method : methods) {
      PsiParameterList parameterList = method.getParameterList();

      if (parameterList.getParametersCount() == arguments.length) {
        boolean shouldDelete = true;

        PsiParameter[] parameters = parameterList.getParameters();

        for (int i = 0; i < arguments.length; i++) {
          if (!parameters[i].getType().getCanonicalText().equals(arguments[i])) {
            shouldDelete = false;
          }
        }

        if (shouldDelete) {
          method.delete();
        }
      }
    }
  }
private void findAndRemoveMethod ( String methodName , String ... arguments ) { // Maybe there's an easier way to do this with mClass.findMethodBySignature(), but I'm not an expert on Psi* PsiMethod [ ] methods = psiClass . findMethodsByName ( methodName , false ) ; for ( PsiMethod method : methods ) { PsiParameterList parameterList = method . getParameterList ( ) ; if ( parameterList . getParametersCount ( ) == arguments . length ) { boolean shouldDelete = true ; PsiParameter [ ] parameters = parameterList . getParameters ( ) ; for ( int i = 0 ; i < arguments . length ; i ++ ) { if ( ! parameters [ i ] . getType ( ) . getCanonicalText ( ) . equals ( arguments [ i ] ) ) { shouldDelete = false ; } } if ( shouldDelete ) { method . delete ( ) ; } } } }
Finds and removes a given method
@param methodName
@param arguments
Finds and removes a given method