Package randoop.types

Class TypeArgument

    • Constructor Detail

      • TypeArgument

        public TypeArgument()
    • Method Detail

      • forType

        public static TypeArgument forType​(Type type)
        Converts a java.lang.reflect.Type to a TypeArgument object.
        Parameters:
        type - the type of a type argument
        Returns:
        the TypeArgument for the given type
      • substitute

        public abstract TypeArgument substitute​(Substitution substitution)
        Applies the type substitution to this type argument.
        Parameters:
        substitution - the substitution
        Returns:
        a version of this type argument with type variables replaced by the substitution
      • contains

        public abstract boolean contains​(TypeArgument otherArgument)
        Checks whether this type argument contains another argument, using relationship defined in JLS Section 4.5.1.
        Parameters:
        otherArgument - the other TypeArgument
        Returns:
        true if this argument contains the other argument
      • getTypeParameters

        public List<TypeVariable> getTypeParameters()
        The type parameters for this type argument.
        Returns:
        the list of type parameters for this argument
      • hasWildcard

        public boolean hasWildcard()
        Indicate whether this type argument has a wildcard.
        Returns:
        true if this argument has a wildcard argument
      • hasCaptureVariable

        public boolean hasCaptureVariable()
        Indicate whether this type argument has a capture variable.
        Returns:
        true if this argument has a capture variable
      • isGeneric

        public final boolean isGeneric()
        Indicates whether this type argument is generic.
        Returns:
        true if this type argument is generic, false otherwise
      • isGeneric

        public abstract boolean isGeneric​(boolean ignoreWildcards)
        Indicates whether this type argument is generic.
        Parameters:
        ignoreWildcards - if true, ignore wildcards; that is, treat wildcards as not making the operation generic
        Returns:
        true if this type argument is generic, false otherwise
      • isInstantiationOfTypeArgument

        boolean isInstantiationOfTypeArgument​(TypeArgument otherArgument)
        Determines whether this type argument is an instantiation of the other argument.
        Parameters:
        otherArgument - the other argument
        Returns:
        true if this type is an instantiation of the other argument, false otherwise
        See Also:
        InstantiatedType.isInstantiationOf(ReferenceType)
      • isWildcard

        public boolean isWildcard()
        Indicate whether this type argument is a wildcard argument.
        Returns:
        true if this is a wildcard argument, false otherwise
      • getInstantiatingSubstitution

        public Substitution getInstantiatingSubstitution​(TypeArgument goalType)
        Returns a unifying substitution. Returns null if unification failed.
        Parameters:
        goalType - the generic type for which a substitution is needed
        Returns:
        a substitution unifying this type or a supertype of this type with the goal type, or null if unification failed
      • isVariable

        public abstract boolean isVariable()
        Indicate whether this type argument is a type variable.
        Returns:
        true if this argument is a type variable, false otherwise
      • getFqName

        public abstract String getFqName()
        Return the fully-qualified name.
        Returns:
        the fully-qualified name
      • getBinaryName

        public abstract String getBinaryName()
        Return the binary name.
        Returns:
        the binary name