public class SignednessVisitor extends BaseTypeVisitor<SignednessAnnotatedTypeFactory>
BaseTypeVisitor.OverrideCheckeratypeFactory, checker, DETERMINISTIC, inferPurity, methodTree, positions, PURE, SIDE_EFFECT_FREE, TARGET, targetValueElement, typeValidator, unusedWhenElementelements, 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.
|
Void |
visitMethod(MethodTree node,
Void p)
Checks that the method obeys override and subtype rules to all overridden methods.
|
Void |
visitMethodInvocation(MethodInvocationTree node,
Void p)
Performs a method invocation check.
|
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, visitNewArray, visitNewClass, visitReturn, visitSwitchExpression17, visitThrow, visitTypeCast, visitTypeParameter, visitUnary, visitVariable, warnAboutIrrelevantJavaTypesvisitgetCurrentPath, scanreduce, 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, visitWildcardpublic SignednessVisitor(BaseTypeChecker checker)
public Void visitBinary(BinaryTree node, Void p)
visitBinary in interface TreeVisitor<Void,Void>visitBinary in class TreeScanner<Void,Void>public Void visitMethod(MethodTree node, Void p)
BaseTypeVisitorThe override rule specifies that a method, m1, may override a method m2 only if:
visitMethod in interface TreeVisitor<Void,Void>visitMethod in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>public Void visitMethodInvocation(MethodInvocationTree node, Void p)
BaseTypeVisitorAn invocation of a method, m, on the receiver, r is valid only if:
visitMethodInvocation in interface TreeVisitor<Void,Void>visitMethodInvocation in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>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)
BaseTypeVisitorOnly 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()
BaseTypeVisitorThis 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)
BaseTypeVisitorBaseTypeVisitor.isValidUse(AnnotatedTypeMirror.AnnotatedDeclaredType,AnnotatedTypeMirror.AnnotatedDeclaredType,Tree).checkConstructorResult in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>constructorType - AnnotatedExecutableType for the constructorconstructorElement - element that declares the constructorprotected boolean shouldWarnAboutIrrelevantJavaTypes()
BaseTypeVisitorshouldWarnAboutIrrelevantJavaTypes in class BaseTypeVisitor<SignednessAnnotatedTypeFactory>