public class SignednessVisitor extends BaseTypeVisitor<SignednessAnnotatedTypeFactory>
BaseTypeVisitor.OverrideChecker
atypeFactory, checker, DETERMINISTIC, inferPurity, methodTree, positions, PURE, SIDE_EFFECT_FREE, TARGET, targetValueElement, typeValidator, unusedWhenElement
elements, root, trees, treesWithSuppressWarnings, types
Constructor and Description |
---|
SignednessVisitor(BaseTypeChecker checker) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType,
ExecutableElement constructorElement)
Issue a warning if the result type of the constructor is not top.
|
protected Set<? extends AnnotationMirror> |
getExceptionParameterLowerBoundAnnotations()
Returns a set of AnnotationMirrors that is a lower bound for exception parameters.
|
protected boolean |
isTypeCastSafe(AnnotatedTypeMirror castType,
AnnotatedTypeMirror exprType)
Returns true if the cast is safe.
|
protected boolean |
shouldWarnAboutIrrelevantJavaTypes()
Returns true if the checker should issue warnings about irrelevant java types.
|
Void |
visitBinary(BinaryTree node,
Void p)
Enforces the following rules on binary operations involving Unsigned and Signed types:
Do not allow any Unsigned types or PolySigned types in {/, %} operations.
|
Void |
visitCompoundAssignment(CompoundAssignmentTree node,
Void p)
Enforces the following rules on compound assignments involving Unsigned and Signed types:
Do not allow any Unsigned types or PolySigned types in {/=, %=} assignments.
|
checkAccess, checkAccessAllowed, checkArguments, checkArrayInitialization, checkConditionalPostcondition, checkConstructorInvocation, checkContract, checkDefaultConstructor, checkExceptionParameter, checkExplicitAnnotationsOnIntersectionBounds, checkExtendsImplements, checkFieldInvariantDeclarations, checkForPolymorphicQualifiers, checkForPolymorphicQualifiers, checkMethodInvocability, checkMethodReferenceAsOverride, checkOverride, checkOverride, checkPostcondition, checkPreconditions, checkPurity, checkQualifierParameter, checkSuperConstructorCall, checkThisConstructorCall, checkThisOrSuperConstructorCall, checkThrownExpression, checkTypeArguments, checkTypecastRedundancy, checkTypecastSafety, checkVarargs, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheck, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckEndDiagnostic, commonAssignmentCheckStartDiagnostic, createOverrideChecker, createTypeFactory, createTypeFactoryPublic, createTypeValidator, enclosingMemberSelect, enclosingStatement, getThrowUpperBoundAnnotations, getTypeFactory, isValidUse, isValidUse, isValidUse, processClassTree, reportMethodInvocabilityError, reportPurityErrors, scan, setRoot, shouldSkipUses, skipReceiverSubtypeCheck, testAnnotationInsertion, testJointJavacJavaParserVisitor, testTypevarContainment, typeCheckVectorCopyIntoArgument, validateType, validateTypeOf, visitAnnotatedType, visitAnnotatedType, visitAnnotation, visitAssignment, visitCatch, visitClass, visitCompilationUnit, visitConditionalExpression, visitEnhancedForLoop, visitIdentifier, visitInstanceOf, visitLambdaExpression, visitMemberReference, visitMethod, visitMethodInvocation, visitNewArray, visitNewClass, visitReturn, visitSwitchExpression17, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, warnAboutIrrelevantJavaTypes
visit
getCurrentPath, scan
reduce, scan, visitArrayAccess, visitArrayType, visitAssert, visitBlock, visitBreak, visitCase, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIf, visitImport, visitIntersectionType, visitLabeledStatement, visitLiteral, visitMemberSelect, visitModifiers, visitModule, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitSwitch, visitSynchronized, visitTry, visitUnionType, visitUses, visitWhileLoop, visitWildcard
public SignednessVisitor(BaseTypeChecker checker)
public Void visitBinary(BinaryTree node, Void p)
visitBinary
in interface TreeVisitor<Void,Void>
visitBinary
in class TreeScanner<Void,Void>
public Void visitCompoundAssignment(CompoundAssignmentTree node, Void p)
visitCompoundAssignment
in interface TreeVisitor<Void,Void>
visitCompoundAssignment
in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>
protected boolean isTypeCastSafe(AnnotatedTypeMirror castType, AnnotatedTypeMirror exprType)
BaseTypeVisitor
Only primary qualifiers are checked unless the command line option "checkCastElementType" is supplied.
isTypeCastSafe
in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>
castType
- annotated type of the castexprType
- annotated type of the casted expressionprotected Set<? extends AnnotationMirror> getExceptionParameterLowerBoundAnnotations()
BaseTypeVisitor
This implementation returns top; subclasses can change this behavior.
Note: by default this method is called by BaseTypeVisitor.getThrowUpperBoundAnnotations()
, so that
this annotation is enforced.
getExceptionParameterLowerBoundAnnotations
in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>
protected void checkConstructorResult(AnnotatedTypeMirror.AnnotatedExecutableType constructorType, ExecutableElement constructorElement)
BaseTypeVisitor
BaseTypeVisitor.isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType,AnnotatedTypeMirror.AnnotatedDeclaredType,Tree)
.checkConstructorResult
in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>
constructorType
- AnnotatedExecutableType for the constructorconstructorElement
- element that declares the constructorprotected boolean shouldWarnAboutIrrelevantJavaTypes()
BaseTypeVisitor
shouldWarnAboutIrrelevantJavaTypes
in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>