docs: public String toJSON(final int indentWidth) {
          if (closed.get()) {
              throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
          }
          if (!scanSpec.enableClassInfo) {
              throw new IllegalArgumentException("Please call ClassGraph#enableClassInfo() before #scan()");
          }
          final List<ClassInfo> allClassInfo = new ArrayList<>(classNameToClassInfo.values());
          CollectionUtils.sortIfNotEmpty(allClassInfo);
          final List<PackageInfo> allPackageInfo = new ArrayList<>(packageNameToPackageInfo.values());
          CollectionUtils.sortIfNotEmpty(allPackageInfo);
          final List<ModuleInfo> allModuleInfo = new ArrayList<>(moduleNameToModuleInfo.values());
          CollectionUtils.sortIfNotEmpty(allModuleInfo);
          return JSONSerializer.serializeObject(new SerializationFormat(CURRENT_SERIALIZATION_FORMAT, scanSpec,
                  allClassInfo, allPackageInfo, allModuleInfo, rawClasspathEltOrderStrs), indentWidth, false);
      }