Class AnnotatedTypeCombiner

All Implemented Interfaces:
AnnotatedTypeVisitor<Void,AnnotatedTypeMirror>

public class AnnotatedTypeCombiner extends DoubleAnnotatedTypeScanner<Void>
Changes each parameter type to be the GLB of the parameter type and visited type.
  • Constructor Details

    • AnnotatedTypeCombiner

      public AnnotatedTypeCombiner(QualifierHierarchy hierarchy)
      Create an AnnotatedTypeCombiner.
      Parameters:
      hierarchy - the hierarchy used to the compute the GLB
  • Method Details

    • combine

      public static void combine(AnnotatedTypeMirror from, AnnotatedTypeMirror to, QualifierHierarchy hierarchy)
      Combines all annotations from from and to into to using the GLB.
      Parameters:
      from - the annotated type mirror from which to take annotations
      to - the annotated type mirror into which annotations should be combined
      hierarchy - the top type of the hierarchy whose annotations should be combined
    • defaultAction

      protected 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 class DoubleAnnotatedTypeScanner<Void>
      Parameters:
      one - the type to visit
      two - 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 annotations
      to - the second set of annotations. This is modified by side-effect to hold the result.