Commit Graph

318 Commits

Author SHA1 Message Date
Mikhail Glukhikh c0dd97b40d Migration to expect/actual: fix CLI tests 2017-09-16 19:47:41 +03:00
Stanislav Erokhin 7982f3489e Rename compiler key -Xno-check-impl to -Xno-check-actual 2017-09-16 19:47:39 +03:00
Denis Zharkov 6336ad874b Get rid of ParametersAreNonnullByDefault copy in test data 2017-09-14 18:05:32 +03:00
Denis Zharkov 24b1f2ed1f Minor. Update CliTestGenerated.Jvm::testExtraHelp test data 2017-09-14 18:05:32 +03:00
Denis Zharkov 4d95c30360 Restore -Xjsr305-annotations flag as a deprecated 2017-09-14 18:05:32 +03:00
Denis Zharkov 97fed6336b Add cli tests on different options of -Xjsr305 flag 2017-09-14 18:05:32 +03:00
Denis Zharkov 363d345752 Make default value for -Xjsr305 flag to be WARN 2017-09-14 18:05:32 +03:00
Dmitry Petrov 179e720e4a Provide fallback flag for KT-19174
-Xno-exception-on-explicit-equals-for-boxed-null

Also unify corresponding names.
2017-09-14 10:15:28 +03:00
Alexey Andreev c66bc0b0e9 Remap source maps in JS DCE. Improve JS DCE error logging
See KT-19821
2017-09-08 18:27:41 +03:00
Mikhail Zarechenskiy 03440210ee Introduce language version 1.3 2017-09-07 12:52:32 +03:00
Alexey Andreev 361d6dfca0 JS: rewrite source map generator to use specialized JSON writer
Fixes problems with string escaping. See KT-20005
2017-09-06 17:55:06 +03:00
Dmitry Petrov 5d44e095c8 Nullability assertions for extension receiver
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'.
2017-09-01 09:49:21 +03:00
Alexander Udalov fb4bf4e5b8 Report error if Java 9 module "kotlin.stdlib" is not found in the graph
Use "-Xallow-kotlin-package" to suppress this error

 #KT-19176 Fixed
2017-08-30 15:47:54 +03:00
baratynskiy 67fdd9f76e javac-wrapper: fixes after rebase and review 2017-08-29 18:01:36 +03:00
baratynskiy 8494e54608 javac-wrapper: -Xuse-javac -> -Xuse-javac and -Xcompile-java 2017-08-29 18:01:36 +03:00
e5l 5501cdf049 Add warnings for jsr305 nullable annotations
#KT-19115 Fixed
2017-08-15 11:01:08 +03:00
Alexey Sedunov e6f1a3ccf3 Minor: Use Kotlin reflection in usage printing and update test data 2017-08-02 13:08:06 +03:00
Yan Zhulanow 3770786075 Minor: Fix test data for CLI test (defaultCacheImplementation option was added in Android Extensions) 2017-08-02 03:36:55 +03:00
Alexander Udalov 1e6850f198 CLI: improve error message if libraries are not found in Kotlin home
Also support the '-kotlin-home' argument in kotlinc-js

 #KT-18859 Fixed
2017-07-28 14:16:46 +03:00
Alexander Udalov 224df7a1ea Change -Xload-jsr305-annotations argument to -Xjsr305-annotations={ignore|enable}
See https://youtrack.jetbrains.com/issue/KT-19229 for a complete
explanation

 #KT-19229 Fixed
 #KT-10942
2017-07-26 11:45:25 +03:00
Yan Zhulanow 4851a83a83 Android Extensions: put new functionality under the flag 2017-07-18 18:10:30 +03:00
Alexander Udalov c94b21edd5 Remove obsolete code about runtime versions conflict 2017-07-10 12:48:21 +03:00
Alexander Udalov 127cd1295e Disable JSR-305 annotations by default, introduce CLI argument
No package annotations are going to be loaded, and
TypeQualifierDefault/TypeQualifierNickname are no longer recognized by
default. Use the CLI argument "-Xload-jsr305-annotations" to enable this
behavior back

 #KT-10942
2017-07-07 22:08:50 +03:00
Alexander Udalov 55468735df Rename -module argument to -Xbuild-file
To prevent confusion with Java 9 module-related arguments

 #KT-18754 Fixed
2017-07-06 17:03:25 +03:00
Vladimir Koshelev 61e52f0bfe Improve a reported message if -jdk-home path does not exist.
Fix KT-18794
2017-07-04 19:40:42 +03:00
Alexander Udalov 03d83db660 Support -Xmodule-path and -Xadd-modules command line arguments
#KT-18598 In Progress
 #KT-18599 Fixed
2017-06-29 15:59:56 +03:00
Alexey Andreev 3331be9cc8 Fix JS CLI test that fails in Windows 2017-06-26 18:15:30 +03:00
Alexey Andreev a0e1bde594 Allow to embed source files into JS source maps 2017-06-26 18:15:28 +03:00
Alexander Udalov 135f0a136e CLI: report error if the first argument for "-script" is not kts
#KT-3045 Fixed
2017-06-22 10:19:05 +03:00
Alexey Andreev 78b238a05b Report warning when two .kt files get same paths in JS source map 2017-06-20 17:40:36 +03:00
Alexey Andreev 13ab63ae09 Generate relative paths in JS source maps
Also, add CLI options to manipulate prefixes of path

See KT-4078
2017-06-20 17:40:32 +03:00
Alexey Andreev 522a56947c Add -keep command line option to JS DCE tool 2017-05-26 18:20:23 +03:00
Alexey Andreev 8a8fdf1968 Command-line tool for JS DCE 2017-05-26 18:20:17 +03:00
Dmitry Petrov a86fe89aae Include file name for package-level members in diagnostics 2017-05-26 13:58:46 +03:00
Dmitry Petrov 7979663e6c Update testData for changed diagnostic messages 2017-05-26 13:58:46 +03:00
Alexander Udalov 671aed252d Support single Java source files in kotlinc arguments
E.g. "kotlinc foo.kt test/Bar.java" will compile foo.kt, and
declarations from Bar.java will be accessible to Kotlin code in foo.kt.

The change in AbstractTopLevelMembersInvocationTest is needed because an
incorrect configuration was created in that test where a library jar was
also a Java source root (the compiler is never configured this way in
production), which led to an exception in
JavaCoreProjectEnvironment#addSourcesToClasspath

 #KT-17697 Fixed
2017-05-18 19:22:17 +03:00
Alexander Udalov bfb3b38ebc Do not try to load Java classes from incorrect packages
#KT-11474 Fixed
2017-05-18 13:30:06 +03:00
Alexander Udalov 9b85fed3c4 Fix typo in kotlinc-js help
File separator is '/', path separator is ':' or ';'
2017-05-18 13:29:03 +03:00
baratynskiy 5eea3b6569 Introduce experimental -Xuse-javac compilation mode
In this mode, javac AST and Symbol files are used during
Kotlin compilation instead of PSI / binary stuff.
Later, they are reused for Java file compilation.
javac in this mode is integrated into kotlinc.
2017-05-17 17:48:17 +03:00
Anton Bannykh 2e9a59819a JS: support internal visibility from friend modules
Friend modules should be provided using the -Xfriend-modules flag
in the same format as -libraries. No manual configuration required for
JPS, Gradle and Maven plugins.

Friend modules could be switched off using the -Xfriend-modules-disabled
flag. Doing that will
  * prevent internal declarations from being exported,
  * values provided by -Xfriend-modules ignored,
  * raise a compilation error on attemps to use internal declarations from other modules

Fixes #KT-15135 and #KT-16568.
2017-05-04 21:44:17 +03:00
Alexander Udalov fcf44af294 Change how kotlinc and tools display their version
- Display the Kotlin version in kotlin-gradle-plugin. This is needed
  because if "-version" is specified in compiler arguments, the "info"
  level of the message printed by the compiler in CLICompiler prevents
  it from being displayed by default (unless "--debug" is passed to
  Gradle).
- Display the version of JRE the compiler is running on. This will be
  helpful to diagnose Java 9 related issues in the future.
- In CLI, also display the executable name (kotlinc-jvm or kotlinc-js)
2017-04-28 20:49:54 +03:00
Alexander Udalov d8d3bafbe9 Introduce "-Xreport-output-files" to report source-output mapping for JPS
This makes "-verbose" not required for JPS to run correctly and
therefore allows to print more useful debugging stuff in the compiler
and read them in CLI, for example. The output will also be more readable
because there'll be no "output" messages
2017-04-28 20:49:28 +03:00
Denis Zharkov a5c352dc9f Add -Xuse-old-class-files-reading CLI argument
By default we use the fast implementation in CLI compiler,
but in the most of the tests the old one is enabled

Also add tests on CompiledJava with the fast class reading
implementation
2017-04-21 12:56:29 +03:00
Alexander Udalov 072f87ddab Introduce -Xintellij-plugin-root, deprecate CompilerJarLocator 2017-04-14 20:13:11 +03:00
Alexander Udalov ce6676baa8 Do not print usage if wrong argument is passed, do not exit with INTERNAL_ERROR
This is a normal situation, not an internal error of the compiler, so
return COMPILATION_ERROR instead
2017-04-14 20:07:54 +03:00
Alexander Udalov ff846e787f Report warning for non-boolean CLI argument passed multiple times
Only if its values are different, see the test
2017-04-14 20:07:54 +03:00
Alexander Udalov be54e4b93b Get rid of coroutinesWarn/coroutinesEnable/coroutinesError
Use a single coroutinesState instead. Change the coroutines state in
some tests from "warn" to "enable"/"error" to test that deserialization
of older config files works ("warn" is the default value, so it wasn't
testing anything here)
2017-04-14 20:07:54 +03:00
Alexander Udalov f4b6db4dc0 Change format of -X arguments to require value after '='
Report a warning when an argument is passed in the old form (with the
whitespace)

 #KT-17264 Fixed
2017-04-14 20:07:54 +03:00
Zalim Bashorov 56d3f90a02 Don't log content of module.xml when Logger is not initialized
When Logger is not initialized it returns default logger which prints to stdout and stderr,
so it can lead to different results when run CLI tests locally and on TC.
2017-04-13 13:16:32 +03:00
Dmitry Jemerov 406714a1f4 Remove warning for running the compiler under Java 6/7
Now the compiler won't even start, so no need to check this manually.
2017-04-10 17:30:03 +02:00