Ejemplo n.º 1
0
 /** Checks if the parameter names are valid. */
 public RefactoringStatus checkParameterNames() {
   RefactoringStatus result = new RefactoringStatus();
   for (ParameterInfo parameter : parameters) {
     result.merge(Checks.checkParameter(parameter.getNewName()));
     for (ParameterInfo other : parameters) {
       if (parameter != other && StringUtils.equals(other.getNewName(), parameter.getNewName())) {
         result.addError(
             Messages.format(
                 RefactoringCoreMessages.ExtractMethodRefactoring_error_sameParameter,
                 other.getNewName()));
         return result;
       }
     }
     if (parameter.isRenamed() && usedNames.contains(parameter.getNewName())) {
       result.addError(
           Messages.format(
               RefactoringCoreMessages.ExtractMethodRefactoring_error_nameInUse,
               parameter.getNewName()));
       return result;
     }
   }
   return result;
 }
Ejemplo n.º 2
0
 /**
  * Checks if the new method name is a valid method name. This method doesn't check if a method
  * with the same name already exists in the hierarchy. This check is done in {@link
  * #checkPossibleConflicts()} since it is expensive.
  */
 public RefactoringStatus checkMethodName() {
   return Checks.checkMethodName(methodName);
 }