String (@NotNull PsiClass psiClass, @NotNull Collection<MemberInfo> memberInfos, @NotNull PsiAnnotation psiAnnotation, boolean forceCallSuper) { final boolean callSuper = forceCallSuper || readCallSuperAnnotationOrConfigProperty(psiAnnotation, psiClass, ConfigKey.TOSTRING_CALL_SUPER); final boolean doNotUseGetters = readAnnotationOrConfigProperty(psiAnnotation, psiClass, "doNotUseGetters", ConfigKey.TOSTRING_DO_NOT_USE_GETTERS); final boolean includeFieldNames = readAnnotationOrConfigProperty(psiAnnotation, psiClass, "includeFieldNames", ConfigKey.TOSTRING_INCLUDE_FIELD_NAMES); final StringBuilder paramString = new StringBuilder(); if (callSuper) { paramString.append("super=\" + super.toString() + \", "); } for (MemberInfo memberInfo : memberInfos) { if (includeFieldNames) { paramString.append(memberInfo.getName()).append('='); } paramString.append("\"+"); final PsiType classFieldType = memberInfo.getType(); if (classFieldType instanceof PsiArrayType) { final PsiType componentType = ((PsiArrayType)classFieldType).getComponentType(); if (componentType instanceof PsiPrimitiveType) { paramString.append("java.util.Arrays.toString("); } else { paramString.append("java.util.Arrays.deepToString("); } } final String memberAccessor = EqualsAndHashCodeToStringHandler.getMemberAccessorName(memberInfo, doNotUseGetters, psiClass); paramString.append("this.").append(memberAccessor); if (classFieldType instanceof PsiArrayType) { paramString.append(")"); } paramString.append("+\", "); } if (paramString.length() > 2) { paramString.delete(paramString.length() - 2, paramString.length()); } return paramString.toString(); }