5d44e095c8
In Kotlin 1.1 and before, there were no nullability assertions on extension receivers, because receiver is resolved with NO_EXPECTED_TYPE. So, if an expression of platform type is passed as an extension receiver to a non-private function, it would fail with IllegalArgumentException. However, if the function is private, then we generated no parameter assertions under assumption that such function can be called from Kotlin only, and all arguments are checked on the call site. Thus 'null' could propagate indefinitely. In Kotlin 1.2, we do the following: - Generate nullability assertions for expression receivers. NB nullability assertions are stored for ReceiverValue instances, not for expressions: given expression can act as receiver in different calls, each with an expected receiver type of its own. - Generate nullability assertions for extension receivers of private operator functions. NB it still can throw NPE for some particular "optimized" cases, but at least those nulls would not propagate indefinitely. This behavior is disabled by an "advanced" command-line option '-Xno-receiver-assertions'.
41 lines
3.3 KiB
Plaintext
Vendored
41 lines
3.3 KiB
Plaintext
Vendored
Usage: kotlinc-jvm <options> <source files>
|
|
where advanced options include:
|
|
-Xadd-compiler-builtins Add definitions of built-in declarations to the compilation classpath (useful with -no-stdlib)
|
|
-Xadd-modules=<module[,]> Root modules to resolve in addition to the initial modules,
|
|
or all modules on the module path if <module> is ALL-MODULE-PATH
|
|
-Xbuild-file=<path> Path to the .xml build file to compile
|
|
-Xcompile-java Reuse javac analysis and compile Java source files
|
|
-Xdump-declarations-to=<path> Path to JSON file to dump Java to Kotlin declaration mappings
|
|
-Xmultifile-parts-inherit Compile multifile classes as a hierarchy of parts and facade
|
|
-Xmodule-path=<path> Paths where to find Java 9+ modules
|
|
-Xjavac-arguments=<option[,]> Java compiler arguments
|
|
-Xjsr305-annotations={ignore|enable|warn}
|
|
Specify global behavior for JSR-305 nullability annotations: ignore, treat as other supported nullability annotations, or report a warning
|
|
-Xload-builtins-from-dependencies
|
|
Load definitions of built-in declarations from module dependencies, instead of from the compiler
|
|
-Xno-call-assertions Don't generate not-null assertions for arguments of platform types
|
|
-Xno-optimize Disable optimizations
|
|
-Xno-param-assertions Don't generate not-null assertions on parameters of methods accessible from Java
|
|
-Xno-receiver-assertions Don't generate not-null assertion for extension receiver arguments of platform types
|
|
-Xreport-perf Report detailed performance statistics
|
|
-Xscript-resolver-environment=<key=value[,]>
|
|
Script resolver environment in key-value pairs (the value could be quoted and escaped)
|
|
-Xsingle-module Combine modules for source files and binary dependencies into a single module
|
|
-Xskip-runtime-version-check Allow Kotlin runtime libraries of incompatible versions in the classpath
|
|
-Xuse-javac Use javac for Java source and class files analysis
|
|
-Xuse-old-class-files-reading Use old class files reading implementation (may slow down the build and should be used in case of problems with the new implementation)
|
|
-Xallow-kotlin-package Allow compiling code in package 'kotlin' and allow not requiring kotlin.stdlib in module-info
|
|
-Xcoroutines={enable|warn|error}
|
|
Enable coroutines or report warnings or errors on declarations and use sites of 'suspend' modifier
|
|
-Xintellij-plugin-root=<path> Path to the kotlin-compiler.jar or directory where IntelliJ configuration files can be found
|
|
-Xmulti-platform Enable experimental language support for multi-platform projects
|
|
-Xno-check-impl Do not check presence of 'impl' modifier in multi-platform projects
|
|
-Xno-inline Disable method inlining
|
|
-Xplugin=<path> Load plugins from the given classpath
|
|
-Xrepeat=<count> Repeat compilation (for performance analysis)
|
|
-Xreport-output-files Report source to output files mapping
|
|
-Xskip-metadata-version-check Load classes with bad metadata version anyway (incl. pre-release classes)
|
|
|
|
Advanced options are non-standard and may be changed or removed without any notice.
|
|
OK
|