public interface ProjectModulesModifier
JavaClassPathConstants.MODULE_COMPILE_PATH
or JavaClassPathConstants.MODULE_EXECUTE_PATH
respectively. The default implementation does nothing for projects (sources), which do
not use module-info
declaration, although they target JDK 9.Modifier and Type | Method and Description |
---|---|
boolean |
addRequiredModules(String pathType,
FileObject projectArtifact,
Collection<URL> locations)
Adds "requires" clauses to module-info.
|
Map<URL,Collection<ClassPath>> |
findModuleUsages(FileObject projectArtifact,
Collection<URL> locations)
Finds source groups which use the specified modules.
|
String |
provideModularClasspath(FileObject projectArtifact,
String classPathType)
Translates the classpath type into a proper modular one, if necessary.
|
boolean |
removeRequiredModules(String pathType,
FileObject projectArtifact,
Collection<URL> locations)
Removes "requires" clauses from module-info.
|
String provideModularClasspath(FileObject projectArtifact, String classPathType)
ClassPath.COMPILE
does not make sense, since it
is inaccessible (without specific startup parameters), so modular project may need to
diverge the request to some other classpath type.
If the project is not modular, or modular project can use artifacts from the original classpath
type, the value of null
should be returned. If null
is returned,
the ProjectModulesModifier.addRequiredModules(java.lang.String, org.openide.filesystems.FileObject, java.util.Collection<java.net.URL>)
or #removeRequiredModuels
should not be called.classPathType
- original classpath typeprojectArtifact
- source, directory which will determine the proper module-info.java
classPathType
.boolean addRequiredModules(String pathType, FileObject projectArtifact, Collection<URL> locations) throws IOException
projectArtifact
- source, directory which will determine the proper module-info.java
locations
- module names to add required directives forpathType
- the original path typeIOException
- on errorboolean removeRequiredModules(String pathType, FileObject projectArtifact, Collection<URL> locations) throws IOException
projectArtifact
- source, directory which will determine the proper module-info.java
locations
- module names whose required directives should be removedpathType
- the original path typeIOException
- on error@NonNull Map<URL,Collection<ClassPath>> findModuleUsages(FileObject projectArtifact, Collection<URL> locations)
projectArtifact
- project artifact a file owned by a project.locations
- locations whose usage should be found