モジュール jdk.compiler
パッケージ com.sun.source.util

クラスTrees

java.lang.Object
com.sun.source.util.Trees
直系の既知のサブクラス:
DocTrees

public abstract class Trees extends Object
JSR 199、JSR 269、およびTree APIをブリッジします。
  • コンストラクタの詳細

    • Trees

      public Trees()
      サブクラスが呼び出すためのコンストラクタ。
  • メソッドの詳細

    • instance

      public static Trees instance(JavaCompiler.CompilationTask task)
      指定されたCompilationTaskのTreesオブジェクトを返します。
      パラメータ:
      task - Treesオブジェクトを取得するコンパイル・タスク
      戻り値:
      Treesオブジェクト
      例外:
      IllegalArgumentException - タスクがTrees APIをサポートしていない場合。
    • instance

      public static Trees instance(ProcessingEnvironment env)
      指定されたProcessingEnvironmentのTreesオブジェクトを返します。
      パラメータ:
      env - Treesオブジェクトを取得する処理環境
      戻り値:
      Treesオブジェクト
      例外:
      IllegalArgumentException - envがTrees APIをサポートしていない場合。
    • getSourcePositions

      public abstract SourcePositions getSourcePositions()
      ソース位置を取得するためのユーティリティ・オブジェクトを返します。
      戻り値:
      ソース位置を取得するためのユーティリティ・オブジェクト
    • getTree

      public abstract Tree getTree(Element element)
      指定されたElementのTreeノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      element - 要素
      戻り値:
      ツリー・ノード
    • getTree

      public abstract ClassTree getTree(TypeElement element)
      指定されたTypeElementのClassTreeノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      element - 要素
      戻り値:
      クラス・ツリー・ノード
    • getTree

      public abstract MethodTree getTree(ExecutableElement method)
      指定されたExecutableElementのMethodTreeノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      method - 実行可能要素
      戻り値:
      メソッド・ツリー・ノード
    • getTree

      public abstract Tree getTree(Element e, AnnotationMirror a)
      指定されたElementのAnnotationMirrorのTreeノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      e - 要素
      a - 注釈ミラー
      戻り値:
      ツリー・ノード
    • getTree

      public abstract Tree getTree(Element e, AnnotationMirror a, AnnotationValue v)
      指定されたElementのAnnotationMirrorのAnnotationValueのTreeノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      e - 要素
      a - 注釈ミラー
      v - 注釈値
      戻り値:
      ツリー・ノード
    • getPath

      public abstract TreePath getPath(CompilationUnitTree unit, Tree node)
      指定されたコンパイル単位内のツリー・ノードへのパスを返します。
      パラメータ:
      unit - コンパイル単位
      node - ツリー・ノード
      戻り値:
      ツリー・パス
    • getPath

      public abstract TreePath getPath(Element e)
      指定されたElementのTreePathノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      e - 要素
      戻り値:
      ツリー・パス
    • getPath

      public abstract TreePath getPath(Element e, AnnotationMirror a)
      指定されたElementのAnnotationMirrorのTreePathノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      e - 要素
      a - 注釈ミラー
      戻り値:
      ツリー・パス
    • getPath

      public abstract TreePath getPath(Element e, AnnotationMirror a, AnnotationValue v)
      指定されたElementのAnnotationMirrorのAnnotationValueのTreePathノードを返します。 ノードが見つからない場合はnullを返します。
      パラメータ:
      e - 要素
      a - 注釈ミラー
      v - 注釈値
      戻り値:
      ツリー・パス
    • getElement

      public abstract Element getElement(TreePath path)
      指定されたTreePathによって識別されるTreeノードのElementを返します。 要素が利用できない場合は、nullを返します。
      パラメータ:
      path - ツリー・パス
      戻り値:
      要素
      例外:
      IllegalArgumentException - TreePathが、関連付けられたElementを持つ可能性があるTreeノードを識別しない場合。
    • getTypeMirror

      public abstract TypeMirror getTypeMirror(TreePath path)
      指定されたTreePathによって識別されるTreeノードのTypeMirrorを返します。 TypeMirrorが利用できない場合は、nullを返します。
      パラメータ:
      path - ツリー・パス
      戻り値:
      型ミラー
      例外:
      IllegalArgumentException - TreePathが、関連付けられたTypeMirrorを持つ可能性があるTreeノードを識別しない場合。
    • getScope

      public abstract Scope getScope(TreePath path)
      指定されたTreePathによって識別されるTreeノードのScopeを返します。 スコープが利用できない場合は、nullを返します。
      パラメータ:
      path - ツリー・パス
      戻り値:
      スコープ
    • getDocComment

      public abstract String getDocComment(TreePath path)
      指定されたTreePathによって識別されるTreeノードのdocコメントがあれば、それを返します。 ドキュメンテーション・コメントが見つからない場合は、nullを返します。
      パラメータ:
      path - ツリー・パス
      戻り値:
      ドキュメンテーションのコメント
      関連項目:
    • isAccessible

      public abstract boolean isAccessible(Scope scope, TypeElement type)
      指定されたスコープ内で、指定された型にアクセス可能であるかどうかを判定します。
      パラメータ:
      scope - チェック対象のスコープ
      type - チェック対象の型
      戻り値:
      typeがアクセス可能な場合はtrue
    • isAccessible

      public abstract boolean isAccessible(Scope scope, Element member, DeclaredType type)
      指定されたスコープ内で、指定された要素が、指定された型のメンバーとしてアクセス可能であるかどうかを判定します。
      パラメータ:
      scope - チェック対象のスコープ
      member - チェック対象のメンバー
      type - メンバーがアクセス可能かどうかを判定する型
      戻り値:
      typememberがアクセス可能な場合はtrue
    • getOriginalType

      public abstract TypeMirror getOriginalType(ErrorType errorType)
      ErrorTypeオブジェクトから元の型を返します。
      パラメータ:
      errorType - 元の型を取得するerrorType
      戻り値:
      元の型に対応する型ミラー。ErrorTypeに置き換えられる
    • printMessage

      public abstract void printMessage(Diagnostic.Kind kind, CharSequence msg, Tree t, CompilationUnitTree root)
      指定されたコンパイル単位内のツリーの位置に、指定された種類のメッセージを出力します
      パラメータ:
      kind - メッセージの種類
      msg - メッセージ、ない場合は空の文字列
      t - 位置のヒントとして使用するツリー
      root - ツリーを格納するコンパイル・ユニット
    • getLub

      public abstract TypeMirror getLub(CatchTree tree)
      catch句で宣言された例外パラメータのlubを返します。
      パラメータ:
      tree - catch節のツリー
      戻り値:
      例外パラメータのlub