Commit Graph

56432 Commits

Author SHA1 Message Date
Yan Zhulanow ccff347ffc Kapt: Attach generated Kotlin sources in 'compilation' mode (KT-32535) 2019-07-26 02:40:32 +09:00
Ivan Gavrilovic 1c63d3aa2f KT-32210: Handle long compiler plugin options
Some of the KAPT compiler plugin options were longer than 0xFFFF bytes in
UTF-8 encoding, causing UTFDataFormatException when serializing them. This
commit avoids that issue by encoding changed files and changed classpath types
one by one instead of joining them to a single string.
2019-07-26 02:40:32 +09:00
Alexey Tsvetkov 4b9a852745 Sort source to output mapping before writing to caches
#KT-32902 Fixed
2019-07-25 20:30:56 +03:00
Alexey Tsvetkov afa10cc125 Rewrite test of relocatable JPS IC caches
* Caches are compared as files now. It is a more robust approach
than comparing strings with dumped contents. E.g previous test
ignored differences in keys ordering, because dumping caches to string
was added for comparing caches after incremental and non-incremental builds,
which cannot be compared without sorting keys (see KT-32674).
* Calling setUp/tearDown twice within the same test instance was
relatively hacky and fragile. Also it complicated adding new test cases.
2019-07-25 20:30:56 +03:00
Alexey Tsvetkov 98aad3e00c Extract EnableICFixture 2019-07-25 20:30:56 +03:00
Alexey Tsvetkov a4c62d156f Make lookup storage addAll order independent
Lookup storage output files could differ for projects
with different absolute paths.
This happened because, paths for lookups were
relativized only before writing to the underlying storage.
Storing absolute paths in a hash table could
result in different order of adding files to the lookup storage.
This commit fixes the issue by sorting lookups and files in
LookupStorage#addAll

    #KT-32674 Fixed
2019-07-25 20:30:56 +03:00
Alexey Tsvetkov 57caca4b0e Improve exception message for directories comparison in tests
It was unclear what dirs were compared (e.g when rebuilding and
comparing caches dirs, it's not obvious which dir is "expected" and
which is "actual"). To improve this, compare resulting strings
with the placeholder for a root dir first. If the comparison fails,
then replace the placeholder with an actual directory and call
assertEquals.
2019-07-25 20:30:56 +03:00
Dmitry Gridin 6914a9dd3d KotlinFindUsagesHandler: fix read access (flaky tests) 2019-07-25 19:16:52 +03:00
Alexander Podkhalyuzin 66fdc148be Revert strong references for compiler only
#KT-32521 Fixed
2019-07-25 16:13:47 +03:00
Alexey Tsvetkov f3112f752d Inherit max metaspace size of client VM for Kotlin compile daemon
#KT-32521 In Progress
    #KT-32950 Fixed
2019-07-25 16:13:47 +03:00
Alexey Tsvetkov 5c99243c10 Substitute kotlin-reflect with kotlin-reflect-api in compile classpath
Currently Kotlin IC can only track changes in "default" jar files by
associating a history of ABI diffs with a source set's jar file.

kotlin-reflect is a non-default fat jar, which causes
non-inremental builds when it gets changed and included in
a compile classpath. To avoid this problem, kotlin-reflect-api
project was added. It is assumed that only kotlin-reflect-api
should be used for compilation.

However, Gradle is known to leak transitive runtime dependencies
to a compile classpath, i.e. when `:b` has a runtime dependency on `:a`,
and `:c` has a compile dependency on `:b`, `:c` also gets `:a`
in its compile classpath.

Before this change kotlin-reflect was leaked to compiler tests's
classpath through kotlin-scripting-compiler-impl.

To work around this issue, and to prevent similar issues from happening,
this change introduces a dependency substitution from kotlin-reflect
to kotlin-reflect-api in all compile classpath configurations.

        #KT-32954 Fixed
2019-07-25 16:09:32 +03:00
Alexey Tsvetkov 33b7745b17 Find only non-default shadow jars in findShadowJarsInClasspath diagnostic
We are interested only in shadow jars that might break the incremental compilation
2019-07-25 16:09:31 +03:00
Alexey Tsvetkov e91eefe709 Remove unnecessary dependencies on kotlin-compiler-runner 2019-07-25 16:09:31 +03:00
Alexey Tsvetkov cd641c9047 Set source and target compatibility in buildSrc
If source and target compatibility are not set explicity,
Gradle will assume they are equal to current JVM version.
This may cause unwanted rebuilds, when a build is run on
different JDK versions (it might happen when switching between
CLI and IDE).
2019-07-25 16:03:07 +03:00
Alexey Tsvetkov a7403b7ee7 Do not fork java compile tasks when current JDK can be used
I see the following improvements:
* `clean dist --parallel` is ~10% faster (from 3:40 to 3:20)
* incremental `dist --parallel` is ~50% faster
(adding public method to org.jetbrains.kotlin.utils.SmartList)

    #KT-32955 Fixed
2019-07-25 16:03:07 +03:00
Alexey Tsvetkov a372f181d2 Check JDK env vars once during configuration when not syncing
Previous code (callback in `beforeTask`) was added to allow
opening project without setting up all env. variables.
This change simplifies the code and avoids a callback,
while keeping the ability to open the project without
setting up all variables by checking `kotlinBuildProperties.isInIdeaSync`
2019-07-25 16:03:07 +03:00
Alexey Tsvetkov a20627fa2c Set sourceCompatibility and targetCompatibility for JavaCompile tasks
Currently running build with JAVA_HOME pointing to
any JDK != 1.8 results in errors like

    #KT-30382 Fixed
2019-07-25 16:03:07 +03:00
Ilmir Usmanov a35d405892 Do not generate accessor if private function is accessed from
coroutines intrinsic lambda.
The logic is if the lambda is crossinline we need to generate the
accessor. However, suspendCoroutine's and
suspendCoroutineUninterceptedOrReturn's parameter, despite being
crossinline, are effectively inline. Thus, we do not need to generate
the accessor.
 #KT-27503 Fixed
2019-07-25 15:25:59 +03:00
Ilmir Usmanov b3e80e6a14 Look for classfile in implementing modules when building inline function
hyperlinks.
 #KT-32864 Fixed
2019-07-25 15:10:03 +03:00
Ilya Kirillov 58db64a478 J2K: Fix old J2K test data's error messages which has changed due to new inference 2019-07-25 14:34:36 +03:00
Ilya Kirillov 4e5e14046d New J2K: use old J2K for evaluate expression instead of new one
#KT-32693 fixed
2019-07-25 14:34:36 +03:00
Ilya Kirillov e795e4b73d New J2K: add conversion of binary literals & fix conversion of octal ones
#KT-32835 fixed
2019-07-25 14:34:36 +03:00
Ilya Kirillov 72a09ab59b New J2K: correctly convert number literals with underscores
#KT-32837 fixed
2019-07-25 14:34:35 +03:00
Ilya Kirillov 4ead820395 New J2K: correctly print comments for qualified expression 2019-07-25 14:34:35 +03:00
Ilya Kirillov 2bd5a1f196 New J2K: separate nullability inference from common one & nullability bug fixes
It will be needed for structure mutability inference

#KT-21467 fixed
#KT-32609 fixed
#KT-32572 fixed
#KT-24677 fixed
2019-07-25 14:34:35 +03:00
Ilya Kirillov d7960caf89 New J2K: move all symbols definitions to symbols package 2019-07-25 14:34:35 +03:00
Ilya Kirillov f79b282c60 New J2K: add better support of implicit functional interfaces
#KT-32702 fixed
#KT-19327 fixed
2019-07-25 14:34:34 +03:00
Ilya Kirillov 96ca4712a0 New J2K: consider in-context declarations while performing conversion on copy-paste plain text conversion
#KT-32602 fixed
2019-07-25 14:34:34 +03:00
Ilya Kirillov c865d74965 New J2K: remove unused dependencies from nj2k modules 2019-07-25 14:34:34 +03:00
Ilya Kirillov 1bbdd0bf15 New J2K: remove unused classes 2019-07-25 14:34:34 +03:00
Ilya Kirillov 6e04b1549c New J2K: remove JKVisitor with type parameters 2019-07-25 14:34:33 +03:00
Leonid Startsev 9c8905ccb6 Patch serializable class with addtional annotation
(which contains actual serializer) to make use of it with @AssociatedObjectKey
2019-07-25 14:07:22 +03:00
Leonid Startsev 3896992b12 Fixes for IR serialization plugin
- Do not insert typeParameters into IrConstructor;
- Set correct property symbol to IrField;

- Use upper bound as a class descriptor for type parameters.
This will allow to get upper bound's KClass in polymorphic serialization.
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/490;

- Lazily add all serializer functions.
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/502;

- Don't generate constructor invocation for abstract(sealed) classes deserializer.
Such code is incorrect anyway (you can't create an instance of abstract class) and causes problems in devirtualization when exporting Native libraries.
2019-07-25 14:07:24 +03:00
Leonid Startsev 6494227c64 Change order in SerializableProperties initialization logic
in that way so binding context would be checked only after resolve is triggered (via .getContributed descriptors).
Empty binding context led to some subtle bugs.
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/508
2019-07-25 14:07:22 +03:00
Leonid Startsev 822b4556e3 Rewrite IDE check whether serialization plugin is enabled
In a such way so it wouldn't check for actual JAR file and wouldn't touch filesystem.
Fixes KT-32346
2019-07-25 14:07:22 +03:00
Mikhail Glukhikh 2381aa330a FIR: fix delegate expression consistency tests 2019-07-25 09:46:46 +03:00
Mikhail Glukhikh d32e5065c5 FIR: implementation of delegateProvider in delegate resolve 2019-07-25 09:46:42 +03:00
Mikhail Glukhikh 213f951da3 FIR: partial implementation of delegate resolve #KT-32217 Fixed 2019-07-25 09:46:34 +03:00
Mikhail Glukhikh 63b7fa70f9 FIR2IR: add extension receiver parameters to functions 2019-07-25 09:46:29 +03:00
Ivan Gavrilovic be3fe9495c Report non-incremental annotation processors correctly
This commit fixes an issue when all APs would be reported as non-incremental,
even if only a single one is non-incremental. Now, additional declared type
is added that is used to denote processors that are incremental, but have
been forced to run non-incrementally in presence of non-incremental APs.

This means that only APs that do not support incremental annotation processing,
or APs that are dynamic and are non-incremental at runtime will be reported.
2019-07-25 04:57:26 +09:00
Ivan Gavrilovic ad352355de KT-23880: Enable incremental APT mode with KAPT by default
The feature has been present since 1.3.30 behind a flag. This
commit enables it by default.
2019-07-25 04:57:26 +09:00
Ivan Gavrilovic a108af76d6 Mark property as output instead of local state when needed
Kapt task incremental annotation processing cache directory
was using @LocalState annotation that was added in Gradle 4.3.
However, minimum supported version is 4.2, so this commit registers
this directory as output of a task for pre 4.3 versions. This is safe
as caching is enabled only for Gradle 4.3+.

Test: verified manually
2019-07-25 04:57:26 +09:00
Ivan Gavrilovic 5a2ff86691 Handle classpath snapshot changes better
Because Kapt Gradle task uses PathSensitivity.NONE for the input representing
the classpath structure, there are cases when paths of the files may change,
but because content is the same, there will be no incremental changes.

Classpath snapshot comparison did not handle this case correctly, but this
commit fixes that. In more details:
- classpath entries with the same path and that are not reported as changed
will have their information loaded from the previous snapshot
- any other entry (changed path or changed content) will be reloaded

Test: ClasspathSnapshotTest
2019-07-25 04:57:26 +09:00
Georgy Bronnikov f66b475867 Create wrapped receiver descriptors where needed 2019-07-24 20:25:47 +03:00
Roman Artemev 46b98a1e98 [JS BE] Make sourceMap generation more precise
- Don't produce mapping for closing bracket in case of expressionBody
 - Map Kt*Function declaration into corresponding js fun declaration
 - Update test data & add new test
2019-07-24 18:56:40 +03:00
Kirill Shmakov 12a1b0296b Clean up useless code 2019-07-24 18:25:11 +03:00
Nikolay Krasko d3bc2ec855 Remove internal jdk to fix flaky MavenUpdateConfigurationQuickFixTest 2019-07-24 17:28:01 +03:00
Nikolay Krasko 6176373713 Test data update for JavaWithGroovyInvoke since 183 2019-07-24 17:28:01 +03:00
Nicolay Mitropolsky 5f9660cd33 KtLightParameter introduced as interface 2019-07-24 10:11:45 +03:00
Nicolay Mitropolsky 50158e508a org.jetbrains.kotlin.asJava.elements.LightParameter converted to Kotlin
to avoid clashes in `getMethod` with `KtLightParameter`
2019-07-24 10:11:44 +03:00