public static void main(String[] args) throws IOException {
    if (args.length == 0 ||
        args.length == 1 && args[0].equals("-v")) {
      out.println();
      out.println("Usage: " + Analyzer.class.getName() + " [-v] [-plugin <plugin_id>] <hprof file>");
      System.exit(1);
    }

    Path hprofPath;
    ProgressIndicator progress;
    Function3<AnalysisContext, ListProvider, ProgressIndicator, String> analysisCallback;
    boolean onlyStrongReferences = false;
    boolean includeClassesAsRoots = true;
    int index = 0;
    if (args[index].equals("-v")) {
      index++;
      progress = new AnalyzerProgressIndicator();
    }
    else {
      progress = new EmptyProgressIndicator(ModalityState.nonModal());
    }
    if (args[index].equals("-plugin")) {
      index++;
      String pluginId = args[index];
      analysisCallback = (analysisContext, listProvider, progressIndicator) -> new AnalyzeClassloaderReferencesGraph(analysisContext, listProvider, pluginId).analyze(progressIndicator).getMainReport().toString();
      onlyStrongReferences = true;
      includeClassesAsRoots = false;
      index++;
    }
    else {
      analysisCallback = (analysisContext, listProvider, progressIndicator) -> new AnalyzeGraph(analysisContext, listProvider).analyze(progressIndicator).getMainReport().toString();
    }
    hprofPath = Paths.get(args[index]);

    String report;
    try (FileChannel channel = FileChannel.open(hprofPath, StandardOpenOption.READ)) {
      HProfAnalysis analysis = new HProfAnalysis(channel, new SystemTempFilenameSupplier(), analysisCallback);
      analysis.setOnlyStrongReferences(onlyStrongReferences);
      analysis.setIncludeClassesAsRoots(includeClassesAsRoots);
      report = analysis.analyze(progress);
      progress.setText("DONE");
    }
    out.println(report);
  }
public static void main(String[] args)