综合编程

Scalac 2.13 Options and Flags

微信扫一扫,分享到朋友圈

Scalac 2.13 Options and Flags
0

Given that Scala 2.13
has just landed, there are a bunch of new flags and options available to the compiler. Below is a full list of options to choose from.

Standard Options

  • -Dproperty=value
    Pass -Dproperty=value directly to the runtime system.
  • -J
    <flag> Pass <flag> directly to the runtime system.
  • -P
    :<plugin>:<opt> Pass an option to a plugin
  • -V
    Print a synopsis of verbose options.
  • -W
    Print a synopsis of warning options.
  • -Werror
    Fail the compilation if there are any warnings.
  • -X
    Print a synopsis of advanced options.
  • -Y
    Print a synopsis of private options.
  • -bootclasspath
    <path> Override location of bootstrap class files.
  • -classpath
    <path> Specify where to find user class files.
  • -d
    <directory|jar> destination for generated classfiles.
  • -dependencyfile
    <file> Set dependency tracking file.
  • -deprecation
    Emit warning and location for usages of deprecated APIs.
  • -encoding
    <encoding> Specify character encoding used by source files.
  • -explaintypes
    Explain type errors in more detail.
  • -extdirs
    <path> Override location of installed extensions.
  • -feature
    Emit warning and location for usages of features that should be imported explicitly.
  • -g
    :<level> Set level of generated debugging info. (none,source,line,[vars],notailcalls)
  • -help
    Print a synopsis of standard options
  • -javabootclasspath
    <path> Override java boot classpath.
  • -javaextdirs
    <path> Override java extdirs classpath.
  • -language
    :<features> Enable or disable language features
  • -no-specialization
    Ignore @specialize
    annotations.
  • -nobootcp
    Do not use the boot classpath for the scala jars.
  • -nowarn
    Generate no warnings.
  • -opt
    :<optimizations> Enable optimizations
  • -opt-inline-from
    :<patterns> Patterns for classfile names from which to allow inlining, help
    for details.
  • -opt-warnings
    :<warnings> Enable optimizer warnings
  • -print
    Print program with Scala-specific features removed.
  • -release
    <release> Compile for a specific version of the Java platform. Supported targets: 6, 7, 8, 9
  • -sourcepath
    <path> Specify location(s) of source files.
  • -target
    :<target> Target platform for object files. All JVM 1.5 – 1.7 targets are deprecated. (jvm-1.5,jvm-1.6,jvm-1.7,[jvm-1.8])
  • -toolcp
    <path> Add to the runner classpath.
  • -unchecked
    Enable additional warnings where generated code depends on assumptions.
  • -uniqid
    Uniquely tag all identifiers in debugging output.
  • -usejavacp
    Utilize the java.class.path in classpath resolution.
  • -usemanifestcp
    Utilize the manifest in classpath resolution.
  • -verbose
    Output messages about what the compiler is doing.
  • -version
    Print product version and exit.
  • @
    <file> A text file containing compiler arguments (options and source files)

Deprecated settings:

  • -optimize Enables optimizations. deprecated: Since 2.12, enables -opt:l:inline -opt-inline-from:**. See -opt:help.

Verbose Options (-V)

  • -Vbrowse
    :<phases> Browse the abstract syntax tree after <phases>
  • -Vclasspath
    Output information about what classpath is being applied.
  • -Vdebug
    Increase the quantity of debugging output.
  • -Vdoc
    Trace scaladoc activity.
  • -Vfree-terms
    Print a message when reification creates a free term.
  • -Vfree-types
    Print a message when reification resorts to generating a free type.
  • -Vhot-statistics
    Enable -Vstatistics
    to also print hot statistics.
  • -Vide
    Generate, validate and output trees using the interactive compiler.
  • -Vimplicit-conversions
    Print a message whenever an implicit conversion is inserted.
  • -Vimplicits
    Show more detail on why some implicits are not applicable.
  • -Vinline
    <package/Class.method> Print a summary of inliner activity; _
    to print all, prefix match to select.
  • -Vissue
    Print stack traces when a context issues an error.
  • -Vlog
    :<phases> Log operations during <phases>
  • -Vmacro
    Trace macro activities: compilation, generation of synthetics, classloading, expansion, exceptions.
  • -Vmacro-lite
    Trace macro activities with less output.
  • -Vopt
    <package/Class.method> Trace the optimizer progress for methods; _
    to print all, prefix match to select.
  • -Vpatmat
    Trace pattern matching translation.
  • -Vphases
    Print a synopsis of compiler phases.
  • -Vpos
    Trace position validation.
  • -Vprint
    :<phases> Print out program after <phases>
  • -Vprint-args
    <file> Print all compiler arguments to the specified location. Use – to echo to the reporter.
  • -Vprint-pos
    Print tree positions, as offsets.
  • -Vprint-types
    Print tree types (debugging option).
  • -Vquasiquote
    Trace quasiquotations.
  • -Vreflective-calls
    Print a message when a reflective method call is generated
  • -Vreify
    Trace reification.
  • -Vshow
    :<phases> (Requires -Xshow-class or -Xshow-object) Show after <phases>
  • -Vshow-class
    <class> Show internal representation of class.
  • -Vshow-member-pos
    <output style> Show start and end positions of members (implies -Yrangepos)
  • -Vshow-object
    <object> Show internal representation of object.
  • -Vshow-symkinds
    Print abbreviated symbol kinds next to symbol names.
  • -Vshow-symowners
    Print owner identifiers next to symbol names.
  • -Vstatistics
    [:phases] Print compiler statistics for specific phases <phases> (default: parser,typer,patmat,erasure,cleanup,jvm)
  • -Vsymbols
    Print the AST symbol hierarchy after each phase.
  • -Vtyper
    Trace type assignments.
  • Note
    :

    • Boolean settings are false unless set: -Xdev -Xcheck-init:true -Xprompt:false
    • Multi-valued settings are comma-separated: -Xlint:infer-any,unused,-missing-interpolator
    • Phases are a list of names, ids, or ranges of ids: -Xprint:parser,typer,5-10 -Ylog:-4_
    • Use _ to enable all: -language:_ -Xprint:_

Advanced Options (-X)

  • -Xcheckinit
    Wrap field accessors to throw an exception on uninitialized access.
  • -Xdev
    Indicates user is a developer – issue warnings about anything which seems amiss
  • -Xdisable-assertions
    Generate no assertions or assumptions.
  • -Xelide-below
    <n> Calls to @elidable
    methods are omitted if method priority is lower than argument
  • -Xgenerate-phase-graph
    <file> Generate the phase graphs (outputs .dot files) to fileX.dot.
  • -Xlint
    :<warnings> Enable recommended warnings
  • -Xmacro-settings
    :<option> Custom settings for macros.
  • -Xmain-class
    <path> Class for manifest’s Main-Class entry (only useful with -d <jar>)
  • -Xmaxerrs
    <n> Maximum errors to print
  • -Xmaxwarns
    <n> Maximum warnings to print
  • -Xmigration
    :<version> Warn about constructs whose behavior may have changed since version.
  • -Xmixin-force-forwarders
    :<mode> Generate forwarder methods in classes inhering concrete methods from traits. Default: true
    , help
    to list choices.
  • -Xno-forwarders
    Do not generate static forwarders in mirror classes.
  • -Xno-patmat-analysis
    Don’t perform exhaustivity/unreachability analysis. Also, ignore @switch
    annotation.
  • -Xno-uescape
    Disable handling of nicode escapes.
  • -Xnojline
    Do not use JLine for editing.
  • -Xplugin
    :<paths> Load a plugin from each classpath.
  • -Xplugin-disable
    :<plugin> Disable plugins by name.
  • -Xplugin-list
    Print a synopsis of loaded plugins.
  • -Xplugin-require
    :<plugin> Abort if a named plugin is not loaded.
  • -Xpluginsdir
    <path> Path to search for plugin archives.
  • -Xprompt
    Display a prompt after each error (debugging option).
  • -Xreporter
    <classname> Specify a custom reporter for compiler messages.
  • -Xresident
    Compiler stays resident: read source filenames from standard input.
  • -Xscript
    <object> Treat the source file as a script and wrap it in a main method.
  • -Xsource
    :<version> Treat compiler input as Scala source for the specified version, see scala/bug#8126
    .
  • -Xsource-reader
    <classname> Specify a custom method for reading source files.
  • -Xverify
    Verify generic signatures in generated bytecode.
  • -Xxml
    :<propertys> Configure XML parsing.

Private Options (-Y)

  • -Ybackend-parallelism
    <n> maximum worker threads for backend
  • -Ybackend-worker-queue
    <n> backend threads worker queue size
  • -Ybreak-cycles
    Attempt to break cycles encountered during typing
  • -Ycache-macro-class-loader
    :<policy> Policy for caching class loaders for macros that are dynamically loaded. Default: none
    , help
    to list choices.
  • -Ycache-plugin-class-loader
    :<policy> Policy for caching class loaders for compiler plugins that are dynamically loaded. Default: none
    , help
    to list choices.
  • -Ycheck
    :<phases> Check the tree at the end of <phases>
  • -Ycompact-trees
    Use compact tree printer when displaying trees.
  • -Ydelambdafy
    :<strategy> Strategy used for translating lambdas into JVM code. (inline,[method])
  • -Ydump-classes
    <dir> Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).
  • -Ygen-asmp
    <dir> Generate a parallel output directory of .asmp files (ie ASM Textifier output).
  • -Yimports
    :<import> Custom root imports, default is java.lang,scala,scala.Predef
    .
  • -Yjar-compression-level
    <n> compression level to use when writing jar files
  • -Ymacro-annotations
    Enable support for macro annotations, formerly in macro paradise.
  • -Ymacro-classpath
    <path> The classpath used to reflectively load macro implementations, default is the compilation classpath.
  • -Ymacro-expand
    :<policy> Control expansion of macros, useful for scaladoc and presentation compiler. ([normal],none,discard)
  • -Ymacro-global-fresh-names
    Should fresh names in macros be unique across all compilation units
  • -Yno-completion
    Disable tab-completion in the REPL.
  • -Yno-flat-classpath-cache
    Do not cache flat classpath representation of classpath elements from jars across compiler instances.
  • -Yno-generic-signatures
    Suppress generation of generic signatures for Java.
  • -Yno-imports
    Compile without importing scala. , java.lang.
    , or Predef.
  • -Yno-predef
    Compile without importing Predef.
  • -Yopt-inline-heuristics
    :<strategy> Set the heuristics for inlining decisions. (at-inline-annotated,everything,[default])
  • -Ypatmat-exhaust-depth
    <n> off
  • -Ypresentation-any-thread
    Allow use of the presentation compiler from any thread
  • -Ypresentation-debug
    Enable debugging output for the presentation compiler.
  • -Ypresentation-delay
    <n> Wait number of ms after typing before starting typechecking
  • -Ypresentation-log
    <file> Log presentation compiler events into file
  • -Ypresentation-replay
    <file> Replay presentation compiler events from file
  • -Ypresentation-strict
    Do not report type errors in sources with syntax errors.
  • -Ypresentation-verbose
    Print information about presentation compiler tasks.
  • -Yprint-trees
    :<style> How to print trees when -Xprint is enabled. ([text],compact,format,text+format)
  • -Yprofile-destination
    <file> Profiling output – specify a file or -
    for console.
  • -Yprofile-enabled
    Enable profiling.
  • -Yprofile-external-tool
    [:phases] Enable profiling for a phase using an external tool hook. Generally only useful for a single phase <phases> (default: typer)
  • -Yprofile-run-gc
    [:phases] Run a GC between phases – this allows heap size to be accurate at the expense of more time. Specify a list of phases, or all <phases> (default: _)
  • -Yprofile-trace
    <file> Capture trace of compilation in Chrome Trace format
  • -Yrangepos
    Use range positions for syntax trees.
  • -Yrecursion
    <n> Set recursion depth used when locking symbols.
  • -Yreify-copypaste
    Dump the reified trees in copypasteable representation.
  • -Yrepl-class-based
    Use classes to wrap REPL snippets instead of objects
  • -Yrepl-outdir
    <path> Write repl-generated classfiles to given output directory (use “” to generate a temporary dir)
  • -Yresolve-term-conflict
    :<strategy> Resolve term conflicts. (package,object,[error])
  • -Yscriptrunner
    <classname> Specify a scala.tools.nsc.ScriptRunner (default, resident, shutdown, or a class name).
  • -Yskip
    :<phases> Skip <phases>
  • -Ystop-after
    :<phases> Stop after <phases>
  • -Ystop-before
    :<phases> Stop before <phases>
  • -Yvalidate-pos
    :<phases> Validate positions after the given phases (implies -Yrangepos) <phases>
  • Note
    :

    • Boolean settings are false unless set: -Xdev -Xcheck-init:true -Xprompt:false
    • Multi-valued settings are comma-separated: -Xlint:infer-any,unused,-missing-interpolator
    • Phases are a list of names, ids, or ranges of ids: -Xprint:parser,typer,5-10 -Ylog:-4
    • Use _ to enable all: -language:_ -Xprint:_

阅读原文...


微信扫一扫,分享到朋友圈

Scalac 2.13 Options and Flags
0

Avatar

The Non-Technical Guide to Artificial Intelligence

上一篇

Google 推出免费利器,让编程小白也能开发游戏

下一篇

评论已经被关闭。

插入图片

热门分类

往期推荐

Scalac 2.13 Options and Flags

长按储存图像,分享给朋友