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
This commit is contained in:
Robert Muir 2010-10-03 16:27:34 +00:00
parent 0789e5f4e7
commit afad8123d2
11 changed files with 62 additions and 72 deletions

View File

@ -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}.

View File

@ -72,12 +72,7 @@ import org.apache.lucene.util.AttributeSource;
* href="../../../../../../../queryparsersyntax.html">query syntax
* documentation</a>.
* </p>
*
* @author Brian Goetz
* @author Peter Halacsy
* @author Tatu Saloranta
*/
public class PrecedenceQueryParser implements PrecedenceQueryParserConstants {
private static final int CONJ_NONE = 0;

View File

@ -96,12 +96,7 @@ import org.apache.lucene.util.AttributeSource;
* href="../../../../../../../queryparsersyntax.html">query syntax
* documentation</a>.
* </p>
*
* @author Brian Goetz
* @author Peter Halacsy
* @author Tatu Saloranta
*/
public class PrecedenceQueryParser {
private static final int CONJ_NONE = 0;

View File

@ -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<QueryNode> 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<QueryNode>();
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<QueryNode> 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<QueryNode>();
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<QueryNode> 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<QueryNode>();
clauses.addElement(first);
}
clauses.addElement(c);

View File

@ -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<QueryNode> 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<QueryNode>();
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<QueryNode> clauses = null;
}
{
first = ConjQuery(field)
@ -242,7 +241,7 @@ QueryNode DisjQuery(CharSequence field) : {
<OR> c=ConjQuery(field)
{
if (clauses == null) {
clauses = new Vector();
clauses = new Vector<QueryNode>();
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<QueryNode> clauses = null;
}
{
first = ModClause(field)
@ -267,7 +266,7 @@ QueryNode ConjQuery(CharSequence field) : {
<AND> c=ModClause(field)
{
if (clauses == null) {
clauses = new Vector();
clauses = new Vector<QueryNode>();
clauses.addElement(first);
}
clauses.addElement(c);

View File

@ -56,22 +56,22 @@ public class QueryParser implements QueryParserConstants {
}
protected SrndQuery getFieldsQuery(
SrndQuery q, ArrayList fieldNames) {
SrndQuery q, ArrayList<String> 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<SrndQuery> 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<SrndQuery> queries, boolean infix, Token andToken) {
return new AndQuery( queries, infix, andToken.image);
}
protected SrndQuery getNotQuery(List queries, Token notToken) {
protected SrndQuery getNotQuery(List<SrndQuery> queries, Token notToken) {
return new NotQuery( queries, notToken.image);
}
@ -91,7 +91,7 @@ public class QueryParser implements QueryParserConstants {
}
protected SrndQuery getDistanceQuery(
List queries,
List<SrndQuery> 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<String> 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<String> OptionalFields() throws ParseException {
Token fieldName;
ArrayList fieldNames = null;
ArrayList<String> 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<String>();
}
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<SrndQuery> 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<SrndQuery>();
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<SrndQuery> 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<SrndQuery>();
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<SrndQuery> 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<SrndQuery>();
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<SrndQuery> 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<SrndQuery>();
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<SrndQuery> 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<SrndQuery>();
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<SrndQuery> 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<SrndQuery> FieldsQueryList() throws ParseException {
SrndQuery q;
ArrayList queries = new ArrayList();
ArrayList<SrndQuery> queries = new ArrayList<SrndQuery>();
jj_consume_token(LPAREN);
q = FieldsQuery();
queries.add(q);

View File

@ -85,22 +85,22 @@ public class QueryParser {
}
protected SrndQuery getFieldsQuery(
SrndQuery q, ArrayList fieldNames) {
SrndQuery q, ArrayList<String> 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<SrndQuery> 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<SrndQuery> queries, boolean infix, Token andToken) {
return new AndQuery( queries, infix, andToken.image);
}
protected SrndQuery getNotQuery(List queries, Token notToken) {
protected SrndQuery getNotQuery(List<SrndQuery> queries, Token notToken) {
return new NotQuery( queries, notToken.image);
}
@ -120,7 +120,7 @@ public class QueryParser {
}
protected SrndQuery getDistanceQuery(
List queries,
List<SrndQuery> queries,
boolean infix,
Token dToken,
boolean ordered) throws ParseException {
@ -231,7 +231,7 @@ SrndQuery TopSrndQuery() : {
SrndQuery FieldsQuery() : {
SrndQuery q;
ArrayList fieldNames;
ArrayList<String> fieldNames;
}{
fieldNames = OptionalFields()
q = OrQuery()
@ -239,15 +239,15 @@ SrndQuery FieldsQuery() : {
}
ArrayList OptionalFields() : {
ArrayList<String> OptionalFields() : {
Token fieldName;
ArrayList fieldNames = null;
ArrayList<String> fieldNames = null;
}{
( LOOKAHEAD(2) // to the colon
fieldName = <TERM>
<COLON> {
if (fieldNames == null) {
fieldNames = new ArrayList();
fieldNames = new ArrayList<String>();
}
fieldNames.add(fieldName.image);
}
@ -258,13 +258,13 @@ ArrayList OptionalFields() : {
SrndQuery OrQuery() : {
SrndQuery q;
ArrayList queries = null;
ArrayList<SrndQuery> queries = null;
Token oprt = null;
}{
q = AndQuery()
( oprt = <OR> { /* keep only last used operator */
if (queries == null) {
queries = new ArrayList();
queries = new ArrayList<SrndQuery>();
queries.add(q);
}
}
@ -278,13 +278,13 @@ SrndQuery OrQuery() : {
SrndQuery AndQuery() : {
SrndQuery q;
ArrayList queries = null;
ArrayList<SrndQuery> queries = null;
Token oprt = null;
}{
q = NotQuery()
( oprt = <AND> { /* keep only last used operator */
if (queries == null) {
queries = new ArrayList();
queries = new ArrayList<SrndQuery>();
queries.add(q);
}
}
@ -298,13 +298,13 @@ SrndQuery AndQuery() : {
SrndQuery NotQuery() : {
SrndQuery q;
ArrayList queries = null;
ArrayList<SrndQuery> queries = null;
Token oprt = null;
}{
q = NQuery()
( oprt = <NOT> { /* keep only last used operator */
if (queries == null) {
queries = new ArrayList();
queries = new ArrayList<SrndQuery>();
queries.add(q);
}
}
@ -318,12 +318,12 @@ SrndQuery NotQuery() : {
SrndQuery NQuery() : {
SrndQuery q;
ArrayList queries;
ArrayList<SrndQuery> queries;
Token dt;
}{
q = WQuery()
( dt = <N> {
queries = new ArrayList();
queries = new ArrayList<SrndQuery>();
queries.add(q); /* left associative */
}
q = WQuery() {
@ -337,12 +337,12 @@ SrndQuery NQuery() : {
SrndQuery WQuery() : {
SrndQuery q;
ArrayList queries;
ArrayList<SrndQuery> queries;
Token wt;
}{
q = PrimaryQuery()
( wt = <W> {
queries = new ArrayList();
queries = new ArrayList<SrndQuery>();
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<SrndQuery> queries;
}{
( oprt = <OR> /* prefix OR */
queries = FieldsQueryList()
@ -389,9 +389,9 @@ SrndQuery PrefixOperatorQuery() : {
}
List FieldsQueryList() : {
List<SrndQuery> FieldsQueryList() : {
SrndQuery q;
ArrayList queries = new ArrayList();
ArrayList<SrndQuery> queries = new ArrayList<SrndQuery>();
}{
<LPAREN>
q = FieldsQuery() {queries.add(q);}

View File

@ -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 {
/**

View File

@ -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();

View File

@ -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:

View File

@ -73,7 +73,7 @@ public class SynonymMap {
}
List<Token> 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;
}