Call me stubborn, but they can get my /:
and :\
out of my cold, dead fingers. I can't wait for scala 2.14 when they are supposed to go away so that I can implement my own and get rid of the deprecation warning completely, but is there anything I can do in the meantime - in scalac, sbt or at least IntelliJ to filter out those warnings? I am an absolute noob with regard to sbt, but it seems like something that should be very easily accomplished.
Scala 2.13.2 has just been released a few days ago, which includes a new -Wconf
flag for configurable warnings. See https://github.com/scala/scala/pull/8373
Configure compiler warnings.
Syntax: -Wconf:<filters>:<action>,<filters>:<action>,...
multiple <filters> are combined with &, i.e., <filter>&...&<filter>
Note: Run with `-Wconf:any:warning-verbose` to print warnings with their category, site,
and (for deprecations) origin and since-version.
<filter>
- Any message: any
- Message categories: cat=deprecation, cat=lint, cat=lint-infer-any
The full list of warning categories is shown at the end of this help text.
- Message content: msg=regex
The regex need only match some part of the message, not all of it.
- Site where the warning is triggered: site=my\.package\..*
The regex must match the full name (`package.Class.method`) of the warning position.
- Source file name: src=src_managed/.*
If `-rootdir` is specified, the regex must match the canonical path relative to the
root directory. Otherwise, the regex must match the canonical path relative to any
path segment (`b/.*Test.scala` matches `/a/b/XTest.scala` but not `/ab/Test.scala`).
Use unix-style paths, separated by `/`.
- Origin of deprecation: origin=external\.package\..*
The regex must match the full name (`package.Class.method`) of the deprecated entity.
- Since of deprecation: since<1.24
Valid operators: <, =, >, valid versions: N, N.M, N.M.P. Compares against the first
version of the form N, N.M or N.M.P found in the `since` parameter of the deprecation,
for example `1.2.3` in `@deprecated("", "some lib 1.2.3-foo")`.
<action>
- error / e
- warning / w
- warning-summary / ws (summary with the number of warnings, like for deprecations)
- warning-verbose / wv (show warning category and site)
- info / i (infos are not counted as warnings and don't affect `-Werror`)
- info-summary / is
- info-verbose / iv
- silent / s
The default configuration is:
-Wconf:cat=deprecation:ws,cat=feature:ws,cat=optimizer:ws
User-defined configurations are added to the left. The leftmost rule matching
a warning message defines the action.
Examples:
- change every warning into an error: -Wconf:any:error
- silence certain deprecations: -Wconf:origin=some\.lib\..*&since>2.2:s
Full list of message categories:
- deprecation
- feature, feature-dynamics, feature-existentials, feature-higher-kinds, feature-implicit-conversions, feature-macros, feature-postfix-ops, feature-reflective-calls
- java-source
- lint, lint-adapted-args, lint-byname-implicit, lint-constant, lint-delayedinit-select, lint-deprecation, lint-doc-detached, lint-eta-sam, lint-eta-zero, lint-implicit-not-found, lint-inaccessible, lint-infer-any, lint-missing-interpolator, lint-nonlocal-return, lint-nullary-override, lint-nullary-unit, lint-option-implicit, lint-package-object-classes, lint-poly-implicit-overload, lint-private-shadow, lint-recurse-with-default, lint-serial, lint-stars-align, lint-type-parameter-shadow, lint-unit-specialization
- optimizer
- other, other-debug, other-match-analysis, other-migration, other-pure-statement, other-shadowing
- scaladoc
- unchecked
- unused, unused-imports, unused-locals, unused-nowarn, unused-params, unused-pat-vars, unused-privates
- w-flag, w-flag-dead-code, w-flag-extra-implicit, w-flag-numeric-widen, w-flag-self-implicit, w-flag-value-discard
To suppress warnings locally, use the `scala.annotation.nowarn` annotation.
Note: on the command-line you might need to quote configurations containing `*` or `&`
to prevent the shell from expanding patterns.
For anyone else still stuck with an earlier Scala version, there is the silencer scalac plugin: https://github.com/ghik/silencer