Class AnnotationFileParser.RecordComponentStub

java.lang.Object
org.checkerframework.framework.stub.AnnotationFileParser.RecordComponentStub
Enclosing class:
AnnotationFileParser

public static class AnnotationFileParser.RecordComponentStub extends Object
Information about a record component: the component's element, and whether there was an accessor in the stubs for that component. That is, for a component "foo" was there a method named exactly "foo()" in the stubs. If so, annotations on that accessor will take precedence over annotations that would otherwise be copied from the component in the stubs to the acessor.

The component's type and declaration annotations are not stored here; they are in annotationFileAnnos.atypes and annotationFileAnnos.declAnnos, keyed by elt, so that they are merged across annotation files like those of any other declaration.

  • Field Details

    • elt

      public final VariableElement elt
      The variable element of the record component.
  • Constructor Details

    • RecordComponentStub

      public RecordComponentStub(VariableElement elt)
      Creates a new RecordComponentStub with the given element.
      Parameters:
      elt - the variable element of the record component
  • Method Details

    • getAnnotationsForTarget

      public AnnotationMirrorSet getAnnotationsForTarget(ElementKind elementKind, Map<String,AnnotationMirrorSet> declAnnos)
      Returns the record component annotations that are applicable to the given element kind.
      Parameters:
      elementKind - the element kind to apply to (e.g., FIELD, METHOD)
      declAnnos - the global map of declaration annotations
      Returns:
      the set of annotations from the component that apply
    • hasAccessorInStubs

      public boolean hasAccessorInStubs()
      Returns true if there is an accessor in a stub file.
      Returns:
      true if some stub file contains an accessor for this record component
    • setHasAccessorInStubs

      public void setHasAccessorInStubs()
      Marks this record component as having an explicit accessor in a stub file: an accessor written in the stub file being parsed, or the hasAccessor flag of a serialized component record.