PsiField (PsiClass builderClass, ParameterData parameterData) { PsiField field = builderClass.findFieldByName(parameterData.getFieldName(), false); if (field == null) { PsiType type = parameterData.getType(); if (type instanceof PsiEllipsisType) { type = ((PsiEllipsisType)type).toArrayType(); } field = myElementFactory.createField(parameterData.getFieldName(), type); field = (PsiField)builderClass.add(field); } final String defaultValue = parameterData.getDefaultValue(); if (defaultValue != null) { final PsiExpression initializer = field.getInitializer(); if (initializer == null) { try { field.setInitializer(myElementFactory.createExpressionFromText(defaultValue, field)); } catch (IncorrectOperationException e) { //skip invalid default value } } } return field; }