src/jdk.compiler/share/classes/com/sun/source/tree/Scope.java

Print this page




  31 
  32 /**
  33  * Interface for determining locally available program elements, such as
  34  * local variables and imports.
  35  * Upon creation, a Scope is associated with a given program position;
  36  * for example, a {@linkplain Tree tree node}. This position may be used to
  37  * infer an enclosing method and/or class.
  38  *
  39  * <p>A Scope does not itself contain the details of the elements corresponding
  40  * to the parameters, methods and fields of the methods and classes containing
  41  * its position. However, these elements can be determined from the enclosing
  42  * elements.
  43  *
  44  * <p>Scopes may be contained in an enclosing scope. The outermost scope contains
  45  * those elements available via "star import" declarations; the scope within that
  46  * contains the top level elements of the compilation unit, including any named
  47  * imports.
  48  *
  49  * @since 1.6
  50  */
  51 @jdk.Exported
  52 public interface Scope {
  53     /**
  54      * Returns the enclosing scope.
  55      * @return the enclosing scope
  56      */
  57     public Scope getEnclosingScope();
  58 
  59     /**
  60      * Returns the innermost type element containing the position of this scope.
  61      * @return the innermost enclosing type element
  62      */
  63     public TypeElement getEnclosingClass();
  64 
  65     /**
  66      * Returns the innermost executable element containing the position of this scope.
  67      * @return the innermost enclosing method declaration
  68      */
  69     public ExecutableElement getEnclosingMethod();
  70 
  71     /**


  31 
  32 /**
  33  * Interface for determining locally available program elements, such as
  34  * local variables and imports.
  35  * Upon creation, a Scope is associated with a given program position;
  36  * for example, a {@linkplain Tree tree node}. This position may be used to
  37  * infer an enclosing method and/or class.
  38  *
  39  * <p>A Scope does not itself contain the details of the elements corresponding
  40  * to the parameters, methods and fields of the methods and classes containing
  41  * its position. However, these elements can be determined from the enclosing
  42  * elements.
  43  *
  44  * <p>Scopes may be contained in an enclosing scope. The outermost scope contains
  45  * those elements available via "star import" declarations; the scope within that
  46  * contains the top level elements of the compilation unit, including any named
  47  * imports.
  48  *
  49  * @since 1.6
  50  */

  51 public interface Scope {
  52     /**
  53      * Returns the enclosing scope.
  54      * @return the enclosing scope
  55      */
  56     public Scope getEnclosingScope();
  57 
  58     /**
  59      * Returns the innermost type element containing the position of this scope.
  60      * @return the innermost enclosing type element
  61      */
  62     public TypeElement getEnclosingClass();
  63 
  64     /**
  65      * Returns the innermost executable element containing the position of this scope.
  66      * @return the innermost enclosing method declaration
  67      */
  68     public ExecutableElement getEnclosingMethod();
  69 
  70     /**