Class InferenceVar

  • All Implemented Interfaces:
    JTypeMirror, JTypeVisitable, SubstVar

    public final class InferenceVar
    extends Object
    implements JTypeMirror, SubstVar
    Represents an inference variable. Inference variables are just placeholder for types, used during the inference process. After type inference they should have been erased and hence this type is of no importance outside the implementation of this framework.
    • Method Detail

      • withAnnotations

        public JTypeMirror withAnnotations​(org.pcollections.PSet<SymbolicValue.SymAnnot> newTypeAnnots)
        Description copied from interface: JTypeMirror
        Returns a type mirror that is equal to this instance but has different type annotations. Note that some types ignore this method and return themselves without changing. Eg the null type cannot be annotated.
        Specified by:
        withAnnotations in interface JTypeMirror
        Parameters:
        newTypeAnnots - New type annotations (not null)
        Returns:
        A new type, maybe this one
      • getTypeAnnotations

        public org.pcollections.PSet<SymbolicValue.SymAnnot> getTypeAnnotations()
        Description copied from interface: JTypeMirror
        Return a list of annotations on this type. Annotations can be written on nearly any type (eg @A Out.@B In<@C T>, @A ? extends @B Up).

        For JTypeVar, this includes both the annotations defined on the type var and those defined at use site. For instance

        
            <@A T> void accept(@B T t);
         
        The T type var will have annotation @A in the symbol (AnnotableSymbol.getDeclaredAnnotations()) and in the type var that is in the JMethodSig.getTypeParameters(). In the formal parameter, the type var will have annotations @B @A.
        Specified by:
        getTypeAnnotations in interface JTypeMirror
      • getName

        public String getName()
      • isEquivalentTo

        public boolean isEquivalentTo​(JTypeMirror t)
      • isSubtypeNoSideEffect

        public boolean isSubtypeNoSideEffect​(@NonNull JTypeMirror other)
      • isSupertypeNoSideEffect

        public boolean isSupertypeNoSideEffect​(@NonNull JTypeMirror other)
      • acceptVisitor

        public <T,​P> T acceptVisitor​(JTypeVisitor<T,​P> visitor,
                                           P p)
        Description copied from interface: JTypeVisitable
        Accept a type visitor, dispatching on this object's runtime type to the correct method of the visitor.
        Specified by:
        acceptVisitor in interface JTypeVisitable
        Type Parameters:
        T - Type of result of the visitor
        P - Type of data of the visitor
      • toString

        public String toString()
        Description copied from interface: JTypeMirror
        The toString of type mirrors prints useful debug information, but shouldn't be relied on anywhere, as it may change anytime. Use TypePrettyPrint to display types.
        Specified by:
        toString in interface JTypeMirror
        Overrides:
        toString in class Object