Search in sources :

Example 1 with CompatibilityType

use of org.revapi.CompatibilityType in project revapi by revapi.

the class AntReporter method report.

@Override
public void report(@Nonnull Report report) {
    Element element = report.getOldElement();
    if (element == null) {
        element = report.getNewElement();
    }
    if (element == null) {
        throw new IllegalStateException("This should not ever happen. Both elements in a report were null.");
    }
    for (Difference difference : report.getDifferences()) {
        DifferenceSeverity maxSeverity = DifferenceSeverity.NON_BREAKING;
        for (Map.Entry<CompatibilityType, DifferenceSeverity> e : difference.classification.entrySet()) {
            if (e.getValue().compareTo(maxSeverity) >= 0) {
                maxSeverity = e.getValue();
            }
        }
        if (maxSeverity.compareTo(minSeverity) < 0) {
            continue;
        }
        StringBuilder message = new StringBuilder();
        message.append(element.getFullHumanReadableString()).append(": ").append(difference.code).append(": ").append(difference.description).append(" [");
        for (Map.Entry<CompatibilityType, DifferenceSeverity> e : difference.classification.entrySet()) {
            message.append(e.getKey()).append(": ").append(e.getValue()).append(", ");
        }
        message.replace(message.length() - 2, message.length(), "]");
        logger.log(message.toString(), Project.MSG_ERR);
    }
}
Also used : DifferenceSeverity(org.revapi.DifferenceSeverity) CompatibilityType(org.revapi.CompatibilityType) Element(org.revapi.Element) Difference(org.revapi.Difference) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 CompatibilityType (org.revapi.CompatibilityType)1 Difference (org.revapi.Difference)1 DifferenceSeverity (org.revapi.DifferenceSeverity)1 Element (org.revapi.Element)1