public class ReturnValueMethodOverrideCheck extends AbstractMethodOverrideCheck
Return value constraints of a method must not be weakened in subtypes. One must not mark a method return value for cascaded validation more than once in a line of a class hierarchy. In other words, overriding methods on subtypes (be it sub classes/interfaces or interface implementations) cannot mark the return value for cascaded validation if the return value has already been marked on the overridden method of the super type or interface.
constraintHelper
Constructor and Description |
---|
ReturnValueMethodOverrideCheck(Elements elementUtils,
Types typeUtils,
ConstraintHelper constraintHelper) |
Modifier and Type | Method and Description |
---|---|
protected Set<ConstraintCheckIssue> |
checkMethodInternal(ExecutableElement currentMethod,
MethodInheritanceTree methodInheritanceTree)
Performs the check of a method.
|
protected boolean |
needToPerformAnyChecks(ExecutableElement currentMethod)
There can be situations in which no checks should be performed.
|
checkMethod, getEnclosingTypeElementQualifiedName
execute
public ReturnValueMethodOverrideCheck(Elements elementUtils, Types typeUtils, ConstraintHelper constraintHelper)
protected Set<ConstraintCheckIssue> checkMethodInternal(ExecutableElement currentMethod, MethodInheritanceTree methodInheritanceTree)
AbstractMethodOverrideCheck
checkMethodInternal
in class AbstractMethodOverrideCheck
currentMethod
- a method to checkmethodInheritanceTree
- the MethodInheritanceTree
of the method to checkprotected boolean needToPerformAnyChecks(ExecutableElement currentMethod)
AbstractMethodOverrideCheck
needToPerformAnyChecks
in class AbstractMethodOverrideCheck
currentMethod
- the method under investigationtrue
if we should proceed with checks and false
otherwiseCopyright © 2007-2019 Red Hat, Inc. All Rights Reserved