Gradle 2.14 breaks my plugin

(Ben Bader) #1

I maintain a Gradle plugin that, among other things, tries to detect the --stacktrace commandline argument (it outputs diagnostic info if it is present). It has done so by using StartParameter.getShowStacktrace(), which appears to be a public API.

As of 2.14, the return value (enum ShowStacktrace) has been moved to another module and, crucially, another package, breaking my plugin at runtime. Sorry to have missed this during RC, but I have two questions:

  1. By all appearances this was a public API. If so, this seems to be an unwarranted breaking change.
  2. If ShowStacktrace was not a public API, how can we tell? I’d like to avoid using internals where possible.

It’s not the end of the world; I can work around the change either by reflection or Groovy magic, but it’s unfortunate for my users in the meantime.


(Ben Bader) #2

For reference, here’s the workaround I landed on:

(Sterling Greene) #3


The parent class LoggingConfiguration wasn’t public, but its methods leaked through StartParameter as inherited methods. There’s a similar problem with AbstractTask and ConventionTask.

Our rule is if the class has a page in our Javadoc/Groovydocs, it’s public. Some older packages do not include internal in the package name, so going by package name alone isn’t enough right now. We’re trying to make more things public and promote internal/leaking types to public as well. We’re renaming packages to internal as we can.

With 2.14, we made a version of LoggingConfiguration and ShowStacktrace public.

(Ben Bader) #4

I see; so the classes were internal and subject to change. Thanks for letting me know about the Javadoc/Groovydoc policy!