Class TypeRecoverer


  • public class TypeRecoverer
    extends Object
    Recovers source types from IR types.
    • Constructor Detail

      • TypeRecoverer

        public TypeRecoverer()
    • Method Detail

      • recoverType

        public SourceType recoverType​(SSAValue value)
        Recovers a source type from an SSA value.
        Parameters:
        value - the SSA value, may be null or untyped
        Returns:
        the recovered type, void when there is nothing to recover from
      • recoverType

        public SourceType recoverType​(Value value)
        Recovers a source type from any Value (SSAValue or Constant).
        Parameters:
        value - the value, may be null
        Returns:
        the recovered type, void for null values and unrecognized value kinds
      • recoverTypeWithInstructionContext

        public SourceType recoverTypeWithInstructionContext​(SSAValue ssa)
        Recovers a source type from an SSAValue, considering its defining instruction.
        Parameters:
        ssa - the SSA value, may be null or untyped
        Returns:
        the recovered type, void when there is nothing to recover from
      • computeCommonType

        public SourceType computeCommonType​(Collection<SourceType> types)
        Computes a common supertype for a collection of types.
        Parameters:
        types - the collection of types to unify
        Returns:
        the common supertype
      • recoverType

        public SourceType recoverType​(IRType irType)
        Recovers a source type from an IR type.
        Parameters:
        irType - the IR type to convert
        Returns:
        the equivalent source type
      • recoverType

        public SourceType recoverType​(String descriptor)
        Recovers a source type from a JVM type descriptor.
        Parameters:
        descriptor - a field descriptor, may be null or empty
        Returns:
        the parsed type, void for an empty or unrecognized descriptor
      • recoverGenericType

        public SourceType recoverGenericType​(String signature)
        Recovers a source type from a JVM generic signature.
        Parameters:
        signature - the signature to parse, may be null or empty
        Returns:
        the parsed type, void when the signature is empty
      • recoverFormalTypeParameters

        public String recoverFormalTypeParameters​(String signature)
        Renders a class/method signature's formal type parameters, e.g. "<T extends Comparable<T>>", else "".
        Parameters:
        signature - the class or method signature, may be null
        Returns:
        the rendered parameter list, or "" when the signature declares none