Index: CHANGES.txt =================================================================== --- CHANGES.txt (revision 836019) +++ CHANGES.txt (working copy) @@ -16,6 +16,12 @@ the internal cache implementation for thread safety, before it was declared protected. (Peter Lenahan, Uwe Schindler, Simon Willnauer) +* 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 + overriden methods unchanged and added varargs to constructors + or final methods (MultiSearcher,...). (Uwe Schindler) + Changes in runtime behavior * LUCENE-1677: Remove the system property to set SegmentReader class Index: src/java/org/apache/lucene/search/ConjunctionScorer.java =================================================================== --- src/java/org/apache/lucene/search/ConjunctionScorer.java (revision 836019) +++ src/java/org/apache/lucene/search/ConjunctionScorer.java (working copy) @@ -33,7 +33,7 @@ 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); Index: src/java/org/apache/lucene/search/FieldCacheTermsFilter.java =================================================================== --- src/java/org/apache/lucene/search/FieldCacheTermsFilter.java (revision 836019) +++ src/java/org/apache/lucene/search/FieldCacheTermsFilter.java (working copy) @@ -97,7 +97,7 @@ private String field; private String[] terms; - public FieldCacheTermsFilter(String field, String[] terms) { + public FieldCacheTermsFilter(String field, String... terms) { this.field = field; this.terms = terms; } Index: src/java/org/apache/lucene/search/function/CustomScoreQuery.java =================================================================== --- src/java/org/apache/lucene/search/function/CustomScoreQuery.java (revision 836019) +++ src/java/org/apache/lucene/search/function/CustomScoreQuery.java (working copy) @@ -82,7 +82,7 @@ * {@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? Index: src/java/org/apache/lucene/search/Query.java =================================================================== --- src/java/org/apache/lucene/search/Query.java (revision 836019) +++ src/java/org/apache/lucene/search/Query.java (working copy) @@ -178,7 +178,7 @@ * *

A utility for use by {@link #combine(Query[])} implementations. */ - public static Query mergeBooleanQueries(BooleanQuery[] queries) { + public static Query mergeBooleanQueries(BooleanQuery... queries) { HashSet allClauses = new HashSet(); for (BooleanQuery booleanQuery : queries) { for (BooleanClause clause : booleanQuery) { Index: src/java/org/apache/lucene/search/spans/SpanOrQuery.java =================================================================== --- src/java/org/apache/lucene/search/spans/SpanOrQuery.java (revision 836019) +++ src/java/org/apache/lucene/search/spans/SpanOrQuery.java (working copy) @@ -37,7 +37,7 @@ 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(clauses.length); Index: src/java/org/apache/lucene/util/FieldCacheSanityChecker.java =================================================================== --- src/java/org/apache/lucene/util/FieldCacheSanityChecker.java (revision 836019) +++ src/java/org/apache/lucene/util/FieldCacheSanityChecker.java (working copy) @@ -78,10 +78,10 @@ /** * 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 @@ * (:TODO: is this a bad idea? are we masking a real problem?) *

*/ - public Insanity[] check(CacheEntry[] cacheEntries) { + public Insanity[] check(CacheEntry... cacheEntries) { if (null == cacheEntries || 0 == cacheEntries.length) return new Insanity[0]; @@ -324,7 +324,7 @@ 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"); Index: src/java/org/apache/lucene/util/SortedVIntList.java =================================================================== --- src/java/org/apache/lucene/util/SortedVIntList.java (revision 836019) +++ src/java/org/apache/lucene/util/SortedVIntList.java (working copy) @@ -50,7 +50,7 @@ * * @param sortedInts A sorted array of non negative integers. */ - public SortedVIntList(int[] sortedInts) { + public SortedVIntList(int... sortedInts) { this(sortedInts, sortedInts.length); }