在使用Netbeans和Weblogic 12c从Java 1.7升级到Java 1.8之后,我们在Comparator
接口上收到了servlet编译错误。 Java 1.7中的.jsp
文件运行正常。我已阅读其他类似问题,但尚未找到解决方案。我已经尝试检查Weblogic Domain配置JSP Compiler Backwards Compatible但没有成功。编译器抱怨的方法是default
方法,所以不需要提及它们,对吗?是否需要为Java 8重写实现Comparator
的类?如果是这样,请指教。
错误
viewFundCites.jsp:151:11: The type compareFundedPrOrderedByPr must implement the inherited abstract method Comparator.thenComparing(Function, Comparator)
class compareFundedPrOrderedByPr implements Comparator {
^-----------------------^
代码
class compareFundedPrOrderedByPr implements Comparator {
public int compare (Object a, Object b) {
int ordering = 0;
FundCite itemA = (FundCite)a;
FundCite itemB = (FundCite)b;
if ((null == itemA) && (null == itemB)) {
ordering = 0;
} else if ((null == itemA.getPrName()) && (null == itemB.getPrName())) {
ordering = 0;
} else if (null == itemA.getPrName()) {
ordering = -1;
} else if (null == itemB.getPrName()) {
ordering = 1;
} else {
// Do primary sort by PR Name.
ordering = itemA.getPrName().compareTo(itemB.getPrName());
if (0 == ordering) {
// Do secondary sort by CLIN.
if ((null == itemA.getClin()) && (null == itemB.getClin())) {
ordering = 0;
} else if (null == itemA.getClin()) {
ordering = -1;
} else if (null == itemB.getClin()) {
ordering = 1;
} else {
ordering = itemA.getClin().compareTo(itemB.getClin());
}
}
}
return ordering;
}
}