We are getting servlet compile errors on Comparator
interface after upgrade from Java 1.7 to Java 1.8, using Netbeans and Weblogic 12c. The .jsp
files ran fine in Java 1.7. I have read through other similar questions but have not found a solution. I have tried checking the Weblogic Domain configuration JSP Compiler Backwards Compatible with no success. The methods that the compiler is complaining about are default
methods so they should not need mentioned, correct? Do the classes implementing Comparator
need to be re written for Java 8? If so, please advise.
Errors
viewFundCites.jsp:151:11: The type compareFundedPrOrderedByPr must implement the inherited abstract method Comparator.thenComparing(Function, Comparator)
class compareFundedPrOrderedByPr implements Comparator {
^-----------------------^
Code
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;
}
}