Finbugs version 3.0 (supporting Java 1.8) does not work

I am using Java 8 for my latest projects and therefor was excited about the new findbugs 3.0 release (released this month). Since the 3.0 version of findbugs is now found in repositories my build fails.

I use the following code in my build.gradle to enable finbugs 3.0:

apply plugin: 'findbugs'
...
findbugs {
    toolVersion: '+'
}
...

When applying this my builds run forever in task findbugsMain. The debug output of the task looks like this:

...
12:04:49.825 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
12:04:49.827 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: Gradle FindBugs Worker 1.
12:04:49.832 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
12:04:49.833 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
12:04:49.833 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'Gradle FindBugs Worker 1'
12:04:50.496 [DEBUG] [system.out] 12:04:50.494 [DEBUG] [org.gradle.messaging.remote.internal.inet.TcpOutgoingConnector] Attempting to connect to [feece2be-4656-4470-b332-f15610
251e16 port:34671, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]].
12:04:50.497 [DEBUG] [system.out] 12:04:50.497 [DEBUG] [org.gradle.messaging.remote.internal.inet.TcpOutgoingConnector] Trying to connect to address /0:0:0:0:0:0:0:1%lo.
12:04:50.504 [DEBUG] [org.gradle.messaging.remote.internal.inet.TcpIncomingConnector] Accepted connection from /0:0:0:0:0:0:0:1:37219 to /0:0:0:0:0:0:0:1:34671.
12:04:50.505 [DEBUG] [system.out] 12:04:50.504 [DEBUG] [org.gradle.messaging.remote.internal.inet.TcpOutgoingConnector] Connected to address /0:0:0:0:0:0:0:1%lo:34671.
12:04:50.512 [DEBUG] [org.gradle.process.internal.DefaultWorkerProcess] Received connection org.gradle.messaging.remote.internal.hub.MessageHubBackedObjectConnection@4cbe484a f
rom Gradle FindBugs Worker 1
12:04:50.557 [DEBUG] [system.out] 12:04:50.556 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Starting Gradle FindBugs Worker 1.
12:04:50.558 [DEBUG] [system.out] 12:04:50.557 [DEBUG] [org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer] Executing FindBugs worker.
Scanning archives (56 / 56)m.out] 12:04:52.810 [QUIET] [system.out]
 2 analysis passes to perform.out] 12:04:53.144 [QUIET] [system.out]
 12:04:53.721 [DEBUG] [system.out] 12:04:53.721 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Stopping client connection.
12:04:53.723 [DEBUG] [system.err] 12:04:53.723 [ERROR] [system.err] java.lang.AbstractMethodError: edu.umd.cs.findbugs.detect.NoteSuppressedWarnings.visitBootstrapMethods(Lorg/
apache/bcel/classfile/BootstrapMethods;)V
12:04:53.724 [DEBUG] [system.err] 12:04:53.724 [ERROR] [system.err]
   at org.apache.bcel.classfile.BootstrapMethods.accept(BootstrapMethods.java:63)
12:04:53.724 [DEBUG] [system.err] 12:04:53.724 [ERROR] [system.err]
   at edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:393)
12:04:53.724 [DEBUG] [system.err] 12:04:53.724 [ERROR] [system.err]
   at org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:215)
12:04:53.725 [DEBUG] [system.err] 12:04:53.724 [ERROR] [system.err]
   at edu.umd.cs.findbugs.detect.NoteSuppressedWarnings.visitClassContext(NoteSuppressedWarnings.java:79)
12:04:53.725 [DEBUG] [system.err] 12:04:53.725 [ERROR] [system.err]
   at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
12:04:53.725 [DEBUG] [system.err] 12:04:53.725 [ERROR] [system.err]
   at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1089)
12:04:53.725 [DEBUG] [system.err] 12:04:53.725 [ERROR] [system.err]
   at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:283)
12:04:53.726 [DEBUG] [system.err] 12:04:53.726 [ERROR] [system.err]
   at org.gradle.api.plugins.quality.internal.findbugs.FindBugsExecuter.runFindbugs(FindBugsExecuter.java:4
4)
12:04:53.726 [DEBUG] [system.err] 12:04:53.726 [ERROR] [system.err]
   at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer.execute(FindBugsWorkerServer.ja
va:45)
12:04:53.726 [DEBUG] [system.err] 12:04:53.726 [ERROR] [system.err]
   at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer.execute(FindBugsWorkerServer.ja
va:35)
12:04:53.727 [DEBUG] [system.err] 12:04:53.726 [ERROR] [system.err]
   at org.gradle.api.plugins.quality.internal.findbugs.FindBugsWorkerServer.execute(FindBugsWorkerServer.ja
va:26)
12:04:53.727 [DEBUG] [system.err] 12:04:53.727 [ERROR] [system.err]
   at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:78)
12:04:53.727 [DEBUG] [system.err] 12:04:53.727 [ERROR] [system.err]
   at org.gradle.process.internal.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:35)
12:04:53.727 [DEBUG] [system.err] 12:04:53.727 [ERROR] [system.err]
   at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWo
rker.java:85)
12:04:53.728 [DEBUG] [system.err] 12:04:53.728 [ERROR] [system.err]
   at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWo
rker.java:41)
12:04:53.728 [DEBUG] [system.err] 12:04:53.728 [ERROR] [system.err]
   at org.gradle.process.internal.child.IsolatedApplicationClassLoaderWorker.call(IsolatedApplicationClassL
oaderWorker.java:48)
12:04:53.728 [DEBUG] [system.err] 12:04:53.728 [ERROR] [system.err]
   at org.gradle.process.internal.child.IsolatedApplicationClassLoaderWorker.call(IsolatedApplicationClassL
oaderWorker.java:30)
12:04:53.731 [DEBUG] [system.err] 12:04:53.728 [ERROR] [system.err]
   at org.gradle.process.internal.launcher.GradleWorkerMain.run(GradleWorkerMain.java:32)
12:04:53.731 [DEBUG] [system.err] 12:04:53.729 [ERROR] [system.err]
   at org.gradle.process.internal.launcher.GradleWorkerMain.main(GradleWorkerMain.java:37)
12:04:53.770 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
12:04:53.771 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'Gradle FindBugs Worker 1' finished with exit value 1 (state: FAILED)

BTW: I am using gradle 2.0 (with java 1.8 and findbugs 3.0) Without applying the findbugs plugin everything works as expected.

Could this please go into the gradle issue tracker? What do I have to do to get it marked as an issue (the gradle issue tracker tells me that I should use the forums to open new issues :-))

Several other users have reported that it works fine for them. Can you try with version ‘3.0.0’?

Tried it with version 3.0.0 -> same result Also tried cleaning the gradle cache (to prevent dependency problems from intermediate releases) with the no success

I created a simple sample project to be sure it is not related to my code. The result is that is not related to my code, but to the asciidoctor plugin. As soon as I activate the asciidoctor plugin (from here: https://github.com/asciidoctor/asciidoctor-gradle-plugin) the build fails. When this plugin is deactivated findbugs works well…

This means that there is a version conflict between FindBugs and AsciiDoctor dependencies (most likely the BCEL dependency). You need to investigate whether there is a BCEL version that works for both of them, and if so, force it (see the dependency management chapter in the Gradle User Guide for details).

Usually I would agree with that, but the output of “gradle dependencies” looks different:

------------------------------------------------------------
Root project
------------------------------------------------------------
  archives - Configuration for archive artifacts.
No dependencies
  asciidoctor
\--- org.asciidoctor:asciidoctorj:1.5.0.preview.7
     +--- org.slf4j:slf4j-api:1.7.5
     +--- org.jruby:jruby-complete:1.7.9
     \--- com.beust:jcommander:1.32
  compile - Compile classpath for source set 'main'.
No dependencies
  default - Configuration for default artifacts.
No dependencies
  findbugs - The FindBugs libraries to be used for this project.
\--- com.google.code.findbugs:findbugs:3.0.0
     +--- net.jcip:jcip-annotations:1.0
     +--- com.google.code.findbugs:jsr305:2.0.1
     +--- org.apache.bcel:bcel:6.0-20140709
     +--- com.google.code.findbugs:jFormatString:2.0.1
     +--- dom4j:dom4j:1.6.1
     |
  \--- xml-apis:xml-apis:1.0.b2
     +--- org.ow2.asm:asm-debug-all:5.0.2
     +--- org.ow2.asm:asm-commons:5.0.2
     |
  \--- org.ow2.asm:asm-tree:5.0.2
     |
       \--- org.ow2.asm:asm:5.0.2
     +--- commons-lang:commons-lang:2.6
     +--- com.apple:AppleJavaExtensions:1.4
     \--- jaxen:jaxen:1.1.6
  findbugsPlugins - The FindBugs plugins to be used for this project.
No dependencies
  runtime - Runtime classpath for source set 'main'.
No dependencies
  testCompile - Compile classpath for source set 'test'.
No dependencies
  testRuntime - Runtime classpath for source set 'test'.
No dependencies
  BUILD SUCCESSFUL

Good point. I don’t understand how asciidoctor could have any influence on findbugs, which even runs in its own process.

Interesting detail is that it works with asciidoctor until version 0.7.1 (it’s broken with 0.7.2 and 0.7.3) In the github issue tracker of the plugin one can find that since 0.7.2 an URLClassLoader is used to enable dynamic loading of asciidoctorj.

I am not sure but there sem to be some problems with this loader that could be fixed with asciidoctorj 1.5.0Final…

However, I will open a bug for the asciidoctor plugin…

I was getting this problem before but the following explicit dependencies solve the issue:

dependencies {
     findbugs 'com.google.code.findbugs:findbugs:3.0.+'
     findbugs 'com.google.code.findbugs:bcel-findbugs:6.0'
     findbugs 'com.google.code.findbugs:jFormatString:3.0.+'
}

Basically the issue is that some of the plugins used (which includes asciidoc give you wrong dependency for some reason on bcel/jformatstring.