LUCENE-3239: Drop Java 5 support on trunk

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1141501 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Simon Willnauer 2011-06-30 12:14:36 +00:00
parent 5ce2c2844a
commit b843dfe839
17 changed files with 40 additions and 50 deletions

View File

@ -115,8 +115,7 @@ public class FieldTermStack {
* @param termInfo the TermInfo object to be put on the top of the stack
*/
public void push( TermInfo termInfo ){
// termList.push( termInfo ); // avoid Java 1.6 feature
termList.addFirst( termInfo );
termList.push( termInfo );
}
/**

View File

@ -351,7 +351,7 @@ public class NRTManager implements Closeable {
}
/** NOTE: caller must separately close the writer. */
// @Override -- not until Java 1.6
@Override
public void close() throws IOException {
swapSearcher(null, indexingGen.getAndIncrement(), true);
}

View File

@ -196,7 +196,7 @@ class BufferedDeletes {
public Iterable<Term> termsIterable() {
return new Iterable<Term>() {
// @Override -- not until Java 1.6
@Override
public Iterator<Term> iterator() {
return terms.keySet().iterator();
}
@ -206,23 +206,23 @@ class BufferedDeletes {
public Iterable<QueryAndLimit> queriesIterable() {
return new Iterable<QueryAndLimit>() {
// @Override -- not until Java 1.6
@Override
public Iterator<QueryAndLimit> iterator() {
return new Iterator<QueryAndLimit>() {
private final Iterator<Map.Entry<Query,Integer>> iter = queries.entrySet().iterator();
// @Override -- not until Java 1.6
@Override
public boolean hasNext() {
return iter.hasNext();
}
// @Override -- not until Java 1.6
@Override
public QueryAndLimit next() {
final Map.Entry<Query,Integer> ent = iter.next();
return new QueryAndLimit(ent.getKey(), ent.getValue());
}
// @Override -- not until Java 1.6
@Override
public void remove() {
throw new UnsupportedOperationException();
}

View File

@ -143,7 +143,7 @@ class BufferedDeletesStream {
// Sorts SegmentInfos from smallest to biggest bufferedDelGen:
private static final Comparator<SegmentInfo> sortSegInfoByDelGen = new Comparator<SegmentInfo>() {
// @Override -- not until Java 1.6
@Override
public int compare(SegmentInfo si1, SegmentInfo si2) {
final long cmp = si1.getBufferedDeletesGen() - si2.getBufferedDeletesGen();
if (cmp > 0) {

View File

@ -93,22 +93,22 @@ class FrozenBufferedDeletes {
public Iterable<Term> termsIterable() {
return new Iterable<Term>() {
// @Override -- not until Java 1.6
@Override
public Iterator<Term> iterator() {
return new Iterator<Term>() {
private int upto;
// @Override -- not until Java 1.6
@Override
public boolean hasNext() {
return upto < terms.length;
}
// @Override -- not until Java 1.6
@Override
public Term next() {
return terms[upto++];
}
// @Override -- not until Java 1.6
@Override
public void remove() {
throw new UnsupportedOperationException();
}
@ -119,24 +119,24 @@ class FrozenBufferedDeletes {
public Iterable<QueryAndLimit> queriesIterable() {
return new Iterable<QueryAndLimit>() {
// @Override -- not until Java 1.6
@Override
public Iterator<QueryAndLimit> iterator() {
return new Iterator<QueryAndLimit>() {
private int upto;
// @Override -- not until Java 1.6
@Override
public boolean hasNext() {
return upto < queries.length;
}
// @Override -- not until Java 1.6
@Override
public QueryAndLimit next() {
QueryAndLimit ret = new QueryAndLimit(queries[upto], queryLimits[upto]);
upto++;
return ret;
}
// @Override -- not until Java 1.6
@Override
public void remove() {
throw new UnsupportedOperationException();
}

View File

@ -584,7 +584,7 @@ public class ParallelReader extends IndexReader {
fields.put(field, perDocs.docValues(field));
}
//@Override -- not until Java 1.6
@Override
public void close() throws IOException {
// nothing to do here
}

View File

@ -137,7 +137,7 @@ public class FieldCacheImpl implements FieldCache { // Made Public so that
}
final static IndexReader.ReaderFinishedListener purgeReader = new IndexReader.ReaderFinishedListener() {
// @Override -- not until Java 1.6
@Override
public void finished(IndexReader reader) {
FieldCache.DEFAULT.purge(reader);
}

View File

@ -51,7 +51,7 @@ public class InputStreamDataInput extends DataInput implements Closeable {
}
}
//@Override -- not until Java 1.6
@Override
public void close() throws IOException {
is.close();
}

View File

@ -39,7 +39,7 @@ public class OutputStreamDataOutput extends DataOutput implements Closeable {
os.write(b, offset, length);
}
// @Override -- not until Java 1.6
@Override
public void close() throws IOException {
os.close();
}

View File

@ -120,7 +120,7 @@ public final class BitVector implements Cloneable, Bits {
return size;
}
// @Override -- not until Java 1.6
@Override
public int length() {
return size;
}

View File

@ -136,7 +136,7 @@ public class OpenBitSet extends DocIdSet implements Bits, Cloneable {
return capacity();
}
// @Override -- not until Java 1.6
@Override
public int length() {
return bits.length << 6;
}

View File

@ -133,22 +133,22 @@ public class RandomIndexWriter implements Closeable {
// addDocuments? Would be better testing.
w.addDocuments(new Iterable<Document>() {
// @Override -- not until Java 1.6
@Override
public Iterator<Document> iterator() {
return new Iterator<Document>() {
boolean done;
// @Override -- not until Java 1.6
@Override
public boolean hasNext() {
return !done;
}
// @Override -- not until Java 1.6
@Override
public void remove() {
throw new UnsupportedOperationException();
}
// @Override -- not until Java 1.6
@Override
public Document next() {
if (done) {
throw new IllegalStateException();
@ -259,22 +259,22 @@ public class RandomIndexWriter implements Closeable {
if (r.nextInt(5) == 3) {
w.updateDocuments(t, new Iterable<Document>() {
// @Override -- not until Java 1.6
@Override
public Iterator<Document> iterator() {
return new Iterator<Document>() {
boolean done;
// @Override -- not until Java 1.6
@Override
public boolean hasNext() {
return !done;
}
// @Override -- not until Java 1.6
@Override
public void remove() {
throw new UnsupportedOperationException();
}
// @Override -- not until Java 1.6
@Override
public Document next() {
if (done) {
throw new IllegalStateException();

View File

@ -59,23 +59,23 @@ public class TestIndexWriterExceptions extends LuceneTestCase {
this.doc = doc;
}
// @Override -- not until Java 1.6
@Override
public Iterator<Document> iterator() {
return new Iterator<Document>() {
int upto;
// @Override -- not until Java 1.6
@Override
public boolean hasNext() {
return upto < count;
}
// @Override -- not until Java 1.6
@Override
public Document next() {
upto++;
return doc;
}
// @Override -- not until Java 1.6
@Override
public void remove() {
throw new UnsupportedOperationException();
}

View File

@ -2,6 +2,7 @@ package org.apache.lucene.util;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -71,11 +72,7 @@ public class UnsafeByteArrayOutputStream extends OutputStream {
}
private void grow(int newLength) {
// It actually should be: (Java 1.6)
// buffer = Arrays.copyOf(buffer, newLength);
byte[] newBuffer = new byte[newLength];
System.arraycopy(buffer, 0, newBuffer, 0, buffer.length);
buffer = newBuffer;
buffer = Arrays.copyOf(buffer, newLength);
}
/**

View File

@ -171,7 +171,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
private static class GroupMerger<T> {
private final GroupComparator<T> groupComp;
private final SortedSet<MergedGroup<T>> queue;
private final NavigableSet<MergedGroup<T>> queue;
private final Map<T,MergedGroup<T>> groupsSeen;
public GroupMerger(Sort groupSort) throws IOException {
@ -242,10 +242,8 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
// Prune un-competitive groups:
while(queue.size() > topN) {
// TODO java 1.6: .pollLast
final MergedGroup<T> group = queue.last();
final MergedGroup<T> group = queue.pollLast();
//System.out.println("PRUNE: " + group);
queue.remove(group);
group.inQueue = false;
}
}
@ -270,9 +268,7 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
int count = 0;
while(queue.size() != 0) {
// TODO Java 1.6: pollFirst()
final MergedGroup<T> group = queue.first();
queue.remove(group);
final MergedGroup<T> group = queue.pollFirst();
group.processed = true;
//System.out.println(" pop: shards=" + group.shards + " group=" + (group.groupValue == null ? "null" : (((BytesRef) group.groupValue).utf8ToString())) + " sortValues=" + Arrays.toString(group.topValues));
if (count++ >= offset) {

View File

@ -193,7 +193,7 @@ public class TestGrouping extends LuceneTestCase {
private Comparator<GroupDoc> getComparator(Sort sort) {
final SortField[] sortFields = sort.getSort();
return new Comparator<GroupDoc>() {
// @Override -- Not until Java 1.6
@Override
public int compare(GroupDoc d1, GroupDoc d2) {
for(SortField sf : sortFields) {
final int cmp;

View File

@ -34,8 +34,6 @@ import java.util.Map;
* Test for ScriptTransformer
* </p>
* <p/>
* All tests in this have been ignored because script support is only available
* in Java 1.6+
*
*
* @since solr 1.3