如何将"sbt"配置为不显示警告"Warning private default argument in object * is never used"



我有一个scala编译器2.12.11,编译器会打印一些警告,如:
private default argument in class SomeClass is never used当它被使用时。

我见过Scala 2.12.2发出大量无用的";警告:参数值。。。在方法中。。。从未使用过";警告。如何摆脱它们?但这对我没有帮助,因为否定params是不可能的
您能帮我取消此警告,但保存另一个unused警告吗?目前,我有-Xlint选项。

您可以手动打开特定选项,而不是-Xlint(它是一个批次(。对于2.13中的即时,我可以打印如下可用选项:

scalac -Xlint:help
Enable recommended warnings
adapted-args            An argument list was modified to match the receiver.
nullary-unit            `def f: Unit` looks like an accessor; add parens to look side-effecting.
inaccessible            Warn about inaccessible types in method signatures.
infer-any               A type argument was inferred as Any.
missing-interpolator    A string literal appears to be missing an interpolator id.
doc-detached            When running scaladoc, warn if a doc comment is discarded.
private-shadow          A private field (or class parameter) shadows a superclass field.
type-parameter-shadow   A local type parameter shadows a type already in scope.
poly-implicit-overload  Parameterized overloaded implicit methods are not visible as view bounds.
option-implicit         Option.apply used an implicit view.
delayedinit-select      Selecting member of DelayedInit.
package-object-classes  Class or object defined in package object.
stars-align             In a pattern, a sequence wildcard `_*` should match all of a repeated parameter.
strict-unsealed-patmat  Pattern match on an unsealed class without a catch-all.
constant                Evaluation of a constant arithmetic expression resulted in an error.
unused                  Enable -Wunused:imports,privates,locals,implicits,nowarn.
nonlocal-return         A return statement used an exception for flow control.
implicit-not-found      Check @implicitNotFound and @implicitAmbiguous messages.
serial                  @SerialVersionUID on traits and non-serializable classes.
valpattern              Enable pattern checks in val definitions.
eta-zero                Usage `f` of parameterless `def f()` resulted in eta-expansion, not empty application `f()`.
eta-sam                 The Java-defined target interface for eta-expansion was not annotated @FunctionalInterface.
deprecation             Enable -deprecation and also check @deprecated annotations.
byname-implicit         Block adapted by implicit with by-name parameter.
recurse-with-default    Recursive call used default argument.
unit-special            Warn for specialization of Unit in parameter position.
multiarg-infix          Infix operator was defined or used with multiarg operand.
implicit-recursion      Implicit resolves to an enclosing definition.
Default: All choices are enabled by default.

所以我可以启用-Xlint:inaccessible -Xlint:adapted-args -Wunused:privates,locales或我想要的任何东西,而不是所有东西。对于2.12,此列表将有所不同。(您也可以检查scalac -Xscalac -Yscalac -W(。

另一种选择是启用警告并在";断开";有意识地做某事。对于未使用的,您有@scala.annotation.unused,对于2.12中的其他警告,以及之前有消音器插件,并且自2.13以来有@scala.annotation.nowarn注释。

相关内容

  • 没有找到相关文章

最新更新