getModulePackagesFromLayers

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.

Return

a map of ModuleName->ExportedPackages

Parameters

moduleLayers

a list of java.lang.ModuleLayer instances that should be used for type solving