Commit Graph

287 Commits

Author SHA1 Message Date
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
Ilya Chernikov 0199ec18b1 Add new compiler argument for passing script resolver environment 2017-04-06 10:02:48 +02:00
Mikhail Zarechenskiy aec0c029e5 Display description of language version in options 2017-03-30 13:27:50 +03:00
Mikhail Zarechenskiy 20d5616d75 Introduce Kotlin language version 1.2
Wherein DEFAULT version is still 1.1, which means that version 1.2 should be configured manually
2017-03-30 13:27:45 +03:00
Yan Zhulanow 228b3c56a3 Minor: fix failing CliTestGenerated#testPluginSimple test
Add missing Android Dialog stub cause Android Extensions plugin now generates the synthetic property for Dialog.
2017-03-28 16:08:46 +03:00
Anton Bannykh 9b34e21619 JS: fixed <Type>Array.iterator methods; added -Xtypedarray compiler key
The <Type>Array.iterator used to lack next<Type>() method (KT-16626).

The -Xtypedarray compiler key enables translation of primitive arrays
to TypedArrays, and primitive array`is`-checks (KT-15358, KT-14007,
KT-14614, KT-16056).
2017-03-27 23:09:34 +03:00
Dmitry Jemerov 0d86bdd216 Remove Java 6/7 warning from expected output of the compiler 2017-03-20 18:45:51 +01:00
Dmitry Jemerov af7de9a0c5 Warn when running the compiler under Java 6 or 7
(cherry picked from commit 5537800)

(cherry picked from commit 5614874)
2017-03-01 16:21:57 +01:00
Alexander Udalov 12b48f86e7 Do not load error classes in ReflectionTypes
Previously ReflectionTypes.find returned an error class in case a class
is not found in the module dependencies. The problem with this approach
is that each call site should call ErrorUtils.isError on the result and
report an error if needed, in order to stop this type from reaching the
codegen, which can't handle error types.

Now we create a MockClassDescriptor instance instead. It's not an error
class, so it'll be handled correctly in the codegen. Also its scope is
empty and errors are reported on any non-trivial usage (see
MissingDependencyClassChecker), so this approach is not worse than error
classes

 #KT-16484 Fixed
2017-02-28 20:19:58 +03:00
Alexander Udalov 2e8bfde2e7 Move -Xskip-metadata-version-check from JVM to common arguments
To be used in JS
2017-02-15 10:46:48 +03:00
Stanislav Erokhin b6fa10cf9e Disable some features when LV=1.1 API=1.0.
Feature list:
 - bound callable references
 - local delegated properties
 - coroutines.

#KT-16017 Fixed
2017-02-13 20:29:38 +03:00
Alexander Udalov 20d856fa77 Minor, remove blank line in extra help 2017-02-13 14:09:38 +03:00
Alexey Andreev 7192529733 JS: drop support of old library format 2017-02-10 21:04:50 +03:00
Alexey Andreev 9d6f4d7770 JS: don't treat library without JS metadata as error, report warning and continue instead. See KT-16158 2017-02-08 11:29:30 +03:00
Alexander Udalov 464820458e JS: rename "-library-files" argument to "-libraries" and change separator
Use the system separator (':' or ';') instead of commas

 #KT-16083 Fixed
2017-01-31 16:26:35 +03:00
Alexander Udalov 8811165de8 Report error on callable reference or class literal with "-no-stdlib"
Also workaround the NoSuchElementException that was happening because error
type never has any type arguments

 #KT-14547 Fixed
2017-01-30 20:27:17 +03:00
Alexander Udalov e5680565b3 JS: drop "-kjsm" flag, merge logic with "-meta-info"
#KT-16049 Fixed
2017-01-30 11:31:03 +03:00
Alexander Udalov ef42e3e4aa JS: write full version (major.minor.patch) to .meta.js 2017-01-30 11:31:02 +03:00
Zalim Bashorov 29ac01f2e2 KJS: allow to use packages with names starting with "kotlin" only if the -Xallow-kotlin-package command line option is specified
#KT-14668 Fixed
2017-01-29 17:21:01 +03:00
Alexey Andreev 31c758994d JS: remove diagnostic about callable reference to built-in 2017-01-25 18:09:22 +03:00
Mikhael Bogdanov 62514e126d Enable jvm 1.8 platform in cli 2017-01-13 13:52:54 +01:00
Mikhail Zarechenskiy d1a3c4c48b Fix description of -Xcoroutines key 2016-12-15 23:58:11 +03:00
Mikhail Zarechenskiy 664485f4bb Introduce keys to control applicability of coroutines
By default now we produce warnings on coroutines
2016-12-15 23:58:07 +03:00
Alexander Udalov d0fa9bac75 Introduce '-Xskip-runtime-version-check' command line option 2016-12-13 21:09:00 +03:00
Mikhael Bogdanov dc5c3a478c Always use default 1.6 build target unless of 'jvm-target' option 2016-12-13 14:51:27 +01:00
Alexander Udalov 513ebb9729 Suggest to use "-Xskip-metadata-version-check" on incompatible classes in classpath 2016-12-09 01:59:36 +03:00
Alexander Udalov b943ed26f3 Report incompatible metadata version error correctly
Similarly to pre-release classes, load metadata for the class anyway and allow
the resolution to select it as the result and prohibit its usage in the end
with the special diagnostic reported in MissingDependencyClassChecker
2016-12-09 01:59:36 +03:00
Alexander Udalov d204fa91cc Use "-Xskip-metadata-version-check" to load pre-release classes 2016-12-09 01:59:35 +03:00
Alexander Udalov 204873edf2 Support "-Xno-check-impl" argument, check only real declarations
Use "-Xno-check-impl" to suppress checking whether the platform declaration
implementation has the "impl" modifier.

Do not check presence of fake overrides from platform class in the impl class,
otherwise there would be a lot of errors about the fact that
equals/hashCode/toString are not marked with the "impl" modifier
2016-11-25 20:50:29 +03:00
Alexander Udalov 73f872172f Add multi-platform projects as experimental language feature 2016-11-22 18:19:01 +03:00
Mikhael Bogdanov 61da8be260 Generate parameters metadata for java 8 reflection 2016-11-14 14:27:08 +01:00
Alexander Udalov 8c65379711 Support injecting custom module into KotlinBuiltIns
Provide a command-line option to load built-ins from the module and its
dependencies instead of looking for them in kotlin-compiler.jar; built-ins must
be found this way, or an error will be reported (or, most likely at this
moment, an exception will be thrown).

Note that this does not affect whether built-ins (loaded from one place or the
other) are added to the _dependencies_ of the module, this is controlled by
another option. The option added in this commit only makes the KotlinBuiltIns
instance which is used via ModuleDescriptor throughout the compiler front-end
(and also injected in a bunch of places) a sort of "helper" which always goes
to that same module to find descriptors for built-in classes
2016-11-08 12:14:24 +03:00