ghik / silencer

Scala compiler plugin for warning suppression
Apache License 2.0
255 stars 33 forks source link

Scalafix and Silencer crash with NoClassDefFoundError #62

Closed sideeffffect closed 3 years ago

sideeffffect commented 3 years ago

When running Scalafix check with Silencer plugin enabled, it crashes with

[error] java.lang.NoClassDefFoundError: scala/tools/nsc/reporters/Reporter$Severity
[error]     at com.github.ghik.silencer.SilencerPlugin.reporter$lzycompute(SilencerPlugin.scala:31)
[error]     at com.github.ghik.silencer.SilencerPlugin.com$github$ghik$silencer$SilencerPlugin$$reporter(SilencerPlugin.scala:31)
[error]     at com.github.ghik.silencer.SilencerPlugin.processOptions(SilencerPlugin.scala:59)
[error]     at scala.tools.nsc.plugins.Plugin.init(Plugin.scala:70)
[error]     at scala.tools.nsc.plugins.Plugins.$anonfun$loadPlugins$9(Plugins.scala:162)
[error]     at scala.tools.nsc.plugins.Plugins.$anonfun$loadPlugins$9$adapted(Plugins.scala:162)

Examples:

This is triggered by upgrade of sbt-scalafix to 0.9.25. (Version of silencer is 1.7.1.)

Bug on the Scalafix side https://github.com/scalacenter/scalafix/issues/1315

SethTisue commented 3 years ago

what Scala version? looks like you might need to be on 2.13.2 or higher (or 2.12.13, if on 2.12.x)

sideeffffect commented 3 years ago

2.12.12, let's see if 2.12.13 will help https://github.com/zio/zio-prelude/pull/498

SethTisue commented 3 years ago

You may need to wait for https://github.com/ghik/silencer/issues/61 to be resolved.

sideeffffect commented 3 years ago

Upgrading to Scala 2.12.13 and sbt-scalafix 0.9.25 in lock step helped. The build now fails because of mdoc, but that's for another story. https://github.com/scalameta/mdoc/issues/446