Class BaseTypeValidator

java.lang.Object
org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<Void,Tree>
org.checkerframework.common.basetype.BaseTypeValidator
All Implemented Interfaces:
TypeValidator, AnnotatedTypeVisitor<Void,Tree>
Direct Known Subclasses:
ReportVisitor.ReportTypeValidator

public class BaseTypeValidator extends AnnotatedTypeScanner<Void,Tree> implements TypeValidator
A visitor to validate the types in a tree.

The validator is called on the type of every expression, such as on the right-hand side of x = Optional.of(Optional.of("baz"));. However, note that the type of the right-hand side is Optional<? extends Object>, not Optional<Optional<String>>.

Note: A TypeValidator (this class and its subclasses) cannot tell whether an annotation was written by a programmer or defaulted/inferred/computed by the Checker Framework, because the AnnotatedTypeMirror does not make distinctions about which annotations in an AnnotatedTypeMirror were explicitly written and which were added by a checker. To issue a warning/error only when a programmer writes an annotation, override BaseTypeVisitor.visitAnnotatedType(com.sun.source.tree.AnnotatedTypeTree, java.lang.Void) and BaseTypeVisitor.visitVariable(com.sun.source.tree.VariableTree, java.lang.Void).