-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultConfigurationBuilder - is not final but cannot be practically extended due to (in)visibility of private fields #3441
Comments
@ppkarwasz - Hi Piotr, I am working on a PR for this - but I have run into a problem. I added some convenience methods to the
The only "in-library" implementation of this interface is the In the BUILDING.adoc it said to talk to the development team... :) |
Hi @JWT007,
It is a
|
Hi @ppkarwasz ok thanks! I will take a look - defaults don' seem sensible in that case but I will look at the annotations. :) Am fighting with some problems with some flaky tests (unrelated to my changes)... all sort of the same scenario where collection sizes don't match. I don't know if the tests are running too fast?
|
Hi @ppkarwasz, I created a PR - hopefully everything correct. Tried to avoid any binary incompatilitty with the exception of the Interface changes mentioned above. There were some shifts in behavior and design - see PR - please review carefully and let me know if changes need to be made. |
Log4j 2.24..3
The DefaultConfigurationBuilder is not final but it practically not extensible because access to the root and other components is private.
This implementation could benefit from a bit more adherence to the Open/Closed Principle: - Open for Extension, Closed for Modification
Since the components (and other attributes) are private, it is not possible to extend this (for example to add a custom component type) - this would be important because a BuiltConfiguration only gets the root component as an argument in the constructor instantiated by reflection.
It also might be useful if this inittialization of the root component was moved out of the constructor to a protected / overridable method.
i.e.
protected Component getRootComponent()
protected void initializeComponents()
maybe a method like this would help?
This would significantly simplify the constructor.
Another nice-to-have would be moving the instantation of the Configuratio to a separate method so that a custom constructor could be called.
For example, from:
This would allow passing custom information to a custom configuration's constructor.
The text was updated successfully, but these errors were encountered: