Scala compiler plugin for warning suppression
Support for Scala 2.13.7
Scala 2.12.15 support (thx @dongjoon-hyun)
Scala 2.13.6 support
Scala 2.12.14 support
This release brings partial support for @nowarn
annotation introduced in Scala 2.13.2. silencer
allows it to be used in Scala 2.11 and 2.12. The annotation itself is provided by scala-collection-compat.
Support for @nowarn
is partial because silencer
doesn't understand filters which may be specified in an argument to @nowarn
. The only filter understood by silencer
is msg=<pattern>
. All other filters are interpreted as suppressing all warnings.
@silent
annotations in macro expansions, primarily for performance reasons (see #45)-P:silencer:searchMacroExpansions
-P:silencer:lineContentFilters
option - particularly useful for suppressing unused import warnings #42Since this version, silencer
is fully cross versioned and released for every minor Scala version.
val silencerVersion = "1.4.3"
libraryDependencies ++= Seq(
compilerPlugin("com.github.ghik" % "silencer-plugin" % silencerVersion cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % silencerVersion % Provided cross CrossVersion.full
)
This version comes with two new features:
@silent
annotation now accepts an optional message pattern (regex) argument which can be used to suppress specific classes of warnings, e.g.
@silent("deprecated")
def usesDeprecatedApi(): Unit = someDeprecatedApi()
The plugin can now be configured to reject with an error any redundant @silent
annotations which don't suppress any warnings (fixes #28). This can be enabled with the checkUnused
flag:
scalacOptions += "-P:silencer:checkUnused"
This release introduces performance improvement by @retronym