title: Lucene 4.0 overrides final method tokenStream
body: <p>For different reasons I have to work with the latest release of Lucene's API. </p>
  
  <p>The API isn't well documented yet so I find myself not able to perform a simple <code>addDocument()</code></p>
  
  <p>Here is the <code>Writer</code> initialization:</p>
  
  <pre><code>analyzer = new StopAnalyzer(Version.LUCENE_40);
  config = new IndexWriterConfig(Version.LUCENE_40, analyzer);
  writer = new IndexWriter(FSDirectory.open(new File(ConfigUtil.getProperty("lucene.directory"))), config);
  </code></pre>
  
  <p>The simple <code>toDocument</code> method:</p>
  
  <pre><code>public static Document getDocument(User user) {
      Document doc = new Document();
      FieldType storedType = new FieldType();
      storedType.setStored(true);
      storedType.setTokenized(false);
  
      // Store user data
      doc.add(new Field(USER_ID, user.getId().toString(), storedType));
      doc.add(new Field(USER_NAME, user.getFirstName() + user.getLastName(), storedType));
  
      FieldType unstoredType = new FieldType();
      unstoredType.setStored(false);
      unstoredType.setTokenized(true);
  
      // Analyze Location
      String tokens = "";
      if (user.getLocation() != null &amp;&amp; ! user.getLocation().isEmpty()){
          for (Tag location : user.getLocation()) tokens += location.getName() + " ";
          doc.add(new Field(USER_LOCATION, tokens, unstoredType));
      }
  }
  </code></pre>
  
  <p>When running:</p>
  
  <pre><code>Document userDoc = DocumentManager.getDocument(userWrap);
  IndexAccess.getWriter().addDocument(userDoc);
  </code></pre>
  
  <p>This is the error message I get:</p>
  
  <p><code>class org.apache.lucene.analysis.util.ReusableAnalyzerBase overrides final method tokenStream.(Ljava/lang/String;Ljava/io/Reader;)Lorg/apache/lucene/analysis/TokenStream;</code></p>
  
  <p>It may be a simple matter but I cannot find any reference to help with this problem. I'm using a default <code>analyzer</code> and I followed a tutorial in order to avoid the deprecated <code>Field.Index.ANALYZED</code></p>