lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: 2.9/3.0 plan & Java 1.5
Date Sun, 14 Dec 2008 17:07:41 GMT

> > A side note: there are some parts in Lucene's API that are not so good:
> very
> > old constructors of Analyzer use e.g.
> Hashtable/HashMap/ArrayList/Vector/...
> > as parameter etc. For clean code, it should be replaced by Map/Set/List
> > interfaces.  But this would not be backwards compatible.
> 
> Or even Iterable, which is new to Java 1.5 and usually makes more sense in
> a read-only context.
> Iterable could have also been used instead of List as a return value in
> method like Document.getFields() and so on, but again, this would not
> be backward compatible (although, for 3.0 we may decide that this is
> not absolutely necessary).

For input parameters Iterable or Collection would be good. Using deprecation
in 2.9 for the old constructors there and then use Collection (because
Iterable cannot be used as replacement in Java 1.4). But on the other hand,
the constructors there need a stop word set, not a list (each stop word
should only be there one time).

For return parameters, I think you should return the most specific interface
you can give to the user (without fixing to something you may change in
future versions). Maybe a user wants to use the return value of getFields()
as List? If it's only Iterable, he cannot e.g. access the list directly.
This is important, because the stored fields are an *ordered* list and maybe
he wants the third entry in this list?

If we want to keep backwards compatible, lets just replace the collection
interfaces by their generic'fied ones.

Uwe


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message