启用迁移警告

发布于 2024-09-14 22:30:30 字数 236 浏览 1 评论 0原文

我正在将 2.7.7 scala 代码库移植到 2.8,并且想知道是否有编译器选项来显示迁移通知?我被可变序列的行为变化所困扰,该序列具有以下迁移通知[1],但是当我构建项目时它不会显示任何内容(我已经启用了弃用和未经检查的警告)

1:@migration (2, 8, "从 2.8 开始,此操作创建一个新地图。将元素添加为\n"+ “对现有地图产生副作用并返回该地图本身,使用 +=。” )

I am porting a 2.7.7 scala code base over to 2.8 and was wondering if there was a compiler option to display migration notices? I was bitten by a change in behavior for mutable sequences that had the following migration notice[1], however it doesn't display anything when I build the project ( I have deprecation and unchecked warnings enabled already)

1: @migration(2, 8,
"As of 2.8, this operation creates a new map. To add an element as a\n"+
"side effect to an existing map and return that map itself, use +=."
)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心意如水 2024-09-21 22:30:30

选项为:-Xmigration

输入scalac -help将显示Scala编译器的标准选项。

输入 scalac -X 将显示高级选项。

输入 scalac -Y 将会显示私有选项。

The option is: -Xmigration

Entering scalac -help will show the standard options of the Scala compiler.

Entering scalac -X will show the advanced options.

Entering scalac -Y will show the private options.

笨死的猪 2024-09-21 22:30:30

它是一个扩展选项,-Xmigration

 ~: scala -X
Usage: scala <options> <source files>
Possible advanced options include:
  -Xassem-extdirs <dirs>         List of directories containing assemblies, defaults to `lib'
  -Xassem-name <file>            Name of the output assembly (only relevant with -target:msil)
  -Xassem-path <path>            List of assemblies referenced by the program (only relevant with -target:msil)
  -Xcheck-null                   Emit warning on selection of nullable reference
  -Xcheckinit                    Add runtime checks on field accessors. Uninitialized accesses result in an exception being thrown.
  -Xdisable-assertions           Generate no assertions and assumptions
  -Xelide-below                  Generate calls to @elidable-marked methods only if method priority is greater than argument.
  -Xexperimental                 Enable experimental extensions
  -Xfatal-warnings               Fail the compilation if there are any warnings.
  -Xfuture                       Turn on future language features
  -Xgenerate-phase-graph <file>  Generate the phase graphs (outputs .dot files) to fileX.dot
  -Xlog-implicits                Show more info on why some implicits are not applicable
  -Xmigration                    Warn about constructs whose behavior may have changed between 2.7 and 2.8
  -Xno-forwarders                Do not generate static forwarders in mirror classes
  -Xno-uescape                   Disables handling of \u unicode escapes
  -Xnojline                      Do not use JLine for editing
  -Xplugin-disable:<plugin>      Disable a plugin
  -Xplugin-list                  Print a synopsis of loaded plugins
  -Xplugin-require:<plugin>      Abort unless a plugin is available
  -Xplugin:<file>                Load a plugin from a file
  -Xpluginsdir <path>            Path to search compiler plugins
  -Xprint-icode                  Log internal icode to *.icode files
  -Xprint-pos                    Print tree positions (as offsets)
  -Xprint-types                  Print tree types (debugging option)
  -Xprint:<phase>                Print out program after <phase> or "all"
  -Xprompt                       Display a prompt after each error (debugging option)
  -Xresident                     Compiler stays resident, files to compile are read from standard input
  -Xscript <object>              Compile as a script, wrapping the code into object.main()
  -Xshow-class <class>           Show class info
  -Xshow-object <object>         Show object info
  -Xshow-phases                  Print a synopsis of compiler phases
  -Xsource-reader <classname>    Specify a custom method for reading source files
  -Xsourcedir <directory>        When -target:msil, the source folder structure is mirrored in output directory.
  -Xwarninit                     Warn about possible changes in initialization semantics
  -Y                             Print a synopsis of private options

It's a extended option, -Xmigration.

 ~: scala -X
Usage: scala <options> <source files>
Possible advanced options include:
  -Xassem-extdirs <dirs>         List of directories containing assemblies, defaults to `lib'
  -Xassem-name <file>            Name of the output assembly (only relevant with -target:msil)
  -Xassem-path <path>            List of assemblies referenced by the program (only relevant with -target:msil)
  -Xcheck-null                   Emit warning on selection of nullable reference
  -Xcheckinit                    Add runtime checks on field accessors. Uninitialized accesses result in an exception being thrown.
  -Xdisable-assertions           Generate no assertions and assumptions
  -Xelide-below                  Generate calls to @elidable-marked methods only if method priority is greater than argument.
  -Xexperimental                 Enable experimental extensions
  -Xfatal-warnings               Fail the compilation if there are any warnings.
  -Xfuture                       Turn on future language features
  -Xgenerate-phase-graph <file>  Generate the phase graphs (outputs .dot files) to fileX.dot
  -Xlog-implicits                Show more info on why some implicits are not applicable
  -Xmigration                    Warn about constructs whose behavior may have changed between 2.7 and 2.8
  -Xno-forwarders                Do not generate static forwarders in mirror classes
  -Xno-uescape                   Disables handling of \u unicode escapes
  -Xnojline                      Do not use JLine for editing
  -Xplugin-disable:<plugin>      Disable a plugin
  -Xplugin-list                  Print a synopsis of loaded plugins
  -Xplugin-require:<plugin>      Abort unless a plugin is available
  -Xplugin:<file>                Load a plugin from a file
  -Xpluginsdir <path>            Path to search compiler plugins
  -Xprint-icode                  Log internal icode to *.icode files
  -Xprint-pos                    Print tree positions (as offsets)
  -Xprint-types                  Print tree types (debugging option)
  -Xprint:<phase>                Print out program after <phase> or "all"
  -Xprompt                       Display a prompt after each error (debugging option)
  -Xresident                     Compiler stays resident, files to compile are read from standard input
  -Xscript <object>              Compile as a script, wrapping the code into object.main()
  -Xshow-class <class>           Show class info
  -Xshow-object <object>         Show object info
  -Xshow-phases                  Print a synopsis of compiler phases
  -Xsource-reader <classname>    Specify a custom method for reading source files
  -Xsourcedir <directory>        When -target:msil, the source folder structure is mirrored in output directory.
  -Xwarninit                     Warn about possible changes in initialization semantics
  -Y                             Print a synopsis of private options
居里长安 2024-09-21 22:30:30
% scala -X
Usage: scala <options> <source files>
Possible advanced options include:
  ...
  -Xmigration                    Warn about constructs whose behavior may have changed between 2.7 and 2.8
  ...
% scala -X
Usage: scala <options> <source files>
Possible advanced options include:
  ...
  -Xmigration                    Warn about constructs whose behavior may have changed between 2.7 and 2.8
  ...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文