mirror of https://github.com/apache/lucene.git
LUCENE-2681: fix generics violations in contrib/modules
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1003978 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
85a27b8b38
commit
0789e5f4e7
|
@ -113,7 +113,7 @@ public class TrecJudge implements Judge {
|
|||
|
||||
// inherit javadocs
|
||||
public boolean validateData(QualityQuery[] qq, PrintWriter logger) {
|
||||
HashMap<String,QRelJudgement> missingQueries = (HashMap<String, QRelJudgement>) judgements.clone();
|
||||
HashMap<String,QRelJudgement> missingQueries = new HashMap<String, QRelJudgement>(judgements);
|
||||
ArrayList<String> missingJudgements = new ArrayList<String>();
|
||||
for (int i=0; i<qq.length; i++) {
|
||||
String id = qq[i].getQueryID();
|
||||
|
|
|
@ -176,6 +176,7 @@ public class WeightedSpanTermExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<SpanQuery>[] disjunctLists = new List[maxPosition + 1];
|
||||
int distinctPositions = 0;
|
||||
|
||||
|
@ -506,12 +507,9 @@ public class WeightedSpanTermExtractor {
|
|||
static private class PositionCheckingMap<K> extends HashMap<K,WeightedSpanTerm> {
|
||||
|
||||
@Override
|
||||
public void putAll(Map m) {
|
||||
Iterator<Map.Entry<K, WeightedSpanTerm>> it = m.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<K, WeightedSpanTerm> entry = it.next();
|
||||
public void putAll(Map<? extends K,? extends WeightedSpanTerm> m) {
|
||||
for (Map.Entry<? extends K,? extends WeightedSpanTerm> entry : m.entrySet())
|
||||
this.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,7 +37,7 @@ public class InstantiatedTerm
|
|||
}
|
||||
};
|
||||
|
||||
public static final Comparator termComparator = new Comparator() {
|
||||
public static final Comparator<Object> termComparator = new Comparator<Object>() {
|
||||
public int compare(Object o, Object o1) {
|
||||
return ((InstantiatedTerm)o).getTerm().compareTo((Term)o1);
|
||||
}
|
||||
|
|
|
@ -202,7 +202,8 @@ public class MemoryIndex implements Serializable {
|
|||
* Sorts term entries into ascending order; also works for
|
||||
* Arrays.binarySearch() and Arrays.sort()
|
||||
*/
|
||||
private static final Comparator termComparator = new Comparator() {
|
||||
private static final Comparator<Object> termComparator = new Comparator<Object>() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public int compare(Object o1, Object o2) {
|
||||
if (o1 instanceof Map.Entry<?,?>) o1 = ((Map.Entry<?,?>) o1).getKey();
|
||||
if (o2 instanceof Map.Entry<?,?>) o2 = ((Map.Entry<?,?>) o2).getKey();
|
||||
|
@ -513,6 +514,7 @@ public class MemoryIndex implements Serializable {
|
|||
/** returns a view of the given map's entries, sorted ascending by key */
|
||||
private static <K,V> Map.Entry<K,V>[] sort(HashMap<K,V> map) {
|
||||
int size = map.size();
|
||||
@SuppressWarnings("unchecked")
|
||||
Map.Entry<K,V>[] entries = new Map.Entry[size];
|
||||
|
||||
Iterator<Map.Entry<K,V>> iter = map.entrySet().iterator();
|
||||
|
|
|
@ -133,7 +133,7 @@ public abstract class CompoundWordTokenFilterBase extends TokenFilter {
|
|||
this(matchVersion, input,makeDictionary(dictionary),DEFAULT_MIN_WORD_SIZE,DEFAULT_MIN_SUBWORD_SIZE,DEFAULT_MAX_SUBWORD_SIZE, onlyLongestMatch);
|
||||
}
|
||||
|
||||
protected CompoundWordTokenFilterBase(Version matchVersion, TokenStream input, Set dictionary, boolean onlyLongestMatch) {
|
||||
protected CompoundWordTokenFilterBase(Version matchVersion, TokenStream input, Set<?> dictionary, boolean onlyLongestMatch) {
|
||||
this(matchVersion, input,dictionary,DEFAULT_MIN_WORD_SIZE,DEFAULT_MIN_SUBWORD_SIZE,DEFAULT_MAX_SUBWORD_SIZE, onlyLongestMatch);
|
||||
}
|
||||
|
||||
|
@ -141,11 +141,11 @@ public abstract class CompoundWordTokenFilterBase extends TokenFilter {
|
|||
this(matchVersion, input,makeDictionary(dictionary),DEFAULT_MIN_WORD_SIZE,DEFAULT_MIN_SUBWORD_SIZE,DEFAULT_MAX_SUBWORD_SIZE, false);
|
||||
}
|
||||
|
||||
protected CompoundWordTokenFilterBase(Version matchVersion, TokenStream input, Set dictionary) {
|
||||
protected CompoundWordTokenFilterBase(Version matchVersion, TokenStream input, Set<?> dictionary) {
|
||||
this(matchVersion, input,dictionary,DEFAULT_MIN_WORD_SIZE,DEFAULT_MIN_SUBWORD_SIZE,DEFAULT_MAX_SUBWORD_SIZE, false);
|
||||
}
|
||||
|
||||
protected CompoundWordTokenFilterBase(Version matchVersion, TokenStream input, Set dictionary, int minWordSize, int minSubwordSize, int maxSubwordSize, boolean onlyLongestMatch) {
|
||||
protected CompoundWordTokenFilterBase(Version matchVersion, TokenStream input, Set<?> dictionary, int minWordSize, int minSubwordSize, int maxSubwordSize, boolean onlyLongestMatch) {
|
||||
super(input);
|
||||
|
||||
this.tokens=new LinkedList<Token>();
|
||||
|
@ -221,8 +221,9 @@ public abstract class CompoundWordTokenFilterBase extends TokenFilter {
|
|||
}
|
||||
}
|
||||
|
||||
protected static final void addAllLowerCase(Set<Object> target, Collection<String> col) {
|
||||
for (String string : col) {
|
||||
protected static final void addAllLowerCase(CharArraySet target, Collection<?> col) {
|
||||
for (Object obj : col) {
|
||||
String string = (String) obj;
|
||||
target.add(string.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -453,11 +453,11 @@ public class TernaryTree implements Cloneable, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
public Enumeration keys() {
|
||||
public Enumeration<String> keys() {
|
||||
return new Iterator();
|
||||
}
|
||||
|
||||
public class Iterator implements Enumeration {
|
||||
public class Iterator implements Enumeration<String> {
|
||||
|
||||
/**
|
||||
* current node index
|
||||
|
@ -494,7 +494,7 @@ public class TernaryTree implements Cloneable, Serializable {
|
|||
/**
|
||||
* Node stack
|
||||
*/
|
||||
Stack ns;
|
||||
Stack<Item> ns;
|
||||
|
||||
/**
|
||||
* key stack implemented with a StringBuilder
|
||||
|
@ -503,7 +503,7 @@ public class TernaryTree implements Cloneable, Serializable {
|
|||
|
||||
public Iterator() {
|
||||
cur = -1;
|
||||
ns = new Stack();
|
||||
ns = new Stack<Item>();
|
||||
ks = new StringBuilder();
|
||||
rewind();
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ public class TernaryTree implements Cloneable, Serializable {
|
|||
run();
|
||||
}
|
||||
|
||||
public Object nextElement() {
|
||||
public String nextElement() {
|
||||
String res = new String(curkey);
|
||||
cur = up();
|
||||
run();
|
||||
|
@ -557,11 +557,11 @@ public class TernaryTree implements Cloneable, Serializable {
|
|||
case 1:
|
||||
if (sc[i.parent] != 0) {
|
||||
res = eq[i.parent];
|
||||
ns.push(i.clone());
|
||||
ns.push((Item) i.clone());
|
||||
ks.append(sc[i.parent]);
|
||||
} else {
|
||||
i.child++;
|
||||
ns.push(i.clone());
|
||||
ns.push((Item) i.clone());
|
||||
res = hi[i.parent];
|
||||
}
|
||||
climb = false;
|
||||
|
@ -569,7 +569,7 @@ public class TernaryTree implements Cloneable, Serializable {
|
|||
|
||||
case 2:
|
||||
res = hi[i.parent];
|
||||
ns.push(i.clone());
|
||||
ns.push((Item) i.clone());
|
||||
if (ks.length() > 0) {
|
||||
ks.setLength(ks.length() - 1); // pop
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public final class FrenchStemFilter extends TokenFilter {
|
|||
*/
|
||||
@Deprecated // TODO remove in 3.2
|
||||
public void setExclusionTable( Map<?,?> exclusiontable ) {
|
||||
exclusions = new HashSet(exclusiontable.keySet());
|
||||
exclusions = exclusiontable.keySet();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,7 @@ public final class QueryAutoStopWordAnalyzer extends Analyzer {
|
|||
/* if the stopwords for a field are changed,
|
||||
* then saved streams for that field are erased.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String,SavedStreams> streamMap = (Map<String,SavedStreams>) getPreviousTokenStream();
|
||||
if (streamMap != null)
|
||||
streamMap.remove(fieldName);
|
||||
|
@ -195,6 +196,7 @@ public final class QueryAutoStopWordAnalyzer extends Analyzer {
|
|||
public TokenStream reusableTokenStream(String fieldName, Reader reader)
|
||||
throws IOException {
|
||||
/* map of SavedStreams for each field */
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String,SavedStreams> streamMap = (Map<String,SavedStreams>) getPreviousTokenStream();
|
||||
if (streamMap == null) {
|
||||
streamMap = new HashMap<String, SavedStreams>();
|
||||
|
|
|
@ -54,9 +54,9 @@ public class TestApp {
|
|||
return;
|
||||
}
|
||||
|
||||
Class stemClass = Class.forName("org.tartarus.snowball.ext." +
|
||||
args[0] + "Stemmer");
|
||||
SnowballProgram stemmer = (SnowballProgram) stemClass.newInstance();
|
||||
Class<? extends SnowballProgram> stemClass = Class.forName("org.tartarus.snowball.ext." +
|
||||
args[0] + "Stemmer").asSubclass(SnowballProgram.class);
|
||||
SnowballProgram stemmer = stemClass.newInstance();
|
||||
Method stemMethod = stemClass.getMethod("stem", new Class[0]);
|
||||
|
||||
Reader reader;
|
||||
|
|
Loading…
Reference in New Issue