Class IteratorAnnotatedTypeFactory

All Implemented Interfaces:
AnnotationProvider

public class IteratorAnnotatedTypeFactory extends ModifiabilityBaseAnnotatedTypeFactory
The annotated type factory for the IteratorChecker.
  • Constructor Details

    • IteratorAnnotatedTypeFactory

      public IteratorAnnotatedTypeFactory(BaseTypeChecker checker)
      Creates an IteratorAnnotatedTypeFactory.
      Parameters:
      checker - the associated type-checker
  • Method Details

    • expandsModifiabilityAliases

      protected boolean expandsModifiabilityAliases()
      Description copied from class: ModifiabilityBaseAnnotatedTypeFactory
      Returns true if this checker's hierarchy is one of the capabilities that the whole-modifiability aliases (@Modifiable, @Unmodifiable, @MaybeModifiable, @UnmodifiableParam, and @PolyModifiable) expand into. The Iterator hierarchy is not: it states what a collection's iterator preserves rather than whether a mutating method throws UnsupportedOperationException.
      Overrides:
      expandsModifiabilityAliases in class ModifiabilityBaseAnnotatedTypeFactory
      Returns:
      true if the whole-modifiability aliases expand into this checker's hierarchy
    • typesWithCapability

      protected List<TypeMirror> typesWithCapability()
      Description copied from class: ModifiabilityBaseAnnotatedTypeFactory
      Returns erased types whose every subtype has this checker's capability, unless ModifiabilityBaseAnnotatedTypeFactory.typeLacksCapability(javax.lang.model.type.TypeMirror) holds of the subtype. For example, the Replace Checker's result includes List.

      A type variable or wildcard may be instantiated by any subtype of its upper bound, including a subtype that also implements an unrelated interface. For example, a type variable whose upper bound is AbstractCollection or Serializable may be instantiated by HashSet, which cannot be replaced into. So an alias written on a type variable claims this checker's capability only if the upper bound is a subtype of one of these types.

      Specified by:
      typesWithCapability in class ModifiabilityBaseAnnotatedTypeFactory
      Returns:
      erased types whose subtypes have this checker's capability