in tools/javac/ApiComparator.java [200:228]
public static Node compare(Api.Field a, Api.Field b) {
Node node = new Node(a, b);
if (node.diff == Diff.ADDED) {
node.compatibility = Compatibility.MINOR;
} else if (node.diff == Diff.REMOVED) {
node.compatibility = Compatibility.MAJOR;
node.messages.add(Message.BREAKING_CHANGES);
} else {
// Breaking changes
node.check(!Objects.equals(a.type, b.type), "changed type");
node.check(!Objects.equals(a.constantValue, b.constantValue), "changed value");
if (node.diff != Diff.NONE) {
node.compatibility = Compatibility.MAJOR;
node.messages.add(Message.BREAKING_CHANGES);
return node;
}
if (compareModifiers(node, a.modifiers, b.modifiers)) return node;
// Compatible changes
node.check(a.deprecation != b.deprecation, "changed deprecation state");
if (node.diff != Diff.NONE) {
node.compatibility = Compatibility.MINOR;
return node;
}
}
return node;
}