checker-framework
checker-framework copied to clipboard
Print nullness or initialization type qualifiers, but not both, in error messages
When printing the "found" and "required" messages, show only, and all, the qualifiers from the relevant type hierarchy. In particular: If the problem is due to nullness, don't print @Initialized in types, which clutters the output.
~~This would be a big refactoring since they are both in the same type system and there is one isSubtype method that returns a boolean, without giving more information.~~
The implementation of isSubtype is a loop calling
boolean isSubtype(
AnnotatedTypeMirror subtype, AnnotatedTypeMirror supertype, AnnotationMirror top)
for each hierarchy. So to implement this, for each error message, isSubtype needs to be called for each hierarchy. If it fails, then the error message should call a new method AnnotatedTypeMirror#toString(AnnotationMirror top). DefaultAnnotatedTypeFormatter needs to be changed to print one hierarchy at a time to implement the new toString method.