# Class Compilation

java.lang.Object
com.google.testing.compile.Compilation

public final class Compilation extends Object
The results of compiling source files.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`Compilation.Status`
The status of a compilation.

## Method Summary

Modifier and Type
Method
Description
`Compiler`
`compiler()`
The compiler.
`com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>>`
`diagnostics()`
All diagnostics reported during compilation.
`com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>>`
`errors()`
Errors reported during compilation.
`Optional<JavaFileObject>`
`generatedFile(JavaFileManager.Location location, String path)`
Returns the file at `path` if one was generated.
`Optional<JavaFileObject>`
`generatedFile(JavaFileManager.Location location, String packageName, String fileName)`
Returns the file with name `fileName` in package `packageName` if one was generated.
`com.google.common.collect.ImmutableList<JavaFileObject>`
`generatedFiles()`
Files generated during compilation.
`Optional<JavaFileObject>`
`generatedSourceFile(String qualifiedName)`
Returns the source file for the type with a given qualified name (no ".java" extension) if one was generated.
`com.google.common.collect.ImmutableList<JavaFileObject>`
`generatedSourceFiles()`
Source files generated during compilation.
`com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>>`
`notes()`
Notes reported during compilation.
`com.google.common.collect.ImmutableList<JavaFileObject>`
`sourceFiles()`
The source files compiled.
`Compilation.Status`
`status()`
The status of the compilation.
`String`
`toString()`
`com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>>`
`warnings()`
Warnings (including mandatory warnings) reported during compilation.

### Methods inherited from class Object

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

## Method Details

### compiler

public Compiler compiler()
The compiler.

### sourceFiles

public com.google.common.collect.ImmutableList<JavaFileObject> sourceFiles()
The source files compiled.

### status

public Compilation.Status status()
The status of the compilation.

### diagnostics

public com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>> diagnostics()
All diagnostics reported during compilation. The order of the returned list is unspecified.

See Also:
  - `errors()`
  - `warnings()`
  - `notes()`

### errors

public com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>> errors()
Errors reported during compilation.

### warnings

public com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>> warnings()
Warnings (including mandatory warnings) reported during compilation.

### notes

public com.google.common.collect.ImmutableList<Diagnostic<? extends JavaFileObject>> notes()
Notes reported during compilation.

### generatedFiles

public com.google.common.collect.ImmutableList<JavaFileObject> generatedFiles()
Files generated during compilation.

Throws:
  `IllegalStateException` - for failed compilations, since the state of the generated files is undefined in that case

### generatedSourceFiles

public com.google.common.collect.ImmutableList<JavaFileObject> generatedSourceFiles()
Source files generated during compilation.

Throws:
  `IllegalStateException` - for failed compilations, since the state of the generated files is undefined in that case

### generatedFile

public Optional<JavaFileObject> generatedFile(JavaFileManager.Location location, String path)
Returns the file at `path` if one was generated.

For example:

    Optional<JavaFileObject> fooClassFile =
        compilation.generatedFile(CLASS_OUTPUT, "com/google/myapp/Foo.class");

Throws:
  `IllegalStateException` - for failed compilations, since the state of the generated files is undefined in that case

### generatedFile

public Optional<JavaFileObject> generatedFile(JavaFileManager.Location location, String packageName, String fileName)
Returns the file with name `fileName` in package `packageName` if one was generated.

For example:

    Optional<JavaFileObject> fooClassFile =
        compilation.generatedFile(CLASS_OUTPUT, "com.google.myapp", "Foo.class");

Throws:
  `IllegalStateException` - for failed compilations, since the state of the generated files is undefined in that case

### generatedSourceFile

public Optional<JavaFileObject> generatedSourceFile(String qualifiedName)
Returns the source file for the type with a given qualified name (no ".java" extension) if one was generated.

For example:

    Optional<JavaFileObject> fooSourceFile =
        compilation.generatedSourceFile("com.google.myapp.Foo");

Throws:
  `IllegalStateException` - for failed compilations, since the state of the generated files is undefined in that case

### toString

public String toString()

Overrides:
  `toString` in class `Object`