Type safety in Field.setValue() methods [LUCENE-3300]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
setValue methods in Field and subclasses should introduce type safety, beacuse what is now possible is to instantiate a BinaryField and set a non-binary value, but introduce it in such way to be able to preserve the ability to yield setValue(string) on parent Field class, e.g.:
```Java
Field b = new BinaryField();
b.setValue( ..byte[] value.. );
```
One idea is to use generics:
```Java
Field s = new StringField();
```
---
Migrated from [LUCENE-3300](https://issues.apache.org/jira/browse/LUCENE-3300) by Nikola Tankovic, updated May 09 2016
Contributor guide
Research direction
Start by reading Field and its subclasses, focusing on the setValue methods and the StringField/BinaryField examples in the issue. Determine how type safety can be introduced while preserving setValue(String) through the parent Field class; done means the API design is agreed and invalid value types can no longer be passed to a field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100