mirror of https://github.com/apache/lucene.git
LUCENE-6740: Reduce warnings emitted by javac #7
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1696098 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
94b12beb4a
commit
0a54365ffa
|
@ -292,7 +292,7 @@ public class PatternParser extends DefaultHandler {
|
||||||
* java.lang.String, java.lang.String)
|
* java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public void endElement(String uri, String local, String raw) {
|
public void endElement(String uri, String local, String raw) {
|
||||||
|
|
||||||
if (token.length() > 0) {
|
if (token.length() > 0) {
|
||||||
|
@ -329,7 +329,7 @@ public class PatternParser extends DefaultHandler {
|
||||||
/**
|
/**
|
||||||
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
|
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
@Override
|
@Override
|
||||||
public void characters(char ch[], int start, int length) {
|
public void characters(char ch[], int start, int length) {
|
||||||
StringBuilder chars = new StringBuilder(length);
|
StringBuilder chars = new StringBuilder(length);
|
||||||
|
|
|
@ -40,10 +40,8 @@ import java.lang.reflect.Method;
|
||||||
* refactored StringBuffers to StringBuilder
|
* refactored StringBuffers to StringBuilder
|
||||||
* uses char[] as buffer instead of StringBuffer/StringBuilder
|
* uses char[] as buffer instead of StringBuffer/StringBuilder
|
||||||
* eq_s,eq_s_b,insert,replace_s take CharSequence like eq_v and eq_v_b
|
* eq_s,eq_s_b,insert,replace_s take CharSequence like eq_v and eq_v_b
|
||||||
* reflection calls (Lovins, etc) use EMPTY_ARGS/EMPTY_PARAMS
|
|
||||||
*/
|
*/
|
||||||
public class Among {
|
public class Among {
|
||||||
private static final Class<?>[] EMPTY_PARAMS = new Class[0];
|
|
||||||
|
|
||||||
public Among(String s, int substring_i, int result,
|
public Among(String s, int substring_i, int result,
|
||||||
String methodname, SnowballProgram methodobject) {
|
String methodname, SnowballProgram methodobject) {
|
||||||
|
@ -56,8 +54,7 @@ public class Among {
|
||||||
this.method = null;
|
this.method = null;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
this.method = methodobject.getClass().
|
this.method = methodobject.getClass().getDeclaredMethod(methodname);
|
||||||
getDeclaredMethod(methodname, EMPTY_PARAMS);
|
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,8 @@ import org.apache.lucene.util.RamUsageEstimator;
|
||||||
* refactored StringBuffers to StringBuilder
|
* refactored StringBuffers to StringBuilder
|
||||||
* uses char[] as buffer instead of StringBuffer/StringBuilder
|
* uses char[] as buffer instead of StringBuffer/StringBuilder
|
||||||
* eq_s,eq_s_b,insert,replace_s take CharSequence like eq_v and eq_v_b
|
* eq_s,eq_s_b,insert,replace_s take CharSequence like eq_v and eq_v_b
|
||||||
* reflection calls (Lovins, etc) use EMPTY_ARGS/EMPTY_PARAMS
|
|
||||||
*/
|
*/
|
||||||
public abstract class SnowballProgram {
|
public abstract class SnowballProgram {
|
||||||
private static final Object[] EMPTY_ARGS = new Object[0];
|
|
||||||
|
|
||||||
protected SnowballProgram()
|
protected SnowballProgram()
|
||||||
{
|
{
|
||||||
|
@ -314,7 +312,7 @@ public abstract class SnowballProgram {
|
||||||
if (w.method == null) return w.result;
|
if (w.method == null) return w.result;
|
||||||
boolean res;
|
boolean res;
|
||||||
try {
|
try {
|
||||||
Object resobj = w.method.invoke(w.methodobject, EMPTY_ARGS);
|
Object resobj = w.method.invoke(w.methodobject);
|
||||||
res = resobj.toString().equals("true");
|
res = resobj.toString().equals("true");
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
res = false;
|
res = false;
|
||||||
|
@ -382,7 +380,7 @@ public abstract class SnowballProgram {
|
||||||
|
|
||||||
boolean res;
|
boolean res;
|
||||||
try {
|
try {
|
||||||
Object resobj = w.method.invoke(w.methodobject, EMPTY_ARGS);
|
Object resobj = w.method.invoke(w.methodobject);
|
||||||
res = resobj.toString().equals("true");
|
res = resobj.toString().equals("true");
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
res = false;
|
res = false;
|
||||||
|
|
|
@ -61,6 +61,7 @@ abstract public class AbstractFirstPassGroupingCollector<GROUP_VALUE_TYPE> exten
|
||||||
* @param topNGroups How many top groups to keep.
|
* @param topNGroups How many top groups to keep.
|
||||||
* @throws IOException If I/O related errors occur
|
* @throws IOException If I/O related errors occur
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public AbstractFirstPassGroupingCollector(Sort groupSort, int topNGroups) throws IOException {
|
public AbstractFirstPassGroupingCollector(Sort groupSort, int topNGroups) throws IOException {
|
||||||
if (topNGroups < 1) {
|
if (topNGroups < 1) {
|
||||||
throw new IllegalArgumentException("topNGroups must be >= 1 (got " + topNGroups + ")");
|
throw new IllegalArgumentException("topNGroups must be >= 1 (got " + topNGroups + ")");
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.apache.lucene.search.grouping;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.search.FieldComparator;
|
import org.apache.lucene.search.FieldComparator;
|
||||||
import org.apache.lucene.search.LeafFieldComparator;
|
|
||||||
import org.apache.lucene.search.Sort;
|
import org.apache.lucene.search.Sort;
|
||||||
import org.apache.lucene.search.SortField;
|
import org.apache.lucene.search.SortField;
|
||||||
|
|
||||||
|
@ -154,9 +153,12 @@ public class SearchGroup<GROUP_VALUE_TYPE> {
|
||||||
|
|
||||||
private static class GroupComparator<T> implements Comparator<MergedGroup<T>> {
|
private static class GroupComparator<T> implements Comparator<MergedGroup<T>> {
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public final FieldComparator[] comparators;
|
public final FieldComparator[] comparators;
|
||||||
|
|
||||||
public final int[] reversed;
|
public final int[] reversed;
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public GroupComparator(Sort groupSort) throws IOException {
|
public GroupComparator(Sort groupSort) throws IOException {
|
||||||
final SortField[] sortFields = groupSort.getSort();
|
final SortField[] sortFields = groupSort.getSort();
|
||||||
comparators = new FieldComparator[sortFields.length];
|
comparators = new FieldComparator[sortFields.length];
|
||||||
|
|
|
@ -119,7 +119,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
private final Sort sortWithinGroup;
|
private final Sort sortWithinGroup;
|
||||||
private final Map<BytesRef, GroupHead> groups;
|
private final Map<BytesRef, GroupHead> groups;
|
||||||
|
|
||||||
private Scorer scorer;
|
Scorer scorer;
|
||||||
|
|
||||||
GeneralAllGroupHeadsCollector(String groupField, Sort sortWithinGroup) {
|
GeneralAllGroupHeadsCollector(String groupField, Sort sortWithinGroup) {
|
||||||
super(groupField, sortWithinGroup.getSort().length);
|
super(groupField, sortWithinGroup.getSort().length);
|
||||||
|
@ -182,10 +182,13 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
|
|
||||||
class GroupHead extends AbstractAllGroupHeadsCollector.GroupHead<BytesRef> {
|
class GroupHead extends AbstractAllGroupHeadsCollector.GroupHead<BytesRef> {
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
final FieldComparator[] comparators;
|
final FieldComparator[] comparators;
|
||||||
|
|
||||||
final LeafFieldComparator[] leafComparators;
|
final LeafFieldComparator[] leafComparators;
|
||||||
|
|
||||||
private GroupHead(BytesRef groupValue, Sort sort, int doc) throws IOException {
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
GroupHead(BytesRef groupValue, Sort sort, int doc) throws IOException {
|
||||||
super(groupValue, doc + readerContext.docBase);
|
super(groupValue, doc + readerContext.docBase);
|
||||||
final SortField[] sortFields = sort.getSort();
|
final SortField[] sortFields = sort.getSort();
|
||||||
comparators = new FieldComparator[sortFields.length];
|
comparators = new FieldComparator[sortFields.length];
|
||||||
|
@ -221,10 +224,10 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
|
|
||||||
private final SentinelIntSet ordSet;
|
private final SentinelIntSet ordSet;
|
||||||
private final List<GroupHead> collectedGroups;
|
private final List<GroupHead> collectedGroups;
|
||||||
private final SortField[] fields;
|
final SortField[] fields;
|
||||||
|
|
||||||
private SortedDocValues[] sortsIndex;
|
SortedDocValues[] sortsIndex;
|
||||||
private Scorer scorer;
|
Scorer scorer;
|
||||||
private GroupHead[] segmentGroupHeads;
|
private GroupHead[] segmentGroupHeads;
|
||||||
|
|
||||||
OrdScoreAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) {
|
OrdScoreAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) {
|
||||||
|
@ -322,7 +325,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
int[] sortOrds;
|
int[] sortOrds;
|
||||||
float[] scores;
|
float[] scores;
|
||||||
|
|
||||||
private GroupHead(int doc, BytesRef groupValue) throws IOException {
|
GroupHead(int doc, BytesRef groupValue) throws IOException {
|
||||||
super(groupValue, doc + readerContext.docBase);
|
super(groupValue, doc + readerContext.docBase);
|
||||||
sortValues = new BytesRefBuilder[sortsIndex.length];
|
sortValues = new BytesRefBuilder[sortsIndex.length];
|
||||||
sortOrds = new int[sortsIndex.length];
|
sortOrds = new int[sortsIndex.length];
|
||||||
|
@ -384,8 +387,8 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
private final List<GroupHead> collectedGroups;
|
private final List<GroupHead> collectedGroups;
|
||||||
private final SortField[] fields;
|
private final SortField[] fields;
|
||||||
|
|
||||||
private SortedDocValues[] sortsIndex;
|
SortedDocValues[] sortsIndex;
|
||||||
private GroupHead[] segmentGroupHeads;
|
GroupHead[] segmentGroupHeads;
|
||||||
|
|
||||||
OrdAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) {
|
OrdAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) {
|
||||||
super(groupField, sortWithinGroup.getSort().length);
|
super(groupField, sortWithinGroup.getSort().length);
|
||||||
|
@ -473,7 +476,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
BytesRefBuilder[] sortValues;
|
BytesRefBuilder[] sortValues;
|
||||||
int[] sortOrds;
|
int[] sortOrds;
|
||||||
|
|
||||||
private GroupHead(int doc, BytesRef groupValue) {
|
GroupHead(int doc, BytesRef groupValue) {
|
||||||
super(groupValue, doc + readerContext.docBase);
|
super(groupValue, doc + readerContext.docBase);
|
||||||
sortValues = new BytesRefBuilder[sortsIndex.length];
|
sortValues = new BytesRefBuilder[sortsIndex.length];
|
||||||
sortOrds = new int[sortsIndex.length];
|
sortOrds = new int[sortsIndex.length];
|
||||||
|
@ -512,12 +515,12 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
// AbstractAllGroupHeadsCollector optimized for scores.
|
// AbstractAllGroupHeadsCollector optimized for scores.
|
||||||
static class ScoreAllGroupHeadsCollector extends TermAllGroupHeadsCollector<ScoreAllGroupHeadsCollector.GroupHead> {
|
static class ScoreAllGroupHeadsCollector extends TermAllGroupHeadsCollector<ScoreAllGroupHeadsCollector.GroupHead> {
|
||||||
|
|
||||||
private final SentinelIntSet ordSet;
|
final SentinelIntSet ordSet;
|
||||||
private final List<GroupHead> collectedGroups;
|
final List<GroupHead> collectedGroups;
|
||||||
private final SortField[] fields;
|
final SortField[] fields;
|
||||||
|
|
||||||
private Scorer scorer;
|
Scorer scorer;
|
||||||
private GroupHead[] segmentGroupHeads;
|
GroupHead[] segmentGroupHeads;
|
||||||
|
|
||||||
ScoreAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) {
|
ScoreAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) {
|
||||||
super(groupField, sortWithinGroup.getSort().length);
|
super(groupField, sortWithinGroup.getSort().length);
|
||||||
|
@ -591,7 +594,7 @@ public abstract class TermAllGroupHeadsCollector<GH extends AbstractAllGroupHead
|
||||||
|
|
||||||
float[] scores;
|
float[] scores;
|
||||||
|
|
||||||
private GroupHead(int doc, BytesRef groupValue) throws IOException {
|
GroupHead(int doc, BytesRef groupValue) throws IOException {
|
||||||
super(groupValue, doc + readerContext.docBase);
|
super(groupValue, doc + readerContext.docBase);
|
||||||
scores = new float[fields.length];
|
scores = new float[fields.length];
|
||||||
float score = scorer.score();
|
float score = scorer.score();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class TermSecondPassGroupingCollector extends AbstractSecondPassGroupingC
|
||||||
private SortedDocValues index;
|
private SortedDocValues index;
|
||||||
private final String groupField;
|
private final String groupField;
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public TermSecondPassGroupingCollector(String groupField, Collection<SearchGroup<BytesRef>> groups, Sort groupSort, Sort withinGroupSort,
|
public TermSecondPassGroupingCollector(String groupField, Collection<SearchGroup<BytesRef>> groups, Sort groupSort, Sort withinGroupSort,
|
||||||
int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields)
|
int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class WeightedSpanTermExtractor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({"unchecked","rawtypes"})
|
||||||
final List<SpanQuery>[] disjunctLists = new List[maxPosition + 1];
|
final List<SpanQuery>[] disjunctLists = new List[maxPosition + 1];
|
||||||
int distinctPositions = 0;
|
int distinctPositions = 0;
|
||||||
|
|
||||||
|
|
|
@ -1221,7 +1221,7 @@ public class TestBlockJoin extends LuceneTestCase {
|
||||||
s.search(childJoinQuery, c);
|
s.search(childJoinQuery, c);
|
||||||
|
|
||||||
//Get all child documents within groups
|
//Get all child documents within groups
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"unchecked","rawtypes"})
|
||||||
TopGroups<Integer>[] getTopGroupsResults = new TopGroups[2];
|
TopGroups<Integer>[] getTopGroupsResults = new TopGroups[2];
|
||||||
getTopGroupsResults[0] = c.getTopGroups(childJoinQuery, null, 0, 10, 0, true);
|
getTopGroupsResults[0] = c.getTopGroups(childJoinQuery, null, 0, 10, 0, true);
|
||||||
getTopGroupsResults[1] = c.getTopGroupsWithAllChildDocs(childJoinQuery, null, 0, 0, true);
|
getTopGroupsResults[1] = c.getTopGroupsWithAllChildDocs(childJoinQuery, null, 0, 0, true);
|
||||||
|
|
|
@ -68,6 +68,7 @@ public class BlockJoinComparatorSource extends FieldComparatorSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public FieldComparator<Integer> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
public FieldComparator<Integer> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
|
||||||
// we keep parallel slots: the parent ids and the child ids
|
// we keep parallel slots: the parent ids and the child ids
|
||||||
final int parentSlots[] = new int[numHits];
|
final int parentSlots[] = new int[numHits];
|
||||||
|
|
Loading…
Reference in New Issue