- All Superinterfaces:
AutoCloseable
This acts as a nexus for managing the lifetime of test sources and directories, and should be used within a try-with-resources block to ensure temporary files get released after the test completes.
- Since:
- 0.0.1
- Author:
- Ashley Scopes
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddAnnotationProcessorPathModule(String moduleName, Path path) Add a module to the annotation processor path.default voidAdd a package to the annotation processor path.default voidaddClassOutputModule(String moduleName, Path path) Add a module to the class outputs.default voidaddClassOutputPackage(Path path) Add a package to the class outputs.default voidaddClassPathPackage(Path path) Add a package to the class path.voidaddModule(JavaFileManager.Location location, String moduleName, Path path) Add an existing package root to this workspace and associate it with the given module name in the given location.default voidaddModulePathModule(String moduleName, Path path) Add a module to the module path.default voidaddNativeHeaderOutputModule(String moduleName, Path path) Add a module to the native header outputs.default voidAdd a package to the native header outputs.voidaddPackage(JavaFileManager.Location location, Path path) Add an existing package root to this workspace and associate it with the given location.default voidaddPatchModulePathModule(String moduleName, Path path) Add a module to the patch module path.default voidAdd a package to the platform class path (also known as the boot class path).default voidaddSourceOutputModule(String moduleName, Path path) Add a module to the source outputs.default voidaddSourceOutputPackage(Path path) Add a package to the source outputs.default voidaddSourcePathModule(String moduleName, Path path) Add a module to the source path.default voidaddSourcePathPackage(Path path) Add a package to the source path.default voidaddSystemModulePathModule(String moduleName, Path path) Add a module to the system module path.default voidaddUpgradeModulePathModule(String moduleName, Path path) Add a module to the upgrade module path.voidclose()Attempt to close all resources in this workspace.default ManagedDirectorycreateAnnotationProcessorPathModule(String moduleName) Create a module in the annotation processor path.default ManagedDirectoryCreate a package in the annotation processor path.default ManagedDirectorycreateClassOutputModule(String moduleName) Create a module in the class outputs.default ManagedDirectoryCreate a package in the class outputs.default ManagedDirectoryCreate a package in the class path.createModule(JavaFileManager.Location location, String moduleName) Create a new test directory for a package root and associate it with the given module name in the given location.default ManagedDirectorycreateModulePathModule(String moduleName) Create a module in the module path.default ManagedDirectorycreateNativeHeaderOutputModule(String moduleName) Create a module in the native header outputs.default ManagedDirectoryCreate a package in the native header outputs.createPackage(JavaFileManager.Location location) Create a new test directory for a package root and associate it with the given location.default ManagedDirectorycreatePatchModulePathModule(String moduleName) Create a module in the patch module path.default ManagedDirectoryCreate a package in the platform class path (also known as the boot class path).default ManagedDirectorycreateSourceOutputModule(String moduleName) Create a module in the source outputs.default ManagedDirectoryCreate a package in the source outputs.default ManagedDirectorycreateSourcePathModule(String moduleName) Create a module in the source path.default ManagedDirectoryCreate a package in the source path.default ManagedDirectorycreateSystemModulePathModule(String moduleName) Create a module in the system module path.default ManagedDirectorycreateUpgradeModulePathModule(String moduleName) Create a module in the upgrade module path.Map<JavaFileManager.Location,List<? extends PathRoot>> Get an immutable copy of the current paths to operate on.Get the path strategy in use.
-
Method Details
-
addPackage
Add an existing package root to this workspace and associate it with the given location.The following constraints must be met, otherwise an
IllegalArgumentExceptionwill be thrown:-
The
locationmust not bemodule-oriented. -
The
pathmust exist.
- Parameters:
location- the location to associate with.path- the path to add.- Throws:
IllegalArgumentException- if the inputs are invalid.
-
The
-
addModule
Add an existing package root to this workspace and associate it with the given module name in the given location.The following constraints must be met, otherwise an
IllegalArgumentExceptionwill be thrown:-
The
locationmust bemodule-orientedor anoutput location. -
The
locationmust not be amodule-location handlealready. -
The
pathmust exist.
- Parameters:
location- the location to associate with.moduleName- the name of the module.path- the path to add.- Throws:
IllegalArgumentException- if the inputs are invalid.
-
The
-
addClassOutputPackage
Add a package to the class outputs.- Parameters:
path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addClassOutputModule
Add a module to the class outputs.- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addSourceOutputPackage
Add a package to the source outputs.- Parameters:
path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addSourceOutputModule
Add a module to the source outputs.- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addClassPathPackage
Add a package to the class path.- Parameters:
path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addModulePathModule
Add a module to the module path.- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addSourcePathPackage
Add a package to the source path.- Parameters:
path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addSourcePathModule
Add a module to the source path.Note that this will signal to the compiler to run in multi-module compilation mode. Any source packages that were
addedorcreateSourcePathPackage()created} will be ignored.If you are using a single-module, you can
add a source packageand include amodule-info.javain the base directory instead.- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addAnnotationProcessorPathPackage
Add a package to the annotation processor path.Note that this will be ignored if the compiler is provided with explicit annotation processor instances to run.
- Parameters:
path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addAnnotationProcessorPathModule
Add a module to the annotation processor path.Note that this will be ignored if the compiler is provided with explicit annotation processor instances to run.
- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addPlatformClassPathPackage
Add a package to the platform class path (also known as the boot class path).- Parameters:
path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addNativeHeaderOutputPackage
Add a package to the native header outputs.- Parameters:
path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addNativeHeaderOutputModule
Add a module to the native header outputs.- Parameters:
moduleName- the name of the module.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addUpgradeModulePathModule
Add a module to the upgrade module path.- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addSystemModulePathModule
Add a module to the system module path.- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
addPatchModulePathModule
Add a module to the patch module path.- Parameters:
moduleName- the module name.path- the path to add.- Throws:
IllegalArgumentException- if the path does not exist.
-
close
void close()Attempt to close all resources in this workspace.- Specified by:
closein interfaceAutoCloseable- Throws:
UncheckedIOException- if an error occurs.
-
createPackage
Create a new test directory for a package root and associate it with the given location.This path will be destroyed when the workspace is
closed.The following constraints must be met, otherwise an
IllegalArgumentExceptionwill be thrown:-
The
locationmust not bemodule-oriented.
- Parameters:
location- the location to associate with.- Returns:
- the test directory that was created.
- Throws:
IllegalArgumentException- if the inputs are invalid.
-
The
-
createModule
Create a new test directory for a package root and associate it with the given module name in the given location.This path will be destroyed when the workspace is
closed.The following constraints must be met, otherwise an
IllegalArgumentExceptionwill be thrown:-
The
locationmust bemodule-orientedor anoutput location. -
The
locationmust not be amodule-location handlealready.
- Parameters:
location- the location to associate with.moduleName- the module name to use.- Returns:
- the test directory that was created.
- Throws:
IllegalArgumentException- if the inputs are invalid.
-
The
-
createClassOutputPackage
Create a package in the class outputs.- Returns:
- the created test directory.
-
createClassOutputModule
Create a module in the class outputs.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createSourceOutputPackage
Create a package in the source outputs.- Returns:
- the created test directory.
-
createSourceOutputModule
Create a module in the source outputs.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createClassPathPackage
Create a package in the class path.- Returns:
- the created test directory.
-
createModulePathModule
Create a module in the module path.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createSourcePathPackage
Create a package in the source path.- Returns:
- the created test directory.
-
createSourcePathModule
Create a module in the source path.Note that this will signal to the compiler to run in multi-module compilation mode. Any source packages that were
createdoraddedwill be ignored.If you are using a single-module, you can
create a source packageand include amodule-info.javain the base directory instead.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createAnnotationProcessorPathPackage
Create a package in the annotation processor path.Note that this will be ignored if the compiler is provided with explicit annotation processor instances to run.
- Returns:
- the created test directory.
-
createAnnotationProcessorPathModule
Create a module in the annotation processor path.Note that this will be ignored if the compiler is provided with explicit annotation processor instances to run.
- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createPlatformClassPathPackage
Create a package in the platform class path (also known as the boot class path).- Returns:
- the created test directory.
-
createNativeHeaderOutputPackage
Create a package in the native header outputs.- Returns:
- the created test directory.
-
createNativeHeaderOutputModule
Create a module in the native header outputs.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createUpgradeModulePathModule
Create a module in the upgrade module path.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createSystemModulePathModule
Create a module in the system module path.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
createPatchModulePathModule
Create a module in the patch module path.- Parameters:
moduleName- the module name.- Returns:
- the created test directory.
-
getAllPaths
Map<JavaFileManager.Location,List<? extends PathRoot>> getAllPaths()Get an immutable copy of the current paths to operate on.- Returns:
- the paths.
-
getPathStrategy
Get the path strategy in use.- Returns:
- the path strategy.
-