docs: public static @CheckForNull
      BugCollectionAndInstance findBugCollectionAndInstanceForMarker(IMarker marker) {
  
          IResource resource = marker.getResource();
          IProject project = resource.getProject();
          if (project == null) {
              // Also shouldn't happen.
              FindbugsPlugin.getDefault().logError("No project for warning marker");
              return null;
          }
          if (!isFindBugsMarker(marker)) {
              // log disabled because otherwise each selection in problems view
              // generates
              // 6 new errors (we need refactor all bug views to get rid of this).
              // FindbugsPlugin.getDefault().logError("Selected marker is not a FindBugs marker");
              // FindbugsPlugin.getDefault().logError(marker.getType());
              // FindbugsPlugin.getDefault().logError(FindBugsMarker.NAME);
              return null;
          }
  
          // We have a FindBugs marker. Get the corresponding BugInstance.
          String bugId = marker.getAttribute(FindBugsMarker.UNIQUE_ID, null);
          if (bugId == null) {
              FindbugsPlugin.getDefault().logError("Marker does not contain unique id for warning");
              return null;
          }
  
          try {
              BugCollection bugCollection = FindbugsPlugin.getBugCollection(project, null);
              if (bugCollection == null) {
                  FindbugsPlugin.getDefault().logError("Could not get BugCollection for SpotBugs marker");
                  return null;
              }
  
              String bugType = (String) marker.getAttribute(FindBugsMarker.BUG_TYPE);
              Integer primaryLineNumber = (Integer) marker.getAttribute(FindBugsMarker.PRIMARY_LINE);
  
              // compatibility
              if (primaryLineNumber == null) {
                  primaryLineNumber = Integer.valueOf(getEditorLine(marker));
              }
  
              if (bugType == null) {
                  FindbugsPlugin.getDefault().logError(
                          "Could not get find attributes for marker " + marker + ": (" + bugId + ", " + primaryLineNumber + ")");
                  return null;
              }
              BugInstance bug = bugCollection.findBug(bugId, bugType, primaryLineNumber.intValue());
              if(bug == null) {
                  FindbugsPlugin.getDefault().logError(
                          "Could not get find bug for marker on " + resource + ": (" + bugId + ", " + primaryLineNumber + ")");
                  return null;
              }
              return new BugCollectionAndInstance(bugCollection, bug);
          } catch (CoreException e) {
              FindbugsPlugin.getDefault().logException(e, "Could not get BugInstance for SpotBugs marker");
              return null;
          }
      }