java - Why must Lucene Token Filter classes be declared "final"? -


according solr's blog, lucene requires tokenfilter subclasses must declared final. advantage of final classes in context? makes impossible extend functionality of existing tokenfilter.

tokenfilter extends tokenstream, , javadoc says:

the tokenstream-api in lucene based on decorator pattern. therefore non-abstract subclasses must final or have @ least final implementation of incrementtoken()! checked when java assertions enabled.

for example, standardfilter not marked final (only incrementtoken() is).

so if want extend existing tokenfilter it's best via delegation.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -