private static GrParameter createNewParameter(@NotNull PsiSubstitutor substitutor,
                                                @NotNull PsiMethod context,
                                                @NotNull GrParameterList parameterList,
                                                @NotNull JavaParameterInfo newParameter,
                                                @NotNull String newName) {
    GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(parameterList.getProject());
    String typeText = newParameter.getTypeText();
    if (newParameter instanceof GrParameterInfo && (typeText.isEmpty() || "def".equals(typeText))) {
      return factory.createParameter(newName, null, getInitializer(newParameter), parameterList);
    }

    PsiType type = substitutor.substitute(newParameter.createType(context, parameterList.getManager()));
    return factory.createParameter(newName, type == null ? null : type.getCanonicalText(), getInitializer(newParameter), parameterList);
  }
private static GrParameter createNewParameter(@NotNull PsiSubstitutor substitutor,
                                                @NotNull PsiMethod context,
                                                @NotNull GrParameterList parameterList,
                                                @NotNull JavaParameterInfo newParameter,
                                                @NotNull String newName)