Gradle 4.0-milestone-2 - AbstractMethodError with SingleFileReport

gradle-core

(Szczepan Faber) #1

Hey guys,

When we use Gradle 4.0-milestone-2 we get AbstractMethodError with our custom implementations of org.gradle.api.reporting.SingleFileReport:

Caused by: java.lang.AbstractMethodError: com.linkedin.ligradle.quality.findbugs.LiFindBugsPlugin$RichXmlReport.setDestination(Ljava/io/File;)V

There were some changes in SingleFileReport interface: (see SingleFileReport.setDestination in 3.5 and SingleFileReport.setDestination in 4.0.

It looks like we need to recompile our plugin code with Gradle 4.0 to resolve the problem (and tweak the implementation to add new methods). However, we cannot do it right now because this would effectively force everybody at LinkedIn to use Gradle 4.0.

Questions:

  1. Is this a known incompatible change that is intended to go out with 4.0 and we need to resolve it by recompiling our plugins?
  2. Any workarounds we can use? Can I use some Groovy magic to create instances of SingleFileReport that would work with Gradle 3 and Gradle 4?

We are looking forward to using Gradle 4.0 at LinkedIn!


(Benjamin Muschko) #2

Hi Szczepan,

The interface ConfigurableReport has changed as follows:

  1. The method setDestination(Object) has been deprecated. It’s going to be removed in Gradle 5.0.
  2. Two new methods have been introduced as a replacement: setDestination(File) and setDestination(Provider<File>).

My guess is that you’ll need to implement the new methods in your plugin implementation. Can you describe the need for wanting to have your own implementation of SingleFileReport?

Any workarounds we can use? Can I use some Groovy magic to create instances of SingleFileReport that would work with Gradle 3 and Gradle 4?

You might want to try casting your Object to a File explicitly or using a File instance instead. If that doesn’t help I can ping the Groovy experts in our team.

Cheers,

Ben