Commit Graph

3045 Commits

Author SHA1 Message Date
Dmitry Petrov 8d16bd1215 Method can be hidden if it is annotated with kotlin.internal.PlatformDependent,
or is a Java method from a Kotlin built-in class (transitively).

https://github.com/Kotlin/KEEP/blob/master/proposals/jdk-dependent-built-ins.md#backward-compatibility-of-overrides
2016-12-23 13:51:08 +03:00
Alexey Tsvetkov 4fdca24db4 Remove source annotations removing (not needed with KAPT3) 2016-12-19 22:46:12 +03:00
Denis Zharkov c73b0d7b76 Move coroutine intrinsics to object (backend's) 2016-12-15 23:58:23 +03:00
Stanislav Erokhin 42440f50dc Remove soft keyword coroutine & isCoroutine from ValueParameterDescriptor. 2016-12-15 23:57:56 +03:00
Stanislav Erokhin 0132f3eea7 Remove kotlin.coroutine package from default imports. 2016-12-15 23:57:51 +03:00
Denis Zharkov 6649f64e9f Support new coroutine convention in JVM backend 2016-12-15 23:57:40 +03:00
Denis Zharkov b1d1128466 Minor. Move createFunctionType to core
As it will be used in the type mapper soon
2016-12-15 23:32:09 +03:00
Mikhael Bogdanov 268d55104c Don't generate delegation to java default methods
#KT-15226  Fixed
2016-12-14 11:20:04 +01:00
Alexander Udalov d0fa9bac75 Introduce '-Xskip-runtime-version-check' command line option 2016-12-13 21:09:00 +03:00
Mikhail Glukhikh 57da92b862 Infrastructure change: module descriptor now knows its platform kind & its sources kind 2016-12-13 18:53:55 +03:00
Stanislav Erokhin 59efedf610 Rename platform to header. 2016-12-13 18:00:00 +03:00
Dmitry Jemerov 7e92cf2af7 Don't create light classes for platform declarations
#KT-15137 Fixed
2016-12-12 20:47:45 +01:00
Roman Elizarov 8affb2726f Pluggable Synthetic Objects 2016-12-12 18:43:26 +03:00
Yan Zhulanow b9a0a4f3db Kapt3: Ensure that field types and method return types are not anonymous (KT-14997) 2016-12-09 20:28:31 +03:00
Yan Zhulanow cbef0250aa Allow to turn the first parameter of a SAM-converted lambda into the receiver (KT-12848) 2016-12-09 20:01:21 +03:00
Alexander Udalov 789483e1eb Remove old mechanism of metadata version error reporting 2016-12-09 01:59:36 +03:00
Alexander Udalov 11f975fe89 Add classifier usage checker for missing dependency classes
This has no effect for the original use case of mock class descriptors
(unresolved classes used in libraries), but is necessary for pre-release
classes in case the compiler is a release, because such classes end up in scope
and can be the result of the resolution
2016-12-09 01:59:33 +03:00
Alexander Udalov 4e99349f1f Write "pre-release" flag to class files, do not allow usages in release 2016-12-09 01:59:33 +03:00
Alexey Andreev 7e37d5d6fa Prohibit external modifiers on classes and properties in JVM target 2016-12-08 15:41:42 +03:00
Alexey Andreev ba2443bcb3 Add external property to class and property descriptors 2016-12-08 15:41:38 +03:00
Alexander Udalov 228d0a1c43 Move "missing dependency class" diagnostic from JVM to common front-end 2016-12-07 21:46:37 +03:00
Alexander Udalov 3b18531b20 Add expectedVersion to IncompatibleVersionErrorData, move to deserialization 2016-12-07 21:46:36 +03:00
Denis Zharkov dd392963ac Minor. Rename SyntheticExtensionFunctions -> SyntheticMemberFunctions 2016-12-07 21:04:57 +03:00
Denis Zharkov 891a036b59 Change resolution priority level for SAM adapters
After this change SAM adapters are being resolved in the same group
as members, thus their overload resolution happens simultaneously.

But in the case of overload resolution ambiguity try to filter out all
synthetic members and run the process again.

See the issue and new test for clarification

 #KT-11128 In Progress
2016-12-07 21:04:44 +03:00
Denis Zharkov a4adfb43d4 Minor. Refine substitution for SAM adapters
Introduce CompositionTypeSubstitution instead of manual composition of
two substitutions.

This change is necessary for the later changes where original substitution
will be able to contain outer type parameters

 #KT-11128 In Progress
2016-12-07 21:04:39 +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
Mikhail Zarechenskiy 240d82d167 Move reified type parameter checker to additional checkers to able turn it off by demand 2016-12-01 10:06:38 +03:00
Denis Zharkov fcd9ee037e Support coroutines stack-unwinding in JVM backend
#KT-14924 In Progress
2016-11-29 14:14:50 +03:00
Alexander Udalov 8d3f6f1ce7 Check platform<->impl declaration compatibility
For each platform declaration, there must be at least one impl declaration in
the module with the compatible signature; similarly, for each impl declaration,
there must be at least one platform declaration with the compatible signature.

Note that currently the presence of the 'impl' modifier is not checked yet.

Also, the sad fact is that if you have platform and impl declarations which are
not compatible, you get two errors: on the platform delcaration and on the impl
declaration. This needs to be addressed as well
2016-11-25 20:50:26 +03:00
Alexander Udalov ce9691cd2b Support platform/impl modifiers for properties
Do not allow platform properties to have backing fields, initializers, be
delegated, lateinit or const, or have accessors with bodies
2016-11-25 20:50:18 +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
Dmitry Petrov fc2a965d2a Fix decompiler tests. 2016-11-22 14:40:02 +03:00
Dmitry Jemerov b8525de726 Disallow @JvmOverloads on any interface methods
#KT-12224 Fixed
2016-11-18 11:05:02 +01:00
Dmitry Jemerov 79e90b32e8 @JvmOverloads on local declarations is now an error 2016-11-18 11:05:01 +01:00
Dmitry Jemerov 12e4cf9a4f Report @JvmOverloads errors on annotation, not on entire declaration (KT-12701) 2016-11-18 11:05:00 +01:00
Dmitry Jemerov 53cb559440 Fix exception on databinding-generated classes in AS 2.3 (https://ea.jetbrains.com/browser/ea_reports/1261189) 2016-11-15 12:47:45 +01:00
Anton Bannykh 334ae72957 Moved checking that reified is used in inlines only to the main frontend (KT-12695, KT-13697 fixed) 2016-11-15 13:44:48 +03:00
Mikhael Bogdanov 61da8be260 Generate parameters metadata for java 8 reflection 2016-11-14 14:27:08 +01:00
Ilya Chernikov 6e96d192bf Move incremental components to compller util to reduce dependencies of compiler interface modules 2016-11-09 11:09:32 +01:00
Denis Zharkov 7e49db8768 Introduce CoroutineImpl as a common super class for coroutines
The main benefit are class-files sizes for them
(not repeating the same declaration for each coroutine)
Also it helped to simplify coroutine codegen code a little

Note that controller/label field become non-volatile (see KT-14636)

 #KT-14636 In Progress
2016-11-09 12:25:31 +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 30d08c989d Kotlin Facet: Use facet configuration to provide language version for IDE analyzer 2016-11-07 20:03:30 +03:00
Yan Zhulanow 951868f590 Explicitly filter out classes found by DataBindingClassFinder and DataBindingComponentClassFinder for scope without sources (KT-12402)
This change is temporary, and it should be reverted when the original problem in DataBinding IDE support is fixed.
2016-11-01 19:36:33 +03:00
Mikhail Glukhikh 2130164d9b EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT is now reported on property if accessor is external #KT-9297 Fixed
Also fixes EA-89227
2016-10-27 16:25:43 +03:00
Alexander Udalov 7f86ce0a20 Introduce fallback option to add built-ins in position manager test
In AbstractPositionManagerTest, built-ins could no longer be resolved because
JvmIDEVirtualFileFinder is used in IDE tests (even when the compilation is
called through JvmResolveUtil/GenerationUtils as in compiler tests), which is
not yet able to locate .kotlin_builtins files
2016-10-26 16:31:09 +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 484b0e36fb Add KotlinBuiltIns#isBuiltIn, use it instead of other utilities 2016-10-26 16:31:05 +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
Alexander Udalov 035d6156a7 Drop Cloneable in JS, synthesize it at compile-time on JVM
Use the same approach that is used for creating function type classes
(Function{0,1,...}) + add Cloneable to supertypes of Array and primitive arrays

 #KT-5537 Fixed
2016-10-25 15:42:33 +03:00