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
Remove Settings.settingsBuilder. #17619
Conversation
|
Note to reviewers: the change is purely mechanical. |
@@ -86,7 +86,7 @@ | |||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; | |||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; | |||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_VERSION_CREATED; | |||
import static org.elasticsearch.common.settings.Settings.settingsBuilder; | |||
import static org.elasticsearch.common.settings.Settings.builder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should never import static Strings.builder
because Settings.builder()
is much more readable than builder()
. It'd be fairly simple to add a check for that to the regexes we run during checkstyle. I'd probably do that - either temporarily to find and remove them all or permanently with a helpful message telling people to use Settings.builder
.
BTW, I love static imports when the static methods are named appropriately, but I also love when static methods can be named in such a way that it is nicer not to statically import them. So, personally, I like that we don't have a hard and fast rule against static imports. The SETTINGS above this are a super great use of static imports.
In the name of moving forward, LGTM. but we really really shouldn't be statically importing |
++ Thanks for doing this Adrien! This always confuses me when my IDE propose the 2 methods... :) |
@nik9000 I agree these static imports are not nice. I pushed a new commit. |
LGTM |
We have both `Settings.settingsBuilder` and `Settings.builder` that do exactly the same thing, so we should keep only one. I kept `Settings.builder` since it has my preference but also it is the one that we use in examples of the Java API.
2b89ebb
to
42526ac
Compare
We have both
Settings.settingsBuilder
andSettings.builder
that do exactlythe same thing, so we should keep only one. I kept
Settings.builder
since ithas my preference but also it is the one that we use in examples of the Java API.