ERROR_CODE_COMPARATOR property

Comparator<AnalysisError> ERROR_CODE_COMPARATOR
getter/setter pair

A Comparator that sorts error codes first by their severity (errors first, warnings second), and then by the error code type.

Implementation

static Comparator<AnalysisError> ERROR_CODE_COMPARATOR =
    (AnalysisError o1, AnalysisError o2) {
  ErrorCode errorCode1 = o1.errorCode;
  ErrorCode errorCode2 = o2.errorCode;
  ErrorSeverity errorSeverity1 = errorCode1.errorSeverity;
  ErrorSeverity errorSeverity2 = errorCode2.errorSeverity;
  if (errorSeverity1 == errorSeverity2) {
    ErrorType errorType1 = errorCode1.type;
    ErrorType errorType2 = errorCode2.type;
    return errorType1.compareTo(errorType2);
  } else {
    return errorSeverity2.compareTo(errorSeverity1);
  }
};