Class AnnotatedTypeCombiner
- java.lang.Object
-
- org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<R,AnnotatedTypeMirror>
-
- org.checkerframework.framework.type.visitor.DoubleAnnotatedTypeScanner<java.lang.Void>
-
- org.checkerframework.framework.type.visitor.AnnotatedTypeCombiner
-
- All Implemented Interfaces:
AnnotatedTypeVisitor<java.lang.Void,AnnotatedTypeMirror>
public class AnnotatedTypeCombiner extends DoubleAnnotatedTypeScanner<java.lang.Void>
Changes each parameter type to be the GLB of the parameter type and visited type.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
AnnotatedTypeScanner.Reduce<R>
-
-
Field Summary
-
Fields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes
-
-
Constructor Summary
Constructors Constructor Description AnnotatedTypeCombiner(QualifierHierarchy hierarchy)
Create an AnnotatedTypeCombiner.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
combine(AnnotatedTypeMirror from, AnnotatedTypeMirror to, QualifierHierarchy hierarchy)
Combines all annotations fromfrom
andto
intoto
using the GLB.protected void
combineAnnotations(AnnotatedTypeMirror from, AnnotatedTypeMirror to)
Computes the greatest lower bound of each set of annotations shared by from and to, and replaces the annotations in to with the result.protected java.lang.Void
defaultAction(AnnotatedTypeMirror one, AnnotatedTypeMirror two)
Called by default for any visit method that is not overridden.-
Methods inherited from class org.checkerframework.framework.type.visitor.DoubleAnnotatedTypeScanner
scan, scan, scanAndReduce, scanAndReduce, visitArray, visitDeclared, visitExecutable, visitIntersection, visitTypeVariable, visitUnion, visitWildcard
-
Methods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, reset, scan, scanAndReduce, visit, visit, visitNoType, visitNull, visitPrimitive
-
-
-
-
Constructor Detail
-
AnnotatedTypeCombiner
public AnnotatedTypeCombiner(QualifierHierarchy hierarchy)
Create an AnnotatedTypeCombiner.- Parameters:
hierarchy
- the hierarchy used to the compute the GLB
-
-
Method Detail
-
combine
public static void combine(AnnotatedTypeMirror from, AnnotatedTypeMirror to, QualifierHierarchy hierarchy)
Combines all annotations fromfrom
andto
intoto
using the GLB.- Parameters:
from
- the annotated type mirror from which to take annotationsto
- the annotated type mirror into which annotations should be combinedhierarchy
- the top type of the hierarchy whose annotations should be combined
-
defaultAction
protected java.lang.Void defaultAction(AnnotatedTypeMirror one, AnnotatedTypeMirror two)
Description copied from class:DoubleAnnotatedTypeScanner
Called by default for any visit method that is not overridden.- Specified by:
defaultAction
in classDoubleAnnotatedTypeScanner<java.lang.Void>
- Parameters:
one
- the type to visittwo
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
combineAnnotations
protected void combineAnnotations(AnnotatedTypeMirror from, AnnotatedTypeMirror to)
Computes the greatest lower bound of each set of annotations shared by from and to, and replaces the annotations in to with the result.- Parameters:
from
- the first set of annotationsto
- the second set of annotations. This is modified by side-effect to hold the result.
-
-