Class ModuleFinder

java.lang.Object
sootup.java.bytecode.frontend.inputlocation.ModuleFinder

public class ModuleFinder extends Object
Discovers all modules in a given module path. For automatic modules, names are generated. Supports exploded modules, modular jars, and automatic modules as defined in the official documentation:
Author:
Andreas Dann on 28.06.18
See Also:
  • Constructor Details

    • ModuleFinder

      public ModuleFinder(@NonNull Path modulePath, @NonNull FileSystem fileSystem, @NonNull SourceType sourceType, @NonNull List<BodyInterceptor> bodyInterceptors)
      Helper Class to discover modules in a given module path.
      Parameters:
      modulePath - the module path
      sourceType -
    • ModuleFinder

      public ModuleFinder(@NonNull Path modulePath, @NonNull SourceType sourceType, @NonNull List<BodyInterceptor> bodyInterceptors)
    • ModuleFinder

      public ModuleFinder(@NonNull Path modulePath)
  • Method Details

    • hasMoreToResolve

      public boolean hasMoreToResolve()
    • getModuleInfo

      public @NonNull Optional<JavaModuleInfo> getModuleInfo(ModuleSignature sig)
    • getModules

      public @NonNull Set<ModuleSignature> getModules()
    • getModule

      public @Nullable AnalysisInputLocation getModule(@NonNull ModuleSignature moduleName)
      Returns the input location that manages the module.
      Parameters:
      moduleName - the module name
      Returns:
      the input location that resolves classes contained in the module
    • getAllModules

      public @NonNull Collection<ModuleSignature> getAllModules()
      Discover all modules in the module path.
      Returns:
      the names of all modules found
    • createModuleNameForAutomaticModule

      public static @NonNull String createModuleNameForAutomaticModule(@NonNull Path path)
      Creates a name for an automatic module based on the name of a jar file. The implementation is consistent with parsing module names in the JDK 9.
      Parameters:
      path - to the jar file
      Returns:
      the name of the automatic module
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object