checker-framework icon indicating copy to clipboard operation
checker-framework copied to clipboard

Print nullness or initialization type qualifiers, but not both, in error messages

Open mernst opened this issue 6 years ago • 1 comments
trafficstars

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.~~

mernst avatar Feb 05 '19 01:02 mernst

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.

smillst avatar Oct 13 '23 22:10 smillst