Class ModuleLayerHelper
java.lang.Object
com.github.javaparser.symbolsolver.utils.ModuleLayerHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA ModuleLayer needs to be provided for the ReflectionTypeSolver and the boot layer (the module layer containing the module `java.base`) is chosen as a default.getModulePackagesFromLayers(Iterable<Object> moduleLayers) The JDK doesn't expose a simple mechanism for listing modules containing classes loaded by a classloader, so users who would like to solve types in modules need to provide a list of module layers containing the modules that should be discoverable by the type solver.
-
Constructor Details
-
ModuleLayerHelper
public ModuleLayerHelper()
-
-
Method Details
-
getModulePackagesFromLayers
public static HashMap<String, Set<String>> getModulePackagesFromLayers(Iterable<Object> moduleLayers) The JDK doesn't expose a simple mechanism for listing modules containing classes loaded by a classloader, so users who would like to solve types in modules need to provide a list of module layers containing the modules that should be discoverable by the type solver.
To maintain compatibility with Java 8, the ModuleLayer and Module classes introduced in Java 9 cannot be used, so reflection and the Object type are used instead.
Note: JavaParser currently does not support the exports...to... feature since necessary state information to handle this correctly is not tracked. If such support is added in the future, the signature of this method may change to include the extra information.- Parameters:
moduleLayers- a list of java.lang.ModuleLayer instances that should be used for type solving- Returns:
- a map of ModuleName->ExportedPackages
-
getBootModuleLayer
A ModuleLayer needs to be provided for the ReflectionTypeSolver and the boot layer (the module layer containing the module `java.base`) is chosen as a default. There may be advanced cases where this assumption is incorrect. In these cases, the ClassLoaderTypeSolver should be used instead.- Returns:
- the boot module layer, if it exists (i.e. on Java > 9)
-