Commit Graph

240 Commits

Author SHA1 Message Date
Nikolay Krasko 620898c73e Use local single-thread cached value instead of thread locals (KT-28940)
It looks like thread locals are not needed here as their global state
is not utilized but creates troubles with memory management.
2019-10-29 13:40:34 +03:00
Nikolay Krasko 02f9b255e6 Clean using thread local in all threads (KT-28940) 2019-10-29 13:40:34 +03:00
Nikolay Krasko 1b96e14b1e Remove reference to temporary thread local explicitly (KT-28940)
There're issue with storing variables in memory longer than needed.
2019-10-25 17:01:52 +03:00
Nikolay Krasko 728ccdee63 Don't publish computed value to other threads till post compute is finished (KT-28940)
This fixes a race condition with counting supertypes (the only client
of createLazyValueWithPostCompute left at the moment).

 #KT-28940 Fixed
2019-10-13 18:21:38 +03:00
Nikolay Krasko 4f488ddd16 Remove lazy values with dummy post compute lambdas 2019-10-13 18:21:38 +03:00
Denis Zharkov 01f0589ddf [Invariant Fix] Use the same lock inside single GlobalFacade
Before refinement, order of accessing compiler's entities (supertypes,
descriptors, memberscopes) was always the following:

    sources -> libraries -> SDK (built-ins)

With refinement, it is sometimes possible to inverse this order, e.g.
access sources after libraries or SDK. This mainly happens in the following
scenario:

- we reference some library/SDK class, but do not acquire source-lock
  This might seem a bit weird, but actually it is quite easy to achieve
  as soon as we understand that analysis sources doesn't necessarily
  acquires respective lock, only forcing lazy computations does so.
  E.g., we can just traverse PSI tree and meet some refernce to "Any?" -
  this doesn't involves acquiring source-lock

- we start resolving it, which usually involves acquiring library/SDK-lock
  (e.g., in order to get it supertypes or memberScope)

- because we reference it from the source-module, we may like to refine
  it, in which case we will have to acquire source-lock on refinement
  cache

Obviously, that may lead to deadlocks, so, in this commit we disable
creating granular locks when we work with refinement.

Note that if refinement is disabled (which is the case for all non-MPP
projects), we still create separate locks.
2019-07-30 12:41:39 +03:00
Dmitry Savvinov 72e28d37fc [Injection] Introduce PlatformSpecificExtensions and PlatformExtensionsClashResolver
This commit introduces the ability to register a PlatformExtensionClashResolver
in a container. Each PlatformExtensionClashResolver has a corresponding
PlatformSpecificExtensions.

If, during container composition, several instances of
PlatformSpecificExtensions were registred, instead of throwing
InvalidCardinalityException, corresponding PlatformExtensionClashResolver
will be asked to resolve clash.

This allows to make injection more composable and less coupled across
different contributors of service, providing a basis for such motivating
cases as composing containers with both JS and JVM services (for analysis
of multiplatform modules).
Previously, that would be impossible:
a) JS would inject default instances for some services which would clash
with non-default JVM services (like SyntheticScopes)
b) Also, there are a very few services for which *both* platforms provide
non-default implementations, so they should be merged manually on
case-by-case basis (e.g., IdentifierChecker)
2019-05-28 13:08:08 +03:00
Dmitry Savvinov d80eba31be [Injection] Discriminate default instances during clashes resolution
The idea is to try to resolve the dependency without considering default
instances first.

This makes containers more composable, e.g., it is now possible to put
several containers together as long as all except one provide default
implemenetation for some particular service (non-default implementation
will be automatically chosen, and all defaults will be discarded).
2019-05-28 13:08:08 +03:00
Nikolay Krasko 213b98fefe Review changes: revert compiler behaviour, add test, remove inner classes 2019-03-12 14:28:31 +03:00
Harry Billinis 6ba134b1be Better names suggestion for constant like reference expressions (KT-28485)
Code was simplified after @igorwojda suggestions

 #KT-28485 Fixed
2019-03-12 14:28:31 +03:00
Dmitry Gridin 57040f6f9d Minor: refactoring & fix warnings 2019-03-11 23:38:19 +07:00
Yan Zhulanow eb1543c71a Minor: Fix a few compilation warnings in compiler and compiler tests, fix formatting 2019-03-06 03:30:55 +03:00
Sergey Rostov f35185b261 Build: remove explicit dependencies to org.jetbrains.annotations 2019-01-28 13:43:08 +03:00
Vyacheslav Gerasimov f58acbeef5 Build: implement useBootstrapStdlib flag
Excludes stdlib projects from build and uses bootstrap stdlib artifacts

 #KT-29205
2019-01-21 21:09:40 +03:00
Dmitry Savvinov 69fff12384 Drop LockBasedStorageManager.defaultDebugName, use meaningful name everywhere
Also, drop `createDelegatingWithSameLock` as it was unused
2019-01-14 11:10:37 +03:00
Sergey Rostov 883970fadb Add explicit dependencies to nullable annotations 2018-12-26 09:07:06 +03:00
Dmitry Petrov 0191e3d1cf Migrate to release coroutines 2018-09-27 21:59:31 +03:00
Ilya Gorbunov a18770fbbb Remove projectDist dependency helper usages
Use default configuration dependencies instead of projectDist ones.
2018-09-12 06:05:05 +03:00
Ilya Gorbunov c1829782b7 Turn off compiler prerelease flag #KT-26643 2018-09-11 21:10:04 +03:00
Ilya Gorbunov 0f5f90cf52 Advance project version to 1.3-SNAPSHOT
Set LATEST_STABLE language version and current version of stdlib to 1.3, set IS_PRE_RELEASE
Remove "EXPERIMENTAL" from 1.3 version description in tests and gradle options
2018-08-30 14:49:27 +03:00
Alexander Udalov 6f9441d3f4 Do not output empty non-root packages in tests with txt
Mostly to avoid listing every internal package in
kotlin-stdlib/kotlin-reflect, as in
https://github.com/JetBrains/kotlin/blob/acd5b62148d797ffd24c4811d1d663f0c1ae7885/compiler/testData/diagnostics/testsWithUnsignedTypes/conversions/conversionOfSignedToUnsigned.txt#L144
2018-08-06 13:43:32 +02:00
Alexander Udalov 1b15619457 Move BinaryVersion to metadata, JVM versions to metadata.jvm
To be used in kotlinx-metadata
2018-05-16 17:16:22 +02:00
Dmitry Savvinov d438988fc6 Fix javadoc for StorageManager.createLazyValueWithPostCompute 2018-04-11 16:03:19 +03:00
Dmitry Savvinov d8b7de4f0e Add extra diagnostic information when no common supertypes are found
We're suspecting that the culprit of such errors is race condition on
'supertypes' in AbstractTypeConstructor, when it is created using
'LockBasedStorageManager.NO_LOCKS'
2018-04-10 10:47:22 +03:00
Alexey Tsvetkov 8a82c1618c Use Plugins DSL in Kotlin Gradle scripts
When plugins DSL is used, there is no need to
manually generate typesafe accessors for extensions and
conventions (by running `./gradlew kotlinDslAccessorsSnapshot`).
2018-03-26 16:09:29 +03:00
Nikolay Krasko 117890dba8 Fix generating cls stubs when is metadata using type tables (KT-23345)
Affected cases:
 - return type for suspend lambda
 - aliased type in type alias declaration
 - using type alias instead of aliased type in declarations

 #KT-23345 Fixed
2018-03-22 11:54:03 +03:00
Yan Zhulanow 34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00
Alexander Udalov b6a55f74f4 Support patch versions in RequireKotlin with kind=COMPILER_VERSION 2018-02-08 17:47:37 +03:00
Denis Zharkov 3cfe43f83a Add -Xsupport-compatqual-checker-framework-annotations flag
It's implemented through Jsr305State while it's not related
to jsr-305 becasue currently it's the most convenient way
to introduce the flag.

Probably, it's worth renaming Jsr305State to something more abstract
like NullabilityAnnotationsConfiguration

 #KT-21982 Fixed
2018-01-10 17:02:46 +03:00
Ilya Gorbunov 093f796fc7 Write compiler and stdlib versions from gradle build 2017-11-01 17:26:18 +03:00
Alexander Udalov 0510c553c3 Mark class files as pre-release if language version > LATEST_STABLE
#KT-20547 Fixed
2017-10-16 15:09:36 +02:00
Leonid Stashevsky 0348561cd2 Add annotation for default parameter value 2017-10-06 15:45:38 +03:00
Leonid Stashevsky 95d32d8d1e Add @UnderMigration annotation and options for report level 2017-10-03 16:44:02 +03:00
Denis Zharkov cd3edfc5b2 Introduce MemberScope::classifierNames and some implementations
It aims to help with further optimizations
2017-09-28 14:01:30 +03:00
Ilya Chernikov 95035b3d72 Fix various tests 2017-09-20 11:51:23 +02:00
Ilya Chernikov fd1b677904 Switch reflect to compiled core classes 2017-09-19 23:58:32 +02:00
Ilya Chernikov d89b53dfea Reorganize builtins built and use in the projects 2017-09-19 23:58:31 +02:00
Ilya Chernikov d039d191f2 Fix tests in the new build infrastructure 2017-09-19 23:58:30 +02:00
Alexander Podkhalyuzin 3f8170d369 Clean idea files generated on the gradle import, add them to .gitignore 2017-09-19 23:58:27 +02:00
Ilya Chernikov 27968c8e13 Set proper jvmTarget for projects 2017-09-19 21:37:27 +02:00
Ilya Chernikov deda50dbbb Continue switching projects to improved dsl: sourceSets and test running 2017-09-19 21:37:26 +02:00
Ilya Chernikov aa4fdaa713 Implement publishing in the build 2017-09-19 21:37:13 +02:00
Ilya Chernikov 61dfb75e0e Implement Gradle Kotlin DSL build 2017-09-19 21:37:06 +02:00
Denis Zharkov 363d345752 Make default value for -Xjsr305 flag to be WARN 2017-09-14 18:05:32 +03:00
Denis Zharkov b744ed0fd3 Minor. Remove unused properties 2017-09-14 18:05:32 +03:00
Denis Zharkov 943dd96a87 Fix Jsr305State::STRICT description 2017-09-14 18:05:32 +03:00
e5l 5bb88b659b Rename flag Xjsr305-annotations->Xjsr305 2017-09-13 15:19:54 +06:00
e5l 746de612ad Move Jsr305State to util.runtime 2017-08-15 11:01:08 +03:00
Mikhael Bogdanov db9f925bb1 Switch default project jvm target to 1.8, keep 1.6 for core modules 2017-08-04 13:14:50 +02:00
Dmitry Jemerov f370d74609 Correctly detect stdlib in Gradle projects; move detection out of EDT
To detect whether a module has an stdlib in its dependencies, look at
source root modules and not at base module.
2017-07-24 19:53:52 +02:00