garydgregory commented on PR #3852: URL: https://github.com/apache/logging-log4j2/pull/3852#issuecomment-3133052094
I think the exception should happen on construction to allow for setters to be called over and over. In general, this design allows for co-dependent values to change but only be validated in the constructor. Otherwise, each setter in the builder needs to know the invariants for all the other values in the builder it depends on. This could be solved with a builder validation method that takes into account the state of the whole builder but it seems to me to be cleaner to have the constructor do the validation, since that's what _really_ needs to be valid. If the constructor is public or protected, then it _must_ do the validation anyway. And I wouldn't want to have validation code in two places. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org