String () { @NonNls final StringBuilder buffer = new StringBuilder(); if (myGenerateAnnotations != null && myGenerateAnnotations.isSelected()) { final NullableNotNullManager nullManager = NullableNotNullManager.getInstance(myProject); buffer.append("@"); buffer.append( StringUtil.getShortName(myNullability == Nullability.NULLABLE ? nullManager.getDefaultNullable() : nullManager.getDefaultNotNull())); buffer.append("\n"); } final int declarationOffset = buffer.length(); final String visibilityString = VisibilityUtil.getVisibilityString(getVisibility()); buffer.append(visibilityString); if (buffer.length() > 0) { buffer.append(" "); } if (isMakeStatic() && !isChainedConstructor()) { buffer.append("static "); } if (myTypeParameterList != null) { final String typeParamsText = myTypeParameterList.getText(); if (!typeParamsText.isEmpty()) { buffer.append(typeParamsText); buffer.append(" "); } } if (isChainedConstructor()) { buffer.append(myTargetClass.getName()); } else { buffer.append(PsiFormatUtil.formatType(mySelector != null ? mySelector.getSelectedType() : myReturnType, 0, PsiSubstitutor.EMPTY)); buffer.append(" "); buffer.append(myNameField.getEnteredName()); } buffer.append("("); final String INDENT = StringUtil.repeatSymbol(' ', buffer.length() - declarationOffset); final VariableData[] datas = myInputVariables; int count = 0; for (int i = 0; i < datas.length; i++) { VariableData data = datas[i]; if (data.passAsParameter) { //String typeAndModifiers = PsiFormatUtil.formatVariable(data.variable, // PsiFormatUtil.SHOW_MODIFIERS | PsiFormatUtil.SHOW_TYPE); PsiType type = data.type; if (i == datas.length - 1 && type instanceof PsiArrayType && myMakeVarargs != null && myMakeVarargs.isSelected()) { type = new PsiEllipsisType(((PsiArrayType)type).getComponentType()); } String typeText = type.getPresentableText(); if (count > 0) { buffer.append(",\n"); buffer.append(INDENT); } buffer.append(typeText); buffer.append(" "); buffer.append(data.name); count++; } } buffer.append(")"); if (myExceptions.length > 0) { buffer.append("\n"); buffer.append("throws "); boolean printSeparator = false; for (PsiType exception : myExceptions) { if (printSeparator) { buffer.append(",\n "); } buffer.append(PsiFormatUtil.formatType(exception, 0, PsiSubstitutor.EMPTY)); printSeparator = true; } } return buffer.toString(); }