apache / apache/lucene

Don't allow IndexWriterConfig setters to chain [LUCENE-3756]

Open
#4,829 13 comments 0 reactions 1 assignee Claimed by @mikemccand View on GitHub
legacy-jira-priority:Major type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Spinoff from #4810.

I don't like that IndexWriterConfig's setters are chainable; it
results in code in our tests like this:

```
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2).setMergePolicy(newLogMergePolicy()));
```

I think in general we should avoid chaining since it encourages hard
to read code (code is already hard enough to read!).

---
Migrated from [LUCENE-3756](https://issues.apache.org/jira/browse/LUCENE-3756) by Michael McCandless (@mikemccand), updated Feb 10 2012

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.