[
https://issues.apache.org/jira/browse/LUCENE-8047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16247169#comment-16247169
]
Dawid Weiss commented on LUCENE-8047:
-------------------------------------
It'd be great if you could review those use cases too and see if they're not
used as object singletons (then the comparison is not a bug, it'd be
intentional)... Ideally, a patch would be awesome!
The SUFFIX_CONDITION_REGEX_PATTERN seems like it could use equals, but the
other one is a relict of pre-enum Java... Replacing it to .equals is only going
to slow things down (arguably by not much).
> Comparison of String objects using == or !=
> -------------------------------------------
>
> Key: LUCENE-8047
> URL: https://issues.apache.org/jira/browse/LUCENE-8047
> Project: Lucene - Core
> Issue Type: Improvement
> Components: modules/analysis
> Affects Versions: 7.0.1
> Environment: Ubuntu 14.04.5 LTS
> Reporter: song
> Priority: Minor
> Labels: performance
>
> 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
> {code:java}
> conditionPattern == SUFFIX_CONDITION_REGEX_PATTERN
> {code}
> analysis/common/src/java/org/apache/lucene/analysis/cjk/CJKBigramFilter.java
> {code:java}
> if (type == doHan || type == doHiragana || type == doKatakana || type ==
> doHangul) {
> {code}
> analysis/common/src/java/org/apache/lucene/analysis/standard/ClassicFilter.java
> {code:java}
> if (type == APOSTROPHE_TYPE &&...){
> } else if (type == ACRONYM_TYPE) {
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]