Class InterningAnnotatedTypeFactory

All Implemented Interfaces:
AnnotationProvider

public class InterningAnnotatedTypeFactory extends BaseAnnotatedTypeFactory
An AnnotatedTypeFactory that accounts for the properties of the Interned type system. This type factory will add the Interned annotation to a type if the input:
  1. is a String literal
  2. is a class literal
  3. has an enum type
  4. has a primitive type
  5. has the type java.lang.Class
  6. is a use of a class declared to be @Interned
This type factory adds InternedDistinct to formal parameters that have a @FindDistinct declaration annotation. (TODO: That isn't a good implementation, because it is not accurate: the value might be equals() to some other Java value. More seriously, it permits too much. Writing @FindDistinct should permit equality tests on the given formal parameter, but should not (for example) permit the formal parameter to be assigned into an @InternedDistinct location.)

This factory extends BaseAnnotatedTypeFactory and inherits its functionality, including: flow-sensitive qualifier inference, qualifier polymorphism (of PolyInterned), implicit annotations via DefaultFor on Interned (to handle cases 1, 2, 4), and user-specified defaults via DefaultQualifier. Case 5 is handled by the stub library.