Class QualifierDefaults.DefaultApplierElement

java.lang.Object
org.checkerframework.framework.util.defaults.QualifierDefaults.DefaultApplierElement
Enclosing class:
QualifierDefaults

protected class QualifierDefaults.DefaultApplierElement extends Object
A default applier element.
  • Field Details

    • atypeFactory

      protected final AnnotatedTypeFactory atypeFactory
      The annotated type factory.
    • qualHierarchy

      protected final QualifierHierarchy qualHierarchy
      The qualifier hierarchy.
    • scope

      protected final Element scope
      The scope of the default.
    • type

      protected final AnnotatedTypeMirror type
      The type to which to apply the default.
    • fromTree

      protected final boolean fromTree
      Whether the element came from a tree.
    • location

      protected TypeUseLocation location
      Location to which to apply the default. (Should only be set by the applyDefault method.)
    • impl

      The default element applier implementation.
  • Constructor Details

    • DefaultApplierElement

      public DefaultApplierElement(AnnotatedTypeFactory atypeFactory, Element scope, AnnotatedTypeMirror type, boolean fromTree)
      Create an instance.
      Parameters:
      atypeFactory - the type factory
      scope - the scope for the defaults
      type - the type to default
      fromTree - whether the element came from a tree
  • Method Details

    • applyDefault

      public void applyDefault(Default def)
      Apply default to the type.
      Parameters:
      def - default to apply
    • shouldBeAnnotated

      protected boolean shouldBeAnnotated(AnnotatedTypeMirror type)
      Returns true if the given qualifier should be applied to the given type. Currently we do not apply defaults to void types, packages, wildcards, and type variables.
      Parameters:
      type - type to which qual would be applied
      Returns:
      true if this application should proceed
    • addAnnotation

      protected void addAnnotation(AnnotatedTypeMirror type, AnnotationMirror qual)
      Add the qualifier to the type if it does not already have an annotation in the same hierarchy as qual.
      Parameters:
      type - type to add qual
      qual - annotation to add