GrParameter (@NotNull GrParameterListOwner parametersOwner, @Nullable MethodJavaDocHelper javaDocHelper, @NotNull PsiType forcedType, @NotNull String parameterName, boolean isFinal, @NotNull Project project) { GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(project); final String typeText = forcedType.equalsToText(CommonClassNames.JAVA_LANG_OBJECT) || forcedType == PsiTypes.nullType() || PsiTypes.voidType().equals(forcedType) ? null : forcedType.getCanonicalText(); GrParameter parameter = factory.createParameter(parameterName, typeText, parametersOwner); parameter.getModifierList().setModifierProperty(PsiModifier.FINAL, isFinal); final PsiParameter anchorParameter = getAnchorParameter(parametersOwner); final GrParameterList parameterList = parametersOwner.getParameterList(); parameter = (GrParameter)parameterList.addAfter(parameter, anchorParameter); JavaCodeStyleManager.getInstance(project).shortenClassReferences(parameter); if (javaDocHelper != null) { final PsiDocTag tagForAnchorParameter = javaDocHelper.getTagForParameter(anchorParameter); javaDocHelper.addParameterAfter(parameterName, tagForAnchorParameter); } return parameter; }