kelloggm / checkerframework-gradle-plugin

Gradle plugin to use the Checker Framework for Java
Apache License 2.0
64 stars 15 forks source link

Freefair's LombokPlugin handler broken after said plugin's latest update #156

Closed clay-golem closed 2 years ago

clay-golem commented 3 years ago

In the latest release of the LombokPlugin - 6.0.0-m2, the method LombokPlugin#configureForJacoco() has been removed in this commit: https://github.com/freefair/gradle-plugins/commit/146498d103e2928f0dc17c4981c75a5088a3afc8

It was a private method, but is still used here: https://github.com/kelloggm/checkerframework-gradle-plugin/blob/def758bc02a10b13596134922129ecc7ca8354f5/src/main/groovy/org/checkerframework/gradle/plugin/CheckerFrameworkPlugin.groovy#L109

Note that the 6.0.0-m2 is a pre-release.

iplantemn commented 2 years ago

I have the same issue - what are the odds that this will be updated?

kelloggm commented 2 years ago

It looks like the io.freefair plugin has deprecated its support for generating lombok configs, and instead moved to a model where it checks that the user has supplied a config that's compatible with each other tool that it supports, and warns the user off if not.

Our previous approach was a bit of a hack: the CF has the same requirements (the presence of the lombok.addLombokGeneratedAnnotation = true key) as a supported tool (Jacoco), so we called into the lombok plugin and asked it to configure itself for Jacoco.

I see a few possible ways forward for us:

I'd like to think about this a bit (and get any input from those of you who've experienced the problem - sorry about that!), but I'm currently leaning towards either the 2nd option (i.e. calling their new private methods) or the last option. What do you think?

mernst commented 2 years ago

My hot take prefers the second option.

iplantemn commented 2 years ago

I agree with @mernst.

  1. My project already has the Lombok configuration
  2. From a user's perspective, this is what I'd prefer
  3. Dislike - I would not want unnecessary warnings
  4. Same as 3.
iplantemn commented 2 years ago

Perhaps working directly with the Lombok team to have them publish their private methods to a public API so that you can leverage it?

kelloggm commented 2 years ago

Interestingly, the Lombok plugin authors removed their support for approach 2 in https://github.com/freefair/gradle-plugins/commit/fdcf57648794eecea3151a2fb4a6e8db5f1f855c, which they merged two days ago (i.e. while we were having this conversation). Their motivation appears to be that some of their users considered it too naggy: https://github.com/freefair/gradle-plugins/issues/383.

Given that they removed support for checking Lombok configs at all, I think we should follow suit. I've opened a PR to do so: #170. That PR keeps our behavior the same (i.e. generate a Lombok config) if the version of the Lombok plugin is a 5.x version or lower. If the version is 6.x or larger, we issue an INFO level nag message, which most users won't see unless they look for it. I'm not thrilled with that choice (it corresponds to 4, but given the feedback from @iplantemn about error messages, I tried to avoid issuing a warning unless the user is looking at a higher logging level than normal).