LUCENE-2052: add varargs where possible

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@836248 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-11-14 19:26:49 +00:00
parent 5e5e5aa85a
commit 945e7eda52
9 changed files with 17 additions and 11 deletions

View File

@ -24,6 +24,12 @@ Changes in backwards compatibility policy
status on the thread is cleared when this exception is thrown.
(Mike McCandless)
* LUCENE-2052: Some methods in Lucene core were changed to accept
Java 5 varargs. This is not a backwards compatibility problem as
long as you not try to override such a method. We left common
overridden methods unchanged and added varargs to constructors,
static, or final methods (MultiSearcher,...). (Uwe Schindler)
Changes in runtime behavior
* LUCENE-1677: Remove the system property to set SegmentReader class

View File

@ -121,7 +121,7 @@ public final class PersianAnalyzer extends Analyzer {
/**
* Builds an analyzer with the given stop words.
*/
public PersianAnalyzer(Version matchVersion, String[] stopwords) {
public PersianAnalyzer(Version matchVersion, String... stopwords) {
stoptable = StopFilter.makeStopSet(stopwords);
this.matchVersion = matchVersion;
}

View File

@ -33,7 +33,7 @@ class ConjunctionScorer extends Scorer {
this(similarity, scorers.toArray(new Scorer[scorers.size()]));
}
public ConjunctionScorer(Similarity similarity, Scorer[] scorers) throws IOException {
public ConjunctionScorer(Similarity similarity, Scorer... scorers) throws IOException {
super(similarity);
this.scorers = scorers;
coord = similarity.coord(scorers.length, scorers.length);

View File

@ -97,7 +97,7 @@ public class FieldCacheTermsFilter extends Filter {
private String field;
private String[] terms;
public FieldCacheTermsFilter(String field, String[] terms) {
public FieldCacheTermsFilter(String field, String... terms) {
this.field = field;
this.terms = terms;
}

View File

@ -178,7 +178,7 @@ public abstract class Query implements java.io.Serializable, Cloneable {
*
*<p>A utility for use by {@link #combine(Query[])} implementations.
*/
public static Query mergeBooleanQueries(BooleanQuery[] queries) {
public static Query mergeBooleanQueries(BooleanQuery... queries) {
HashSet<BooleanClause> allClauses = new HashSet<BooleanClause>();
for (BooleanQuery booleanQuery : queries) {
for (BooleanClause clause : booleanQuery) {

View File

@ -82,7 +82,7 @@ public class CustomScoreQuery extends Query {
* {@link org.apache.lucene.search.function.FieldScoreQuery FieldScoreQueries}.
* This parameter is optional - it can be null or even an empty array.
*/
public CustomScoreQuery(Query subQuery, ValueSourceQuery valSrcQueries[]) {
public CustomScoreQuery(Query subQuery, ValueSourceQuery... valSrcQueries) {
super();
this.subQuery = subQuery;
this.valSrcQueries = valSrcQueries!=null?

View File

@ -37,7 +37,7 @@ public class SpanOrQuery extends SpanQuery implements Cloneable {
private String field;
/** Construct a SpanOrQuery merging the provided clauses. */
public SpanOrQuery(SpanQuery[] clauses) {
public SpanOrQuery(SpanQuery... clauses) {
// copy clauses array into an ArrayList
this.clauses = new ArrayList<SpanQuery>(clauses.length);

View File

@ -78,10 +78,10 @@ public final class FieldCacheSanityChecker {
/**
* Quick and dirty convenience method that instantiates an instance with
* "good defaults" and uses it to test the CacheEntry[]
* "good defaults" and uses it to test the CacheEntrys
* @see #check
*/
public static Insanity[] checkSanity(CacheEntry[] cacheEntries) {
public static Insanity[] checkSanity(CacheEntry... cacheEntries) {
FieldCacheSanityChecker sanityChecker = new FieldCacheSanityChecker();
// doesn't check for interned
sanityChecker.setRamUsageEstimator(new RamUsageEstimator(false));
@ -96,7 +96,7 @@ public final class FieldCacheSanityChecker {
* (:TODO: is this a bad idea? are we masking a real problem?)
* </p>
*/
public Insanity[] check(CacheEntry[] cacheEntries) {
public Insanity[] check(CacheEntry... cacheEntries) {
if (null == cacheEntries || 0 == cacheEntries.length)
return new Insanity[0];
@ -324,7 +324,7 @@ public final class FieldCacheSanityChecker {
private final InsanityType type;
private final String msg;
private final CacheEntry[] entries;
public Insanity(InsanityType type, String msg, CacheEntry[] entries) {
public Insanity(InsanityType type, String msg, CacheEntry... entries) {
if (null == type) {
throw new IllegalArgumentException
("Insanity requires non-null InsanityType");

View File

@ -50,7 +50,7 @@ public class SortedVIntList extends DocIdSet {
*
* @param sortedInts A sorted array of non negative integers.
*/
public SortedVIntList(int[] sortedInts) {
public SortedVIntList(int... sortedInts) {
this(sortedInts, sortedInts.length);
}