mirror of https://github.com/apache/lucene.git
LUCENE-3645: Remove unnecessary array wrapping when calling varargs methods
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1214413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1b0c37ea9c
commit
60929a5adb
|
@ -104,9 +104,8 @@ public class TestSearch extends LuceneTestCase {
|
|||
|
||||
ScoreDoc[] hits = null;
|
||||
|
||||
Sort sort = new Sort(new SortField[] {
|
||||
SortField.FIELD_SCORE,
|
||||
new SortField("id", SortField.Type.INT)});
|
||||
Sort sort = new Sort(SortField.FIELD_SCORE,
|
||||
new SortField("id", SortField.Type.INT));
|
||||
|
||||
for (Query query : buildQueries()) {
|
||||
out.println("Query: " + query.toString("contents"));
|
||||
|
|
|
@ -107,9 +107,8 @@ public class TestSearchForDuplicates extends LuceneTestCase {
|
|||
System.out.println("TEST: search query=" + query);
|
||||
}
|
||||
|
||||
final Sort sort = new Sort(new SortField[] {
|
||||
SortField.FIELD_SCORE,
|
||||
new SortField(ID_FIELD, SortField.Type.INT)});
|
||||
final Sort sort = new Sort(SortField.FIELD_SCORE,
|
||||
new SortField(ID_FIELD, SortField.Type.INT));
|
||||
|
||||
ScoreDoc[] hits = searcher.search(query, null, MAX_DOCS, sort).scoreDocs;
|
||||
printHits(out, hits, searcher);
|
||||
|
|
|
@ -846,9 +846,8 @@ public class TestSort extends LuceneTestCase {
|
|||
public void testParallelMultiSort() throws Exception {
|
||||
ExecutorService exec = Executors.newFixedThreadPool(_TestUtil.nextInt(random, 2, 8));
|
||||
IndexSearcher searcher = new IndexSearcher(
|
||||
new MultiReader(
|
||||
new IndexReader[] {searchX.getIndexReader(),
|
||||
searchY.getIndexReader()}), exec);
|
||||
new MultiReader(searchX.getIndexReader(),
|
||||
searchY.getIndexReader()), exec);
|
||||
runMultiSorts(searcher, false);
|
||||
exec.shutdown();
|
||||
exec.awaitTermination(1000, TimeUnit.MILLISECONDS);
|
||||
|
|
|
@ -92,7 +92,7 @@ public class TestCollectionUtil extends LuceneTestCase {
|
|||
|
||||
public void testEmptyListSort() {
|
||||
// should produce no exceptions
|
||||
List<Integer> list = Arrays.asList(new Integer[0]);
|
||||
List<Integer> list = Arrays.asList(new Integer[0]); // LUCENE-2989
|
||||
CollectionUtil.quickSort(list);
|
||||
CollectionUtil.mergeSort(list);
|
||||
CollectionUtil.insertionSort(list);
|
||||
|
|
|
@ -64,8 +64,8 @@ public class TestKeywordMarkerFilter extends BaseTokenStreamTestCase {
|
|||
new KeywordMarkerFilter(
|
||||
new KeywordMarkerFilter(
|
||||
new MockTokenizer(new StringReader("Dogs Trees Birds Houses"), MockTokenizer.WHITESPACE, false),
|
||||
new HashSet<String>(Arrays.asList(new String[] { "Birds", "Houses" }))),
|
||||
new HashSet<String>(Arrays.asList(new String[] { "Dogs", "Trees" }))));
|
||||
new HashSet<String>(Arrays.asList("Birds", "Houses"))),
|
||||
new HashSet<String>(Arrays.asList("Dogs", "Trees"))));
|
||||
|
||||
assertTokenStreamContents(ts, new String[] { "Dogs", "Trees", "Birds", "Houses" });
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class BaseTestTopK extends FacetTestBase {
|
|||
if (VERBOSE) {
|
||||
System.out.println("Adding CP: " + cp.toString());
|
||||
}
|
||||
return Arrays.asList(new CategoryPath[] { cp });
|
||||
return Arrays.asList(cp);
|
||||
}
|
||||
|
||||
protected FacetSearchParams searchParamsWithRequests(int numResults) {
|
||||
|
|
|
@ -601,7 +601,7 @@ public class TestBlockJoin extends LuceneTestCase {
|
|||
childDoc.add(newField("child", "1", StringField.TYPE_UNSTORED));
|
||||
Document parentDoc = new Document();
|
||||
parentDoc.add(newField("parent", "1", StringField.TYPE_UNSTORED));
|
||||
w.addDocuments(Arrays.asList(new Document[] {childDoc, parentDoc}));
|
||||
w.addDocuments(Arrays.asList(childDoc, parentDoc));
|
||||
IndexReader r = w.getReader();
|
||||
w.close();
|
||||
IndexSearcher s = newSearcher(r);
|
||||
|
@ -624,7 +624,7 @@ public class TestBlockJoin extends LuceneTestCase {
|
|||
Document parentDoc = new Document();
|
||||
parentDoc.add(newField("parent", "1", StringField.TYPE_UNSTORED));
|
||||
parentDoc.add(newField("isparent", "yes", StringField.TYPE_UNSTORED));
|
||||
w.addDocuments(Arrays.asList(new Document[] {parentDoc}));
|
||||
w.addDocuments(Arrays.asList(parentDoc));
|
||||
|
||||
// Add another doc so scorer is not null
|
||||
parentDoc = new Document();
|
||||
|
@ -632,7 +632,7 @@ public class TestBlockJoin extends LuceneTestCase {
|
|||
parentDoc.add(newField("isparent", "yes", StringField.TYPE_UNSTORED));
|
||||
Document childDoc = new Document();
|
||||
childDoc.add(newField("child", "2", StringField.TYPE_UNSTORED));
|
||||
w.addDocuments(Arrays.asList(new Document[] {childDoc, parentDoc}));
|
||||
w.addDocuments(Arrays.asList(childDoc, parentDoc));
|
||||
|
||||
// Need single seg:
|
||||
w.forceMerge(1);
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.junit.Test;
|
|||
|
||||
public class FloatMagicTest extends LuceneTestCase {
|
||||
public void testFloatMagic() {
|
||||
ArrayList<Float> floats = new ArrayList<Float>(Arrays.asList(new Float [] {
|
||||
ArrayList<Float> floats = new ArrayList<Float>(Arrays.asList(
|
||||
Float.intBitsToFloat(0x7f800001), // NaN (invalid combination).
|
||||
Float.intBitsToFloat(0x7fffffff), // NaN (invalid combination).
|
||||
Float.intBitsToFloat(0xff800001), // NaN (invalid combination).
|
||||
|
@ -26,7 +26,7 @@ public class FloatMagicTest extends LuceneTestCase {
|
|||
-0.1f,
|
||||
-1f,
|
||||
-10f,
|
||||
Float.NEGATIVE_INFINITY }));
|
||||
Float.NEGATIVE_INFINITY));
|
||||
|
||||
// Sort them using juc.
|
||||
Collections.sort(floats);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class AbstractDIHCacheTestCase {
|
|||
data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Daisy", new Float(4.44), Feb21_2011, null }));
|
||||
data.add(new ControlData(new Object[] { new Integer(4), new BigDecimal(Math.PI), "D", "Drawing", new Float(4.44), Feb21_2011, null }));
|
||||
data.add(new ControlData(new Object[] { new Integer(5), new BigDecimal(Math.PI), "E",
|
||||
Arrays.asList(new String[] { "Eggplant", "Ear", "Elephant", "Engine" }), new Float(5.55), Feb21_2011, null }));
|
||||
Arrays.asList("Eggplant", "Ear", "Elephant", "Engine"), new Float(5.55), Feb21_2011, null }));
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
@ -51,7 +51,7 @@ public class TestTemplateTransformer extends AbstractDataImportHandlerTestCase {
|
|||
fields.add(createMap("column", "mrname",
|
||||
TemplateTransformer.TEMPLATE,"Mr ${e.name}"));
|
||||
|
||||
List<String> mails = Arrays.asList(new String[]{"a@b.com", "c@d.com"});
|
||||
List<String> mails = Arrays.asList("a@b.com", "c@d.com");
|
||||
Map row = createMap(
|
||||
"firstName", "Shalin",
|
||||
"middleName", "Shekhar",
|
||||
|
|
|
@ -388,10 +388,9 @@ public class QueryElevationComponent extends SearchComponent implements SolrCore
|
|||
// insert documents in their proper place
|
||||
SortSpec sortSpec = rb.getSortSpec();
|
||||
if( sortSpec.getSort() == null ) {
|
||||
sortSpec.setSort( new Sort( new SortField[] {
|
||||
sortSpec.setSort( new Sort(
|
||||
new SortField(idField, booster.comparatorSource, false ),
|
||||
new SortField(null, SortField.Type.SCORE, false)
|
||||
}));
|
||||
new SortField(null, SortField.Type.SCORE, false)));
|
||||
}
|
||||
else {
|
||||
// Check if the sort is based on score
|
||||
|
|
|
@ -148,7 +148,7 @@ public class HaversineConstFunction extends ValueSource {
|
|||
} catch (InvalidGeoException e) {
|
||||
throw new ParseException("Bad spatial pt:" + pt);
|
||||
}
|
||||
return new VectorValueSource(Arrays.asList(new ValueSource[] {new DoubleConstValueSource(point[0]),new DoubleConstValueSource(point[1])}));
|
||||
return new VectorValueSource(Arrays.<ValueSource>asList(new DoubleConstValueSource(point[0]),new DoubleConstValueSource(point[1])));
|
||||
}
|
||||
|
||||
private static double[] getConstants(MultiValueSource vs) {
|
||||
|
|
|
@ -81,11 +81,11 @@ public class SpellCheckCollator {
|
|||
params.remove(GroupParams.GROUP);
|
||||
|
||||
// creating a request here... make sure to close it!
|
||||
ResponseBuilder checkResponse = new ResponseBuilder(new LocalSolrQueryRequest(ultimateResponse.req.getCore(), params),new SolrQueryResponse(), Arrays.asList(new SearchComponent[] { queryComponent }));
|
||||
ResponseBuilder checkResponse = new ResponseBuilder(new LocalSolrQueryRequest(ultimateResponse.req.getCore(), params),new SolrQueryResponse(), Arrays.<SearchComponent>asList(queryComponent));
|
||||
checkResponse.setQparser(ultimateResponse.getQparser());
|
||||
checkResponse.setFilters(ultimateResponse.getFilters());
|
||||
checkResponse.setQueryString(collationQueryStr);
|
||||
checkResponse.components = Arrays.asList(new SearchComponent[] { queryComponent });
|
||||
checkResponse.components = Arrays.<SearchComponent>asList(queryComponent);
|
||||
|
||||
try {
|
||||
queryComponent.prepare(checkResponse);
|
||||
|
|
Loading…
Reference in New Issue