public interface Check
extends org.revapi.configuration.Configurable
The methods on this interface are called in the following order:
initialize
setOldTypeEnvironment
setNewTypeEnvironment
(visitClass
(visitClass ... visitEnd)* //inner classes
(visitField
visitAnnotation*
visitEnd)*
(visitMethod
(visitMethodParameter
visitAnnotation*
visitEnd)*
visitAnnotation*
visitEnd)*
visitAnnotation*
visitEnd)*
Consider inheriting from the CheckBase
instead of directly implementing this
interface because it takes care of matching the corresponding visit*()
and visitEnd()
calls.
Modifier and Type | Interface and Description |
---|---|
static class |
Check.Type |
Modifier and Type | Method and Description |
---|---|
EnumSet<Check.Type> |
getInterest()
Each check typically checks only a single type of java element - a method or an annotation - but may be
interested in more.
|
boolean |
isDescendingOnNonExisting()
When the analyzer encounters an element that doesn't have a matching counterpart in the other version of the
API, by default, the analysis doesn't descend into the children of the existing element.
|
void |
setNewTypeEnvironment(TypeEnvironment env)
The environment containing the new version of the classes.
|
void |
setOldTypeEnvironment(TypeEnvironment env)
The environment containing the old version of the classes.
|
List<org.revapi.Difference> |
visitAnnotation(JavaAnnotationElement oldAnnotation,
JavaAnnotationElement newAnnotation)
Visiting annotation is slightly different, because it is not followed by the standard
visitEnd() call. |
void |
visitClass(JavaTypeElement oldType,
JavaTypeElement newType) |
List<org.revapi.Difference> |
visitEnd()
Each of the other visit* calls is followed by a corresponding call to this method in a stack-like
manner.
|
void |
visitField(JavaFieldElement oldField,
JavaFieldElement newField) |
void |
visitMethod(JavaMethodElement oldMethod,
JavaMethodElement newMethod) |
void |
visitMethodParameter(JavaMethodParameterElement oldParameter,
JavaMethodParameterElement newParameter) |
boolean isDescendingOnNonExisting()
void setOldTypeEnvironment(@Nonnull TypeEnvironment env)
Called once after the check has been instantiated.
env
- the environment to obtain the helper objects using which one can navigate and examine typesvoid setNewTypeEnvironment(@Nonnull TypeEnvironment env)
Called once after the check has been instantiated.
env
- the environment to obtain the helper objects using which one can navigate and examine typesEnumSet<Check.Type> getInterest()
This method must be used by the implementations to advertise what type of checks they are interested in.
Only the appropriate visit*
calls will then be made on the check instances.
@Nullable List<org.revapi.Difference> visitEnd()
I.e. a series of calls might look like this:
visitClass();
visitMethod();
visitEnd();
visitMethod();
visitEnd();
visitEnd(); //"ends" the visitClass()
void visitClass(@Nullable JavaTypeElement oldType, @Nullable JavaTypeElement newType)
void visitMethod(@Nullable JavaMethodElement oldMethod, @Nullable JavaMethodElement newMethod)
void visitMethodParameter(@Nullable JavaMethodParameterElement oldParameter, @Nullable JavaMethodParameterElement newParameter)
void visitField(@Nullable JavaFieldElement oldField, @Nullable JavaFieldElement newField)
@Nullable List<org.revapi.Difference> visitAnnotation(@Nullable JavaAnnotationElement oldAnnotation, @Nullable JavaAnnotationElement newAnnotation)
visitEnd()
call.
Instead, because visiting annotation is always "terminal" in a sense that an annotation doesn't have any child
elements, the list of differences is returned straight away.oldAnnotation
- the annotation in the old APInewAnnotation
- the annotation in the new APICopyright © 2014-2021 Lukas Krejci. All Rights Reserved.