You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Steve Rowe (JIRA)" <ji...@apache.org> on 2013/12/07 15:39:35 UTC
[jira] [Updated] (LUCENE-5364) Review usages of hard-coded Version
constants
[ https://issues.apache.org/jira/browse/LUCENE-5364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Rowe updated LUCENE-5364:
-------------------------------
Description:
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?
For those that should remain, and need to be updated with each release, there should be an easy way to find them.
was:
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.
> 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?
> For those that should remain, and need to be updated with each release, there should be an easy way to find them.
--
This message was sent by Atlassian JIRA
(v6.1#6144)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org