com.sun.source.tree

## Interface CompilationUnitTree

- All Superinterfaces:
    Tree

      public interface CompilationUnitTree
      extends Tree

  Represents the abstract syntax tree for compilation units (source files) and package declarations (package-info.java).
  Since:
    1.6
  See Also:
    "The Java Language Specification, 3rd ed, sections 7.3, and 7.4"

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.sun.source.tree.Tree

      `Tree.Kind`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<? extends ImportTree>` | `getImports()`
    `LineMap` | `getLineMap()` Gets the line map for this compilation unit, if available.
    `List<? extends AnnotationTree>` | `getPackageAnnotations()`
    `ExpressionTree` | `getPackageName()`
    `JavaFileObject` | `getSourceFile()`
    `List<? extends Tree>` | `getTypeDecls()`

    - ### Methods inherited from interface com.sun.source.tree.Tree

      `accept, getKind`

- - ### Method Detail

    - #### getPackageAnnotations

          List<? extends AnnotationTree> getPackageAnnotations()

    - #### getPackageName

          ExpressionTree getPackageName()

    - #### getImports

          List<? extends ImportTree> getImports()

    - #### getTypeDecls

          List<? extends Tree> getTypeDecls()

    - #### getSourceFile

          JavaFileObject getSourceFile()

    - #### getLineMap

          LineMap getLineMap()

      Gets the line map for this compilation unit, if available. Returns null if the line map is not available.
      Returns:
        the line map for this compilation unit

Copyright © 2005, 2014, Oracle and/or its affiliates. All rights reserved.