Class InterfaceUnit

  • All Implemented Interfaces:
    CodeElement

    public class InterfaceUnit
    extends CompilationUnit
    A interface unit of the program to analyze. A interface unit is a Unit that only defines instance members, from which other units (both ClassUnit and InterfaceUnit) can inherit from
    • Constructor Detail

      • InterfaceUnit

        public InterfaceUnit​(CodeLocation location,
                             Program program,
                             java.lang.String name,
                             boolean sealed)
        Builds an interface unit, defined at the given location.
        Parameters:
        location - the location where the unit is define within the source file
        program - the program where this unit is defined
        name - the name of the unit
        sealed - whether or not this unit can be inherited from
    • Method Detail

      • canBeInstantiated

        public boolean canBeInstantiated()
        Description copied from class: Unit
        Yields true if this unit can be instantiated, false otherwise (e.g., interfaces, abstract classes).
        Specified by:
        canBeInstantiated in class Unit
        Returns:
        true if this unit can be instantiated, false otherwise
      • addSuperinterface

        public boolean addSuperinterface​(InterfaceUnit unit)
        Adds the given InterfaceUnit to the list of direct ancestors of this interface.
        Parameters:
        unit - the unit to add
        Returns:
        true only if the list has changed
      • addAncestor

        public boolean addAncestor​(CompilationUnit unit)
        Description copied from class: CompilationUnit
        Adds a new CompilationUnit as direct inheritance ancestor (i.e., superclass, interface, or superinterface) of this unit.
        Specified by:
        addAncestor in class CompilationUnit
        Parameters:
        unit - the unit to add
        Returns:
        true if the collection of ancestors changed as a result of the call