Commit Graph

1250 Commits

Author SHA1 Message Date
Alexander Udalov 2b1b1fb0d4 Merge VirtualFileKotlinClassFinder into VirtualFileFinder
VirtualFileKotlinClassFinder was the only direct subclass of VirtualFileFinder
2017-03-03 13:33:50 +03:00
Alexander Udalov abb5bc6aba Simplify VirtualFileFinder and their factories' hierarchy
Since there's no JsVirtualFileFinder anymore, inline JvmVirtualFileFinder into
VirtualFileFinder and drop "Jvm" prefix everywhere
2017-03-03 13:33:50 +03: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
Ilya Chernikov a3a782613a Cleanup 2017-02-24 16:58:24 +01:00
Ilya Chernikov b23911fd59 Reintroduce history check between compile and eval, place generation into code line and id 2017-02-24 16:58:24 +01:00
Ilya Chernikov 7b2ea001c1 Fix state conversion, fix tests 2017-02-24 16:58:24 +01:00
Ilya Chernikov f9dedab8c8 Extract repl state as a separate object 2017-02-24 16:58:24 +01:00
Alexander Udalov a9678010a8 Invert LanguageFeature responsible for warning on coroutines
The problem was that LanguageVersionSettingsImpl.DEFAULT did not have
"WarnOnCoroutines" as a feature and so it was manually added to the settings,
but only in two places: in the compiler and in the IDE
2017-02-22 18:55:48 +03:00
Alexander Udalov 21449763ab Add extension CompilerConfiguration.languageVersionSettings for convenience 2017-02-21 10:58:19 +03:00
Alexander Udalov 8e407d548a Suggest to provide explicit dependency on new kotlin-reflect
In case when there's kotlin-stdlib 1.1 and kotlin-reflect 1.0 in the classpath
2017-02-15 20:43:25 +03:00
Alexander Udalov 71fcb07fad Infer API version from older runtime in compiler's classpath
For example, if you invoke kotlinc 1.1 with kotlin-stdlib 1.0 in the classpath,
we now infer -api-version 1.0 automatically
2017-02-15 20:43:25 +03:00
Alexander Udalov b56639a775 Filter out files with the same paths in runtime version checker
To prevent listing them several times in the diagnostic message
2017-02-15 20:43:25 +03:00
Alexander Udalov 8457ab7c58 Report warnings instead of errors in runtime version checker 2017-02-15 20:43:25 +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
Alexander Udalov a1a71a01b1 Drop JvmMetadataVersion.skipCheck, support this correctly
Pass the value of this flag via DeserializationConfiguration
2017-02-15 10:46:48 +03:00
Alexander Udalov 20d856fa77 Minor, remove blank line in extra help 2017-02-13 14:09:38 +03:00
Ilya Chernikov da2f310895 Convert line endings when creating ReplCodeLine, fixes KT-15861
(cherry picked from commit 894ee4c)
2017-02-09 22:00:30 +01: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
Ilya Chernikov 99b902f5f2 Fix version calculation code
(cherry picked from commit fb74040)
2017-02-07 13:45:22 +01:00
Ilya Chernikov f6ce74edb3 Set jvmTarget property for repl compilation from sys prop or java version, fixes KT-16126
(cherry picked from commit 4cf2bce)
2017-02-07 13:45:12 +01:00
Alexander Udalov ca1ed850b8 Improve error on runtime of version different than API version
Include the actual runtime version in the error message
2017-02-06 19:39:15 +03:00
Alexander Udalov 57f8ef372f Report different runtime versions earlier than incompatibility with API version
Previously if you had kotlin-reflect 1.0 and kotlin-runtime 1.1 in the
classpath, checkCompatibleWithApiVersion was invoked first, and an error was
reported that suggested to pass "-api-version" to the compiler. However, no
correct "-api-version" can be passed in this case, because
checkMatchingVersions would then report that the two libraries have different
versions anyway. So, now we first ensure that all libraries have the same
version, and only then do check if the version is correct
2017-02-06 19:39:15 +03:00
Alexander Udalov 3a7eec8635 Check API version instead of language in JVM runtime versions checker
It should be a valid case to invoke the 1.1 compiler with the 1.0 runtime in
the classpath and "-api-version 1.0". However, previously it was an error and
the message suggested to specify "-language-version 1.0". Language version 1.0
implies API version 1.0, so this effectively made the "-api-version" option
useless
2017-02-06 19:39:15 +03:00
Anton Bannykh 289a7a9cc3 JS: fixed support for test source roots (KT-6627) 2017-02-03 13:03:12 +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 424afba246 Add hint to use "-language-version", when applicable, in JVM runtime checker 2017-01-30 20:27:17 +03:00
Alexander Udalov 7167139c2e Refactor JvmRuntimeVersionsConsistencyChecker for readability 2017-01-30 20:27:16 +03:00
Alexander Udalov 9e877b4a9e Do not report error on libraries that bundle Kotlin runtime in classpath
Instead, report a strong warning, suggesting to remove such libraries from the
classpath

 #KT-15995 Fixed
2017-01-30 20:27:16 +03:00
Alexander Udalov e9a737b85a Promote severity of configuration warnings to STRONG_WARNING
The reason is that these configuration problems may be the reason of
compilation errors, but they were hidden from the output because warnings are
not reported when there's at least one error
2017-01-30 16:01:29 +03:00
Alexander Udalov 7ac96163ac Introduce CompilerMessageSeverity.STRONG_WARNING
This is a severity for mandatory warnings, i.e. those which should be reported
in any case, even if there are compilation errors
2017-01-30 16:01:27 +03:00
Dmitry Jemerov 3a3cf048a6 Register ControlFlowFactory in KotlinCoreProjectEnvironment
#KT-16047 Fixed
2017-01-30 13:22:47 +01:00
Alexander Udalov e5680565b3 JS: drop "-kjsm" flag, merge logic with "-meta-info"
#KT-16049 Fixed
2017-01-30 11:31:03 +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
Ilya Chernikov b8b044c6b0 Reuse script args substitution for replacing bindings in JSR 223 sample engines, fixes KT-15450 2017-01-27 22:20:44 +01:00
Ilya Chernikov 0b689a4ecb PR-1021 review: minor fixes
# Conflicts:
#	compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/GenericReplCompilingEvaluator.kt
#	compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/repl/GenericReplEvaluator.kt
#	compiler/cli/src/org/jetbrains/kotlin/cli/jvm/repl/GenericReplCompiler.kt
2017-01-27 22:20:44 +01:00
apatrida 5ad06e1e92 PR-1021: Merge Keplin project scripting code into Kotlin core.
Overhauls the scripting layers (GenericRepl and related, and JSR223 and related)
Adds repeating modes (none, only latest eval'd line, or random order)
Also adds better thread-safe IO capturing, default imports, SimpleRepl wrapper, more unit tests

NOTE: the script-util part of the pull request was rejected due to various problems and incompatibilities.
It may be incorporated into the code later.

(originally cherry picked from commit 6f7d517)
2017-01-27 22:20:44 +01:00
Ilya Chernikov 8caf607378 PR-1021 preparations: prepare files to preserve important history
- Split GenericRepl.kt into separate files
- Rename Repl.kt
2017-01-27 22:20:44 +01:00
Ilya Chernikov ec7e8873f4 Update daemon client with wrappers for basic compiler API
Other changes to extract results for compiler, tests.
2017-01-25 15:29:15 +01:00
Alexander Udalov 76fc3b40d5 Do not consider Kotlin compiler as library in runtime versions checker
Otherwise because there's no Kotlin-Version in its manifest, it's regarded as a
1.0 runtime library which conflicts with 1.1 libraries
2017-01-23 11:30:53 +03:00
Alexander Udalov 139d37cfd0 Support "Main" component in JVM runtime version consistency checker
The point here is to disable the "checkNotNewerThanCompiler" check because it
breaks a real life use case of compiling with an old compiler against the new
runtime library (that may come implicitly as a transitive dependency of another
library). However, to keep the possibility of restoring this check in the
future without backporting the needed changes into the old branches, we now
only perform this check for the "Core" runtime components, and all other checks
-- for "Core" and "Main" runtime components. In the follow-up commit, we change
the runtime component of our libraries to "Main". If we decide we need the
"checkNotNewerThanCompiler" behavior in the future, we can change the runtime
component to "Core", effectively restoring this check in the old compilers
2017-01-21 12:57:14 +03:00
Alexander Udalov 7b4e826650 Enable JVM runtime version consistency checker in 1.1 2017-01-21 12:57:14 +03:00
Mikhael Bogdanov 62514e126d Enable jvm 1.8 platform in cli 2017-01-13 13:52:54 +01:00
Alexey Tsvetkov 99c72b6dff Refactor JPS daemon client 2017-01-13 15:08:12 +03:00
Alexander Udalov 2ba18beb89 Report JVM runtime version inconsistency as errors instead of warnings
(cherry picked from commit f8fc7e94ac07d80f332149529b34297b7f0db82e)
2017-01-13 11:53:52 +03:00
Alexander Udalov edb4fd1dfd Do not emit pre-release flag if -Xskip-metadata-version-check is used
The -Xskip-metadata-version-check command line argument is supposed to be used
to avoid getting errors only; the side effect that it also caused compiler to
write the pre-release flag to binaries was a mistake and is fixed now
2017-01-11 19:28:52 +03:00
Alexander Udalov 7b5c90ebaf Correctly load multifile package parts from binaries
JvmPackagePartProvider should not just blindly load all multifile parts from
all libraries on the classpath, but only those from multifile classes which
shadow (come earlier on the classpath) other classes with the same name.
Otherwise if you have different versions of the same library (which uses
multifile classes) on the classpath, the compiler will see parts from both
versions. If some declaration have moved from one part to another, it's
possible to observe an overload resolution ambiguity error

 #KT-15287 Fixed
2017-01-11 13:15:58 +03:00
Alexander Udalov db3fa8eaca Refactor JvmPackagePartProvider
Make code more imperative than functional, preserve the information about the
original root where the module mapping was discovered
2017-01-11 13:15:56 +03:00
Alexander Udalov 164c72e877 Prefer package with class files to class with the same name
See comments in JvmDependenciesIndexImpl and in the test

 #KT-15464 Fixed
2017-01-10 12:23:25 +03:00
Yan Zhulanow fdb568f86d Kapt3: Generate incremental compilation metadata (light classes with Kotlin metadata) 2016-12-28 22:28:33 +03:00
Alexey Tsvetkov fb869277d9 Set property "idea.plugins.compatible.build" every time production environment is created
Gradle can wipe system properties between the build.
If this property is not set, "idea.properties is not found exception"
can be thrown when creating KotlinCoreEnvironment.
2016-12-19 22:55:22 +03:00