String (Match match, final PsiMethod method, final boolean shouldBeStatic, String visibility) { final PsiType returnType = match.getChangedReturnType(method); if (!match.myChangedParams.isEmpty() || returnType != null) { @NonNls StringBuilder buffer = new StringBuilder(); buffer.append(visibility); if (buffer.length() > 0) { buffer.append(" "); } if (shouldBeStatic) { buffer.append("static "); } final PsiTypeParameterList typeParameterList = method.getTypeParameterList(); if (typeParameterList != null) { buffer.append(typeParameterList.getText()); buffer.append(" "); } buffer.append(PsiFormatUtil.formatType(returnType != null ? returnType : method.getReturnType(), 0, PsiSubstitutor.EMPTY)); buffer.append(" "); buffer.append(method.getName()); buffer.append("("); int count = 0; final String INDENT = " "; final List<ParameterInfoImpl> params = patchParams(match.myChangedParams, method); for (ParameterInfoImpl param : params) { String typeText = param.getTypeText(); if (count > 0) { buffer.append(","); } buffer.append("\n"); buffer.append(INDENT); buffer.append(typeText); buffer.append(" "); buffer.append(param.getName()); count++; } if (count > 0) { buffer.append("\n"); } buffer.append(")"); final PsiClassType[] exceptions = method.getThrowsList().getReferencedTypes(); if (exceptions.length > 0) { buffer.append("\n"); buffer.append("throws\n"); for (PsiType exception : exceptions) { buffer.append(INDENT); buffer.append(PsiFormatUtil.formatType(exception, 0, PsiSubstitutor.EMPTY)); buffer.append("\n"); } } return buffer.toString(); } return null; }