-
Notifications
You must be signed in to change notification settings - Fork 12
Modify copy mechanism of unused properties in configuration builder #25
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
Conversation
The set of unused properties was shared, which makes it impossible to check for unused properties in derived subconfigurations. Now subconfigurations will have a distinct set for tracking those, while still removing used properties from the corresponding set in their parent configuration.
In general, we do want this, of course. Feel free to add more unit tests for the whole functionality of detecting unused options, there is currently only one. Currently this code does not work transitively for chains of >= 3 configuration instances, correct? If a field It is probably nice for code understandability if Configuration instances can stand alone. Furthermore, just today I had the idea of #26, which would also introduce a reference to some kind of "parent config", but with different semantics. But if a parent field is necessary, it is not unacceptable. |
Thanks goes to the codacy bot who suggested this.
183818e
to
a653285
Compare
Thanks for the input!
I thought it would, but I can just write a test to see who is right.
Me neither.
Not at all, I thought it was nicer to have the relation via a parent object instead of just the sets.
Sure, currently, the only thing I need the reference to the parent for is for getting the set of unused properties. And of course once in the constructor, I need the actual set of properties. But after construction, there is no need to keep that.
Do you mean that we should try to avoid accessing the parents set of unused properties? This would lead to options marked as unused in the parent config that are used in the child config, I do not see a way to make both work at the same time.
I looked into it and posted some questions I had. It is kind of hard to wrap my head around all the implications and possibilities of the configuration system. |
No, that's fine. My slight tendency against a |
Will this be continued or shall we close it? |
@MartinSpiessl ping? |
Currently, when we have something like the following:
the
newConfig
and theoldConfig
share the same set ofunusedProperties
.This has the downside that
newConfig
might add options that are not in theoldConfig
. These are then nowhere marked as unused, despite the fact that this information is relevant for users.This PR will address this by keeping the sets of
unusedProperties
separate and updating the set inoldConfig
when the option is used in thenewConfig
.The
unusedProperties
ofnewConfig
are set to only contain properties that are only present innewConfig
, notoldConfig
. This has the advantage that unused properties are not reported redundantly.I introduced a reference to the parent configuration inside the new configuration, this effectively leads to a tree-like structure where unused property tracking will work correctly across all levels.
The motivation behind this PR is to allow to check for unused options in subconfigs (c.f. CPAchecker issue #545). It should be backwards compatible as far as the effect on
oldConfig
is concerned.I have not yet added unit tests that test the new functionality, I will add them if there are no objections against this PR in general.