diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.java index 028bceeff80..9aa4e381ad3 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/PatternParser.java @@ -292,7 +292,7 @@ public class PatternParser extends DefaultHandler { * java.lang.String, java.lang.String) */ @Override - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public void endElement(String uri, String local, String raw) { if (token.length() > 0) { @@ -329,7 +329,7 @@ public class PatternParser extends DefaultHandler { /** * @see org.xml.sax.ContentHandler#characters(char[], int, int) */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void characters(char ch[], int start, int length) { StringBuilder chars = new StringBuilder(length); diff --git a/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java b/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java index 1d4756e55ab..0500876008e 100644 --- a/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java +++ b/lucene/analysis/common/src/java/org/tartarus/snowball/Among.java @@ -40,10 +40,8 @@ import java.lang.reflect.Method; * refactored StringBuffers to 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 - * reflection calls (Lovins, etc) use EMPTY_ARGS/EMPTY_PARAMS */ public class Among { - private static final Class[] EMPTY_PARAMS = new Class[0]; public Among(String s, int substring_i, int result, String methodname, SnowballProgram methodobject) { @@ -56,8 +54,7 @@ public class Among { this.method = null; } else { try { - this.method = methodobject.getClass(). - getDeclaredMethod(methodname, EMPTY_PARAMS); + this.method = methodobject.getClass().getDeclaredMethod(methodname); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } diff --git a/lucene/analysis/common/src/java/org/tartarus/snowball/SnowballProgram.java b/lucene/analysis/common/src/java/org/tartarus/snowball/SnowballProgram.java index dbce73b2125..bf7ed2de7ae 100644 --- a/lucene/analysis/common/src/java/org/tartarus/snowball/SnowballProgram.java +++ b/lucene/analysis/common/src/java/org/tartarus/snowball/SnowballProgram.java @@ -44,10 +44,8 @@ import org.apache.lucene.util.RamUsageEstimator; * refactored StringBuffers to 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 - * reflection calls (Lovins, etc) use EMPTY_ARGS/EMPTY_PARAMS */ public abstract class SnowballProgram { - private static final Object[] EMPTY_ARGS = new Object[0]; protected SnowballProgram() { @@ -314,7 +312,7 @@ public abstract class SnowballProgram { if (w.method == null) return w.result; boolean res; try { - Object resobj = w.method.invoke(w.methodobject, EMPTY_ARGS); + Object resobj = w.method.invoke(w.methodobject); res = resobj.toString().equals("true"); } catch (InvocationTargetException e) { res = false; @@ -382,7 +380,7 @@ public abstract class SnowballProgram { boolean res; try { - Object resobj = w.method.invoke(w.methodobject, EMPTY_ARGS); + Object resobj = w.method.invoke(w.methodobject); res = resobj.toString().equals("true"); } catch (InvocationTargetException e) { res = false; diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractFirstPassGroupingCollector.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractFirstPassGroupingCollector.java index 1667bd0ffaa..ad5194220bb 100644 --- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractFirstPassGroupingCollector.java +++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/AbstractFirstPassGroupingCollector.java @@ -61,6 +61,7 @@ abstract public class AbstractFirstPassGroupingCollector exten * @param topNGroups How many top groups to keep. * @throws IOException If I/O related errors occur */ + @SuppressWarnings({"unchecked", "rawtypes"}) public AbstractFirstPassGroupingCollector(Sort groupSort, int topNGroups) throws IOException { if (topNGroups < 1) { throw new IllegalArgumentException("topNGroups must be >= 1 (got " + topNGroups + ")"); diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java index 4239da28a17..bd31afd4d9c 100644 --- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java +++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java @@ -18,7 +18,6 @@ package org.apache.lucene.search.grouping; */ import org.apache.lucene.search.FieldComparator; -import org.apache.lucene.search.LeafFieldComparator; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; @@ -154,9 +153,12 @@ public class SearchGroup { private static class GroupComparator implements Comparator> { + @SuppressWarnings("rawtypes") public final FieldComparator[] comparators; + public final int[] reversed; + @SuppressWarnings({"unchecked", "rawtypes"}) public GroupComparator(Sort groupSort) throws IOException { final SortField[] sortFields = groupSort.getSort(); comparators = new FieldComparator[sortFields.length]; diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermAllGroupHeadsCollector.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermAllGroupHeadsCollector.java index 2fe472cd552..c80665a4d7a 100644 --- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermAllGroupHeadsCollector.java +++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/term/TermAllGroupHeadsCollector.java @@ -119,7 +119,7 @@ public abstract class TermAllGroupHeadsCollector groups; - private Scorer scorer; + Scorer scorer; GeneralAllGroupHeadsCollector(String groupField, Sort sortWithinGroup) { super(groupField, sortWithinGroup.getSort().length); @@ -182,10 +182,13 @@ public abstract class TermAllGroupHeadsCollector { + @SuppressWarnings({"unchecked", "rawtypes"}) final FieldComparator[] comparators; + 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); final SortField[] sortFields = sort.getSort(); comparators = new FieldComparator[sortFields.length]; @@ -221,10 +224,10 @@ public abstract class TermAllGroupHeadsCollector collectedGroups; - private final SortField[] fields; + final SortField[] fields; - private SortedDocValues[] sortsIndex; - private Scorer scorer; + SortedDocValues[] sortsIndex; + Scorer scorer; private GroupHead[] segmentGroupHeads; OrdScoreAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) { @@ -322,7 +325,7 @@ public abstract class TermAllGroupHeadsCollector collectedGroups; private final SortField[] fields; - private SortedDocValues[] sortsIndex; - private GroupHead[] segmentGroupHeads; + SortedDocValues[] sortsIndex; + GroupHead[] segmentGroupHeads; OrdAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) { super(groupField, sortWithinGroup.getSort().length); @@ -473,7 +476,7 @@ public abstract class TermAllGroupHeadsCollector { - private final SentinelIntSet ordSet; - private final List collectedGroups; - private final SortField[] fields; + final SentinelIntSet ordSet; + final List collectedGroups; + final SortField[] fields; - private Scorer scorer; - private GroupHead[] segmentGroupHeads; + Scorer scorer; + GroupHead[] segmentGroupHeads; ScoreAllGroupHeadsCollector(String groupField, Sort sortWithinGroup, int initialSize) { super(groupField, sortWithinGroup.getSort().length); @@ -591,7 +594,7 @@ public abstract class TermAllGroupHeadsCollector> groups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException { diff --git a/lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java b/lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java index 766f389fa21..b6b991dd18d 100644 --- a/lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java +++ b/lucene/highlighter/src/java/org/apache/lucene/search/highlight/WeightedSpanTermExtractor.java @@ -180,7 +180,7 @@ public class WeightedSpanTermExtractor { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked","rawtypes"}) final List[] disjunctLists = new List[maxPosition + 1]; int distinctPositions = 0; diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java index 5bead24879d..f59ffaed053 100644 --- a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java +++ b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java @@ -1221,7 +1221,7 @@ public class TestBlockJoin extends LuceneTestCase { s.search(childJoinQuery, c); //Get all child documents within groups - @SuppressWarnings({"unchecked"}) + @SuppressWarnings({"unchecked","rawtypes"}) TopGroups[] getTopGroupsResults = new TopGroups[2]; getTopGroupsResults[0] = c.getTopGroups(childJoinQuery, null, 0, 10, 0, true); getTopGroupsResults[1] = c.getTopGroupsWithAllChildDocs(childJoinQuery, null, 0, 0, true); diff --git a/lucene/misc/src/java/org/apache/lucene/search/BlockJoinComparatorSource.java b/lucene/misc/src/java/org/apache/lucene/search/BlockJoinComparatorSource.java index bd7d5e4a919..6463bfac12f 100644 --- a/lucene/misc/src/java/org/apache/lucene/search/BlockJoinComparatorSource.java +++ b/lucene/misc/src/java/org/apache/lucene/search/BlockJoinComparatorSource.java @@ -68,6 +68,7 @@ public class BlockJoinComparatorSource extends FieldComparatorSource { } @Override + @SuppressWarnings({"unchecked", "rawtypes"}) public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { // we keep parallel slots: the parent ids and the child ids final int parentSlots[] = new int[numHits];