Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何正确使用scalac-Xlint_Scala_Compiler Flags_Scalac_Scala Compiler - Fatal编程技术网

如何正确使用scalac-Xlint

如何正确使用scalac-Xlint,scala,compiler-flags,scalac,scala-compiler,Scala,Compiler Flags,Scalac,Scala Compiler,scalax-Xlint帮助提供以下信息: $ scalac -Xlint:help Enable or disable specific warnings adapted-args Warn if an argument list is modified to match the receiver. nullary-unit Warn when nullary methods return Unit. inaccessible

scalax-Xlint帮助提供以下信息:

$ scalac -Xlint:help
Enable or disable specific warnings
  adapted-args               Warn if an argument list is modified to match the receiver.
  nullary-unit               Warn when nullary methods return Unit.
  inaccessible               Warn about inaccessible types in method signatures.
  nullary-override           Warn when non-nullary `def f()' overrides nullary `def f'.
  infer-any                  Warn when a type argument is inferred to be `Any`.
  missing-interpolator       A string literal appears to be missing an interpolator id.
  doc-detached               A Scaladoc comment appears to be detached from its element.
  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 implicit view.
  delayedinit-select         Selecting member of DelayedInit.
  by-name-right-associative  By-name parameter of right associative operator.
  package-object-classes     Class or object defined in package object.
  unsound-match              Pattern match may not be typesafe.
  stars-align                Pattern sequence wildcard must align with sequence component.
是否有办法启用所有检查?scalac-Xlint的语义是什么?它会让所有人都能做到吗?默认设置(哪个)?什么都不做

注:Scala 2.11.8和sbt 0.13.9

如果较新版本提供不同的行为/功能,请告诉我,因为更新它们不是问题

-Xlint
-Xlint:
,但这需要

从历史上看,总是存在噪音太大或不可靠的警告,无法在默认情况下启用,因此总是存在从
-Xlint
中排除的警告

目前,有,但它没有连接到命令行选项

过去有一个
-Ywarn all
,意思是
-Xlint
加上其他警告。现在还不清楚为什么这个选项消失了

在某一点上,
-Xlint:
意味着
-Ywarn all
,而
-Xlint
意味着一个推荐的子集,但事实证明,人们喜欢使用
-Xlint:-恼人的,
禁用一个或两个lint规则,如果启用任意多个嘈杂的lint规则,则很难做到这一点

通常,
scalac-X
显示默认值;但是可能会改进
scalac-Xlint:help
以显示其默认行为。对于像
-Yopt
这样的东西,默认值是不常见的

$ scalac -help
Usage: scalac <options> <source files>
where possible standard options include:
  -X                              Print a synopsis of advanced options.


$ scalac -X
Usage: scalac <options> <source files>

-- Notes on option parsing --
Boolean settings are always false unless set.
Where multiple values are accepted, they should be comma-separated.
  example: -Xplugin:option1,option2
<phases> means one or a comma-separated list of:
  (partial) phase names, phase ids, phase id ranges, or the string "all".
  example: -Xprint:all prints all phases.
  example: -Xprint:expl,24-26 prints phases explicitouter, closelim, dce, jvm.
  example: -Xprint:-4 prints only the phases up to typer.

Possible advanced options include:
  -Xlint:<_,warning,-warning>    Enable or disable specific warnings: `_' for all, `-Xlint:help' to list
$scalac-帮助
用法:scalac
在可能的情况下,标准选项包括:
-打印高级选项的概要。
$scalac-X
用法:scalac
--关于选项解析的注记--
除非已设置,否则布尔设置始终为false。
如果接受多个值,则应使用逗号分隔。
示例:-Xplugin:option1,option2
指一个或一个逗号分隔的列表:
(部分)阶段名称、阶段id、阶段id范围或字符串“all”。
示例:-Xprint:all打印所有阶段。
示例:-Xprint:expl,24-26打印阶段explicitoter、closelim、dce、jvm。
示例:-Xprint:-4只打印打字机之前的相位。
可能的高级选项包括:
-Xlint:启用或禁用特定警告:``对于所有人,`-Xlint:帮助'以列出

是,
-Xlint
全部启用。您可以自己用
scala-e
检查它,并查看警告消息,例如:
scala-Xlint-e'print(“foo${1}”)“
cand'-Xdev'replace'-Ywarn all'和friends?我正在尝试启用所有警告和linter,以便我们能够生成输出,并将其纳入Jenkins“警告下一代”插件的报告中。@JesseAdelman人们开玩笑说,警告是多么糟糕。他们说他们不希望它出现在他们最坏的敌人身上,但我打赌如果编译器能够检测到他们最坏的敌人,他们会说“好”,然后继续并启用所有的唠叨。我在哪里可以找到2.11
scalac
?@bradsomon您可以下载以前的二进制发行版,里面是
doc/tools/scalac.html
我不认为它是在线的;而且我认为它最近没有更新。