From afad8123d2a299e346def512268abc2ba197c4d6 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Sun, 3 Oct 2010 16:27:34 +0000 Subject: [PATCH] clear up more warnings in modules/contrib git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1003990 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/benchmark/byTask/utils/Config.java | 2 +- .../precedence/PrecedenceQueryParser.java | 5 --- .../precedence/PrecedenceQueryParser.jj | 5 --- .../standard/parser/StandardSyntaxParser.java | 13 +++--- .../standard/parser/StandardSyntaxParser.jj | 13 +++--- .../surround/parser/QueryParser.java | 44 +++++++++---------- .../surround/parser/QueryParser.jj | 44 +++++++++---------- .../TestMultiFieldQueryParserWrapper.java | 1 + .../standard/TestQueryParserWrapper.java | 1 + .../compound/hyphenation/TernaryTree.java | 4 +- .../lucene/analysis/synonym/SynonymMap.java | 2 +- 11 files changed, 62 insertions(+), 72 deletions(-) diff --git a/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java b/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java index ccb252553dd..48ae87c66c4 100644 --- a/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java +++ b/lucene/contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java @@ -319,7 +319,7 @@ public class Config { String t = st.nextToken(); a.add(t); } - return (String[]) a.toArray(new String[a.size()]); + return a.toArray(new String[a.size()]); } // extract properties to array, e.g. for "10:100:5" return int[]{10,100,5}. diff --git a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java index ea53d12575b..e4ec9b033a0 100644 --- a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java +++ b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.java @@ -72,12 +72,7 @@ import org.apache.lucene.util.AttributeSource; * href="../../../../../../../queryparsersyntax.html">query syntax * documentation. *

- * - * @author Brian Goetz - * @author Peter Halacsy - * @author Tatu Saloranta */ - public class PrecedenceQueryParser implements PrecedenceQueryParserConstants { private static final int CONJ_NONE = 0; diff --git a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj index 11523cc86e8..c7151c17a22 100644 --- a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj +++ b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/precedence/PrecedenceQueryParser.jj @@ -96,12 +96,7 @@ import org.apache.lucene.util.AttributeSource; * href="../../../../../../../queryparsersyntax.html">query syntax * documentation. *

- * - * @author Brian Goetz - * @author Peter Halacsy - * @author Tatu Saloranta */ - public class PrecedenceQueryParser { private static final int CONJ_NONE = 0; diff --git a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java index b1657601823..4391149e7ae 100644 --- a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java +++ b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.java @@ -48,7 +48,6 @@ import org.apache.lucene.queryParser.core.nodes.QueryNodeImpl; import org.apache.lucene.queryParser.core.nodes.QuotedFieldQueryNode; import org.apache.lucene.queryParser.core.parser.SyntaxParser; -@SuppressWarnings("all") public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserConstants { private static final int CONJ_NONE =0; @@ -167,7 +166,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserC // ConjQuery ::= Clause ( AND Clause )* // Clause ::= [ Modifier ] ... final public QueryNode Query(CharSequence field) throws ParseException { - Vector clauses = null; + Vector clauses = null; QueryNode c, first=null; first = DisjQuery(field); label_1: @@ -191,7 +190,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserC } c = DisjQuery(field); if (clauses == null) { - clauses = new Vector(); + clauses = new Vector(); clauses.addElement(first); } clauses.addElement(c); @@ -206,7 +205,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserC final public QueryNode DisjQuery(CharSequence field) throws ParseException { QueryNode first, c; - Vector clauses = null; + Vector clauses = null; first = ConjQuery(field); label_2: while (true) { @@ -221,7 +220,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserC jj_consume_token(OR); c = ConjQuery(field); if (clauses == null) { - clauses = new Vector(); + clauses = new Vector(); clauses.addElement(first); } clauses.addElement(c); @@ -236,7 +235,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserC final public QueryNode ConjQuery(CharSequence field) throws ParseException { QueryNode first, c; - Vector clauses = null; + Vector clauses = null; first = ModClause(field); label_3: while (true) { @@ -251,7 +250,7 @@ public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserC jj_consume_token(AND); c = ModClause(field); if (clauses == null) { - clauses = new Vector(); + clauses = new Vector(); clauses.addElement(first); } clauses.addElement(c); diff --git a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.jj b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.jj index 7aed9f1e6b8..0db993a3d78 100644 --- a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.jj +++ b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/standard/parser/StandardSyntaxParser.jj @@ -60,7 +60,6 @@ import org.apache.lucene.queryParser.core.nodes.QueryNodeImpl; import org.apache.lucene.queryParser.core.nodes.QuotedFieldQueryNode; import org.apache.lucene.queryParser.core.parser.SyntaxParser; -@SuppressWarnings("all") public class StandardSyntaxParser implements SyntaxParser { private static final int CONJ_NONE =0; @@ -208,7 +207,7 @@ QueryNode TopLevelQuery(CharSequence field) : QueryNode Query(CharSequence field) : { - Vector clauses = null; + Vector clauses = null; QueryNode c, first=null; } { @@ -217,7 +216,7 @@ QueryNode Query(CharSequence field) : c=DisjQuery(field) { if (clauses == null) { - clauses = new Vector(); + clauses = new Vector(); clauses.addElement(first); } clauses.addElement(c); @@ -234,7 +233,7 @@ QueryNode Query(CharSequence field) : QueryNode DisjQuery(CharSequence field) : { QueryNode first, c; - Vector clauses = null; + Vector clauses = null; } { first = ConjQuery(field) @@ -242,7 +241,7 @@ QueryNode DisjQuery(CharSequence field) : { c=ConjQuery(field) { if (clauses == null) { - clauses = new Vector(); + clauses = new Vector(); clauses.addElement(first); } clauses.addElement(c); @@ -259,7 +258,7 @@ QueryNode DisjQuery(CharSequence field) : { QueryNode ConjQuery(CharSequence field) : { QueryNode first, c; - Vector clauses = null; + Vector clauses = null; } { first = ModClause(field) @@ -267,7 +266,7 @@ QueryNode ConjQuery(CharSequence field) : { c=ModClause(field) { if (clauses == null) { - clauses = new Vector(); + clauses = new Vector(); clauses.addElement(first); } clauses.addElement(c); diff --git a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.java b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.java index bab1f30e886..be6f9b86c56 100644 --- a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.java +++ b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.java @@ -56,22 +56,22 @@ public class QueryParser implements QueryParserConstants { } protected SrndQuery getFieldsQuery( - SrndQuery q, ArrayList fieldNames) { + SrndQuery q, ArrayList fieldNames) { /* FIXME: check acceptable subquery: at least one subquery should not be * a fields query. */ return new FieldsQuery(q, fieldNames, fieldOperator); } - protected SrndQuery getOrQuery(List queries, boolean infix, Token orToken) { + protected SrndQuery getOrQuery(List queries, boolean infix, Token orToken) { return new OrQuery(queries, infix, orToken.image); } - protected SrndQuery getAndQuery(List queries, boolean infix, Token andToken) { + protected SrndQuery getAndQuery(List queries, boolean infix, Token andToken) { return new AndQuery( queries, infix, andToken.image); } - protected SrndQuery getNotQuery(List queries, Token notToken) { + protected SrndQuery getNotQuery(List queries, Token notToken) { return new NotQuery( queries, notToken.image); } @@ -91,7 +91,7 @@ public class QueryParser implements QueryParserConstants { } protected SrndQuery getDistanceQuery( - List queries, + List queries, boolean infix, Token dToken, boolean ordered) throws ParseException { @@ -144,16 +144,16 @@ public class QueryParser implements QueryParserConstants { final public SrndQuery FieldsQuery() throws ParseException { SrndQuery q; - ArrayList fieldNames; + ArrayList fieldNames; fieldNames = OptionalFields(); q = OrQuery(); {if (true) return (fieldNames == null) ? q : getFieldsQuery(q, fieldNames);} throw new Error("Missing return statement in function"); } - final public ArrayList OptionalFields() throws ParseException { + final public ArrayList OptionalFields() throws ParseException { Token fieldName; - ArrayList fieldNames = null; + ArrayList fieldNames = null; label_1: while (true) { if (jj_2_1(2)) { @@ -165,7 +165,7 @@ public class QueryParser implements QueryParserConstants { fieldName = jj_consume_token(TERM); jj_consume_token(COLON); if (fieldNames == null) { - fieldNames = new ArrayList(); + fieldNames = new ArrayList(); } fieldNames.add(fieldName.image); } @@ -175,7 +175,7 @@ public class QueryParser implements QueryParserConstants { final public SrndQuery OrQuery() throws ParseException { SrndQuery q; - ArrayList queries = null; + ArrayList queries = null; Token oprt = null; q = AndQuery(); label_2: @@ -191,7 +191,7 @@ public class QueryParser implements QueryParserConstants { oprt = jj_consume_token(OR); /* keep only last used operator */ if (queries == null) { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); } q = AndQuery(); @@ -203,7 +203,7 @@ public class QueryParser implements QueryParserConstants { final public SrndQuery AndQuery() throws ParseException { SrndQuery q; - ArrayList queries = null; + ArrayList queries = null; Token oprt = null; q = NotQuery(); label_3: @@ -219,7 +219,7 @@ public class QueryParser implements QueryParserConstants { oprt = jj_consume_token(AND); /* keep only last used operator */ if (queries == null) { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); } q = NotQuery(); @@ -231,7 +231,7 @@ public class QueryParser implements QueryParserConstants { final public SrndQuery NotQuery() throws ParseException { SrndQuery q; - ArrayList queries = null; + ArrayList queries = null; Token oprt = null; q = NQuery(); label_4: @@ -247,7 +247,7 @@ public class QueryParser implements QueryParserConstants { oprt = jj_consume_token(NOT); /* keep only last used operator */ if (queries == null) { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); } q = NQuery(); @@ -259,7 +259,7 @@ public class QueryParser implements QueryParserConstants { final public SrndQuery NQuery() throws ParseException { SrndQuery q; - ArrayList queries; + ArrayList queries; Token dt; q = WQuery(); label_5: @@ -273,7 +273,7 @@ public class QueryParser implements QueryParserConstants { break label_5; } dt = jj_consume_token(N); - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); /* left associative */ q = WQuery(); @@ -286,7 +286,7 @@ public class QueryParser implements QueryParserConstants { final public SrndQuery WQuery() throws ParseException { SrndQuery q; - ArrayList queries; + ArrayList queries; Token wt; q = PrimaryQuery(); label_6: @@ -300,7 +300,7 @@ public class QueryParser implements QueryParserConstants { break label_6; } wt = jj_consume_token(W); - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); /* left associative */ q = PrimaryQuery(); @@ -345,7 +345,7 @@ public class QueryParser implements QueryParserConstants { final public SrndQuery PrefixOperatorQuery() throws ParseException { Token oprt; - List queries; + List queries; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OR: oprt = jj_consume_token(OR); @@ -379,9 +379,9 @@ public class QueryParser implements QueryParserConstants { throw new Error("Missing return statement in function"); } - final public List FieldsQueryList() throws ParseException { + final public List FieldsQueryList() throws ParseException { SrndQuery q; - ArrayList queries = new ArrayList(); + ArrayList queries = new ArrayList(); jj_consume_token(LPAREN); q = FieldsQuery(); queries.add(q); diff --git a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.jj b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.jj index 15b95e54474..a29964a03c6 100644 --- a/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.jj +++ b/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/surround/parser/QueryParser.jj @@ -85,22 +85,22 @@ public class QueryParser { } protected SrndQuery getFieldsQuery( - SrndQuery q, ArrayList fieldNames) { + SrndQuery q, ArrayList fieldNames) { /* FIXME: check acceptable subquery: at least one subquery should not be * a fields query. */ return new FieldsQuery(q, fieldNames, fieldOperator); } - protected SrndQuery getOrQuery(List queries, boolean infix, Token orToken) { + protected SrndQuery getOrQuery(List queries, boolean infix, Token orToken) { return new OrQuery(queries, infix, orToken.image); } - protected SrndQuery getAndQuery(List queries, boolean infix, Token andToken) { + protected SrndQuery getAndQuery(List queries, boolean infix, Token andToken) { return new AndQuery( queries, infix, andToken.image); } - protected SrndQuery getNotQuery(List queries, Token notToken) { + protected SrndQuery getNotQuery(List queries, Token notToken) { return new NotQuery( queries, notToken.image); } @@ -120,7 +120,7 @@ public class QueryParser { } protected SrndQuery getDistanceQuery( - List queries, + List queries, boolean infix, Token dToken, boolean ordered) throws ParseException { @@ -231,7 +231,7 @@ SrndQuery TopSrndQuery() : { SrndQuery FieldsQuery() : { SrndQuery q; - ArrayList fieldNames; + ArrayList fieldNames; }{ fieldNames = OptionalFields() q = OrQuery() @@ -239,15 +239,15 @@ SrndQuery FieldsQuery() : { } -ArrayList OptionalFields() : { +ArrayList OptionalFields() : { Token fieldName; - ArrayList fieldNames = null; + ArrayList fieldNames = null; }{ ( LOOKAHEAD(2) // to the colon fieldName = { if (fieldNames == null) { - fieldNames = new ArrayList(); + fieldNames = new ArrayList(); } fieldNames.add(fieldName.image); } @@ -258,13 +258,13 @@ ArrayList OptionalFields() : { SrndQuery OrQuery() : { SrndQuery q; - ArrayList queries = null; + ArrayList queries = null; Token oprt = null; }{ q = AndQuery() ( oprt = { /* keep only last used operator */ if (queries == null) { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); } } @@ -278,13 +278,13 @@ SrndQuery OrQuery() : { SrndQuery AndQuery() : { SrndQuery q; - ArrayList queries = null; + ArrayList queries = null; Token oprt = null; }{ q = NotQuery() ( oprt = { /* keep only last used operator */ if (queries == null) { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); } } @@ -298,13 +298,13 @@ SrndQuery AndQuery() : { SrndQuery NotQuery() : { SrndQuery q; - ArrayList queries = null; + ArrayList queries = null; Token oprt = null; }{ q = NQuery() ( oprt = { /* keep only last used operator */ if (queries == null) { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); } } @@ -318,12 +318,12 @@ SrndQuery NotQuery() : { SrndQuery NQuery() : { SrndQuery q; - ArrayList queries; + ArrayList queries; Token dt; }{ q = WQuery() ( dt = { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); /* left associative */ } q = WQuery() { @@ -337,12 +337,12 @@ SrndQuery NQuery() : { SrndQuery WQuery() : { SrndQuery q; - ArrayList queries; + ArrayList queries; Token wt; }{ q = PrimaryQuery() ( wt = { - queries = new ArrayList(); + queries = new ArrayList(); queries.add(q); /* left associative */ } q = PrimaryQuery() { @@ -368,7 +368,7 @@ SrndQuery PrimaryQuery() : { /* bracketed weighted query or weighted term */ SrndQuery PrefixOperatorQuery() : { Token oprt; - List queries; + List queries; }{ ( oprt = /* prefix OR */ queries = FieldsQueryList() @@ -389,9 +389,9 @@ SrndQuery PrefixOperatorQuery() : { } -List FieldsQueryList() : { +List FieldsQueryList() : { SrndQuery q; - ArrayList queries = new ArrayList(); + ArrayList queries = new ArrayList(); }{ q = FieldsQuery() {queries.add(q);} diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java index aedece380d3..3d0ae089d5f 100644 --- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java +++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestMultiFieldQueryParserWrapper.java @@ -45,6 +45,7 @@ import org.apache.lucene.util.LuceneTestCase; * @deprecated this tests test the deprecated MultiFieldQueryParserWrapper, so * when the latter is gone, so should this test. */ +@Deprecated public class TestMultiFieldQueryParserWrapper extends LuceneTestCase { /** diff --git a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java index 3aa6b899c3d..010a024aded 100644 --- a/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java +++ b/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQueryParserWrapper.java @@ -84,6 +84,7 @@ import org.junit.runner.RunWith; * deprecated. When QPW is gone, so will the test. */ @RunWith(LuceneTestCase.LocalizedTestCaseRunner.class) +@Deprecated public class TestQueryParserWrapper extends LuceneTestCase { public static Analyzer qpAnalyzer = new QPTestAnalyzer(); diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java index ca0d56e68dc..61a68f7ac72 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/compound/hyphenation/TernaryTree.java @@ -394,7 +394,7 @@ public class TernaryTree implements Cloneable, Serializable { Iterator iter = new Iterator(); while (iter.hasMoreElements()) { v[i] = iter.getValue(); - k[i++] = (String) iter.nextElement(); + k[i++] = iter.nextElement(); } init(); insertBalanced(k, v, 0, n); @@ -551,7 +551,7 @@ public class TernaryTree implements Cloneable, Serializable { boolean climb = true; while (climb) { - i = (Item) ns.pop(); + i = ns.pop(); i.child++; switch (i.child) { case 1: diff --git a/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java b/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java index e3a60abe6e4..1defd7010c6 100644 --- a/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java +++ b/modules/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java @@ -73,7 +73,7 @@ public class SynonymMap { } List superset = currMap.synonyms==null ? replacement : mergeTokens(Arrays.asList(currMap.synonyms), replacement); - currMap.synonyms = (Token[])superset.toArray(new Token[superset.size()]); + currMap.synonyms = superset.toArray(new Token[superset.size()]); if (includeOrig) currMap.flags |= INCLUDE_ORIG; }