Class UnknownType

All Implemented Interfaces:
NodeWithRange<Node>, NodeWithTokenRange<Node>, Observable, Visitable, HasParentNode<Node>, Resolvable<ResolvedType>, Cloneable

public class UnknownType extends Type
An unknown parameter type object. It plays the role of a null object for lambda parameters that have no explicit type declared. As such, it has no lexical representation and hence gets no comment attributed.


In DoubleToIntFunction d = x -> (int)x + 1; the x parameter in bold has type UnknownType.

Author:
Didier Villevalois
  • Constructor Details

    • UnknownType

      public UnknownType()
    • UnknownType

      public UnknownType(TokenRange tokenRange)
      This constructor is used by the parser and is considered private.
  • Method Details

    • accept

      public <R,​ A> R accept(GenericVisitor<R,​A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Type Parameters:
      R - the type of the return value of the visitor
      A - the type the user argument passed to the visitor
      Parameters:
      v - the visitor implementation
      arg - the argument passed to the visitor (of type A)
      Returns:
      the result of the visit (of type R)
    • accept

      public <A> void accept(VoidVisitor<A> v, A arg)
      Description copied from interface: Visitable
      Accept method for visitor support.
      Type Parameters:
      A - the type the argument passed for the visitor
      Parameters:
      v - the visitor implementation
      arg - any value relevant for the visitor (of type A)
    • setAnnotations

      public UnknownType setAnnotations(NodeList<AnnotationExpr> annotations)
      Overrides:
      setAnnotations in class Type
    • asString

      public String asString()
      Specified by:
      asString in class Type
    • clone

      public UnknownType clone()
      Overrides:
      clone in class Type
    • getMetaModel

      public UnknownTypeMetaModel getMetaModel()
      Overrides:
      getMetaModel in class Type
      Returns:
      get JavaParser specific node introspection information.
    • isUnknownType

      public boolean isUnknownType()
      Overrides:
      isUnknownType in class Type
    • asUnknownType

      public UnknownType asUnknownType()
      Overrides:
      asUnknownType in class Type
    • ifUnknownType

      public void ifUnknownType(Consumer<UnknownType> action)
      Overrides:
      ifUnknownType in class Type
    • resolve

      public ResolvedType resolve()
      Specified by:
      resolve in interface Resolvable<ResolvedType>
      Specified by:
      resolve in class Type
    • toUnknownType

      public Optional<UnknownType> toUnknownType()
      Overrides:
      toUnknownType in class Type
    • isPhantom

      public boolean isPhantom()
      Overrides:
      isPhantom in class Node