Comparison of String objects using == or != [LUCENE-8047]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
My tool has scanned the whole codebase of Lucene and found there are eight practice issues of string comparison, in which strings are compared by using ==/!= instead of equals( ).
analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java
```java
conditionPattern == SUFFIX_CONDITION_REGEX_PATTERN
```
analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKBigramFilter.java
```java
if (type == doHan || type == doHiragana || type == doKatakana || type == doHangul) {
```
analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicFilter.java
```java
if (type == APOSTROPHE_TYPE &&...){
} else if (type == ACRONYM_TYPE) {
```
---
Migrated from [LUCENE-8047](https://issues.apache.org/jira/browse/LUCENE-8047) by song
Environment:
```
Ubuntu 14.04.5 LTS
```
Contributor guide
Research direction
Review the reported comparisons in analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java, analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKBigramFilter.java, and analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicFilter.java. Check the operand types and locate the remaining reported cases before changing anything. Done means actual String comparisons use the intended equality method and the relevant Lucene tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100