code: @Nonnull
    // it's reflection, can't avoid unchecked cast
    @SuppressWarnings("unchecked")
    public static Module classNameToModule(final Parameters parameters, final Class<?> clazz,
        Optional<? extends Class<? extends Annotation>> annotation)
        throws IllegalAccessException, InvocationTargetException, InstantiationException {
      if (Module.class.isAssignableFrom(clazz)) {
        return instantiateModule((Class<? extends Module>) clazz, parameters, annotation);
      } else {
        // to abbreviate the names of modules in param files, if a class name is provided which
        // is not a Module, we check if there is an inner-class named Module which is a Module
        for (final String fallbackInnerClassName : FALLBACK_INNER_CLASS_NAMES) {
          final String fullyQualifiedName = clazz.getName() + "$" + fallbackInnerClassName;
          final Class<? extends Module> innerModuleClazz;
          try {
            innerModuleClazz = (Class<? extends Module>) Class.forName(fullyQualifiedName);
          } catch (ClassNotFoundException cnfe) {
            // it's okay, we just try the next one
            continue;
          }
  
          if (Module.class.isAssignableFrom(innerModuleClazz)) {
            return instantiateModule(innerModuleClazz, parameters, annotation);
          } else {
            throw new RuntimeException(clazz.getName() + " is not a module; "
                + fullyQualifiedName + " exists but is not a module");
          }
        }
  
        // if we got here, we didn't find any module
        throw new RuntimeException("Could not find inner class of " + clazz.getName()
            + " matching any of " + FALLBACK_INNER_CLASS_NAMES);
      }
    }
docs: Attempts to convert a module class name to an instantiate module by applying heuristics to
  construct it.
  
  It first tries to instantiate the provided class itself as a module, if possible. If it is not
  a module, it looks for an inner class called "Module",
  "FromParametersModule", or "FromParamsModule" which is a {@link Module}.
  
  When instantiating a module, it tries to find a constructor taking parameters and an annotation
  (if annotation is present), just an annotation, just parameters, or zero arguments.