lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sim...@apache.org
Subject svn commit: r888799 - in /lucene/java/trunk/contrib: ./ analyzers/common/src/java/org/apache/lucene/analysis/cjk/ analyzers/common/src/java/org/apache/lucene/analysis/cn/ analyzers/common/src/java/org/apache/lucene/analysis/de/ analyzers/common/src/jav...
Date Wed, 09 Dec 2009 13:32:33 GMT
Author: simonw
Date: Wed Dec  9 13:32:32 2009
New Revision: 888799

URL: http://svn.apache.org/viewvc?rev=888799&view=rev
Log:
LUCENE-2100: Marked all contrib Analyzer subclasses as final. Analyzers should be only act
as a composition of TokenStreams, users should compose their own analyzers instead of subclassing
existing ones.

Modified:
    lucene/java/trunk/contrib/CHANGES.txt
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cjk/CJKAnalyzer.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cn/ChineseAnalyzer.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/de/GermanAnalyzer.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzer.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java
    lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/de/TestGermanStemFilter.java
    lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java
    lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java
    lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapperTest.java
    lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java
    lucene/java/trunk/contrib/analyzers/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java
    lucene/java/trunk/contrib/icu/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
    lucene/java/trunk/contrib/snowball/src/java/org/apache/lucene/analysis/snowball/SnowballAnalyzer.java
    lucene/java/trunk/contrib/snowball/src/test/org/apache/lucene/analysis/snowball/TestSnowball.java

Modified: lucene/java/trunk/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/CHANGES.txt?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/CHANGES.txt (original)
+++ lucene/java/trunk/contrib/CHANGES.txt Wed Dec  9 13:32:32 2009
@@ -2,12 +2,19 @@
 
 ======================= Trunk (not yet released) =======================
 
+Changes in backwards compatibility policy
+
+ * LUCENE-2100: All Analyzers in Lucene-contrib have been marked as final.
+   Analyzers should be only act as a composition of TokenStreams, users should
+   compose their own analyzers instead of subclassing existing ones.
+   (Simon Willnauer) 
+
 Changes in runtime behavior
 
-* LUCENE-2117: SnowballAnalyzer uses TurkishLowerCaseFilter instead of
-  LowercaseFilter to correctly handle the unique Turkish casing behavior if
-  used with Version > 3.0 and the TurkishStemmer.
-  (Robert Muir via Simon Willnauer)  
+ * LUCENE-2117: SnowballAnalyzer uses TurkishLowerCaseFilter instead of
+   LowercaseFilter to correctly handle the unique Turkish casing behavior if
+   used with Version > 3.0 and the TurkishStemmer.
+   (Robert Muir via Simon Willnauer)  
 
 Bug fixes
 

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cjk/CJKAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cjk/CJKAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cjk/CJKAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cjk/CJKAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -35,7 +35,7 @@
  * filters with {@link StopFilter}
  *
  */
-public class CJKAnalyzer extends Analyzer {
+public final class CJKAnalyzer extends Analyzer {
   //~ Static fields/initializers ---------------------------------------------
 
   /**

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cn/ChineseAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cn/ChineseAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cn/ChineseAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/cn/ChineseAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -29,7 +29,7 @@
  *
  */
 
-public class ChineseAnalyzer extends Analyzer {
+public final class ChineseAnalyzer extends Analyzer {
 
     public ChineseAnalyzer() {
     }

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/de/GermanAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/de/GermanAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/de/GermanAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/de/GermanAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -51,7 +51,7 @@
  * <p><b>NOTE</b>: This class uses the same {@link Version}
  * dependent settings as {@link StandardAnalyzer}.</p>
  */
-public class GermanAnalyzer extends Analyzer {
+public final class GermanAnalyzer extends Analyzer {
   
   /**
    * List of typical german stopwords.
@@ -133,7 +133,6 @@
   public GermanAnalyzer(Version matchVersion, Set<?> stopwords, Set<?> stemExclusionSet)
{
     stopSet = CharArraySet.unmodifiableSet(CharArraySet.copy(matchVersion, stopwords));
     exclusionSet = CharArraySet.unmodifiableSet(CharArraySet.copy(matchVersion, stemExclusionSet));
-    setOverridesTokenStreamMethod(GermanAnalyzer.class);
     this.matchVersion = matchVersion;
   }
 
@@ -221,13 +220,6 @@
    */
   @Override
   public TokenStream reusableTokenStream(String fieldName, Reader reader) throws IOException
{
-    if (overridesTokenStreamMethod) {
-      // LUCENE-1678: force fallback to tokenStream() if we
-      // have been subclassed and that subclass overrides
-      // tokenStream but not reusableTokenStream
-      return tokenStream(fieldName, reader);
-    }
-    
     SavedStreams streams = (SavedStreams) getPreviousTokenStream();
     if (streams == null) {
       streams = new SavedStreams();

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -64,7 +64,7 @@
  * </pre>
  *
  */
-public class PatternAnalyzer extends Analyzer {
+public final class PatternAnalyzer extends Analyzer {
   
   /** <code>"\\W+"</code>; Divides text at non-letters (NOT Character.isLetter(c))
*/
   public static final Pattern NON_WORD_PATTERN = Pattern.compile("\\W+");

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -52,7 +52,7 @@
  * <p><b>NOTE</b>: This class uses the same {@link Version}
  * dependent settings as {@link StandardAnalyzer}.</p>
  */
-public class DutchAnalyzer extends Analyzer {
+public final class DutchAnalyzer extends Analyzer {
   /**
    * List of typical Dutch stopwords.
    * @deprecated use {@link #getDefaultStopSet()} instead
@@ -119,7 +119,6 @@
     stoptable = CharArraySet.unmodifiableSet(CharArraySet.copy(matchVersion, stopwords));
     excltable = CharArraySet.unmodifiableSet(CharArraySet.copy(matchVersion, stemExclusionTable));
     this.matchVersion = matchVersion;
-    setOverridesTokenStreamMethod(DutchAnalyzer.class);
   }
 
   /**
@@ -151,7 +150,6 @@
    */
   public DutchAnalyzer(Version matchVersion, File stopwords) {
     // this is completely broken!
-    setOverridesTokenStreamMethod(DutchAnalyzer.class);
     try {
       stoptable = org.apache.lucene.analysis.WordlistLoader.getWordSet(stopwords);
     } catch (IOException e) {
@@ -243,13 +241,6 @@
   @Override
   public TokenStream reusableTokenStream(String fieldName, Reader reader)
       throws IOException {
-    if (overridesTokenStreamMethod) {
-      // LUCENE-1678: force fallback to tokenStream() if we
-      // have been subclassed and that subclass overrides
-      // tokenStream but not reusableTokenStream
-      return tokenStream(fieldName, reader);
-    }
-    
     SavedStreams streams = (SavedStreams) getPreviousTokenStream();
     if (streams == null) {
       streams = new SavedStreams();

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -43,7 +43,7 @@
  * stop words found in an already existing index.
  * </p>
  */
-public class QueryAutoStopWordAnalyzer extends Analyzer {
+public final class QueryAutoStopWordAnalyzer extends Analyzer {
   Analyzer delegate;
   HashMap<String,HashSet<String>> stopWordsPerField = new HashMap<String,HashSet<String>>();
   //The default maximum percentage (40%) of index documents which
@@ -58,7 +58,6 @@
    */
   public QueryAutoStopWordAnalyzer(Version matchVersion, Analyzer delegate) {
     this.delegate = delegate;
-    setOverridesTokenStreamMethod(QueryAutoStopWordAnalyzer.class);
     this.matchVersion = matchVersion;
   }
 
@@ -198,13 +197,6 @@
   @Override
   public TokenStream reusableTokenStream(String fieldName, Reader reader)
       throws IOException {
-    if (overridesTokenStreamMethod) {
-      // LUCENE-1678: force fallback to tokenStream() if we
-      // have been subclassed and that subclass overrides
-      // tokenStream but not reusableTokenStream
-      return tokenStream(fieldName, reader);
-    }
-
     /* map of SavedStreams for each field */
     Map<String,SavedStreams> streamMap = (Map<String,SavedStreams>) getPreviousTokenStream();
     if (streamMap == null) {

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapper.java
Wed Dec  9 13:32:32 2009
@@ -31,7 +31,7 @@
  * A shingle is another name for a token based n-gram.
  * </p>
  */
-public class ShingleAnalyzerWrapper extends Analyzer {
+public final class ShingleAnalyzerWrapper extends Analyzer {
 
   protected Analyzer defaultAnalyzer;
   protected int maxShingleSize = 2;
@@ -40,7 +40,6 @@
   public ShingleAnalyzerWrapper(Analyzer defaultAnalyzer) {
     super();
     this.defaultAnalyzer = defaultAnalyzer;
-    setOverridesTokenStreamMethod(ShingleAnalyzerWrapper.class);
   }
 
   public ShingleAnalyzerWrapper(Analyzer defaultAnalyzer, int maxShingleSize) {
@@ -54,7 +53,6 @@
   public ShingleAnalyzerWrapper(Version matchVersion) {
     super();
     this.defaultAnalyzer = new StandardAnalyzer(matchVersion);
-    setOverridesTokenStreamMethod(ShingleAnalyzerWrapper.class);
   }
 
   /**
@@ -119,13 +117,6 @@
   
   @Override
   public TokenStream reusableTokenStream(String fieldName, Reader reader) throws IOException
{
-    if (overridesTokenStreamMethod) {
-      // LUCENE-1678: force fallback to tokenStream() if we
-      // have been subclassed and that subclass overrides
-      // tokenStream but not reusableTokenStream
-      return tokenStream(fieldName, reader);
-    }
-    
     SavedStreams streams = (SavedStreams) getPreviousTokenStream();
     if (streams == null) {
       streams = new SavedStreams();

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/th/ThaiAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -35,11 +35,10 @@
  * <p><b>NOTE</b>: This class uses the same {@link Version}
  * dependent settings as {@link StandardAnalyzer}.</p>
  */
-public class ThaiAnalyzer extends Analyzer {
+public final class ThaiAnalyzer extends Analyzer {
   private final Version matchVersion;
 
   public ThaiAnalyzer(Version matchVersion) {
-    setOverridesTokenStreamMethod(ThaiAnalyzer.class);
     this.matchVersion = matchVersion;
   }
   
@@ -59,13 +58,6 @@
   
   @Override
   public TokenStream reusableTokenStream(String fieldName, Reader reader) throws IOException
{
-    if (overridesTokenStreamMethod) {
-      // LUCENE-1678: force fallback to tokenStream() if we
-      // have been subclassed and that subclass overrides
-      // tokenStream but not reusableTokenStream
-      return tokenStream(fieldName, reader);
-    }
-    
     SavedStreams streams = (SavedStreams) getPreviousTokenStream();
     if (streams == null) {
       streams = new SavedStreams();

Modified: lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/de/TestGermanStemFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/de/TestGermanStemFilter.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/de/TestGermanStemFilter.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/de/TestGermanStemFilter.java
Wed Dec  9 13:32:32 2009
@@ -21,13 +21,9 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStreamReader;
-import java.io.Reader;
 
 import org.apache.lucene.analysis.BaseTokenStreamTestCase;
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.WhitespaceTokenizer;
-import org.apache.lucene.analysis.standard.StandardTokenizer;
 import org.apache.lucene.util.Version;
 
 /**
@@ -68,24 +64,6 @@
     checkReuse(a, "Tischen", "tisch");
   }
   
-  /**
-   * subclass that acts just like whitespace analyzer for testing
-   */
-  private class GermanSubclassAnalyzer extends GermanAnalyzer {
-    public GermanSubclassAnalyzer(Version matchVersion) {
-      super(matchVersion);
-    }
-
-    @Override
-    public TokenStream tokenStream(String fieldName, Reader reader) {
-      return new WhitespaceTokenizer(reader);
-    }
-  }
-  
-  public void testLUCENE1678BWComp() throws Exception {
-    checkReuse(new GermanSubclassAnalyzer(Version.LUCENE_CURRENT), "Tischen", "Tischen");
-  }
-
   /* 
    * Test that changes to the exclusion table are applied immediately
    * when using reusable token streams.

Modified: lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java
Wed Dec  9 13:32:32 2009
@@ -18,12 +18,9 @@
  */
 
 import java.io.File;
-import java.io.Reader;
 
 import org.apache.lucene.analysis.BaseTokenStreamTestCase;
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.WhitespaceTokenizer;
 import org.apache.lucene.util.Version;
 
 /**
@@ -127,27 +124,6 @@
     checkOneTermReuse(a, "lichamelijkheden", "licham");
   }
   
-  /**
-   * subclass that acts just like whitespace analyzer for testing
-   */
-  private class DutchSubclassAnalyzer extends DutchAnalyzer {
-    public DutchSubclassAnalyzer(Version matchVersion) {
-      super(matchVersion);
-    }
-    @Override
-    public TokenStream tokenStream(String fieldName, Reader reader) {
-      return new WhitespaceTokenizer(reader);
-    }
-  }
-  
-  public void testLUCENE1678BWComp() throws Exception {
-    Analyzer a = new DutchSubclassAnalyzer(Version.LUCENE_CURRENT);
-    checkOneTermReuse(a, "lichaamsziek", "lichaamsziek");
-    checkOneTermReuse(a, "lichamelijk", "lichamelijk");
-    checkOneTermReuse(a, "lichamelijke", "lichamelijke");
-    checkOneTermReuse(a, "lichamelijkheden", "lichamelijkheden");
-  }
- 
   /* 
    * Test that changes to the exclusion table are applied immediately
    * when using reusable token streams.

Modified: lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java
Wed Dec  9 13:32:32 2009
@@ -148,27 +148,6 @@
 
   }
   
-  /**
-   * subclass that acts just like whitespace analyzer for testing
-   */
-  private class QueryAutoStopWordSubclassAnalyzer extends QueryAutoStopWordAnalyzer {
-    public QueryAutoStopWordSubclassAnalyzer(Version matchVersion) {
-      super(matchVersion, new WhitespaceAnalyzer());
-    }
-    
-    @Override
-    public TokenStream tokenStream(String fieldName, Reader reader) {
-      return new WhitespaceTokenizer(reader);
-    }    
-  }
-  
-  public void testLUCENE1678BWComp() throws Exception {
-    QueryAutoStopWordAnalyzer a = new QueryAutoStopWordSubclassAnalyzer(Version.LUCENE_CURRENT);
-    a.addStopWords(reader, "repetitiveField", 10);
-    int numHits = search(a, "repetitiveField:boring");
-    assertFalse(numHits == 0);
-  }
-  
   /*
    * analyzer that does not support reuse
    * it is LetterTokenizer on odd invocations, WhitespaceTokenizer on even.

Modified: lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapperTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapperTest.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapperTest.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/shingle/ShingleAnalyzerWrapperTest.java
Wed Dec  9 13:32:32 2009
@@ -213,28 +213,6 @@
         new int[] { 1, 0, 1, 0, 1, 0, 1 });
   }
   
-  /**
-   * subclass that acts just like whitespace analyzer for testing
-   */
-  private class ShingleWrapperSubclassAnalyzer extends ShingleAnalyzerWrapper {
-    public ShingleWrapperSubclassAnalyzer() {
-      super(org.apache.lucene.util.Version.LUCENE_CURRENT);
-    }
-  
-    @Override
-    public TokenStream tokenStream(String fieldName, Reader reader) {
-      return new WhitespaceTokenizer(reader);
-    }  
-  };
-  
-  public void testLUCENE1678BWComp() throws Exception {
-    Analyzer a = new ShingleWrapperSubclassAnalyzer();
-    assertAnalyzesToReuse(a, "this is a test",
-        new String[] { "this", "is", "a", "test" },
-        new int[] { 0, 5, 8, 10 },
-        new int[] { 4, 7, 9, 14 });
-  }
-  
   /*
    * analyzer that does not support reuse
    * it is LetterTokenizer on odd invocations, WhitespaceTokenizer on even.

Modified: lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -17,12 +17,7 @@
  * limitations under the License.
  */
 
-import java.io.Reader;
-
 import org.apache.lucene.analysis.BaseTokenStreamTestCase;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.WhitespaceTokenizer;
 import org.apache.lucene.util.Version;
 
 /**
@@ -124,22 +119,4 @@
           "บริษัทชื่อ XY&Z - คุยกับ
xyz@demo.com",
           new String[] { "บริษัท", "ชื่อ",
"xy&z", "คุย", "กับ", "xyz@demo.com" });
 	}
-	
-	/**
-	 * subclass that acts just like whitespace analyzer for testing
-	 */
-	private class ThaiSubclassAnalyzer extends ThaiAnalyzer {
-          public ThaiSubclassAnalyzer(Version matchVersion) {
-            super(matchVersion);
-          }
-	  @Override
-	  public TokenStream tokenStream(String fieldName, Reader reader) {
-	    return new WhitespaceTokenizer(reader);
-	  }
-	}
-	
-	public void testLUCENE1678BWComp() throws Exception {
-	  ThaiSubclassAnalyzer a = new ThaiSubclassAnalyzer(Version.LUCENE_CURRENT);
-	  assertAnalyzesToReuse(a, "การที่ได้ต้องแสดงว่างานดี",
new String[] { "การที่ได้ต้องแสดงว่างานดี"
});
-	}
 }

Modified: lucene/java/trunk/contrib/analyzers/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/analyzers/smartcn/src/java/org/apache/lucene/analysis/cn/smart/SmartChineseAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -58,7 +58,7 @@
  * supported anymore in such a case.</font>
  * </p>
  */
-public class SmartChineseAnalyzer extends Analyzer {
+public final class SmartChineseAnalyzer extends Analyzer {
 
   private final Set<?> stopWords;
   

Modified: lucene/java/trunk/contrib/icu/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/icu/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/icu/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/icu/src/java/org/apache/lucene/collation/ICUCollationKeyAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -69,7 +69,7 @@
  *   java.text.Collator over several languages.
  * </p>
  */
-public class ICUCollationKeyAnalyzer extends Analyzer {
+public final class ICUCollationKeyAnalyzer extends Analyzer {
   private Collator collator;
 
   public ICUCollationKeyAnalyzer(Collator collator) {

Modified: lucene/java/trunk/contrib/snowball/src/java/org/apache/lucene/analysis/snowball/SnowballAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/snowball/src/java/org/apache/lucene/analysis/snowball/SnowballAnalyzer.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/snowball/src/java/org/apache/lucene/analysis/snowball/SnowballAnalyzer.java
(original)
+++ lucene/java/trunk/contrib/snowball/src/java/org/apache/lucene/analysis/snowball/SnowballAnalyzer.java
Wed Dec  9 13:32:32 2009
@@ -40,7 +40,7 @@
  * </ul>
  * </p>
  */
-public class SnowballAnalyzer extends Analyzer {
+public final class SnowballAnalyzer extends Analyzer {
   private String name;
   private Set<?> stopSet;
   private final Version matchVersion;
@@ -48,7 +48,6 @@
   /** Builds the named analyzer with no stop words. */
   public SnowballAnalyzer(Version matchVersion, String name) {
     this.name = name;
-    setOverridesTokenStreamMethod(SnowballAnalyzer.class);
     this.matchVersion = matchVersion;
   }
 
@@ -80,7 +79,7 @@
   private class SavedStreams {
     Tokenizer source;
     TokenStream result;
-  };
+  }
   
   /** Returns a (possibly reused) {@link StandardTokenizer} filtered by a 
    * {@link StandardFilter}, a {@link LowerCaseFilter}, 
@@ -88,13 +87,6 @@
   @Override
   public TokenStream reusableTokenStream(String fieldName, Reader reader)
       throws IOException {
-    if (overridesTokenStreamMethod) {
-      // LUCENE-1678: force fallback to tokenStream() if we
-      // have been subclassed and that subclass overrides
-      // tokenStream but not reusableTokenStream
-      return tokenStream(fieldName, reader);
-    }
-    
     SavedStreams streams = (SavedStreams) getPreviousTokenStream();
     if (streams == null) {
       streams = new SavedStreams();

Modified: lucene/java/trunk/contrib/snowball/src/test/org/apache/lucene/analysis/snowball/TestSnowball.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/snowball/src/test/org/apache/lucene/analysis/snowball/TestSnowball.java?rev=888799&r1=888798&r2=888799&view=diff
==============================================================================
--- lucene/java/trunk/contrib/snowball/src/test/org/apache/lucene/analysis/snowball/TestSnowball.java
(original)
+++ lucene/java/trunk/contrib/snowball/src/test/org/apache/lucene/analysis/snowball/TestSnowball.java
Wed Dec  9 13:32:32 2009
@@ -17,11 +17,8 @@
  * limitations under the License.
  */
 
-import java.io.Reader;
-
 import org.apache.lucene.analysis.BaseTokenStreamTestCase;
 import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.WhitespaceTokenizer;
 import org.apache.lucene.index.Payload;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.tokenattributes.FlagsAttribute;
@@ -86,26 +83,6 @@
         new String[]{"she", "abhor", "him"});
   }
   
-  /**
-   * subclass that acts just like whitespace analyzer for testing
-   */
-  private class SnowballSubclassAnalyzer extends SnowballAnalyzer {
-    public SnowballSubclassAnalyzer(String name) {
-      super(Version.LUCENE_CURRENT, name);
-    }
-    
-    @Override
-    public TokenStream tokenStream(String fieldName, Reader reader) {
-      return new WhitespaceTokenizer(reader);
-    }
-  }
-  
-  public void testLUCENE1678BWComp() throws Exception {
-    Analyzer a = new SnowballSubclassAnalyzer("English");
-    assertAnalyzesToReuse(a, "he abhorred accents",
-        new String[]{"he", "abhorred", "accents"});
-  }
-  
   public void testFilterTokens() throws Exception {
     SnowballFilter filter = new SnowballFilter(new TestTokenStream(), "English");
     TermAttribute termAtt = filter.getAttribute(TermAttribute.class);



Mime
View raw message