diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java index 5202fb48ef5e..9fa84346e169 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java @@ -266,11 +266,11 @@ private CharsRef newStem(char buffer[], int length, IntsRef forms, int formID) { // some state for traversing FSTs final FST.BytesReader prefixReaders[] = new FST.BytesReader[3]; - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked","rawtypes"}) final FST.Arc prefixArcs[] = new FST.Arc[3]; final FST.BytesReader suffixReaders[] = new FST.BytesReader[3]; - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked","rawtypes"}) final FST.Arc suffixArcs[] = new FST.Arc[3]; diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/OrQuery.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/OrQuery.java index 4f5384737a36..5189218b3e7a 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/OrQuery.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/OrQuery.java @@ -40,9 +40,9 @@ public Query makeLuceneQueryFieldNoBoost(String fieldName, BasicQueryFactory qf) @Override public String distanceSubQueryNotAllowed() { - Iterator sqi = getSubQueriesIterator(); + Iterator sqi = getSubQueriesIterator(); while (sqi.hasNext()) { - SrndQuery leq = (SrndQuery) sqi.next(); + SrndQuery leq = sqi.next(); if (leq instanceof DistanceSubQuery) { String m = ((DistanceSubQuery)leq).distanceSubQueryNotAllowed(); if (m != null) { @@ -57,9 +57,10 @@ public String distanceSubQueryNotAllowed() { @Override public void addSpanQueries(SpanNearClauseFactory sncf) throws IOException { - Iterator sqi = getSubQueriesIterator(); + Iterator sqi = getSubQueriesIterator(); while (sqi.hasNext()) { - ((DistanceSubQuery)sqi.next()).addSpanQueries(sncf); + SrndQuery s = sqi.next(); + ((DistanceSubQuery) s).addSpanQueries(sncf); } } } diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/RewriteQuery.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/RewriteQuery.java index aba4ef840351..df7417565939 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/RewriteQuery.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/RewriteQuery.java @@ -61,7 +61,7 @@ public boolean equals(Object obj) { return false; if (! getClass().equals(obj.getClass())) return false; - RewriteQuery other = (RewriteQuery)obj; + @SuppressWarnings("unchecked") RewriteQuery other = (RewriteQuery)obj; return super.equals(obj) && fieldName.equals(other.fieldName) && qf.equals(other.qf) diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/QueryTemplateManager.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/QueryTemplateManager.java index 3abdd27e7cd1..d3e5e81ef670 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/QueryTemplateManager.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/QueryTemplateManager.java @@ -176,9 +176,9 @@ public static void transformCriteria(Properties formProperties, Transformer tran Element root = doc.createElement("Document"); doc.appendChild(root); - Enumeration keysEnum = formProperties.keys(); + Enumeration keysEnum = formProperties.propertyNames(); while (keysEnum.hasMoreElements()) { - String propName = (String) keysEnum.nextElement(); + String propName = keysEnum.nextElement().toString(); String value = formProperties.getProperty(propName); if ((value != null) && (value.length() > 0)) { DOMUtils.insertChild(root, propName, value); diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java index 9d24e538a4e3..efef8fa3d07e 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/classic/TestQueryParser.java @@ -156,14 +156,13 @@ public void testDefaultOperator() throws Exception { @SuppressWarnings("rawtype") public void testProtectedCtors() throws Exception { try { - QueryParser.class.getConstructor(new Class[] {CharStream.class}); + QueryParser.class.getConstructor(CharStream.class); fail("please switch public QueryParser(CharStream) to be protected"); } catch (NoSuchMethodException nsme) { // expected } try { - QueryParser.class - .getConstructor(new Class[] {QueryParserTokenManager.class}); + QueryParser.class.getConstructor(QueryParserTokenManager.class); fail("please switch public QueryParser(QueryParserTokenManager) to be protected"); } catch (NoSuchMethodException nsme) { // expected