我试图将SDK API级别降低到23,并且Java编译器抱怨此错误消息:
import com.yahoo.prelude.query.CompositeItem;
import com.yahoo.prelude.query.Item;
import com.yahoo.prelude.query.PrefixItem;
import com.yahoo.prelude.query.WordItem;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
import com.yahoo.search.query.QueryTree;
import com.yahoo.search.searchchain.Execution;
import java.util.ListIterator;
public class PrefixMatchSearcher extends Searcher {
@Override
public Result search(Query query, Execution execution) {
matchLastByPrefix(query);
return execution.search(query);
}
private boolean matchLastByPrefix(Query query) {
boolean spaceTerminated = query.getModel().getQueryString().endsWith(" ");
if (spaceTerminated) return false;
QueryTree tree = query.getModel().getQueryTree();
if (tree.getRoot() instanceof WordItem) {
tree.setRoot(toPrefixItem((WordItem) tree.getRoot()));
return true;
}
else if (tree.getRoot() instanceof CompositeItem) {
CompositeItem root = (CompositeItem) tree.getRoot();
for (ListIterator<Item> i = root.getItemIterator(); i.hasNext();) {
Item child = i.next();
if (i.hasNext()) continue; // Skip to last
if (child instanceof WordItem) {
i.set(toPrefixItem((WordItem)child));
return true;
}
}
}
return false;
}
private PrefixItem toPrefixItem(WordItem word) {
return new PrefixItem(word.getWord(), word.getIndexName());
}
}
编译器未提供文件名或行号。
一个错误的来源可能是Java compiler: (3 errors)
error: failed linking references.
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
的这一部分(工作室将@android ..标记为红色):
style.xml
但是删除并不能改变错误。
如何找到此问题的根源?以及如何解决。