Commit Graph

1276 Commits

Author SHA1 Message Date
Ilya Chernikov d78fc50e90 Fix after review 2016-12-15 07:26:08 +01:00
Ilya Chernikov f036422ee9 Refactor eval code to avoid compiler (codegen) hangings on various loops inside RW locks 2016-12-15 07:26:08 +01:00
Ilya Chernikov fc416476a8 Move invokable parts to JSR223 only, remove unneeded code 2016-12-15 07:26:08 +01:00
Ilya Chernikov b1cd98f2d5 Refactor and fix script annotation processing 2016-12-15 07:26:07 +01:00
Ilya Chernikov 1cc85df78e Refactor REPL infrastructure for passing evaluation/invoke wrapper to every eval/invoke function 2016-12-15 07:26:07 +01:00
Ilya Chernikov cb7f22ffec Refactor JSR223 to support Compilable interface, drop daemon eval engine and sample, simplify 2016-12-15 07:26:07 +01:00
Ilya Chernikov eb3d8a1a4a Fix classpah update moment on script dependencies calculations 2016-12-15 07:26:06 +01:00
Ilya Chernikov c82e91eafe Implement Invocable on base evaluator and locally-evaluating JSR223 sample engines
fixes #KT-14707
2016-12-15 07:26:06 +01:00
Ilya Chernikov fbd4c6eb61 Implement invokable/invoker interface on the generic repl evaluator, refactor reflection utils on the way 2016-12-15 07:26:06 +01:00
Ilya Chernikov 7a79fff9d6 Put lines history into all data structures returned by repl, refactor storage and passing of the history for that 2016-12-15 07:26:06 +01:00
Ilya Chernikov 125cc6ebfb Fix compiled line class loading in repl, fixes #KT-14706 2016-12-15 07:26:06 +01:00
Alexander Udalov d0fa9bac75 Introduce '-Xskip-runtime-version-check' command line option 2016-12-13 21:09:00 +03:00
Alexander Udalov 6aaf2c7c4d Decrease number of reported runtime version diagnostics
If there's at least one runtime newer than the compiler, do not report that
it's inconsistent with the correct runtime
2016-12-13 21:09:00 +03:00
Alexander Udalov 2c527d89ab Improve diagnostics for runtime versions consistency checker
- report the diagnostic on the actual problematic file
- output the list of all runtime jars if min version != max version
2016-12-13 21:09:00 +03:00
Alexander Udalov d3e5580ab9 Use MavenComparableVersion in runtime version consistency checker
LanguageVersion is an enum consisting of the current and all previous versions
only, so with it we won't be able to detect the language version of a future
runtime
2016-12-13 21:08:59 +03:00
Dmitry Petrov 1866a33781 Check classpath version consistency.
Add 'Kotlin-version' attribute to kotlin-runtime and kotlin-reflect JARs.
2016-12-13 21:08:59 +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
Roman Elizarov 8affb2726f Pluggable Synthetic Objects 2016-12-12 18:43:26 +03:00
Sergey Mashkov f59377011c Initial Kotlin plugin support in Maven 2016-12-09 20:01:00 +03:00
Yan Zhulanow f57df272ac Allopen: Handle allopen annotations on classes (KT-12149) 2016-12-09 20:00:56 +03: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 789483e1eb Remove old mechanism of metadata version error reporting 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 3b18531b20 Add expectedVersion to IncompatibleVersionErrorData, move to deserialization 2016-12-07 21:46:36 +03:00
Alexander Udalov 414daef001 Rename KotlinVersion->KotlinCompilerVersion, move to module util.runtime
Rename to avoid confusion with the recently added kotlin.KotlinVersion
2016-12-07 21:11:15 +03:00
Yan Zhulanow d884830700 Allow to avoid declaration body resolution for function and property initializers if the return type is explicitly specified. This significantly reduces the analysis time in kapt3. 2016-12-05 19:57:43 +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 0dc31af73d Introduce KotlinMetadataFinder#hasMetadataPackage
Before creating a MetadataPackageFragment, check that the corresponding
directory (across the classpath) contains at least one .kotlin_metadata file.
Otherwise we're creating packages for every simple name queried during the
resolution and sometimes prefer a (empty) package to the existing class, for
example when the latter class is star-imported
2016-11-25 20:50:15 +03:00
Alexander Udalov bfb7b21472 Load definitions of symbols from .kotlin_metadata files
Extract AbstractDeserializedPackageFragmentProvider out of
JvmBuiltInsPackageFragmentProvider and implement it a little bit differently in
MetadataPackageFragmentProvider. The main difference is in how the package
fragment scope is constructed: for built-ins, it's just a single scope that
loads everything from one protobuf message. For metadata, package scope can
consist of many files, some of which store information about classes and others
are similar to package parts on JVM, so a ChainedMemberScope instance is
created.

Introduce a bunch of interfaces/methods to deliver the needed behavior to the
'deserialization' module which is not JVM-specific and does not depend on the
compiler code: MetadataFinderFactory,
PackagePartProvider#findMetadataPackageParts, KotlinMetadataFinder#findMetadata.
Note that these declarations are currently only implemented in the compiler; no
metadata package parts/fragments will be found in IDE or reflection
2016-11-25 20:50:13 +03:00
Alexander Udalov ec03c6decb Introduce K2MetadataCompiler, extract MetadataSerializer out of BuiltInsSerializer
K2MetadataCompiler is a compiler facade similar to K2JVMCompiler and
K2JSCompiler and it produces .kotlin_metadata files. Each .kotlin_metadata file
contains the binary data which is a serialized BuiltIns protobuf message.

There's no 'kotlinc-***' script yet though, so to run this compiler currently
invoke this:

    KOTLIN_COMPILER=org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler kotlinc
2016-11-25 20:50:09 +03:00
Alexander Udalov 19520bf29c Extract KotlinMetadataFinder interface out of KotlinClassFinder 2016-11-22 18:19:02 +03:00
Alexander Udalov 73f872172f Add multi-platform projects as experimental language feature 2016-11-22 18:19:01 +03:00
Dmitry Jemerov 5a533a521b Don't consider a directory to be a package if there's a .java or .class file with the same name in its parent directory
#KT-12664 Fixed
2016-11-18 14:00:44 +01:00
Mikhael Bogdanov 61da8be260 Generate parameters metadata for java 8 reflection 2016-11-14 14:27:08 +01:00
Alexey Tsvetkov f381f1e699 Revert default value for "main" parameter for Gradle JS plugin to "call"
#KT-14724 fixed
2016-11-11 21:25:05 +03:00
Valentin Kipyatkov e850446f17 Introduced BindingContext.DATA_FLOW_INFO_BEFORE 2016-11-08 19:14:40 +03: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
Alexander Udalov 7898e2447d Minor, rename JVMConfigurationKeys.ADD_BUILT_INS_TO_DEPENDENCIES 2016-11-08 12:14:24 +03:00
Alexey Sedunov d0de9dd43c Kotlin Facet: Get rid of copy constructors for compiler arguments/settings and use reflection-based copying instead 2016-11-07 20:03:29 +03:00
Alexey Sedunov a2948a624f Kotlin Facet: Reuse JvmTarget and LanguageVersion in facet configuration 2016-11-07 20:03:28 +03:00
Alexander Udalov c49c019250 Add option to restore fallback to compiler built-ins + resurrect Maven build 2016-10-26 19:02:31 +03:00
Alexander Udalov e0989caf46 Load built-ins from module dependencies in JVM compiler
Introduce a new method KotlinClassFinder#findBuiltInsData, which is only
implemented correctly in the JvmCliVirtualFileFinder because it's only used in
the compiler code at the moment.

Introduce JvmBuiltInsPackageFragmentProvider, the purpose of which is to look
for .kotlin_builtins files in the classpath and provide definitions of
built-ins from those files.

Also exclude script.runtime from compilation because, as other excluded
modules, it has no dependency on the stdlib and is no longer compilable from
the IDE now, because it cannot resolve built-ins from anywhere
2016-10-26 16:31:09 +03:00
Alexander Udalov 8a5c8da757 Simplify module configuration and built-ins dependency in some tests
- In tests on built-ins with no sources, just call
  JvmResolve.analyze(environment) and inspect the resulting module
- In AbstractLocalClassProtoTest, create container via
  TDAForJVM.createContainer
- Inline single module container creation into AbstractDiagnosticsTest
2016-10-26 16:31:04 +03:00
Alexey Sedunov ea13456bba Kotlin Facet: Add compiler settings to facet configuration 2016-10-26 15:03:42 +03:00
Alexander Udalov d9f248ccf4 Minor refactoring in JvmDependenciesIndexImpl
Make SearchResult a sealed class, inline local function & trivial utility
2016-10-24 15:30:38 +03:00
Alexander Udalov 76523cc175 Split JvmDependenciesIndex to several files, move to 'index' package 2016-10-24 15:30:38 +03:00
Ilya Chernikov 846797ff61 Switch to templates in the separate script runtime 2016-10-12 15:38:52 +02:00
Ilya Chernikov c2b5c11781 Fix all small and medium-sized issues after review 2016-10-12 15:37:54 +02:00
Ilya Chernikov 10d259771c Refactor repl and JSR 223 support code, add separate example jars for each type of JSR 223 repl (with tests) 2016-10-12 15:37:52 +02:00
Ilya Chernikov bf0d5b6237 Add basic bindings support to IDEA JSR223 scripting, fix evaluator 2016-10-12 15:37:51 +02:00