Class ClassDeclaration

  • All Implemented Interfaces:
    Constants, RuntimeConstants

    public final class ClassDeclaration
    extends java.lang.Object
    implements Constants
    This class represents an Java class declaration. It refers to either a binary or source definition. ClassDefinitions are loaded on demand, this means that class declarations are late bound. The definition of the class is obtained in stages. The status field describes the state of the class definition: CS_UNDEFINED - the definition is not yet loaded CS_UNDECIDED - a binary definition is loaded, but it is still unclear if the source definition need to be loaded CS_BINARY - the binary class is loaded CS_PARSED - the class is loaded from the source file, the type information is available, but the class has not yet been compiled. CS_CHECKED - the class is loaded from the source file and has been type-checked. CS_COMPILED - the class has been type checked, compiled, and written out. CS_NOTFOUND - no class definition could be found WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
    • Field Detail

      • status

        int status
      • found

        private boolean found
        This is a flag for use by getClassDefinition(env). It is used to mark that a class has been successfully looked up by that method before.
    • Constructor Detail

      • ClassDeclaration

        public ClassDeclaration​(Identifier name)
        Constructor
    • Method Detail

      • getStatus

        public int getStatus()
        Get the status of the class
      • getName

        public Identifier getName()
        Get the name of the class
      • getType

        public Type getType()
        Get the type of the class
      • isDefined

        public boolean isDefined()
        Check if the class is defined
      • getClassDefinition

        public ClassDefinition getClassDefinition()
        Get the definition of this class. Returns null if the class is not yet defined.
      • getClassDefinition

        public ClassDefinition getClassDefinition​(Environment env)
                                           throws ClassNotFound
        Get the definition of this class, if the class is not yet defined, load the definition. Loading a class may throw various exceptions.
        Throws:
        ClassNotFound
      • getClassDefinitionNoCheck

        public ClassDefinition getClassDefinitionNoCheck​(Environment env)
                                                  throws ClassNotFound
        Get the definition of this class, if the class is not yet defined, load the definition. Loading a class may throw various exceptions. Perform no basicCheck() on this class.
        Throws:
        ClassNotFound
      • setDefinition

        public void setDefinition​(ClassDefinition definition,
                                  int status)
        Set the class definition
      • equals

        public boolean equals​(java.lang.Object obj)
        Equality
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        toString
        Overrides:
        toString in class java.lang.Object