Apparently you should use
public int compareTo(@NonNull Node node) {
instead
public int compareTo(@NotNull Node node) {
The compiler can detect cases where the code path can be zero, without having to debug NullPointerException.
From here.
Checker Framework. , .