【问题标题】:Enabling Migration Warnings启用迁移警告
【发布时间】:2010-08-17 19:47:12
【问题描述】:

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

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 +=." )

【问题讨论】:

    标签: scala warnings scala-2.8


    【解决方案1】:

    选项是:-Xmigration

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

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

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

    【讨论】:

      【解决方案2】:

      这是一个扩展选项,-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
      

      【讨论】:

        【解决方案3】:
        % 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
          ...
        

        【讨论】:

          猜你喜欢
          • 2020-11-11
          • 2022-01-12
          • 2019-08-12
          • 2020-10-27
          • 1970-01-01
          • 2020-01-29
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多