clean up some fallthru/deprecation warnings

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1003873 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-10-02 19:58:35 +00:00
parent cdc93f3b79
commit fd11477ece
13 changed files with 29 additions and 8 deletions

View File

@ -156,12 +156,15 @@ public class QueryParser implements QueryParserConstants {
Collator rangeCollator = null;
/** @deprecated remove when getFieldQuery is removed */
@Deprecated
private static final VirtualMethod<QueryParser> getFieldQueryMethod =
new VirtualMethod<QueryParser>(QueryParser.class, "getFieldQuery", String.class, String.class);
/** @deprecated remove when getFieldQuery is removed */
@Deprecated
private static final VirtualMethod<QueryParser> getFieldQueryWithQuotedMethod =
new VirtualMethod<QueryParser>(QueryParser.class, "getFieldQuery", String.class, String.class, boolean.class);
/** @deprecated remove when getFieldQuery is removed */
@Deprecated
private final boolean hasNewAPI =
VirtualMethod.compareImplementationDistance(getClass(),
getFieldQueryWithQuotedMethod, getFieldQueryMethod) >= 0; // its ok for both to be overridden
@ -1622,12 +1625,6 @@ public class QueryParser implements QueryParserConstants {
finally { jj_save(0, xla); }
}
private boolean jj_3R_2() {
if (jj_scan_token(TERM)) return true;
if (jj_scan_token(COLON)) return true;
return false;
}
private boolean jj_3_1() {
Token xsp;
xsp = jj_scanpos;
@ -1644,6 +1641,12 @@ public class QueryParser implements QueryParserConstants {
return false;
}
private boolean jj_3R_2() {
if (jj_scan_token(TERM)) return true;
if (jj_scan_token(COLON)) return true;
return false;
}
/** Generated Token Manager. */
public QueryParserTokenManager token_source;
/** Current token. */

View File

@ -180,12 +180,15 @@ public class QueryParser {
Collator rangeCollator = null;
/** @deprecated remove when getFieldQuery is removed */
@Deprecated
private static final VirtualMethod<QueryParser> getFieldQueryMethod =
new VirtualMethod<QueryParser>(QueryParser.class, "getFieldQuery", String.class, String.class);
/** @deprecated remove when getFieldQuery is removed */
@Deprecated
private static final VirtualMethod<QueryParser> getFieldQueryWithQuotedMethod =
new VirtualMethod<QueryParser>(QueryParser.class, "getFieldQuery", String.class, String.class, boolean.class);
/** @deprecated remove when getFieldQuery is removed */
@Deprecated
private final boolean hasNewAPI =
VirtualMethod.compareImplementationDistance(getClass(),
getFieldQueryWithQuotedMethod, getFieldQueryMethod) >= 0; // its ok for both to be overridden

View File

@ -183,6 +183,7 @@ public abstract class FilteredTermsEnum extends TermsEnum {
tenum.cacheCurrentTerm();
}
@SuppressWarnings("fallthrough")
@Override
public BytesRef next() throws IOException {
if (tenum == null)

View File

@ -62,11 +62,13 @@ public final class CommonGramsFilter extends TokenFilter {
private State savedState;
/** @deprecated Use {@link #CommonGramsFilter(Version, TokenStream, Set)} instead */
@Deprecated
public CommonGramsFilter(TokenStream input, Set<?> commonWords) {
this(Version.LUCENE_29, input, commonWords);
}
/** @deprecated Use {@link #CommonGramsFilter(Version, TokenStream, Set, boolean)} instead */
@Deprecated
public CommonGramsFilter(TokenStream input, Set<?> commonWords, boolean ignoreCase) {
this(Version.LUCENE_29, input, commonWords, ignoreCase);
}

View File

@ -93,6 +93,7 @@ public class LetterTokenizer extends CharTokenizer {
* @deprecated use {@link #LetterTokenizer(Version, Reader)} instead. This
* will be removed in Lucene 4.0.
*/
@Deprecated
public LetterTokenizer(Reader in) {
super(Version.LUCENE_30, in);
}
@ -103,6 +104,7 @@ public class LetterTokenizer extends CharTokenizer {
* use {@link #LetterTokenizer(Version, AttributeSource, Reader)} instead.
* This will be removed in Lucene 4.0.
*/
@Deprecated
public LetterTokenizer(AttributeSource source, Reader in) {
super(Version.LUCENE_30, source, in);
}
@ -114,6 +116,7 @@ public class LetterTokenizer extends CharTokenizer {
* @deprecated use {@link #LetterTokenizer(Version, AttributeSource.AttributeFactory, Reader)}
* instead. This will be removed in Lucene 4.0.
*/
@Deprecated
public LetterTokenizer(AttributeFactory factory, Reader in) {
super(Version.LUCENE_30, factory, in);
}

View File

@ -106,6 +106,7 @@ public final class LowerCaseTokenizer extends LetterTokenizer {
* @deprecated use {@link #LowerCaseTokenizer(AttributeSource, Reader)}
* instead. This will be removed in Lucene 4.0.
*/
@Deprecated
public LowerCaseTokenizer(AttributeSource source, Reader in) {
super(Version.LUCENE_30, source, in);
}
@ -117,6 +118,7 @@ public final class LowerCaseTokenizer extends LetterTokenizer {
* @deprecated use {@link #LowerCaseTokenizer(AttributeSource.AttributeFactory, Reader)}
* instead. This will be removed in Lucene 4.0.
*/
@Deprecated
public LowerCaseTokenizer(AttributeFactory factory, Reader in) {
super(Version.LUCENE_30, factory, in);
}

View File

@ -25,6 +25,7 @@ package org.apache.lucene.analysis.en;
* Donna Harman.
*/
public class EnglishMinimalStemmer {
@SuppressWarnings("fallthrough")
public int stem(char s[], int len) {
if (len < 3 || s[len-1] != 's')
return len;
@ -38,7 +39,7 @@ public class EnglishMinimalStemmer {
return len - 2;
}
if (s[len-3] == 'i' || s[len-3] == 'a' || s[len-3] == 'o' || s[len-3] == 'e')
return len;
return len; /* intentional fallthrough */
default: return len - 1;
}
}

View File

@ -202,6 +202,7 @@ public class HungarianLightStemmer {
return len;
}
@SuppressWarnings("fallthrough")
private int removePlural(char s[], int len) {
if (len > 3 && s[len-1] == 'k')
switch(s[len-2]) {

View File

@ -89,7 +89,7 @@ public class TestApp {
int character;
while ((character = reader.read()) != -1) {
char ch = (char) character;
if (Character.isWhitespace((char) ch)) {
if (Character.isWhitespace(ch)) {
if (input.length() > 0) {
stemmer.setCurrent(input.toString());
for (int i = repeat; i != 0; i--) {

View File

@ -72,6 +72,7 @@ public class TestTrimFilter extends BaseTokenStreamTestCase {
/**
* @deprecated does not support custom attributes
*/
@Deprecated
private static class IterTokenStream extends TokenStream {
final Token tokens[];
int index = 0;

View File

@ -98,6 +98,7 @@ public class TestPatternTokenizer extends BaseTokenStreamTestCase
* TODO: rewrite tests not to use string comparison.
* @deprecated only tests TermAttribute!
*/
@Deprecated
private static String tsToString(TokenStream in) throws IOException {
StringBuilder out = new StringBuilder();
CharTermAttribute termAtt = in.addAttribute(CharTermAttribute.class);

View File

@ -73,6 +73,7 @@ public class TestSnowball extends BaseTokenStreamTestCase {
* Test turkish lowercasing (old buggy behavior)
* @deprecated Remove this when support for 3.0 indexes is no longer required
*/
@Deprecated
public void testTurkishBWComp() throws Exception {
Analyzer a = new SnowballAnalyzer(Version.LUCENE_30, "Turkish");
// AĞACI in turkish lowercases to ağacı, but with lowercase filter ağaci.

View File

@ -334,6 +334,7 @@ public class TestSynonymFilter extends BaseTokenStreamTestCase {
* a,1,10,11 => "a" with positionIncrement=1, startOffset=10, endOffset=11
* @deprecated does not support attributes api
*/
@Deprecated
private List<Token> tokens(String str) {
String[] arr = str.split(" ");
List<Token> result = new ArrayList<Token>();
@ -379,6 +380,7 @@ public class TestSynonymFilter extends BaseTokenStreamTestCase {
/**
* @deprecated does not support custom attributes
*/
@Deprecated
private static class IterTokenStream extends TokenStream {
final Token tokens[];
int index = 0;