diff --git a/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java b/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java index 949d47e749b..ad8047887ca 100644 --- a/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java +++ b/lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/FieldTermStack.java @@ -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 ); } /** diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/index/NRTManager.java b/lucene/contrib/misc/src/java/org/apache/lucene/index/NRTManager.java index ed944f02082..1e9d20ba77c 100644 --- a/lucene/contrib/misc/src/java/org/apache/lucene/index/NRTManager.java +++ b/lucene/contrib/misc/src/java/org/apache/lucene/index/NRTManager.java @@ -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); } diff --git a/lucene/src/java/org/apache/lucene/index/BufferedDeletes.java b/lucene/src/java/org/apache/lucene/index/BufferedDeletes.java index 8fa8639e9fe..89db6e933ad 100644 --- a/lucene/src/java/org/apache/lucene/index/BufferedDeletes.java +++ b/lucene/src/java/org/apache/lucene/index/BufferedDeletes.java @@ -196,7 +196,7 @@ class BufferedDeletes { public Iterable termsIterable() { return new Iterable() { - // @Override -- not until Java 1.6 + @Override public Iterator iterator() { return terms.keySet().iterator(); } @@ -206,23 +206,23 @@ class BufferedDeletes { public Iterable queriesIterable() { return new Iterable() { - // @Override -- not until Java 1.6 + @Override public Iterator iterator() { return new Iterator() { private final Iterator> 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 ent = iter.next(); return new QueryAndLimit(ent.getKey(), ent.getValue()); } - // @Override -- not until Java 1.6 + @Override public void remove() { throw new UnsupportedOperationException(); } diff --git a/lucene/src/java/org/apache/lucene/index/BufferedDeletesStream.java b/lucene/src/java/org/apache/lucene/index/BufferedDeletesStream.java index 0b7f1988d7d..2657a1edbcf 100644 --- a/lucene/src/java/org/apache/lucene/index/BufferedDeletesStream.java +++ b/lucene/src/java/org/apache/lucene/index/BufferedDeletesStream.java @@ -143,7 +143,7 @@ class BufferedDeletesStream { // Sorts SegmentInfos from smallest to biggest bufferedDelGen: private static final Comparator sortSegInfoByDelGen = new Comparator() { - // @Override -- not until Java 1.6 + @Override public int compare(SegmentInfo si1, SegmentInfo si2) { final long cmp = si1.getBufferedDeletesGen() - si2.getBufferedDeletesGen(); if (cmp > 0) { diff --git a/lucene/src/java/org/apache/lucene/index/FrozenBufferedDeletes.java b/lucene/src/java/org/apache/lucene/index/FrozenBufferedDeletes.java index 3849fb41e98..37aed6c4dca 100644 --- a/lucene/src/java/org/apache/lucene/index/FrozenBufferedDeletes.java +++ b/lucene/src/java/org/apache/lucene/index/FrozenBufferedDeletes.java @@ -93,22 +93,22 @@ class FrozenBufferedDeletes { public Iterable termsIterable() { return new Iterable() { - // @Override -- not until Java 1.6 + @Override public Iterator iterator() { return new Iterator() { 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 queriesIterable() { return new Iterable() { - // @Override -- not until Java 1.6 + @Override public Iterator iterator() { return new Iterator() { 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(); } diff --git a/lucene/src/java/org/apache/lucene/index/ParallelReader.java b/lucene/src/java/org/apache/lucene/index/ParallelReader.java index 04934e66fd9..d587b4a7b51 100644 --- a/lucene/src/java/org/apache/lucene/index/ParallelReader.java +++ b/lucene/src/java/org/apache/lucene/index/ParallelReader.java @@ -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 } diff --git a/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java b/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java index f3080622a99..7b74aa1fb23 100644 --- a/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java +++ b/lucene/src/java/org/apache/lucene/search/FieldCacheImpl.java @@ -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); } diff --git a/lucene/src/java/org/apache/lucene/store/InputStreamDataInput.java b/lucene/src/java/org/apache/lucene/store/InputStreamDataInput.java index 35add13afb6..7516065f51f 100644 --- a/lucene/src/java/org/apache/lucene/store/InputStreamDataInput.java +++ b/lucene/src/java/org/apache/lucene/store/InputStreamDataInput.java @@ -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(); } diff --git a/lucene/src/java/org/apache/lucene/store/OutputStreamDataOutput.java b/lucene/src/java/org/apache/lucene/store/OutputStreamDataOutput.java index 927760ac272..8be6ad8280d 100644 --- a/lucene/src/java/org/apache/lucene/store/OutputStreamDataOutput.java +++ b/lucene/src/java/org/apache/lucene/store/OutputStreamDataOutput.java @@ -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(); } diff --git a/lucene/src/java/org/apache/lucene/util/BitVector.java b/lucene/src/java/org/apache/lucene/util/BitVector.java index 1dc296ee94a..505eca22484 100644 --- a/lucene/src/java/org/apache/lucene/util/BitVector.java +++ b/lucene/src/java/org/apache/lucene/util/BitVector.java @@ -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; } diff --git a/lucene/src/java/org/apache/lucene/util/OpenBitSet.java b/lucene/src/java/org/apache/lucene/util/OpenBitSet.java index 281faaa317c..fd08981ea6c 100644 --- a/lucene/src/java/org/apache/lucene/util/OpenBitSet.java +++ b/lucene/src/java/org/apache/lucene/util/OpenBitSet.java @@ -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; } diff --git a/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java b/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java index 8338a9a537e..ddddda48503 100644 --- a/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java +++ b/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java @@ -133,22 +133,22 @@ public class RandomIndexWriter implements Closeable { // addDocuments? Would be better testing. w.addDocuments(new Iterable() { - // @Override -- not until Java 1.6 + @Override public Iterator iterator() { return new Iterator() { 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() { - // @Override -- not until Java 1.6 + @Override public Iterator iterator() { return new Iterator() { 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(); diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java index 83dcc257a0f..bf1c61ee817 100644 --- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java +++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java @@ -59,23 +59,23 @@ public class TestIndexWriterExceptions extends LuceneTestCase { this.doc = doc; } - // @Override -- not until Java 1.6 + @Override public Iterator iterator() { return new Iterator() { 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(); } diff --git a/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.java b/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.java index d5e7f87c4ff..5345e433a5d 100644 --- a/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.java +++ b/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.java @@ -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); } /** diff --git a/modules/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java b/modules/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java index f2ecb42acc7..a0894b9754f 100644 --- a/modules/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java +++ b/modules/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java @@ -171,7 +171,7 @@ public class SearchGroup { private static class GroupMerger { private final GroupComparator groupComp; - private final SortedSet> queue; + private final NavigableSet> queue; private final Map> groupsSeen; public GroupMerger(Sort groupSort) throws IOException { @@ -242,10 +242,8 @@ public class SearchGroup { // Prune un-competitive groups: while(queue.size() > topN) { - // TODO java 1.6: .pollLast - final MergedGroup group = queue.last(); + final MergedGroup group = queue.pollLast(); //System.out.println("PRUNE: " + group); - queue.remove(group); group.inQueue = false; } } @@ -270,9 +268,7 @@ public class SearchGroup { int count = 0; while(queue.size() != 0) { - // TODO Java 1.6: pollFirst() - final MergedGroup group = queue.first(); - queue.remove(group); + final MergedGroup 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) { diff --git a/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java b/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java index 5e7224d361d..3eebb902788 100644 --- a/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java +++ b/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java @@ -193,7 +193,7 @@ public class TestGrouping extends LuceneTestCase { private Comparator getComparator(Sort sort) { final SortField[] sortFields = sort.getSort(); return new Comparator() { - // @Override -- Not until Java 1.6 + @Override public int compare(GroupDoc d1, GroupDoc d2) { for(SortField sf : sortFields) { final int cmp; diff --git a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestScriptTransformer.java b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestScriptTransformer.java index 25477ef0cb1..cd7b11ea8e4 100644 --- a/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestScriptTransformer.java +++ b/solr/contrib/dataimporthandler/src/test/java/org/apache/solr/handler/dataimport/TestScriptTransformer.java @@ -34,8 +34,6 @@ import java.util.Map; * Test for ScriptTransformer *

*

- * All tests in this have been ignored because script support is only available - * in Java 1.6+ * * * @since solr 1.3