Package org.codehaus.janino

# Class Java.AbstractCompilationUnit

java.lang.Object
org.codehaus.janino.Java.AbstractCompilationUnit

All Implemented Interfaces:
  `Java.Scope`

Direct Known Subclasses:
  `Java.CompilationUnit`, `Java.ModularCompilationUnit`

Enclosing class:
  `Java`

public abstract static class Java.AbstractCompilationUnit extends Object implements Java.Scope
Holds the result of `Parser.parseAbstractCompilationUnit()`.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`Java.AbstractCompilationUnit.ImportDeclaration`
Base class for the various IMPORT declarations.
`static class`
`Java.AbstractCompilationUnit.SingleStaticImportDeclaration`
Represents a single static import declaration like
`static class`
`Java.AbstractCompilationUnit.SingleTypeImportDeclaration`
Represents a "single-type import declaration" like "`import java.util.Map;`".
`static class`
`Java.AbstractCompilationUnit.StaticImportOnDemandDeclaration`
Represents a static-import-on-demand declaration like
`static class`
`Java.AbstractCompilationUnit.TypeImportOnDemandDeclaration`
Represents a type-import-on-demand declaration like `import java.util.*;`.

## Field Summary

Fields
Modifier and Type
Field
Description
`final String`
`fileName`
A string that explains the "file" (or similar resource) where this compilation unit was loaded from.
`final Java.AbstractCompilationUnit.ImportDeclaration[]`
`importDeclarations`
The IMPORT declarations in this compilation unit.

## Constructor Summary

Constructors
Constructor
Description
`AbstractCompilationUnit(String fileName, Java.AbstractCompilationUnit.ImportDeclaration[] importDeclarations)`

## Method Summary

Modifier and Type
Method
Description
`abstract <R, EX extends Throwable>
R`
`accept(Visitor.AbstractCompilationUnitVisitor<R,EX> visitor)`
Invokes the "`visit...()`" method of `Visitor.AbstractCompilationUnitVisitor` for the concrete `Java.AbstractCompilationUnit` type.
`Java.Scope`
`getEnclosingScope()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### fileName

@Nullable public final String fileName
A string that explains the "file" (or similar resource) where this compilation unit was loaded from.

### importDeclarations

public final Java.AbstractCompilationUnit.ImportDeclaration[] importDeclarations
The IMPORT declarations in this compilation unit.

## Constructor Details

### AbstractCompilationUnit

public AbstractCompilationUnit(@Nullable String fileName, Java.AbstractCompilationUnit.ImportDeclaration[] importDeclarations)

## Method Details

### getEnclosingScope

public Java.Scope getEnclosingScope()

Specified by:
  `getEnclosingScope` in interface `Java.Scope`
Returns:
  The scope that encloses this scope, or `null`

### accept

@Nullable public abstract <R, EX extends Throwable> R accept(Visitor.AbstractCompilationUnitVisitor<R,EX> visitor) throws EX
Invokes the "`visit...()`" method of `Visitor.AbstractCompilationUnitVisitor` for the concrete `Java.AbstractCompilationUnit` type.

Throws:
  `EX`