Locating compiled .class files

The FindBugs plugin works by analyzing the compiled .class files, and then reports the findings on the corresponding source files.
Currently the .class files are located using the built-in java plugin through the DefaultJavaResourceLocator class.

  • The DefaultJavaResourceLocator.classpath() method works but for Gradle multi module projects it also returns the .class files from the dependent projects, so the analysis takes longer
  • The DefaultJavaResourceLocator.classFilesToAnalyze() seems to returns a set of classes built as a side effect of the java analysis. I have bug reports that this seems to return no classes for PR analysis and also seems to have side effect with the ThymeLeaf sensor. Unfortunately cannot reproduce these issues with the community edition

Basically I would like to get the content of sonar.java.binaries but this is not trivial (for instance I’d need to match paths such as /target/**/*-classes/**/*.class)
This is already implemented by the java plugin but it does not seem to be exposed through the API, would it be possible to expose it? Or is there a way to get it already?
Ideally I would also like to get the compiled test classes (so ClasspathForTest)