Steve Rowe created LUCENE-5364:
----------------------------------

             Summary: Review usages of hard-coded Version constants
                 Key: LUCENE-5364
                 URL: https://issues.apache.org/jira/browse/LUCENE-5364
             Project: Lucene - Core
          Issue Type: Bug
          Components: core/other
    Affects Versions: 5.0, 4.7
            Reporter: Steve Rowe
            Priority: Minor


There are some hard-coded {{Version.LUCENE_XY}} constants used in various 
places.  Some of these are intentional and appropriate:
* in deprecated code, e.g. {{ArabicLetterTokenizer}}, deprecated in 3.1, uses 
{{Version.LUCENE_31}}
* to make behavior version-dependent (e.g. {{StandardTokenizer}} and other 
analysis components)
* to test different behavior at different points in history (e.g. 
{{TestStopFilter}} to test position increments)

But should hard-coded constants be used elsewhere?  Here are non-deprecated, 
non-version-dependent-behavior cases that I found:

# {{Version.LUCENE_46}} is used in 
{{lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java}}.
  Mike McCandless said on #lucene-dev IRC that this should use the latest 
version (i.e. {{Version.LUCENE_CURRENT}}).
# {{Version.LUCENE_40}} is used in 
{{lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java}}.
  I think this should be {{Version.TEST_VERSION_CURRENT}}.
# {{Version.LUCENE_40}} is used in {{testEndStopWord()}} in 
{{lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java}}.
  I think this should be changed to {{Version.TEST_VERSION_CURRENT}}, since, 
unlike other {{Version}} constants used on branch_4x in this test class, no 
version-dependent behavior is intended.
# {{Version.LUCENE_40}} is used in 
{{lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/htmlentity.py}},
 which generates {{HTMLCharacterEntities.flex}}, which is used by 
{{HTMLStripCharFilter}}.  This should be {{Version.LUCENE_CURRENT}}.
#  {{Version.LUCENE_40}} is used in 
{{lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/HTMLStripCharFilter.jflex}},
 which generates {{HTMLStripCharFilter.java}}.  This should be 
{{Version.LUCENE_CURRENT}}.
# {{Version.LUCENE_40}} is used in {{testStopList()}} in 
{{lucene/analysis/common/src/test/org/apache/lucene/analysis/core/TestStopAnalyzer.java}}.
  I think it should be {{Version.TEST_VERSION_CURRENT}}.
# {{Version.LUCENE_31}} is used to instantiate a bunch of {{CharArraySet}}-s in 
{{/Users/sarowe/svn/lucene/dev/branches/branch_4x/lucene/analysis/common/src/java/org/apache/lucene/analysis/el/GreekStemmer.java}}.
  I think these should be {{Version.LUCENE_CURRENT}}.

This is a partial list - I'll add more later.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to