Tree
public interface CompilationUnitTree extends Tree
Modifier and Type | Method | Description |
---|---|---|
List |
getImports() |
Returns the import declarations appearing in this compilation unit, or an empty list if there are no import declarations. |
LineMap |
getLineMap() |
Returns the line map for this compilation unit, if available, or null if the line map is not available. |
default ModuleTree |
getModule() |
Returns the module tree associated with this compilation unit, or null if there is no module declaration. |
PackageTree |
getPackage() |
Returns the package tree associated with this compilation unit, or null if there is no package declaration. |
List |
getPackageAnnotations() |
Returns the annotations listed on any package declaration at the head of this compilation unit, or null if there is no package declaration. |
ExpressionTree |
getPackageName() |
Returns the name contained in any package declaration at the head of this compilation unit, or null if there is no package declaration. |
JavaFileObject |
getSourceFile() |
Returns the file object containing the source for this compilation unit. |
List |
getTypeDecls() |
Returns the type declarations appearing in this compilation unit, or an empty list if there are no type declarations. |
default ModuleTree getModule()
null
if there is no module declaration.UnsupportedOperationException
List<? extends AnnotationTree> getPackageAnnotations()
null
if there is no package declaration.ExpressionTree getPackageName()
null
if there is no package declaration.PackageTree getPackage()
null
if there is no package declaration.List<? extends ImportTree> getImports()
List<? extends Tree> getTypeDecls()
JavaFileObject getSourceFile()
LineMap getLineMap()
null
if the line map is not available.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/tree/CompilationUnitTree.html