Class DynamicConstantExpr

  • All Implemented Interfaces:
    ASTNode, Expression

    public final class DynamicConstantExpr
    extends Object
    implements Expression
    A dynamic constant (condy, Java 11+) whose bootstrap method was not a recognized pattern, preserving the bootstrap information for display.
    • Constructor Detail

      • DynamicConstantExpr

        public DynamicConstantExpr​(String name,
                                   String descriptor,
                                   int bootstrapMethodIndex,
                                   String bootstrapOwner,
                                   String bootstrapName,
                                   String bootstrapDescriptor,
                                   SourceType type)
        Creates a dynamic constant with full bootstrap information; null arguments fall back to placeholders.
        Parameters:
        name - the constant name
        descriptor - the constant type descriptor
        bootstrapMethodIndex - the index into the BootstrapMethods attribute
        bootstrapOwner - the bootstrap method owner class
        bootstrapName - the bootstrap method name
        bootstrapDescriptor - the bootstrap method descriptor
        type - the inferred source type, or null for Object
      • DynamicConstantExpr

        public DynamicConstantExpr​(String name,
                                   String descriptor,
                                   int bootstrapMethodIndex,
                                   SourceType type)
        Creates a dynamic constant with unknown bootstrap owner, name, and descriptor.
        Parameters:
        name - the constant name
        descriptor - the constant type descriptor
        bootstrapMethodIndex - the index into the BootstrapMethods attribute
        type - the inferred source type, or null for Object
    • Method Detail

      • getName

        public String getName()
        Returns:
        the name
      • getDescriptor

        public String getDescriptor()
        Returns:
        the descriptor
      • getBootstrapMethodIndex

        public int getBootstrapMethodIndex()
        Returns:
        the bootstrap method index
      • getBootstrapOwner

        public String getBootstrapOwner()
        Returns:
        the bootstrap owner
      • getBootstrapName

        public String getBootstrapName()
        Returns:
        the bootstrap name
      • getBootstrapDescriptor

        public String getBootstrapDescriptor()
        Returns:
        the bootstrap descriptor
      • getType

        public SourceType getType()
        Description copied from interface: Expression
        Gets the inferred type of this expression.
        Specified by:
        getType in interface Expression
        Returns:
        the type
      • setType

        public void setType​(SourceType type)
        Parameters:
        type - the new inferred source type
      • getLocation

        public SourceLocation getLocation()
        Description copied from interface: ASTNode
        Gets the source location of this node.
        Specified by:
        getLocation in interface ASTNode
        Returns:
        the location
      • getParent

        public ASTNode getParent()
        Description copied from interface: ASTNode
        Gets the parent node in the AST tree.
        Specified by:
        getParent in interface ASTNode
        Returns:
        the parent
      • setParent

        public void setParent​(ASTNode parent)
        Description copied from interface: ASTNode
        Sets the parent node in the AST tree.
        Specified by:
        setParent in interface ASTNode
        Parameters:
        parent - the enclosing AST node
      • accept

        public <T> T accept​(SourceVisitor<T> visitor)
        Description copied from interface: ASTNode
        Accepts a visitor for this node.
        Specified by:
        accept in interface ASTNode
        Type Parameters:
        T - the return type of the visitor
        Parameters:
        visitor - the visitor to accept
        Returns:
        the result from the visitor
      • getFormattedBootstrapMethod

        public String getFormattedBootstrapMethod()
        Returns:
        the bootstrap method reference as owner.method with dots for slashes