Compare commits

..

648 Commits

Author SHA1 Message Date
anastasiia.spaseeva
a6b7a38bc0 test 2 2021-04-19 17:18:27 +02:00
anastasiia.spaseeva
25386aa0e0 Merge branch '1.5.0-github-testing' of https://github.com/JetBrains/kotlin into 1.5.0-github-testing 2021-04-19 17:10:12 +02:00
anastasiia.spaseeva
e6ec318425 test 2021-04-19 17:09:48 +02:00
Stanislav Erokhin
3cdad07fe4 add file2 2021-04-19 17:08:56 +02:00
Stanislav Erokhin
572f93de06 add file 2021-04-19 16:59:48 +02:00
Ilmir Usmanov
d0fa40cc5f Generate return when generating continuation class for expression body
Otherwise, the function will return Unit instead of correct value.
 #KT-46007 Fixed
2021-04-19 09:57:31 +02:00
Ilmir Usmanov
bd2d6c8083 Add 'value' modifier to modifier order
Otherwise, there will be unfixable 'non-canonical modifier order'
warning
 #KT-46088
 #KTIJ-5636 Fixed
2021-04-19 09:55:26 +02:00
Dmitry Petrov
5b6a57be15 JVM_IR KT-45934 don't generate declaration stubs for delegates
(cherry picked from commit e89ab71bf8)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
dd2a9e11c0 JVM_IR KT-46092 fix array spread operator in Kotlin->Java call
(cherry picked from commit cc415f62b5)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
a7592b93f2 PSI2IR KT-46069 resolve IR-based type parameter descriptors to symbols
(cherry picked from commit f1eeb72c01)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
d88bb951a4 JVM_IR KT-46060 'contains' operator without receiver is non-optimizable
(cherry picked from commit 531a0de399)
2021-04-16 12:28:41 +03:00
Dmitry Petrov
22e6c88fba JVM_IR KT-45187 use Arrays.copyOf to copy an array in spread operator
Creating a new array (and copying data into it with System.arraycopy)
doesn't work in generic case, because the actual array class depends on
call site.

(cherry picked from commit 7d62f0b5aa)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
efa79b3519 JVM_IR KT-45853 include return type into Java method IdSignature
This is a hack required to accept [potentially] incorrect input
provided by the front-end; see KT-46042.

(cherry picked from commit 7e03f8ea80)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
98aced50ef JVM_IR KT-45967 generate accessor for argument of indy intrinsic
TODO handle inaccessible constructors gracefully

(cherry picked from commit f59b49db68)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
9c571af0d4 JVM_IR KT-45868 look for parent for delegating lambda in scope stack
(cherry picked from commit ed88aa43a4)
2021-04-16 12:28:40 +03:00
Dmitry Petrov
08bc150a56 JVM_IR KT-45920 don't add special bridge if it clashes with known method
(cherry picked from commit c2a5b0b6e2)
2021-04-16 12:28:39 +03:00
Ilya Gorbunov
8663fe580a Support Char.code in constant evaluator, KT-46036
But do not consider Char.code a pure integer constant.

(cherry picked from commit 8041c3aa1d)
2021-04-16 04:31:05 +03:00
Leonid Startsev
bba22e8330 Support new inline(value) class syntax in serialization plugin
Use .isInlineClass() instead of .isInline + .isValue

 #KT-45783 Fixed

(cherry picked from commit f94e8f95d1)
2021-04-15 14:32:04 +03:00
Andrei Klunnyi
892b597041 KT-46049 Java-Kotlin sealed inheritors inspection: refactoring
(cherry picked from commit 73d2e1a42d)
2021-04-15 13:28:24 +02:00
Andrei Klunnyi
ef6102565d KT-46049 Java-Kotlin sealed inheritors inspection: false positive for type parameter
^KT-46049 Fixed

(cherry picked from commit 2fce968de0)
2021-04-15 13:28:23 +02:00
Ilya Goncharov
60ef5b385a [Gradle, JS] Mark visited dependencies inside dependency graph traversing
(cherry picked from commit 266daed2cb)
2021-04-15 13:15:40 +03:00
Ilmir Usmanov
aa09f7ba03 Minor. Change warning message 2021-04-15 12:10:51 +02:00
Yahor Berdnikau
7514aced27 Fix plugin is using deprecated method that is removed in AGP 7.0.
^KT-45950 Fixed
2021-04-15 11:08:00 +02:00
Yahor Berdnikau
a118653e35 Set Android Gradle Plugin dependency version to 3.4.0.
This is required to get method deprecations and new proposed methods.
2021-04-15 11:07:56 +02:00
Nikolay Krasko
2cae6756ce Add dependencies verification for prepareSonatypeStaging.gradle
File is applied conditionally when sonatype publication is enabled.
2021-04-13 17:50:04 +03:00
Margarita Bobova
e84e667929 Add changelog for 1.5.0-RC 2021-04-13 16:31:26 +03:00
anastasiia.spaseeva
952f11287d Add changelog for 1.5.0-M2 2021-04-13 16:30:27 +03:00
Svyatoslav Scherbina
eea18585b9 Update Kotlin/Native: 1.5-rc1-41 2021-04-12 18:26:17 +03:00
Victor Petukhov
275f8fcf63 Avoid subtype checking between type variable of self type and captured star projection only for invariant positions
Subtyping with non-invariant positions may produce useful constraints

^KT-46001 Fixed
2021-04-12 13:40:21 +03:00
Svyatoslav Scherbina
8f80deefc3 Update Kotlin/Native: 1.5-rc1-17 2021-04-09 10:51:31 +03:00
Abduqodiri Qurbonzoda
7fe4eb767c Remove deprecated JQuery
(cherry picked from commit 46338224e1)
2021-04-08 19:35:12 +03:00
Abduqodiri Qurbonzoda
db7649d635 Migrate compiler and idea-completion testData 2021-04-08 18:32:21 +03:00
Abduqodiri Qurbonzoda
89d7383365 Migrate stdlib, tests and samples to new case conversion api 2021-04-08 18:32:20 +03:00
Abduqodiri Qurbonzoda
36c788b57c Deprecate old Char and String case conversion api #KT-43023 2021-04-08 18:32:20 +03:00
Abduqodiri Qurbonzoda
0a9d6ad30e Deprecate sumBy and sumByDouble with WARNING
(cherry picked from commit 33b44585c4)
2021-04-08 15:32:11 +03:00
Renee Vandervelde
cc23d0bad9 Add assertEquals and assertNotEquals for floating point numbers to kotlin-test #KT-8364
(cherry picked from commit d520c37454)
2021-04-08 14:39:04 +03:00
Abduqodiri Qurbonzoda
c57f367040 Introduce assertContains in kotlin-test #KT-45582
(cherry picked from commit ff59b1c2ef)
2021-04-08 14:39:02 +03:00
Ilya Gorbunov
2027fff626 Deprecate Char-to-Number conversions in stdlib (JVM and JS)
- Int.toChar was left non-deprecated because the replacement is not intrinsic yet.
- Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar.

KT-23451

(cherry picked from commit b64b96eee6)
2021-04-08 13:36:27 +03:00
Abduqodiri Qurbonzoda
aef884efe1 Disable Werror in the release branch
This is to avoid migrating all the usages that will become deprecated
 after the following changes.
2021-04-08 13:36:25 +03:00
Alexander Udalov
c81ce8637a Add kotlin.build.disable.werror to disable -Werror locally
This can be placed, for example, in `local.properties` to temporarily
disable `-Werror` in compiler/stdlib/plugin/test modules during
development.

(cherry picked from commit 496d857db1)
2021-04-08 13:07:33 +03:00
Ilya Gorbunov
52846e7722 Hide deprecated JS Math object from public API and rename to JsMath
KT-41318

- Rename Math to JsMath and remove unused functions
- Fix return types, remove duplicating JsMath from longjs.kt

Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
(cherry picked from commit d70edeb38b)
2021-04-08 13:00:45 +03:00
Abduqodiri Qurbonzoda
1902be18a1 Mute a failing test of the old J2K, the old J2K is removed in master 2021-04-08 12:50:21 +03:00
Abduqodiri Qurbonzoda
97399e5269 Advance max/min(By/With) deprecation level to ERROR
(cherry picked from commit b0f1ddc91e)
2021-04-08 12:50:19 +03:00
Abduqodiri Qurbonzoda
8c2f1a5fc9 Advance deprecation level of mixed Int/FP overloads of ClosedRange.contains to HIDDEN KT-22423
(cherry picked from commit d9ab96126d)
2021-04-08 12:50:18 +03:00
Abduqodiri Qurbonzoda
ff223a4901 Advance String(CharArray) deprecation level to ERROR in Common and JS 2021-04-08 12:50:17 +03:00
Abduqodiri Qurbonzoda
44a18616b0 Remove deprecated Clock and ClockMark
(cherry picked from commit 29040d6f53)
2021-04-08 12:50:16 +03:00
Abduqodiri Qurbonzoda
a77ddbe6d8 Remove deprecated scanReduce and scanReduceIndexed
(cherry picked from commit abcc572b97)
2021-04-08 12:50:14 +03:00
Abduqodiri Qurbonzoda
6c7d4b1905 Remove DefaultAsserter() constructor-like function in kotlin-test
(cherry picked from commit c46d71d4ac)
2021-04-08 12:50:13 +03:00
Abduqodiri Qurbonzoda
6a2da4bb4b Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360
(cherry picked from commit 968099fbec)
2021-04-08 12:50:12 +03:00
Abduqodiri Qurbonzoda
c62d099d60 Advance deprecation level of InputStream.readBytes(estimatedSize) to ERROR
(cherry picked from commit e8992c5d19)
2021-04-08 12:50:12 +03:00
Dmitriy Novozhilov
9e4ff58aac Support actualization of expect sealed class with typealias in CliSealedClassInheritorsProvider 2021-04-08 11:38:01 +03:00
Dmitriy Novozhilov
9e2a1a404d Refine expect classes in CliSealedClassInheritorsProvider
KT-45796 Fixed
2021-04-08 11:38:01 +03:00
Ilya Gorbunov
991afb382f Fix case-insensitive character-wise comparison KT-45496
- Step 1: add failing tests
- Step 2: fix common case insensitive Char.equals
- Step 3: fix case insensitive String.equals in K/JS
- Step 4: enable unicode case folding in K/JS Regexes and
  string replacement (KT-45928)

(cherry picked from commit 22ca412dd2)
2021-04-07 14:49:12 +03:00
Ilya Gorbunov
376b250482 Add description for kotlin.io.path package
(cherry picked from commit f1cdd0e2ed)
2021-04-06 14:34:10 +03:00
Ilya Gorbunov
28d469aeec Stabilize existing Path API and annotate with @Throws where appropriate
KT-45913

(cherry picked from commit 81f2aea316)
2021-04-06 14:34:09 +03:00
Ilya Gorbunov
4673fd1e90 Stabilize new string and char case conversion API KT-45873
(cherry picked from commit 35ae913a5e)
2021-04-06 14:33:19 +03:00
Ilya Gorbunov
ab24019e40 Support all digit chars in digitToInt on JVM KT-23451
(cherry picked from commit 256f634e61)
2021-04-06 14:32:53 +03:00
Ilya Gorbunov
a95d69a9a8 Stabilize Char-to-Int conversions KT-45874
(cherry picked from commit 8b85bae020)
2021-04-06 14:32:49 +03:00
Ilya Gorbunov
b273bc17fe Duration: inWholeUnits properties instead of inUnits
Introduce conversion properties returning Long values,
deprecate the old ones returning Doubles.

(cherry picked from commit 0e93924ff3)
2021-04-02 19:10:49 +03:00
Ilya Gorbunov
809e85f9b4 Make Duration storage ranges symmetric and non-overlapping
Increase accuracy of multiplication and division.

(cherry picked from commit 11d15f3343)
2021-04-02 19:10:46 +03:00
Ilya Gorbunov
dc7d6021b6 Advance TestTimeSource more precisely
Change durations in its test so that they hold precise number
of nanoseconds

(cherry picked from commit 4fd2254f3f)
2021-04-02 19:10:43 +03:00
Ilya Gorbunov
5c82d8cd33 Store Duration value as a multi-range Long
Now precision loss happens at bigger durations.

This changes the binary API due different underlying type of Duration.

(cherry picked from commit fa7460ba48)
2021-04-02 19:10:39 +03:00
Ilmir Usmanov
b3e556e662 Enable suspend in fun interfaces by default
#KT-45836 Fixed
2021-04-02 14:40:46 +02:00
Ilya Muradyan
c14039cd37 [Scripting] Fix Bintray-dependent test 2021-04-01 16:47:55 +03:00
Nikolay Krasko
58d5b1bd26 Update verification data with older versions 2021-04-01 16:20:28 +03:00
Nikolay Krasko
46c68b4d1e Disable verification in IDE bunches 2021-04-01 16:15:56 +03:00
Nikolay Krasko
c8dfb1d6f5 CodeConformanceTest for no Bintray except jcenter (KTI-528)
(cherry picked from commit 7f60cd81fe)
2021-04-01 16:06:04 +03:00
Nikolay Krasko
ee5d677b19 Drop scripts for uploading to plugin repository (KTI-528)
(cherry picked from commit b48ede4a62)
2021-04-01 16:05:39 +03:00
Nikolay Krasko
ea394f4de4 Bintray dukat -> Space kotlin/kotlin-dependencies (KTI-528)
(cherry picked from commit 35ad28c372)
2021-04-01 16:05:25 +03:00
Nikolay Krasko
86b9fbbc14 Drop Bintray from maven inspections tests (KTI-528)
(cherry picked from commit d10f4ad718)
2021-04-01 16:05:11 +03:00
Nikolay Krasko
81733beb6a Stop using Bintray in ignored test in MavenResolverTest (KTI-528)
(cherry picked from commit 03c0a81a33)
2021-04-01 16:04:56 +03:00
Nikolay Krasko
607742de8c Drop Bintray from wizards (KTI-528)
(cherry picked from commit c868116535)
2021-04-01 16:04:42 +03:00
Nikolay Krasko
01f095adbc Move testResolveDependencyOnMppInCustomConfiguration to library from maven central (KTI-528)
(cherry picked from commit c74a3bd2b1)
2021-04-01 16:04:30 +03:00
Nikolay Krasko
0e28db28f3 Drop bintray from Gradle inspections and fixes tests (KTI-528)
(cherry picked from commit 1547d4f516)
2021-04-01 16:04:16 +03:00
Nikolay Krasko
6de5c408ff Drop bootstrap mentioning from CodeConformanceTest
(cherry picked from commit 7a9c2c1d17)
2021-04-01 16:04:14 +03:00
Nikolay Krasko
f4b464c126 Drop custom private Bintray Android Studio repository (KTI-528)
(cherry picked from commit 529fc352b3)
2021-04-01 16:04:01 +03:00
Nikolay Krasko
8d06261a9d Drop bintray kotlin-dev (KTI-528)
(cherry picked from commit 5631481747)
2021-04-01 16:03:47 +03:00
Nikolay Krasko
c8e0f3399a Drop bintray jetbrains markdown (KTI-528)
(cherry picked from commit 1cedc7e93e)
2021-04-01 16:03:33 +03:00
Nikolay Krasko
31ae15d19b Replace intellij-third-party-dependencies repository (KTI-528)
(cherry picked from commit 832523e23f)
2021-04-01 16:03:30 +03:00
Nikolay Krasko
f4cb821f08 Rearrange list of repositories - move jcenter to the end
(cherry picked from commit 87d509a7aa)
2021-04-01 16:01:00 +03:00
Nikolay Krasko
59cd8c5c5d Update cache redirector for more complex aliases
For example:
"https://packages.jetbrains.team/maven/p/ij/intellij-dependencies" to "https://cache-redirector.jetbrains.com/intellij-dependencies",

(cherry picked from commit 818855d6f0)
2021-04-01 16:00:57 +03:00
Nikolay Krasko
33eb57043e Fix build of benchmarks module
Fix after 998a65d1cb

(cherry picked from commit c680ee8525)
2021-04-01 15:58:54 +03:00
Nikolay Krasko
65b7365684 Move Bintray js-externals to Space (KTI-528)
(cherry picked from commit a5e445492f)
2021-04-01 15:58:29 +03:00
Nikolay Krasko
880c628a69 Drop kotin/kotlinx and kotlin/kotlinx.html bintray usages (KTI-528)
(cherry picked from commit b903f87704)
2021-04-01 15:58:14 +03:00
Nikolay Krasko
c56025572c Bump version of kotlinx.benchmark plugin 0.2.0-dev-7 -> 0.3.0 (KTI-528)
(cherry picked from commit 998a65d1cb)
2021-04-01 15:57:49 +03:00
Nikolay Krasko
712c79c270 Minor: investigate j2objc-annotations:1.1 verification trace
(cherry picked from commit 455773299b)
2021-04-01 15:57:45 +03:00
Nikolay Krasko
117a88f7ba Add dependency verification description to ReadMe.md
(cherry picked from commit ddc12834cb)
2021-04-01 15:57:42 +03:00
Nikolay Krasko
113ff90c5b Trust all module metadata till Gradle 6.8 update (KTI-493)
There's and issue with absent module files in the cache that leads to
"Artifact has been deleted from dependency cache" that can be resolved
by cleaning caches. It should be fixed in Gradle 6.8

https://github.com/gradle/gradle/issues/12713
(cherry picked from commit 1558bd7373)
2021-04-01 15:54:59 +03:00
Nikolay Krasko
7145b524bf Trust all poms till Gradle 6.8 update (KTI-493)
There's and issue with absent poms in the cache that leads to
"Artifact has been deleted from dependency cache" that can be resolved
by cleaning caches. It should be fixed in Gradle 6.8

https://github.com/gradle/gradle/issues/12713
(cherry picked from commit 73bc16896d)
2021-04-01 15:54:57 +03:00
Nikolay Krasko
d41652b42b Trust javadoc and sources artifacts as the shouldn't be used in builds (KTI-493)
(cherry picked from commit efcb071f24)
2021-04-01 15:54:44 +03:00
Nikolay Krasko
8f877b33ba Trust kotlin-native-prebuild-* (KTI-493)
Need more investigation for this artifact

(cherry picked from commit fd921f1dc0)
2021-04-01 15:54:38 +03:00
Nikolay Krasko
0cfbeffaeb Trust kotlin artifacts for bootstrapping (KTI-493)
Can't predict exact version after build

(cherry picked from commit fae1215881)
2021-04-01 15:54:36 +03:00
Nikolay Krasko
0bc77f90dd Trust ivy xml files as they are constantly regenerated (KTI-493)
(cherry picked from commit 4bbba74360)
2021-04-01 15:54:33 +03:00
Nikolay Krasko
fd9b5f8c27 Add dependencies lock with md5 and sha256 (KTI-493)
Initial commit without explicit check or cleanup.

Includes Kotlin Native dependencies.

(cherry picked from commit 8240f5e459)
2021-04-01 15:54:31 +03:00
Ilya Gorbunov
e9e62622b6 Stabilize unsigned types KT-45653
Deprecate specialized unsigned iterators for removal.

Fix compiler tests:
- drop unsignedLiteralsOn1_2 because apiVersion 1.2 is no longer supported
- drop experimental unsigned literals diagnostic test

(cherry picked from commit 94240f7b21)
2021-04-01 14:56:36 +03:00
Victor Petukhov
f45a471457 Assert that the separation of two annotations on function type during rendering it, is any whitespace-like symbol, not only whitespace itself
E.g. in quick doc mode (HTML), it may be line break

^KT-38747 Fixed
2021-04-01 14:33:39 +03:00
Yahor Berdnikau
9d5b1dcd7a Fix Gradle 7 deprecation on adding associated compilation dependencies.
^KT-45787 Fixed
2021-04-01 10:50:54 +02:00
pyos
73147a7422 JVM_IR: cast bound property receivers to original type
Because the receiver type is used for determining where to put
accessors, and the type of fake overrides' receivers is the same as for
the original declaration, casting to the type of the parameter leads to
assertion errors.

 #KT-44658 Fixed

(cherry picked from commit 85aa6383ad)
2021-04-01 10:48:58 +02:00
Svyatoslav Scherbina
86f8c2ec5d Update Kotlin/Native: 1.5-eap-4 2021-03-31 15:17:32 +03:00
pyos
68f1925726 JVM_IR: do not inline @JvmStatic into their static proxies
(cherry picked from commit 66429cfb43)
2021-03-31 14:09:42 +02:00
pyos
b116597fd7 JVM_IR: remap calls to protected @JvmStatic in companions
Protected functions on unrelated classes cannot be called from outside
the current package, so in general, we can only call the static proxy,
not the original companion method.

This has an ABI compatibility implication in that removing `@JvmStatic`
from a protected companion method will require recompiling Kotlin use
sites (of course, this is already source- and binary-incompatible from
Java perspective).

 #KT-12063 Fixed

(cherry picked from commit a518a9407d)
2021-03-31 14:09:40 +02:00
Pavel Kirpichenkov
40d6d16b96 [IDE] Optimize stdlib cache for non-JVM modules
Consider only dependencies of JVM modules.
Cache found/missing stdlib dependencies for modules.

As of now, non-JVM platforms use default builtins in IDE.
For any non-JVM module indexed stdlib dependency is guaranteed
to be missing, searching for it is useless and costly.

^KTIJ-5666 Fixed
See also KT-44552
2021-03-31 14:09:21 +03:00
Andrey Zinovyev
6a2a1d7472 [parcelize] Fix codegen for generic classes
Replace type arguments with star projection in static methods
Fix IR function generation

^KT-42652  Fixed
2021-03-31 13:53:21 +03:00
Victor Petukhov
488d2206ef Regenerate tests 2021-03-31 11:12:46 +03:00
Victor Petukhov
10ba85d8c8 Mark some tests 'fir identical' 2021-03-31 11:12:46 +03:00
Matthew Gharrity
68554a0e93 KT-45676: fix backing field annotation resolve
(cherry picked from commit 2cb9d1f287)
2021-03-31 11:12:45 +03:00
Victor Petukhov
f641288fbe Report resolution ambiguity on '+=' by taking into account full resolution result including post type checking for '+'
^KT-45503 Fixed

(cherry picked from commit 5d78b0a962)
2021-03-31 11:12:45 +03:00
Victor Petukhov
a2d90ba39b Do subtyping between self types with captured type in special way
(cherry picked from commit bbf5c4412e)
2021-03-31 11:12:45 +03:00
Victor Petukhov
6ed1fe28d0 Propagate input type position across incorporation properly
^KT-45719 Fixed

(cherry picked from commit 7f2c5cde55)
2021-03-31 11:12:45 +03:00
Victor Petukhov
3ccf8e5aa5 Approximate types when only input types check is done. Otherwise given types are inconsistent with types obtained by ResultTypeResolver
^KT-45714 Fixed

(cherry picked from commit d06031ece3)
2021-03-31 11:12:45 +03:00
Victor Petukhov
86cdbf2328 Remove NonStrictOnlyInputTypesChecks LF and introduce opposite – StrictOnlyInputTypesChecks, set default as strict
(cherry picked from commit cc1cb463b2)
2021-03-31 11:12:45 +03:00
Victor Petukhov
c0ca5160ed Turn only input type warning to error
^KT-45482 Fixed

(cherry picked from commit b60056f11e)
2021-03-31 11:12:45 +03:00
Victor Petukhov
55e3ea9cfd Add compiler flag to enable strict mode for improvements in the type enhancement
^KT-45674 Fixed

(cherry picked from commit 9c38db754e)
2021-03-31 11:12:44 +03:00
Victor Petukhov
8b36ad6132 Rename LV ImprovementsAroundTypeEnhancement into TypeEnhancementImprovementsInStrictMode
(cherry picked from commit 731e3ebae1)
2021-03-31 11:12:44 +03:00
Victor Petukhov
91cd685616 Don't generate tests on top-down completion of the builder inference for WASM
(cherry picked from commit 4f1ed2f112)
2021-03-31 11:12:44 +03:00
Victor Petukhov
eacbe16965 Proper taking top level trace to pass it into completion
(cherry picked from commit 178910a2e5)
2021-03-31 11:12:44 +03:00
Victor Petukhov
36859d7eb1 Do updating calls for all nested builder inference sessions including at the same level
(cherry picked from commit e0a8e9a664)
2021-03-31 11:12:44 +03:00
Victor Petukhov
953b4880d5 Introduce hierarchy of inference sessions
(cherry picked from commit 999d1f982e)
2021-03-31 11:12:44 +03:00
Victor Petukhov
007e78100f Don't lose inference session in all the possible locations
(cherry picked from commit 80ac62864d)
2021-03-31 11:12:43 +03:00
Victor Petukhov
e33ecf0126 Rename CoroutineInferenceSession to BuilderInferenceSession
(cherry picked from commit b5d3f9ee31)
2021-03-31 11:12:43 +03:00
Victor Petukhov
25cb98e0d7 Implement top-down completion for nested builder inference calls
^KT-42742 Fixed

(cherry picked from commit 7a66e22bb2)
2021-03-31 11:12:43 +03:00
Victor Petukhov
035726372f Process captured types with type variable inside properly, in the operations related with the type variables fixation
(cherry picked from commit 60f2f85be7)
2021-03-31 11:12:43 +03:00
Victor Petukhov
d4db5eb818 Substitute captured types with type variables properly
^KT-44687 Fixed

(cherry picked from commit a2b1aa753b)
2021-03-31 11:12:42 +03:00
Victor Petukhov
371664caf3 Don't stop constraints processing if all type variables have proper equality constraints
Those type variable may have other constraints after incorporation into which, the constraint error may appear

^KT-42042 Fixed

(cherry picked from commit b87c2a15b5)
2021-03-31 11:12:42 +03:00
Ilmir Usmanov
372f412ffb JVM IR: IC coroutines: return boxed type from suspend function if
the function overrides function, returning type argument
 #KT-45451 Fixed
2021-03-31 01:19:19 +02:00
Alexander Udalov
dea37386c6 Workaround illegal access to JDK internals in DynamicBundle
This is basically a manual cherry-pick of
https://github.com/JetBrains/intellij-community/commit/547caebd980d.

 #KT-44624 Fixed

(cherry picked from commit 6e86df2f6d)
2021-03-30 20:36:58 +02:00
Alexander Udalov
8bc04c9465 Copy com.intellij.DynamicBundle to compiler/cli
This is needed to fix KT-44264 without updating the whole project to
intellij 203, which might take significant time.

In this commit, the file is copied as is from
27837dd8e6/platform/core-api/src/com/intellij/DynamicBundle.java.

(cherry picked from commit 8e1a70cff6)
2021-03-30 20:36:57 +02:00
Dmitriy Novozhilov
fb98338fb8 Add workaround for problem with incorrect bytecode generation for callable references
This commit may be removed after next bootstrap update
2021-03-30 18:21:32 +03:00
Dmitriy Novozhilov
43accd4127 Update testdata 2021-03-30 18:21:27 +03:00
Dmitriy Novozhilov
dcf2e0afc7 Advance bootstrap to 1.5.0-RC-556 2021-03-30 18:21:11 +03:00
Dmitriy Novozhilov
c3cfba6a8e Switch IS_PRE_RELEASE flag to false 2021-03-30 18:20:24 +03:00
Mikhail Zarechenskiy
5a410946e0 Fix add import quick fix for delegated property and missing extension
^KT-39199 Fixed
2021-03-30 17:02:44 +03:00
Steven Schäfer
6e8a5c88ad JVM IR: Avoid IndexOutOfBounds exceptions in TypeOperatorLowering
The code didn't account for SYNTHETIC_OFFSETs (KT-45688) and could
throw on IR containing broken line numbers (KT-44910).

(cherry picked from commit a7f8f0d903)
2021-03-30 14:35:10 +03:00
Dmitry Petrov
6cc687f16c JVM_IR fix receiver type for fake overrides
(cherry picked from commit 466e7b60b0)
2021-03-30 14:35:10 +03:00
Ilya Chernikov
cd97f2bcba Fix parameter index on IR script generation in REPL scenario
Before it, the wrong index lead to the validation error when repl
script definition had c-tor parameters (see test)
2021-03-26 18:24:20 +01:00
Ilya Chernikov
d0349731fa Fix arguments processing with scripting with old backend by default 2021-03-26 18:24:20 +01:00
Anton Yalyshev
de62199901 Add change-notes for 1.5-M2 release 2021-03-26 13:44:04 +03:00
Anton Yalyshev
aa10005b7a Add change-notes for 1.4.30 release
(cherry picked from commit 3e59adc7f3)
2021-03-26 13:44:03 +03:00
Ilya Goncharov
3df6559f30 [Gradle, JS] Fix packages with hardcoded display name
^KT-45621 fixed

[Gradle, JS] Use karma 6.0 API to set ping timeout

^KT-45621 fixed

[Gradle, JS] Changed API for warnings filter in Webpack 5

^KT-45621 fixed

[Gradle, JS] Add workaround for debugging with webpack 5

^KT-45621 fixed

[Gradle, JS] Use patch only for webpack 5

^KT-45621 fixed
2021-03-25 15:03:47 +03:00
Vladimir Dolzhenko
9423ba4ee1 Fix handling non ctor elements in SECONDARY_CONSTRUCTOR_DELEGATION_CALL
#KT-45339 Fixed

(cherry picked from commit 8068a5439f)
2021-03-24 21:20:00 +01:00
Andrei Klunnyi
712fe59d4b KT-44299 [Sealed Interfaces]: when exhaustiveness in IDE considers java inheritor
^KT-44299 fixed
2021-03-23 17:11:01 +01:00
Svyatoslav Kuzmich
0490fe79bb [JS IR] Fix kotlin.js.js with complex constant expressions
Use IR interpreter to evaluate complex constexprs
2021-03-23 19:06:49 +03:00
Victor Petukhov
c7666b173c Revert "Don't stop constraints processing if all type variables have proper equality constraints"
This reverts commit 8ba60d41
2021-03-23 18:33:25 +03:00
Alexander Udalov
bcb870f377 Write underlying property name & type for inline class to metadata
This will be used in the compiler starting from 1.5.20 instead of the
currently used approach of looking for the single value parameter of the
primary constructor. The problem with the current approach is that
primary constructor can be private (since 1.4.30) and the property could
always be private. Relying on private declarations from metadata is
dangerous; for example lazy IR doesn't usually create stubs for private
declarations, and it didn't create stubs for private inline class
constructors before b5f9b1df, which led to the problem reported in
KT-44723.

(cherry picked from commit ea01c97a8e)
2021-03-23 16:25:05 +01:00
Ilmir Usmanov
f6962dfb75 Allow Result return type and nullability operators on Result type
by default
2021-03-23 15:33:30 +01:00
Dmitry Petrov
ccba574e81 JVM_IR KT-45377 rewrite constants again after AddContinuationLowering 2021-03-23 17:17:06 +03:00
Ilya Goncharov
ae79455460 [Wizard, JS] Fix kotlin-redux version
(cherry picked from commit 0a444bbc43)
2021-03-23 15:13:12 +01:00
Alexander Udalov
df06c174d1 JVM IR: support inline classes with private constructors from other modules
#KT-44723 Fixed

(cherry picked from commit b5f9b1dfc0)
2021-03-23 15:02:54 +01:00
Ilmir Usmanov
69e8f77646 Check for backend when checking for suspend in fun interfaces 2021-03-23 12:35:30 +01:00
Dmitry Petrov
02ac4c49c5 Minor: regenerate compiler tests 2021-03-22 15:39:01 +03:00
Dmitry Petrov
643c9dffec JVM_IR KT-45581 generate H_INVOKEINTERFACE for interface method handles 2021-03-22 15:39:01 +03:00
Dmitry Petrov
42f382714d JVM_IR KT-45431 don't optimize out $$delegatedProperties in companion
Corresponding delegates are initialized in the host class, using
'$$delegatedProperties'.
TODO figure out proper code generation scheme for delegated properties
in companions (KT-45580)

(cherry picked from commit 73d4fa65ea)
2021-03-22 15:39:01 +03:00
Dmitry Petrov
b3fa48e9a3 JVM_IR KT-45408 rewrite static calls recursively
(cherry picked from commit f6baabd98e)
2021-03-22 15:39:01 +03:00
Alexander Udalov
dab0e642fe Deprecate KotlinJvmOptions.useIR
Starting from language version 1.5, JVM IR is enabled by default, so
this option has no effect. To rollback to the old JVM backend, the new
option useOldBackend can be used.

 #KT-45504 Fixed

(cherry picked from commit 415d52fe54)
2021-03-22 11:12:56 +01:00
Alexander Udalov
4b3eacf3a1 JVM IR: minor, improve error messages for inline classes
It will help in diagnosing problems like KT-44723.

(cherry picked from commit e5f218859b)
2021-03-22 11:12:44 +01:00
Ilya Gorbunov
9e987cfbf5 kotlin-test: make assertIs<T> returning value cast to T KT-45296
(cherry picked from commit 42648d55a0)
2021-03-19 17:06:19 +03:00
Ilya Gorbunov
8688f89680 Compile and run common tests of kotlin-test in kotlin-test-js-ir build
(cherry picked from commit 85a0538f0a)
2021-03-19 17:06:19 +03:00
Ilya Gorbunov
70d64b5db1 kotlin-test: assertIs and assertIsNot KT-45296
- Rename assertNotIs to assertIsNot
- Extract parts of implementation to helper internal PublishedApi
functions in order to inline minimum amount of code at use sites
- Remove PublishedApi from messagePrefix, no longer needed

(cherry picked from commit e66eeefe2a)
2021-03-19 17:06:18 +03:00
Ben Asher
5642780c88 kotlin-test: add assertIs and assertNotIs assertions KT-45296
(cherry picked from commit 3a0219d84c)
2021-03-19 17:06:18 +03:00
Sergey.Shanshin
d9cc6ccf1e Disabled deserialization fields check optimization for non-JVM platforms
Resolves KT-45440
2021-03-19 16:36:34 +03:00
Sergey.Shanshin
1635a258cc Revert lazy serializers for objects, sealed and abstract classes
Resolves KT-45440
2021-03-19 16:36:33 +03:00
Steven Schäfer
ee7a01e36b JVM IR: Resolve fake overrides when calculating return types (KT-44867)
(cherry picked from commit d0424465b8)
2021-03-19 11:56:06 +01:00
Dmitry Petrov
4a549af4b4 Minor: regenerate compiler tests 2021-03-19 12:54:08 +03:00
Dmitry Petrov
97d0170006 JVM_IR KT-45195 generate non-static annotation members as ACC_ABSTRACT 2021-03-19 12:54:08 +03:00
Dmitry Petrov
e9033aac9a Add bytecode listing tests for 'allopen' plugin with JVM_IR 2021-03-19 12:54:08 +03:00
Dmitry Petrov
4715dbc479 JVM_IR KT-36853 patch parents after tailrecPhase
(cherry picked from commit ac6232b4ba)
2021-03-19 12:54:08 +03:00
Ilya Goncharov
1967297d6f [Gradle, JS] Use one folder for sync tasks
[Gradle, JS] WA for tests with multiple binaries

^KT-45574 fixed
2021-03-19 12:48:02 +03:00
Ilya Goncharov
703cfabfd8 Add possibility to hardcode version
^KT-42921 fixed

[Gradle, JS] Adopt Gradle plugin to webpack 5

^KT-42921 fixed

[Gradle, JS] Update versions with karma-webpack 5.0.0

^KT-42921 fixed

[Gradle, JS] Webpack serve for webpack-dev-server

^KT-42921 fixed

[Gradle, JS] Fix of using format-util

^KT-42921 fixed

[Gradle, JS] Use compatible node version

^KT-42921 fixed

[Gradle, JS] Add compatibility with webpack 4

^KT-42921 fixed

[Gradle, JS] Support custom display name in npm versions generator

^KT-42921 fixed
2021-03-19 11:42:07 +03:00
Roman Artemev
847a9f247d [Psi2Ir] Fix generation of property references for synthetic java props
- Declare it on use-site
 - Fix export checker for that case
 - Fix KT-45297

(cherry picked from commit 44d03bc727)
2021-03-18 18:58:04 +03:00
Alexander Udalov
8cf8a31072 Fix ParallelBuildTest for Windows
Enclose file paths in raw strings. Otherwise in the string
"C:\Users\...", "\U" was detected as an illegal escape which led to an
error.

(cherry picked from commit a3a745e7a5)
2021-03-18 16:19:52 +01:00
Mikhail Zarechenskiy
e4d5e4e7d8 Disable check about unimplemented check for real defaults
Now we can generate proper defaults and there is no need in additional
 checks about unimplemented methods

 #KT-41130 Fixed
2021-03-18 15:25:54 +03:00
Mikhail Zarechenskiy
13df529a5a Use compiler arguments for Java against Kotlin highlighting tests
This is needed for the next commit to check jvm-default options

 #KT-41130 In Progress
2021-03-18 15:25:54 +03:00
Mikhail Zarechenskiy
bd489bc04d Do not generate DefaultImpls for light classes if not needed
#KT-41130 In Progress
2021-03-18 15:25:50 +03:00
SokolovaMaria
a0c1d73fee Exclude kotlinx.atomicfu compiler plugin modules 2021-03-18 14:39:12 +03:00
Alexander Udalov
3ff2ff7b8a Add JVM target bytecode version 16
#KT-45515 Fixed

(cherry picked from commit 27174de891)
2021-03-18 11:56:04 +01:00
Alexander Udalov
baf8edc3ff Deduplicate source roots in psi2ir and CLI
Compiler plugins can add new source roots to the next compilation round
by using `AnalysisResult.RetryWithAdditionalRoots`. Some plugins added
already existing source roots to this list in some cases. For example,
this is reproducible with `square/anvil` with incremental compilation
(KT-45100, KT-44925). Psi2ir didn't deduplicate the source files before,
which resulted in several classes with the same name linked to the same
symbol. This led to a "symbol is already bound" exception, and in case
of KT-44925, to an additional NPE when we were rendering the class to
display it in the message.

The solution is to deduplicate classes before psi2ir. Note that this
commit has two changes, in CLI and in psi2ir. Any one of these is
sufficient for fixing the problem, however both are made just to make it
more future-proof against new components and/or changes in existing
subsystems (e.g. fir2ir).

In the old JVM backend, similar deduplication was happening in
`ClassFileFactory.registerSourceFiles`, which is why the problem is not
reproducible there.

 #KT-45100 Fixed

(cherry picked from commit 83a4b6396a)
2021-03-18 11:56:01 +01:00
Alexander Udalov
2e6b75a5d8 Annotate kotlin.reflect.jvm.reflect with ExperimentalReflectionOnLambdas
This function was always experimental, as explained in its kdoc, but it
was introduced before opt-in requirement markers were supported. Thus,
breaking changes (such as in KT-42746) were always expected, and the
`@ExperimentalReflectionOnLambdas` annotation just makes it clearer.

 #KT-45486 Fixed

(cherry picked from commit fc36178f3a)
2021-03-18 11:55:57 +01:00
Anton Lakotka
8124a95467 Add separate Plugin Classpaths per compilation
Make them extend the common CP for sake of backward compatibility
^KT-45020 Fixed
2021-03-18 09:34:19 +01:00
Yahor Berdnikau
bf4a6492ae Fix issues in Android test projects setup.
(cherry picked from commit 543ab3fa2a)
2021-03-18 10:13:59 +03:00
Dmitry Petrov
60a4afc556 JVM_IR KT-45446 don't erase captured var if it's dead code 2021-03-17 15:57:43 +03:00
Dmitry Petrov
ad93189c4f JVM_IR KT-44993 preserve inner expression type when fusing if-null
(cherry picked from commit decfaa3ba5)
2021-03-17 15:57:43 +03:00
Dmitry Petrov
2dd73500af PSI2IR KT-44414 fix adapted reference to imported object member
(cherry picked from commit d74168fb8f)
2021-03-17 15:57:43 +03:00
Yaroslav Chernyshev
81e90f68a1 Fix infinite org.gradle.tooling.internal.adapter.TypeInspector.visit call on 201 platform 2021-03-17 13:28:57 +03:00
Yaroslav Chernyshev
e8dab960c5 Revert "Revert "loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception'""
This reverts commit 758cd9d2
2021-03-17 13:28:57 +03:00
Yaroslav Chernyshev
e6b5695265 Revert "Revert "Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData'""
This reverts commit e86ca3b4
2021-03-17 13:28:56 +03:00
Yaroslav Chernyshev
c83f02f4b7 Revert "Revert "Precise platform importing changes ported from new repository""
This reverts commit c38b48c7
2021-03-17 13:28:56 +03:00
Yaroslav Chernyshev
9f41993d1d Revert "Revert "Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies""
This reverts commit 2ff99611
2021-03-17 13:28:55 +03:00
Yaroslav Chernyshev
95666c55c2 Revert "Revert "HMPP import: add dependencies present on all compilation a jvm&android shared source set participates""
This reverts commit 18deb8eb
2021-03-17 13:28:55 +03:00
Stanislav Erokhin
18deb8eb3d Revert "HMPP import: add dependencies present on all compilation a jvm&android shared source set participates"
This reverts commit af07c48a
2021-03-16 15:12:11 +01:00
Stanislav Erokhin
2ff99611fb Revert "Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies"
This reverts commit e74eee55
2021-03-16 15:11:18 +01:00
Stanislav Erokhin
c38b48c7f1 Revert "Precise platform importing changes ported from new repository"
This reverts commit ee50a584
2021-03-16 15:11:10 +01:00
Stanislav Erokhin
e86ca3b49a Revert "Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData'"
This reverts commit 1741f0fc
2021-03-16 15:11:01 +01:00
Stanislav Erokhin
758cd9d268 Revert "loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception'"
This reverts commit 05144914
2021-03-16 15:10:27 +01:00
Dmitry Petrov
98ece21909 Minor: regenerate compiler tests 2021-03-15 17:43:44 +03:00
Dmitry Petrov
8d8745bd48 JVM_IR KT-44744 check accessibility of enum entry 'this' 2021-03-15 17:38:39 +03:00
Yaroslav Chernyshev
051449143c loadClassOrNull: catch 'ClassNotFoundException' and 'LinkageError' over 'Exception'
(cherry picked from commit aff49c76a9)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
1741f0fc9d Continue 'populateModuleDependenciesBySourceSetVisibilityGraph' on missing GradleSourceSetData'
(cherry picked from commit 116b11d8be)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
ee50a584a7 Precise platform importing changes ported from new repository
(cherry picked from commit d053ee33a8)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
e74eee55dd Re-structure KotlinMPPGradleProjectResolver.populateModuleDependencies
(cherry picked from commit 960a7dca45)
2021-03-15 17:25:44 +03:00
Yaroslav Chernyshev
af07c48a86 HMPP import: add dependencies present on all compilation a jvm&android shared source set participates
(cherry picked from commit 18a06dc37e)
2021-03-15 17:25:44 +03:00
Dmitry Savvinov
dbb6d03084 Minor: inline addDependsOnSourceSets in buildCompilation
(cherry picked from commit 96a4d19365)
2021-03-15 17:25:44 +03:00
Dmitry Savvinov
6d8a8bc20d Minor: rename KotlinCompilation.sourceSets -> allSourceSets
(cherry picked from commit 4927777ffb)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
3526ebfd88 Minor: add test on importing platform of commonMain in single-backend project
(cherry picked from commit 1143865e88)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
39b9ae7c5d Implement precise platforms importing in MPP
- skip metadata target from importing. That lead to metadata
compilations being imported is well -> some source-sets were
participating in metadata compilations as well -> logic for determining
platforms used to consider metadata compilations as well, adding COMMON
platform to set of platforms

Seems like metadata was never needed in import/IDE, and got there purely
by accident

- Use only targets, actually present in the project, as the default
platform. This is needed mostly for corner-cases/miconfigurations, like
orphan source-sets (source-sets which are created but not included into
any configuraion). Still, for those source-sets the tooling is required
to behave properly; presence of non-existing target can lead to various
issues like showing gutters for test runs, which would fail on launch
(because tests for that target actually do not exist)

^KT-37127 Fixed

(cherry picked from commit c3f5d57d3b)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
da044135d9 Refactoring: collect all logic regarding detecting sourceSet platform in one function
Note that previously addSourceSetsToCompilation had logic regarding
platforms. The reason for that is that it was the last place where
default soruce sets of compilations could be distinguished from all
participated source sets.

So, to move that logic, we have to preserve default source sets.
Therefore, this commit introduces 'KotlinCompilation.defaultSourceSets',
and 'ImportingContext.isDefaultSourceSet' method.

The rest is trivial code moving/methods introduction

The resulting code isn't really pretty and likely has non-orthogonal
predicates, this will be cleaned-up in the next commits

(cherry picked from commit 7a5b4ccb9a)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
a9285389ac Minor: swap receiver and parameter for shouldCoerceToCommon
Otherwise, it reads as if KotlinSourceSet coerces ImportingContext,
which is in fact the other way around

(cherry picked from commit ef04ae041e)
2021-03-15 17:25:43 +03:00
Dmitry Savvinov
b28db4d6d8 Dont coerce platforms of source-sets in HMPP to set of available targets in project
(cherry picked from commit 7ddcdca6bb)
2021-03-15 17:25:43 +03:00
Andrey Uskov
71e41b7c48 Update Gradle verion in tests from 6.1 to 6.1.1
Gradle 6.1 is not suitable for testing because of memory leak on
artefact validation (https://github.com/gradle/gradle/issues/11966)

(cherry picked from commit 9c000000cf)
2021-03-15 16:02:56 +03:00
Ilmir Usmanov
76d7b4254c Minor. Ignore tests on WASM 2021-03-15 13:29:44 +01:00
Ilmir Usmanov
f89ff877de JVM_IR: Do not unbox Result argument inside java SAM adapters
#KT-45259
2021-03-15 13:29:41 +01:00
Ilmir Usmanov
1d36def10c JVM_IR: Do not unbox Result argument inside SAM adapters
#KT-45259 Fixed
2021-03-15 13:29:40 +01:00
Ilmir Usmanov
8d68e56a78 Revert "Value Classes: Forbid var properties with value class receivers"
This reverts commit f43899086a.
2021-03-15 13:23:59 +01:00
Ilmir Usmanov
71f79a1ffc Revert "Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error"
This reverts commit bad197e075.
2021-03-15 13:23:56 +01:00
Roman Golyshev
37b90108ac KT-44756 Ignore annotations on value parameters if metadata says so
There is a `gradle-api-impldep.jar` created by Gradle which contains
our nullability annotations, but relocated in the
`org.gradle.internal.impldep` package

In the deserialization process we use a `HAS_ANNOTATIONS` flag, and
if it is present on the declaration, we do not try to build annotations
for it, even when they are actually present and even when they are
relocated
(see usages of Flags.HAS_ANNOTATIONS in org.jetbrains.kotlin.serialization.deserialization.MemberDeserializer)

In the stubs builder we also use this HAS_ANNOTATIONS flag, but we did
not use it for the value parameters. This commit fixes that - now, if
the `org.jetbrains.annotations` packages are relocated, it should not
cause `Stub Mismatch Error` for the value parameters

Lets consider two possible cases:

1. If the value parameter has a user-defined annotation,
it will be marked as having annotations (HAS_ANNOTATIONS == true), and
both stubs and deserialized descriptors will have to
use all available annotations (even a relocated ones)

2. If, for example, the value parameter is of non-nullable type, it will
have a `@NotNull` annotation on it, but will be marked as having
no annotations at all (HAS_ANNOTATIONS == false), since `NotNull` is
considered as auxiliary by the compiler. Because of the flag, both stubs
and descriptors will ignore all present annotations (even if they were
relocated)

In the both cases, the stubs and the descriptors will completely match

^KT-44756 Fixed

See IDEA-262971 about fixing the Gradle jar and the details

N.B. This does not fixes the cases when `kotlin.Metadata` and similar
annotations are relocated (e.g. KT-25709)

(cherry picked from commit 5d0760c685)
2021-03-15 12:40:02 +03:00
Abduqodiri Qurbonzoda
6bfd6c0afb Mark kt45410.kt with TARGET_BACKEND: JVM
(cherry picked from commit 77c263fcc4)
2021-03-15 12:10:02 +03:00
Mikhael Bogdanov
43bb78a566 Fix compilation after @JvmDefault deprecation
Suppress could be removed after switch to -Xjvm-default=all

(cherry picked from commit 6fab1305e9)
2021-03-15 09:13:08 +01:00
Mikhail Bogdanov
0a4a3b6480 Deprecate @JvmDefault
#KT-40392 Fixed

(cherry picked from commit c11f38688e)
(cherry picked from commit 95654bb9bc)
2021-03-15 09:13:07 +01:00
Abduqodiri Qurbonzoda
16d7b2ffbb Introduce firstNotNullOf and firstNotNullOfOrNull #KT-12109
(cherry picked from commit ff5b2404af)
2021-03-13 02:54:22 +03:00
Abduqodiri Qurbonzoda
67241f9760 Strict version of String.toBoolean() #KT-42071
(cherry picked from commit 09ad5ca602)
2021-03-13 02:54:19 +03:00
Abduqodiri Qurbonzoda
f22e90337e Introduce assertContentEquals in kotlin-test #KT-32996
(cherry picked from commit 5f4a4fd8ae)
2021-03-13 02:54:16 +03:00
pyos
7948533230 JVM: fix inline cycle detection
1. use the correct descriptor in the old backend;
 2. clear the temporary variables for arguments in the IR backend.

 #KT-45292 Fixed

(cherry picked from commit e06bacafad)
2021-03-12 18:02:02 +01:00
SokolovaMaria
d83a4fec7e Unused lambda parameter removed 2021-03-12 18:17:01 +03:00
SokolovaMaria
7868dc1880 Fixed running box tests for kotlinx.atomicfu compiler plugin 2021-03-12 18:17:01 +03:00
Mads Ager
5972130ee0 [JVM IR] Support break in do-while condition.
This breaks from the loop itself which is inconsistent with
what happens for breaks in while conditions.

Also, the frontend will report that code after the loop is
unreachable, which it isn't. :-\

However, those issues are covered in
https://youtrack.jetbrains.com/issue/KT-17728, so for now
we follow the old backend to not "break" anyone. :)

Fixes KT-44412

(cherry picked from commit 8588412a56)
2021-03-12 14:47:11 +01:00
SokolovaMaria
bd9d8614dd Fix for running box tests on JS_IR 2021-03-12 16:18:14 +03:00
Victor Petukhov
c14d5d70ba Don't lose upper non-expected type constraints to include them to intersection type during finding the result type of the fixing type variable 2021-03-12 14:58:07 +03:00
Victor Petukhov
8ba60d41e1 Don't stop constraints processing if all type variables have proper equality constraints
Those type variable may have other constraints after incorporation into which, the constraint error may appear

^KT-42042 Fixed
2021-03-12 14:58:03 +03:00
Victor Petukhov
878b3a7616 Don't fix a type variable into the intersection type if there is an explicit expected type
^KT-43303 Fixed
^KT-42472 Fixed
2021-03-12 14:57:58 +03:00
Mikhael Bogdanov
9e979e1e65 Advance bootstrap to 1.5.0-RC-325 2021-03-12 11:04:15 +01:00
Igor Yakovlev
d4493104d2 [ULC] Fix invalid primitive type annotating
Fixed #KT-45417
2021-03-12 10:43:43 +01:00
Dmitry Petrov
16da790a04 JVM_IR Spill stack on array constructor call
KT-42932

(cherry picked from commit 44e6483090)
2021-03-12 11:36:43 +03:00
Ilya Goncharov
a775cd261e [JS IR] In file JsModule top level with fresh names
[JS IR] Fix name for external classes

^KT-39272 fixed
^KT-41650 fixed
2021-03-12 11:12:57 +03:00
Ilya Chernikov
ad0b1a1e26 [minor] disable implicits test on IR, see added comments for details 2021-03-11 18:31:24 +01:00
Ilya Chernikov
c2ae0e4887 Add script metedata flag 2021-03-11 18:31:24 +01:00
Ilya Chernikov
c16e0f1e83 Mark script result expression as used to avoid coercion to unit 2021-03-11 18:31:24 +01:00
Ilya Chernikov
92be633866 Fix handling of lambdas in top-level destructuring declarations 2021-03-11 18:31:23 +01:00
Ilya Chernikov
94b97ce950 Fix CFA for destructuring declarations in scripts
in particular without the fix, the CFA skipped marking of the used
result values in lambdas and they were coerced to unit in IR
2021-03-11 18:31:23 +01:00
Ilya Chernikov
8e26173ac0 [minor] fix scripting test dependencies 2021-03-11 18:31:23 +01:00
Ilya Chernikov
831eaa3b96 [minor] uncomment 2 scripting tests:
Tests were failing before, but now fixed, most likely by switching to
default target 1.8 and some changes in scripting IR support.
#KT-44471 fixed
2021-03-11 18:31:22 +01:00
Ilya Chernikov
9bd64c3976 [minor] fix script util tests 2021-03-11 18:31:22 +01:00
Ilya Chernikov
d7cc7f59fc Implement REPL support in IR scripting 2021-03-11 18:31:21 +01:00
Ilya Chernikov
1977cfa3a9 Fix provided properties generation in ir scripting 2021-03-11 18:31:20 +01:00
Ilya Chernikov
a8acfee1b1 Enable IR in jvm scripting host tests 2021-03-11 18:31:20 +01:00
Ilya Chernikov
a804bc2041 Implement property for passing argumens to isolated script compiler 2021-03-11 18:31:18 +01:00
Ilya Chernikov
a62cf77dcf Protect scripts compilation from passing -Xuse-ir via configuration
as well as other options that require changes in the compilation setup
before compiler options from the configuration could be processed
2021-03-11 18:31:18 +01:00
Ilya Chernikov
91ea3b04d9 Extend GeneratorExtensions with previous script, implemt it for JS REPL
also refactor JS REPL for better compatibility with the generic
REPL/scripting infrastructure
2021-03-11 18:31:18 +01:00
Ilya Chernikov
113117b8d3 [minor] Implement in-process test for main.kts cache
mainly to ease debugging
2021-03-11 18:31:18 +01:00
Ilya Chernikov
11588cdb7a Implement proper call to the base class ctor in ir script lowering 2021-03-11 18:31:16 +01:00
Ilya Chernikov
349c00ca28 Implement metadata handling for IR scripts 2021-03-11 18:31:16 +01:00
Ilya Chernikov
36503922c2 Implement IR backend support in scripting tests, enable for some tests 2021-03-11 18:31:16 +01:00
SokolovaMaria
e02c089bd4 kotlinx.atomicfu compiler plugin for JS_IR
Support transformations of atomic operations introduced by the kotlinx.atomicfu library for the JS_IR backend. Compiler plugin is applied externally by the kotlinx.atomicfu gradle plugin.
2021-03-11 20:03:15 +03:00
Ilya Gorbunov
518173d63b Suggest duration static factories instead of number extension properties
Introduce Duration companion functions to convert numbers to Duration.
Deprecate number extension properties and propose to use these
new functions instead.

(cherry picked from commit a7fda66fa1)
2021-03-11 17:54:57 +03:00
Ilya Gorbunov
c83988cc61 Make more lambda-taking functions in kotlin-test inline-only
So that the lambda can contain non-local control flow, such as suspend
calls. Inline-only helps preserving line numbers in the failed assertion
stack traces.

KT-44717

(cherry picked from commit ca99fc4fed)
2021-03-11 17:54:56 +03:00
Alexander Udalov
58e95e3af3 Fix compilation after cherry-picking 51edbfdd
It turns out that that commit depended on f332192d, which isn't
cherry-picked to 1.5.0.
2021-03-11 15:51:34 +01:00
Alexander Udalov
357a49a8c9 Update public API dump for stdlib
(cherry picked from commit f4c63c8ba2)
2021-03-11 15:11:33 +01:00
Michael Hoisie
d924303849 Make kotlin.jvm.internal.DefaultConstructorMarker public
DefaultConstructorMarker is used as a marker to ensure that a
constructor is unique for companion objects. Prior to this change,
DefaultConstructorMarker was package private.

Being package private worked when calling the
DefaultConstructorMarker-marked constsructor using `invokespecial`,
likely because the JVM may not perform strict access checks in this
situation.

However, when access checks are performed, trying to call a
DefaultConstructorMarker-marked constructor will fail. This could happen
if the constructor was called using reflection or the MethodHandle API.
These APIs may be used by tools that perform bytecode instrumentation
on Kotlin JVM bytecode, such as Robolectric. It also caused problems
when using ByteBuddy validation.

Fixes https://youtrack.jetbrains.com/issue/KT-20869

(cherry picked from commit 83383ab9e5)
2021-03-11 15:11:29 +01:00
Alexander Udalov
51edbfdd03 JVM, JVM IR: report error if not all parts of multifile class are @JvmSynthetic
#KT-41884 Fixed

(cherry picked from commit bc5fc122c5)
2021-03-11 13:55:18 +01:00
Alexander Udalov
fc630fe25b Minor, move bytecodeListing tests on JvmMultifileClass
(cherry picked from commit 75850a618c)
2021-03-11 13:55:16 +01:00
Steven Schäfer
96a90b431a JVM: Add FILE target to the JvmSynthetic annotation (#4149)
(cherry picked from commit 057ead358c)
2021-03-11 13:55:15 +01:00
Victor Petukhov
568bde81d2 [jspecify] Change annotations' package from org.jspecify.annotations to org.jspecify.nullness, and DefaultNonNull to NullMarked
^KT-45409 Fixed

(cherry picked from commit b45d5abeb1)
2021-03-11 15:33:14 +03:00
Alexander Udalov
c67541ef26 JVM IR: prevent behavior change with operator dot calls on literals
#KT-42321 Fixed

(cherry picked from commit bf844aa8e4)
2021-03-11 13:15:29 +01:00
Alexander Udalov
438bb71a15 Remove one layer of nested exceptions in JVM backend
(cherry picked from commit c7498dd74d)
2021-03-11 12:42:12 +01:00
Vladimir Dolzhenko
da5fa4d573 Filter KtAnnotated on-the-fly diagnostic elements
Relates to #KTIJ-1760
Relates to #KT-45254

(cherry picked from commit fbe18164b4)
2021-03-11 10:51:08 +01:00
Dmitry Petrov
19f34c11c8 Minor: regenerate tests 2021-03-11 12:03:22 +03:00
Dmitry Petrov
0798d32630 Bump d8 used in box tests to 2.1.75 2021-03-11 12:03:22 +03:00
Dmitry Petrov
7ce6f2f30b JVM_IR Do not generate generic signatures for lifted lambda methods 2021-03-11 12:03:22 +03:00
Dmitry Petrov
3df95bc536 JVM_IR indy-SAM: use '-Xsam-conversions=indy' if JVM 1.8+, LV 1.5+ 2021-03-11 12:03:22 +03:00
Dmitriy Novozhilov
d5fd91918a [FE] Don't fail with exception if ESVisitor tries to visit ESLambda
#KT-45243 Fixed
2021-03-11 11:27:08 +03:00
Alexander Udalov
54ddbab79e JVM: fix EnclosingMethod information for SAMs in inline lambdas
Pass parentContext to SamWrapperCodegen from the outside instead of
using the one from parentCodegen. The difference is that in case of an
inline lambda, we're creating an InlineLambdaContext whose parent is a
ClosureContext, but the codegen for that lambda has that latter
ClosureContext as its context. So the getNonInlineOuterContext call in
SamWrapperCodegen.generateInnerClassInformation wasn't able to identify
that this is a context of a lambda that needs to be skipped, and
generated it as EnclosingMethod, which caused Java reflection to fail
because once that lambda was inlined, it was removed and thus didn't
make it to runtime.

 #KT-44827 Fixed

(cherry picked from commit 628d75c7cd)
2021-03-10 19:57:37 +01:00
Alexander Udalov
18bcf6a375 IR: add descriptor to "unbound symbols not allowed" message
This will help in diagnosing problems such as KT-45236.

(cherry picked from commit 8294aed40c)
2021-03-10 12:30:29 +01:00
Alexander Udalov
3528b854ff Add original KotlinType to rendered IrErrorType
Also improve an error message in `IrType.erasedUpperBound`, which seems
like a frequent first place where the JVM IR backend crashes in case an
error type has made it past psi2ir.

This will help in diagnosing problems such as KT-45016.

(cherry picked from commit e3dc112c5f)
2021-03-10 12:30:26 +01:00
Alexander Udalov
f46b8220a1 Psi2ir: do not generate default accessor body for expect properties
Because generateDefaultGetterBody/generateDefaultSetterBody reference
the property's backing field, which in case of extension properties
leads to an error "Unbound symbols not allowed" because extension
property cannot have a backing field.

In some way, this check is similar to the `isExpect` check in
`generatePrimaryConstructor`.

(cherry picked from commit bdaeaca5ae)
2021-03-10 12:30:22 +01:00
Alexander Udalov
a2fd3a86d0 Minor, add box test for unreachable uninitialized property
#KT-44496

(cherry picked from commit 5fc9f3bc17)
2021-03-10 12:30:18 +01:00
Alexander Udalov
31d93fd3b3 Do not require backing fields for extension properties
This has no effect on correct code because extension properties cannot
have a backing field anyway and that is checked separately. But this
function is used in psi2ir to determine whether or not to create a
backing field for a property, and in case the code where the property is
declared is unreachable like in KT-44496 and has no explicit getter or
setter, it would previously return true for extension properties, which
on JVM would result in an actual field in the class file, which made no
sense.

After this change, the compiler will actually crash with an exception in
the IR validaton step because the symbol for the field is unbound. That
is a bit better than proceeding to generate potentially invalid
bytecode, but of course a proper fix would be to report an error in the
frontend.

 #KT-44496

(cherry picked from commit 247efb220c)
2021-03-10 12:30:14 +01:00
Mikhael Bogdanov
33fc319c83 Use compatibility accessors only in compatibility stubs
(cherry picked from commit 66a29c70bf)
2021-03-10 10:50:23 +01:00
Mikhael Bogdanov
4eb85174e0 Don't generate private members in compatibility mode in DefaultImpls
(cherry picked from commit efceb89b98)
2021-03-10 10:50:20 +01:00
Mikhael Bogdanov
33d4e6f4f0 Generate stubs for private function with default arguments as public in interfaces
(cherry picked from commit f648d86d2b)
2021-03-10 10:50:19 +01:00
Ilmir Usmanov
250092c78d Regenerate test 2021-03-09 21:38:14 +01:00
Mads Ager
7de71d6045 [IR] Make IrGetObjectValue copyable to avoid duplicate IR nodes.
Fixes KT-45170
2021-03-09 18:52:50 +03:00
Svyatoslav Scherbina
2504a1cea1 Update Kotlin/Native: 1.5-M2-eap-1 2021-03-09 17:10:09 +03:00
Igor Yakovlev
1532a92209 [ULC] Fix annotations with no site for ctor
Fixed #KT-45291
2021-03-09 13:56:15 +01:00
Igor Yakovlev
f98ceaf5a7 [ULC] Fix annotations invalid parents
Fixed #KT-45287
2021-03-09 13:56:01 +01:00
sebastian.sellmair
dc0aae2dde [Commonizer] Implement safe SharedCommonizerTarget factory function
Do not try to instantiate SharedCommonizerTarget with no leaves
^KT-45350 Verification Pending
2021-03-09 12:21:47 +01:00
sebastian.sellmair
dfa1794deb [Commonizer] Add CommonizerIT test for ^KT-45350
Adding a test project containing commonization targets for
ios, linux and windows to test behaviour if at least one commonizer group
is fully not supported.

(cherry picked from commit 6527452143)
2021-03-09 12:21:47 +01:00
Ilmir Usmanov
209c18374c Extend LVT record of alive variables to end of next suspension point
Otherwise, arguments of suspend call become invisible in async stack
trace
 #KT-44714
2021-03-09 12:14:59 +01:00
Ilmir Usmanov
6c2e3af775 Make start label of LVT record the point where variable becomes alive
Otherwise, there will be overlapping LVT records, which leads to
removal of the whole LVT by R8.
 #KT-44714 Fixed
2021-03-09 12:14:48 +01:00
Ilmir Usmanov
e491e7e289 Do not remove dead variables' LVT records
Also, extend liveness of alive variable to nearest suspension points
 #KT-44714
2021-03-09 12:14:46 +01:00
Mikhael Bogdanov
733f4e7501 Fix EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE message
(cherry picked from commit 4d51d71699)
2021-03-09 12:06:49 +01:00
Mikhael Bogdanov
fcf75f60a1 Use actual implementation instead of inherited one in -Xjvm-default diagnostics
(cherry picked from commit 3568eba1b2)
2021-03-09 12:06:49 +01:00
Mikhael Bogdanov
389f489fda Fix checker for -Xjvm-defaults
(cherry picked from commit 71c134e54f)
2021-03-09 12:06:48 +01:00
Alexander Udalov
940469dc4f Add KClass.isValue to kotlin-reflect
#KT-44782 Fixed

(cherry picked from commit 6ddca4a592)
2021-03-09 11:45:48 +01:00
Alexander Udalov
d8b85debe6 Restore writing bytecode version to metadata for LV < 1.5
#KT-45323 Fixed

(cherry picked from commit 9970851684)
2021-03-08 11:19:12 +01:00
Alexander Udalov
ffe642c0b7 Revert "Do not write bytecode version to class file"
This reverts commit c6f5ce6837.

 #KT-45323

(cherry picked from commit a2200b5386)
2021-03-08 11:19:10 +01:00
Vladimir Dolzhenko
ee11ace111 Ignore when failed to get file text
Relates to #KTIJ-706

(cherry picked from commit 36ff952a0f)
2021-03-08 09:51:46 +01:00
Andrey Uskov
5aea142d3a Fixed loading Gradle script templates located on WSL2
#KT-45042 Fixed

(cherry picked from commit b7e13d677d)
2021-03-07 19:41:49 +03:00
Andrey Uskov
6794e4d54c Implemented collecting projectId from Gradle
#KT-45337 Fixed

(cherry picked from commit 63925ee018)
2021-03-07 19:41:44 +03:00
justin.wei
b63b1aee7a Support relocatable cache for InputCache
(cherry picked from commit 34274dd032)
2021-03-07 16:55:44 +03:00
Ivan Gavrilovic
c2bcc7be15 KAPT - Make StructureTransformAction cacheable
When computing classpath structure ignore absolute
paths and timestamps. This also makes the transform
cacheable and it should increase cache hit rate.

Test: existing BuildCacheRelocationIT
2021-03-07 16:55:41 +03:00
Ivan Gavrilovic
b2d4f0f9a2 KT-45168: Avoid generating stubs for generated Kotlin sources
Filter out Kotlin sources coming from KAPT-generated dirs.
Some annotation processors e.g Moshi, generate Kotlin sources,
and when generating stubs in non-incremental runs, stub generation
must ignore those sources. This fixes #KT-45168.

Test: Kapt3IT
(cherry picked from commit 08446e2371)
2021-03-07 16:55:39 +03:00
Yahor Berdnikau
96a91189b0 Distinguish outputs of JS IR tasks.
Now JS IR link and sync tasks will output produced artifacts based on
compilation name, binary name and binary mode. This will remove
Gradle 7 error about missing task dependencies, which should not depend
on each other.

^KT-44949 In Progress
2021-03-07 12:02:35 +01:00
Yahor Berdnikau
c34a05866e Fix test expects slightly different variant selection error message.
Error message was slightly changed on Gradle 7.

^KT-44949 In Progress
2021-03-07 12:02:34 +01:00
Yahor Berdnikau
99c24a8ce2 Update AGP tests.
Bump AGP version in some tests and ignore AGP 3.4 tests on Gradle 7.
AGP 3.4 is not compatible with Gradle 7.

^KT-44949 In Progress
2021-03-07 12:02:34 +01:00
Yahor Berdnikau
d393038762 Change source jar duplication error to warning.
For now Gradle 7 will print warnings on publishing sources jar containing
duplicate files.

Duplicates are coming from SourceSets SourceSet added to sources jar
task depends on. Such approach should be rethought.

^KT-44949 In Progress
2021-03-07 12:02:34 +01:00
Yahor Berdnikau
b1ddb612ee Fix test was using removed publication plugin.
Replace usage of removed 'maven' plugin with 'maven-publish'.

^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
6e5af9e6b6 Fix test project uses removed configuration for dependencies.
^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
11fc1dccaf Link task producing jar with sources to dukat tasks.
This required by Gradle 7 task validation.
Though in some cases sourcesJar task should not depend in some cases on Dukat tasks.

^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
d1b7f203d2 Split klib and cinterop outputs.
So Gradle 7 will not complain that some tasks using klib or cinterop
should depend on both tasks producing klib and cinterop, while they
don't need both.

^KT-44949 In Progress
2021-03-07 12:02:33 +01:00
Yahor Berdnikau
52454977ca Fix test was using old KMM dependency notation.
^KT-44949 In Progress
2021-03-07 12:02:32 +01:00
Yahor Berdnikau
e3833fedf1 Ensure compilation task depends on friend artifact producer task.
Without it Gradle 7.0 tasks dependency validation will fail.

Fix JS tasks are not cacheable due to friends inputs change.

^KT-44949 In Progress
2021-03-07 12:02:27 +01:00
Abduqodiri Qurbonzoda
906d434abb Fix @SinceKotlin in Common titlecase and titlecaseChar functions
(cherry picked from commit e7a45bba91)
2021-03-07 07:59:43 +03:00
Abduqodiri Qurbonzoda
476c157847 Mark with @SinceKotlin("1.5") the Common char category API
(cherry picked from commit 10b0d147af)
2021-03-07 07:59:41 +03:00
Cedric Champeau
b69dc5fde1 Fix File as input of an artifact transform
Using `File` as input of an artifact transform was deprecated.
With Gradle 7, this becomes an error. This commit fixes the
problem by using the proper replacement:

   Provider<FileSystemLocation>
2021-03-06 13:51:15 +01:00
Abduqodiri Qurbonzoda
f1503d8f10 Optimized toArray method for ArrayDeque and ListBuilder #KT-42720
(cherry picked from commit 421cb6971d)
2021-03-06 11:22:30 +03:00
Abduqodiri Qurbonzoda
54feaa8528 Commonize and generalize JVM-only String.contentEquals #KT-42840
(cherry picked from commit ed57bcb3b1)
2021-03-06 11:22:29 +03:00
Ilya Gorbunov
54d20b5768 Support mod and floorDiv extensions in constant evaluator
Ignore evaluation tests for floorDiv and mod with FIR for now.

(cherry picked from commit 9cc8f44390)
2021-03-06 02:02:32 +03:00
Ilya Gorbunov
8eaccb5d23 Rename test of rem operator evaluation
(cherry picked from commit 58e6f775bb)
2021-03-06 02:02:28 +03:00
Ilya Gorbunov
529e82cfcb Generate docs for floorDiv and mod and improve docs for div and rem
Refactor operator documentation generation for primitives and unsigned
types so that it is easier to specialize it.

Manually sync docs of numeric types in js-ir stdlib.

 KT-26234

(cherry picked from commit 7e2c365b79)
2021-03-06 02:02:25 +03:00
Ilya Gorbunov
28f632987a Floor division and remainder for numeric types KT-26234
- floorDiv/mod for unsigned types
- floorDiv/mod for signed types
- mod for floating point types

- mod return type: same as divisor for integer types

- Update JS API dump
- Avoid triggering division overflow in tests due to K/N
- Workaround failing test in JS-legacy

(cherry picked from commit 50d4979531)
2021-03-06 02:02:22 +03:00
Mads Ager
c34d2f979a [IR] Move annotations from original to new constructor declarations.
LocalDeclarationsLowering did not move annotations when creating
a new constructor declaration, thereby losing the annotations.

Fixes KT-45298

(cherry picked from commit e5631addf3)
2021-03-05 21:24:54 +01:00
Mads Ager
970ca5264c [JVM IR] Make upper bounds check recursive for ieee Equals.
Fixes KT-44402

(cherry picked from commit 965c118521)
2021-03-05 21:23:12 +01:00
Mikhael Bogdanov
55e7d4bf7a Reports warning on super calls in public-api inline functions
(cherry picked from commit 8ff0b1e243)
2021-03-05 20:29:18 +01:00
Alexander Udalov
48fe3a699a Add test which runs Kotlin compiler in parallel
This will be useful in diagnosing issues like KT-45007 in the future.

 #KT-45007

(cherry picked from commit 027df41740)
2021-03-05 17:59:16 +01:00
Alexander Udalov
dfa7dadac4 Revert "Fix KotlinCoreEnvironment projectCount disposable"
This reverts commit 99a6bdeec7.

 #KT-45007 Fixed

(cherry picked from commit e7e17cdaa9)
2021-03-05 17:59:14 +01:00
Alexander Likhachev
da5c625f6e [Gradle] Rework KotlinTestReport to be compatible with configuration cache
(cherry picked from commit ef890464d8)
2021-03-05 17:48:58 +03:00
Roman Artemev
0137f3e39f [KLIB] Support assignable value parameters in deserializer
- fix KT-44945
2021-03-05 17:13:04 +03:00
Yahor Berdnikau
81dd45ab86 Fix Jvm target tries to use removed configuration.
KT-44949 In Progress
KT-44957 Fixed
2021-03-05 14:32:25 +01:00
Yahor Berdnikau
63d48416b6 Fix JS target configuration triggers task creation too early.
This raised the problem that task, compilation task depends on, has not
been yet created and Gradle fails the build with exception.

KT-44949 In Progress
2021-03-05 14:32:13 +01:00
Yahor Berdnikau
a21266009c Migrate to the actual workers api available from Gradle 5.6.
Old api was removed in Gradle 7 and causes build crashes.

KT-44949 In Progress
2021-03-05 14:32:00 +01:00
Victor Turansky
147874be43 Use optimized Ktor client (-0.5MB)
[Details](https://youtrack.jetbrains.com/issue/KTOR-1084)
2021-03-05 13:11:12 +01:00
Victor Turansky
d25e48dbfe Use appropriate kotlin wrappers version (1.4.21 -> 1.4.30) 2021-03-05 13:11:11 +01:00
Bingran
b2489d87bb Update min supported gradle version to 6.1
This PR also updates the min agp version we test with because older agp
versions are using gradle apis which doesn't exist in gradle 6.0+.

GH PR: #4155
2021-03-05 12:42:41 +01:00
Alexander Likhachev
049580e639 [Gradle, JS] Make MultiplePluginDeclarationDetector compatible w/ conf cache 2021-03-05 12:41:13 +01:00
Alexander Likhachev
85d30c16f1 [Gradle] Replace deprecated dependencies configurations in buildscript
(cherry picked from commit ef458b20e1)
2021-03-05 14:05:42 +03:00
Ilya Gorbunov
d8de055767 Add runtime dependency on junit-jupiter-engine to kotlin-test-junit5
It is required to run tests authored with kotlin-test, so it seems
convenient to have it as a runtime dependency of kotlin-test-junit5
variant.

Depend on the version 5.6.0, which is approx. one year old.
Can be upgraded in the consumer project if necessary.

Also upgrade junit-jupiter-api dependency to 5.6.0, so that users could
use more recent JUnit functionality in JVM tests,
but continue compiling the artifact against 5.0.0 to leave a
possibility to downgrade JUnit platform dependency if needed.

KT-45107

(cherry picked from commit 284e6f5bb3)
2021-03-05 04:14:57 +03:00
Ilya Gorbunov
a7a4ccee0c Unify test package names in kotlin-stdlib tests
This makes 'test.' an implicit package prefix, thus fixing the inspection
"Package directive doesn't match file location" positive in almost all
test files.

(cherry picked from commit ca6ce151a2)
2021-03-05 04:12:01 +03:00
Nikolay Krasko
30f654c4ea Add fasutil to the list of package to relocate (KT-44758)
#KT-44758 Fixed

(cherry picked from commit 3022fb396b)
2021-03-04 23:03:53 +03:00
Mikhail Zarechenskiy
67e812cd28 Increase stub versions for major release
^KT-41056 Fixed
2021-03-04 22:12:22 +03:00
Abduqodiri Qurbonzoda
4a936324b5 Commonize Char.titlecaseChar() and Char.titlecase() #KT-44369
(cherry picked from commit 2266cd4631)
2021-03-04 20:43:35 +03:00
Abduqodiri Qurbonzoda
a2bdee74e1 Add String case conversion tests
(cherry picked from commit 0c9205423f)
2021-03-04 20:43:32 +03:00
Abduqodiri Qurbonzoda
48582b1caa Add Char case conversion tests
(cherry picked from commit 49ce776bf4)
2021-03-04 20:43:29 +03:00
Abduqodiri Qurbonzoda
6b5379e6c0 Implement String case conversion generators #KT-45213
(cherry picked from commit fc5e4c20c1)
2021-03-04 20:43:26 +03:00
Abduqodiri Qurbonzoda
ce0fe0358a Implement Char one-to-one and one-to-many case conversion generators #KT-45213
(cherry picked from commit 1066de1be6)
2021-03-04 20:43:24 +03:00
Pavel Kirpichenkov
825563d4f8 [MPP] Consider expect-actual inline/value classes interchangeable
^KT-44926 Fixed
2021-03-04 20:13:20 +03:00
Pavel Kirpichenkov
68b2a0931a Add test for KT-44926 2021-03-04 20:13:20 +03:00
Pavel Kirpichenkov
9f793dab35 Minor: refactor extended compiler checks
Use an analysis flag instead of a stub language feature
2021-03-04 20:13:20 +03:00
Pavel Kirpichenkov
df243ebd66 Provide additional information about missing supertypes
Add -X flag to report extra compiler diagnostics which migth break compatibility.
Use the flag to unconditionally check constructors without fear of
prematurely evaluating lazy supertypes.

KT-19234
KT-42404
KT-44583
2021-03-04 20:13:20 +03:00
Alexander Likhachev
bb558c5282 Update tests after compiler properties rework
#KT-43605 Fixed

(cherry picked from commit 70d434e992)
2021-03-04 19:52:49 +03:00
Alexander Likhachev
de62c4cde7 [Gradle] Read system properties at configuration time using Gradle providers
The change is a step to fully support Gradle configuration cache.
Relates to #KT-43605
Relates to #KT-44611

(cherry picked from commit 3537c699b5)
2021-03-04 19:52:44 +03:00
Alexander Likhachev
5c05860ad3 [Gradle, MPP] Rework build finished listener into build service
Registering build finished listeners is not supported by configuration cache
Relates to #KT-44611
#KT-44900 Fixed

(cherry picked from commit 67632a495b)
2021-03-04 19:39:56 +03:00
Alexander Likhachev
a372dd7660 [Gradle] Bump gradle-download-task version to 4.1.1 to support configuration cache
Relates to #KT-44611

(cherry picked from commit 3e09bb3d3f)
2021-03-04 19:39:34 +03:00
Alexander Likhachev
268e33fa49 [Gradle, JVM] Don't create deprecated compile/runtime configurations
Gradle also removes these configurations in 7.0. See gradle/gradle@2cb45cdbd0
#KT-44462 Fixed

(cherry picked from commit 683bd0ed38)
2021-03-04 19:38:10 +03:00
Margarita Bobova
8d71befde0 Add Changelog for 1.5-M1, 1.4.31, 1.4.30 2021-03-04 14:20:14 +03:00
Sergey Shanshin
43a6d7a180 Lazy delegate for serializer in objects, sealed and abstract classes
Fixes Kotlin/kotlinx.serialization#585

(cherry picked from commit bf6dda2d99)
2021-03-03 21:45:26 +03:00
Yahor Berdnikau
3a11ac6799 Replace, where possible in tests, jcenter() with mavenCentral().
In few places I have to leave bintray repository due to not all kotlin
dependencies where migrated to maven central.

^KT-44949 In progress
2021-03-02 16:01:49 +01:00
Sergey Shanshin
45192ea73d Updated bytecode of serialization for IR
`shouldEncodeElementDefault` now checked before evaluating default value

(cherry picked from commit 8c20c655fe)
2021-03-02 17:03:56 +03:00
Sergey Shanshin
17bb85d624 Support serialization of java enum classes in IR
Fixes Kotlin/kotlinx.serialization#1334

(cherry picked from commit 91f1cb88c1)
2021-03-02 17:03:55 +03:00
Sergey Shanshin
06fa4b8128 Added external serializers in serialization plugin for IR backend
- added fallback support of external serializers in IR
- implemented calculations of properties default values in IR
- swapped check of shouldEncodeElementDefault and comparing the property with default value in IR. Now default value calculated only of shouldEncodeElementDefault returns false

(cherry picked from commit de06a69b12)
2021-03-02 17:03:55 +03:00
Yaroslav Chernyshev
cb97fe0274 Add lambda configurable languageSettings function in KotlinSourceSet
Function with Groovy Closure is already exists, it provides DSL parity
#KT-44834 Fixed

(cherry picked from commit 7d766add4b)
2021-03-02 16:37:43 +03:00
Ilmir Usmanov
c0c985993c IC: Add inline class -> @JvmInline value class warning 2021-03-02 13:07:42 +01:00
Yaroslav Chernyshev
48370ecf8c Fix jvmTarget default divergence between KGP & IDE after change to 1.8
(cherry picked from commit 634c8522a1)
2021-03-02 11:54:22 +03:00
Mikhael Bogdanov
a76ee3ae2e Fix ultra light class generation for private suspend methods
(cherry picked from commit 373d0ac660)
2021-03-01 16:25:33 +01:00
Mikhael Bogdanov
5d69bc5022 Remove version requirements for -Xjvm-default=enable (1.2.40) and JvmFieldInInterface(1.2.70)
(cherry picked from commit 989fea3399)
2021-03-01 16:25:32 +01:00
Mikhael Bogdanov
3aa7f72527 Generate local delegated properties in interface in jvm-default all modes
(cherry picked from commit 49aa36b70d)
2021-03-01 16:25:31 +01:00
Mikhael Bogdanov
a7002d5e38 Generate private suspend functions as private (not synthetic package-private)
#KT-26592 Fixed

(cherry picked from commit c25a694b6b)
2021-03-01 16:25:30 +01:00
Mikhael Bogdanov
6ceff112e2 Add test for private suspend and JVM defaults
(cherry picked from commit ad8eddac99)
2021-03-01 16:25:27 +01:00
Mikhael Bogdanov
491ee56cd4 Generate synthetic annotation method in interface if -Xjvm-default is on
(cherry picked from commit 8764bb09f2)
2021-03-01 16:25:25 +01:00
anastasiia.spaseeva
d5666ba699 Update compose version to 0.3.1
(cherry picked from commit fb83c491bb)
2021-03-01 16:08:45 +01:00
anastasiia.spaseeva
8cb17f57f7 Fix tests after libraries and wrappers versions updating 2021-03-01 16:08:44 +01:00
Andrei Klunnyi
ee11fbcbf7 KT-44821 [Sealed Interfaces]: when-exhaustiveness failure in IDE
Compiler check for 'when' exhaustiveness requires that module
descriptors of a sealed class and its inheritors are the same (reference
identity matters). Prior to this commit and under some conditions they
were not. Details follow below.

Resolution related data structures (resolution facades) are organized
into trees (sdks, libs, and modules have their own nodes/facades,
module/class descriptors are stored inside). And the trees themselves
are put into a map associating so called PlatformAnalysisSettings and
GlobalFacades (plays a role of a root). PlatformAnalysisSettings is an
abstraction describing target platform and sdk of a module. The more
combinations exist for a project the more facades are used. Please, see
KotlinCacheService for more details.

So why a module can have multiple ModuleDescriptor-s?
Every tree mentioned above is an isolated resolution environment
containing its own instances of the outer world descriptors. Say, if a
project has modules X, Y, Z and we consider X then all three might have
their own vision of X, i.e. 3 descriptors exist at a time.

What descriptor instance does compiler get?
The path starts when the user opens a file in the editor and
highlighting pass starts (see usages of
ResolutionUtils#analyzeWithAllCompilerChecks). Module descriptor stored
in the resolution tree of the file's module gets injected into the
compiler's context. Starting from this moment compiler sees other
modules through the prism of a single resolution facade (tree).
Descriptors residing outside are alien.

This commit allows IdeSealedClassInheritorsProvider to figure out what
PlatformAnalysisSettings are associated with the resolution facade (read
ModuleDescriptor) seen by the compiler. Later on the same facade is used
to provide correct instances of sealed inheritors back to the compiler.

(cherry picked from commit f45af5ea0e)
2021-03-01 12:34:40 +01:00
anastasiia.spaseeva
448a6cb995 Update libraries and wrappers versions for 1.5.0 2021-02-26 17:29:11 +01:00
Nikita Katkov
1132bde48f IDEA-253605 jvmClassPathUtil: preserve old behaviour
(cherry picked from commit e1b3cd32f3)
2021-02-26 15:07:32 +01:00
Nikita Katkov
6bcb4cc53a IDEA-253605 jvmClassPathUtil: correct collection of parent classloaders
(cherry picked from commit 738c6d3119)
2021-02-26 15:07:31 +01:00
Dmitry Savvinov
c0e01ddebb Minor: use more clear and specific naming for LazyClassContext.typeChecker (relevant for MPP with type refinement) 2021-02-26 12:56:09 +03:00
Dmitry Savvinov
1baa83bd34 Use overriding util with proper typechecker for overriding in LazyClassMemberScope
Note that LazyClassMemberScope actually has a separate field for
KotlinTypeRefiner, and it might be actually different from the one in
c.kotlinTypeChecker.

The one in c.kotlinTypeChecker is the refiner of *owner* module, i.e. a
module in which the class has been declared. If we have a class Foo :
Expect in common, then the refiner will be from common, and thus it
won't be able to refine supertypes to their platform-dependent values.

The one passed in constructor is actual refiner of dependant-module.
Say, if we're looking at Foo from the point of view of jvmMain, then
we'll create a (view-dependent) LCMS for that, and it will contain
refiner for jvmMain.

It is important to use proper refiner, otherwise the idea of having
"module-dependent view" breaks, and we might suddenly mismatch some
overrides with expect-classes in their signatures.

^KT-44898 Fixed
2021-02-26 12:56:08 +03:00
Dmitry Savvinov
3700d23b18 Add test on KT-44898 (MPP + type refinement + complex inheritance)
The current behaviour is undesired (ABSTRACT_MEMEBER_NOT_IMPLEMENTED
reported on class Concrete), will be fixed in the next commit
2021-02-26 12:56:07 +03:00
Dmitry Savvinov
023d80b5fa Minor: rename createMemberScope -> createScopesHolderForClass 2021-02-26 12:56:06 +03:00
Igor Chevdar
a2760b3f78 [IR] Fixed bug with reflectionTarget evaluation 2021-02-26 12:50:45 +05:00
Igor Chevdar
696557032c [PSI2IR] Set reflectionTarget for all adapted references 2021-02-26 12:50:38 +05:00
Alexander Udalov
94fe759b9d IR: support smart cast values in RangeContainsLowering
#KT-44878 Fixed

(cherry picked from commit acc2256de9)
2021-02-25 21:00:47 +01:00
Alexander Udalov
5f9fe82903 IR: add isUnsignedType/getUnsignedType
(cherry picked from commit 820762ca16)
2021-02-25 21:00:45 +01:00
Alexander Udalov
00668484bd IR: add getPrimitiveType, optimize some usages of isInt/isByte/...
(cherry picked from commit 0ebdf7c3c4)
2021-02-25 21:00:43 +01:00
Alexander Udalov
295fff2fbc Minor, fix compilation warning in DurationUnit.kt
(cherry picked from commit 17ee10a0d8)
2021-02-25 21:00:41 +01:00
Ilmir Usmanov
9e090ea744 Do not add @JvmInline annotation on JS and Native 2021-02-25 18:09:58 +01:00
Ilmir Usmanov
f783bb87b3 Minor. Remove outdated test and update maven test 2021-02-25 18:09:56 +01:00
Ilmir Usmanov
51394349d0 fixup! Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 18:09:54 +01:00
Ilmir Usmanov
a536d4c5b8 Add inline class -> @JvmInline value class intention 2021-02-25 18:09:52 +01:00
Ilmir Usmanov
6e654067ab Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 18:09:49 +01:00
Dmitriy Novozhilov
86b01d2ba6 Fix non-exhaustive when in common stdlib
(cherry picked from commit 99c47a0487)
2021-02-25 17:07:29 +03:00
Dmitriy Novozhilov
522cfebc9a [FE] Make whens on expect sealed classes and enums not exhaustive 2021-02-25 17:07:28 +03:00
Alexander Udalov
3b026c9116 JVM IR: do not hide constructor with inline class in anonymous object
#KT-45131 Fixed

(cherry picked from commit b417786fd4)
2021-02-25 14:44:53 +01:00
Alexander Udalov
1210381342 Do not ever run JVM test handlers after previous errors
If there's a frontend error in a test, or bytecode generation crashed
with an exception, it makes no sense to run JVM test handlers such as
lambda inlining checker or D8 checker.

(cherry picked from commit b026de768d)
2021-02-25 14:44:42 +01:00
Andrei Klunnyi
badfaf3db9 KT-45074 [Sealed Interfaces]: when exhaustiveness after gradle reimport
Module descriptor names in the form of 'stableName' depend on a build
system. See JvmCodegenUtil#getModuleName(). For JPS we get
<module-name.main> or <module-name.test> whereas for Gradle we get top
level <module-name>.
This commit changes approach: ModuleDescriptor-to-Module conversion is
no longer made by name. ModuleInfo is utilized instead.

^KT-45074 fixed
2021-02-25 11:41:07 +01:00
Victor Petukhov
ebfa56d9ed Don't throw an exception while loading type use annotations on implicit bounds of a wildcard
^KT-45067 Fixed
2021-02-24 21:07:59 +03:00
Stefan Wolf
cdc1aa8928 Remove references to validateTaskProperties
The task is now called `validatePlugins`.
2021-02-23 23:29:18 +03:00
Stefan Wolf
c2a4b2d886 Add PathSensitive annotation to all input file properties
So new validation which will be added in Gradle 7.1
won't cause warnings during the build.
2021-02-23 23:29:16 +03:00
Stefan Wolf
b69e119fd4 Enable stricter validation 2021-02-23 23:29:13 +03:00
Mads Ager
ca1df95052 [PSI2IR] Do not generate property reference setter if inaccessible.
Fixes KT-45064.

(cherry picked from commit 8852323a76)
2021-02-23 19:38:08 +01:00
Ilmir Usmanov
c90f01a81b JVM IR: Use INVOKESPECIAL instead of INVOKEVIRTUAL for default private
suspend functions.

 #KT-26592
2021-02-23 18:49:45 +01:00
Ilmir Usmanov
85b9b5b85f JVM IR: Do not generate private suspend functions as synthetic package-private
#KT-26592
2021-02-23 18:49:42 +01:00
Alexander Udalov
396ea68c1a Deprecate kotlin.Metadata.bytecodeVersion
#KT-41758 Fixed

(cherry picked from commit 48fb085bf6)
2021-02-23 14:16:24 +01:00
Alexander Udalov
15b3f54e66 Remove JvmBytecodeBinaryVersion from the compiler code
Move it to build-common where it's still used in incremental compilation
caches, and simplify a bit. In the future, it'll make sense to remove it
completely and to avoid writing it to caches. In this commit, I don't do
that to prevent the IC cache version to be updated, causing rebuilds for
all JPS projects.

 #KT-41758

(cherry picked from commit f63ffc51ae)
2021-02-23 14:16:22 +01:00
Alexander Udalov
e90e8fa53b Remove obsolete code in inliner for experimental coroutines
(cherry picked from commit d300e05be9)
2021-02-23 14:16:20 +01:00
Alexander Udalov
403245bd38 kotlinx-metadata-jvm: deprecate KotlinClassHeader.bytecodeVersion
#KT-41758

(cherry picked from commit 448c6c2f0d)
2021-02-23 14:16:18 +01:00
Alexander Udalov
02710c33d3 Do not write bytecode version to class file
#KT-41758

(cherry picked from commit c6f5ce6837)
2021-02-23 14:16:17 +01:00
Alexander Udalov
5a698f8121 Do not report errors about bytecode version
#KT-41758

(cherry picked from commit 862a9143da)
2021-02-23 14:16:08 +01:00
Alexander Udalov
4536b13ceb JVM IR: fix isMarkedNullable for nullability-flexible types
Since nullability-flexible types in IR are represented by an annotation
on an IrSimpleType, not a special instance, the common implementation of
`KotlinTypeMarker.isMarkedNullable` in `TypeSystemContext` doesn't work.

This method is used for example to generate `typeOf` in JVM IR, in
`TypeSystemCommonBackendContext.generateTypeOf`, and this issue led to a
difference in behavior of `typeOf` for nullability-flexible types.

 #KT-44726 Fixed

(cherry picked from commit e6476c39ca)
2021-02-22 12:53:02 +01:00
Vladimir Dolzhenko
c7376896d6 Do not swallow PCE
#KT-39776 Fixed

(cherry picked from commit b8d1bbdd0d)
2021-02-22 10:52:49 +01:00
Victor Petukhov
5f53dff7c9 Approximate captured types in contravariant positions properly
^KT-43802 Fixed

(cherry picked from commit 4e5647090e)
2021-02-20 17:01:36 +03:00
Dmitriy Novozhilov
be18cb1cb7 Don't run fir tests in :miscCompilerTest configuration
This is fine because FIR is not released, we don't track
  correctness of it in 1.5.0 release branch and there are
  no clients of FIR
2021-02-20 16:45:21 +03:00
Dmitriy Novozhilov
6a0e9d5d38 Fix FIR testdata 2021-02-20 16:18:48 +03:00
Dmitry Petrov
11c154226f JVM_IR indy-SAM: KT-45069 box lambda 'Unit' return type if needed 2021-02-20 13:46:19 +03:00
Ilya Goncharov
99fdcc647a [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed

(cherry picked from commit bd2601f289)
2021-02-20 12:10:56 +03:00
Sergey Bogolepov
fe89c8d64e Support for macos_arm64 target in backend
(cherry picked from commit 06498c0efd)
2021-02-20 13:56:04 +07:00
Aleksei.Cherepanov
12b984e53d Add synchronization to MultiClassFiles maps
(cherry picked from commit d0eeb0535d)
2021-02-19 23:59:13 +03:00
Aleksei.Cherepanov
ef3c73554f JPS: Fix JvmMultifileClass processing for IR backend
#KT-44644 Fixed

(cherry picked from commit aa683d3b2a)
2021-02-19 23:59:11 +03:00
Alexander Udalov
ff0f0def59 JVM IR: do not generate invokeinterface hashCode if smart cast is present
#KT-45008 Fixed

(cherry picked from commit 56f9e3360f)
2021-02-19 14:22:15 +01:00
Dmitriy Novozhilov
b328532356 [FE] Assume that effective visibility of sealed class constructor is internal
#KT-45033 Fixed
#KT-45043
2021-02-19 14:10:16 +03:00
Dmitry Petrov
ce9381cfa4 JVM_IR indy-SAM: function reference to Java interface 2021-02-19 10:27:55 +03:00
Dmitry Petrov
9abfc6bc1c Minor: regenerate tests 2021-02-19 09:29:41 +03:00
Dmitry Petrov
22689c28d3 PSI2IR KT-45022 object in LHS of compound assignment
(cherry picked from commit 744a0fcd25)
2021-02-19 09:29:41 +03:00
Vladimir Dolzhenko
f89ebbe5d2 Report highlight errors to WolfTheProblemSolver
Relates to #KT-37702
#KTIJ-1246 Fixed

Original commit: bd222a5255c2fd6f4abfce3115f81733ef9a39f3

(cherry picked from commit 8783ebc352)
2021-02-19 06:49:55 +01:00
Ilmir Usmanov
8aedf23deb Use erased upper bound instead of checking for inline type 2021-02-18 18:38:15 +01:00
Ilmir Usmanov
a147080ac1 JVM_IR: IC: Unbox inline class argument of callable reference
if it is unbound and the underlying type is reference type.
If the underlying type is primitive, it is boxed and unboxed
correctly, otherwise, it is simply casted and not unboxed.
Additionally, generate functions for inliner with inline classes
in signature, so unboxing works.
The unboxing is removed after inlining.
 #KT-44722 Fixed
2021-02-18 18:38:12 +01:00
Victor Petukhov
65a490eefc KotlinBinaryClassCache: clean-up request caches for all threads
^KT-44550 Fixed

(cherry picked from commit ad9fd7ecf3)
2021-02-18 17:07:37 +03:00
Alexander Udalov
28fb718529 Update JVM metadata version to 1.5.0
Improve the test which checks that we use correct metadata version if
`-language-version` is passed by checking all supported language
versions.

The change in libraries/reflect/build.gradle.kts is needed because
kotlinx-metadata-jvm of version 0.1.0 is based on pre-1.4 Kotlin, which
doesn't support the new module file metadata generated with metadata
version 1.4 and later, and module files need to be readable there to be
able to transform them for the shadow plugin.

Similarly override dependency on kotlinx-metadata-jvm in the
binary-compatibility-validator module.

(cherry picked from commit 8c95b78346)
2021-02-18 12:42:50 +01:00
Mikhael Bogdanov
9bbd6ccb87 Fix test data 2021-02-18 07:23:50 +01:00
Dmitry Petrov
3361526e4a JVM_IR indy-SAM on functional expression
(cherry picked from commit 6d019d9544)
2021-02-18 09:11:18 +03:00
Alexander Udalov
9faf83899d JVM IR: write inherited multifile parts flag to kotlin.Metadata
This flag is unused at the moment, but might be used one day to support
proper incremental compilation for multifile classes.

(cherry picked from commit adb05ab076)
2021-02-17 21:56:36 +01:00
Mikhael Bogdanov
fcc1e7f54c Support Unit/V types in string-concat indy calls
unitComponent.kt test fails with JVM target 9+

(cherry picked from commit 134fda8bad)
2021-02-17 18:47:22 +01:00
Mikhael Bogdanov
2cbad94c09 Make indy-with-constants default for -jvm-target 9+
#KT-42522 Fixed

(cherry picked from commit e3e7e6b740)
2021-02-17 18:47:21 +01:00
Mikhael Bogdanov
46c11d1f85 Fail on compilation errors in AbstractBytecodeTextTest
(cherry picked from commit 3d8e8dd3ba)
2021-02-17 18:47:21 +01:00
Mikhael Bogdanov
786b405ed6 Support new targets in KotlinBytecodeToolWindow
#KT-30222 Fixed

(cherry picked from commit 61fce74b76)
2021-02-17 18:45:17 +01:00
Alexander Udalov
bb30ac2a04 Minor, add workaround for KT-45008
(cherry picked from commit 67e91b7ebd)
2021-02-17 16:40:04 +01:00
Dmitriy Novozhilov
94ecbbf8f7 [FE] Change message for sealed interfaces with language target < 1.5 2021-02-17 16:45:12 +03:00
Dmitriy Novozhilov
650e031aca [FE] Prohibit sealed fun interfaces 2021-02-17 16:45:11 +03:00
Alexander Udalov
031bc484ab Support structural equals/hashCode for type constructors of type parameters
Use the same logic as for type constructors of classes, based on the
fully-qualified name of the classifier, with special cases for error
types and local declarations, with an additional check that the type
constructors' declaration descriptors are structurally equal via
`DescriptorEquivalenceForOverrides`. The latter is required because type
parameters of overloaded functions must be different, even though their
full FQ name is the same.

This (hopefully) has no effect for the compiler, but is useful for
kotlin-reflect where `KType.equals` runs the type checker on the
underlying `KotlinType` instances, which eventually ends up comparing
type constructors. Descriptors and types in kotlin-reflect are cached on
soft references, so they may be suddenly garbage-collected and
recomputed, and we want copies of the same type parameter to be equal to
each other.

This fixes flaky codegen tests which started to fail after migration to
the new test infrastructure, where tests are now run in parallel in the
same process, thus with higher memory pressure and more soft references
being GC'd:

* `codegen/box/reflection/types/createType/typeParameter.kt`
* `codegen/box/reflection/supertypes/genericSubstitution.kt`

Also, add a new test to check that we do the instanceof check in
overrides of `AbstractTypeConstructor.isSameClassifier`.

 #KT-44850 Fixed

(cherry picked from commit 4d9cffccf2)
2021-02-17 14:41:58 +01:00
Alexander Udalov
db70ca4a69 Tests: compute runtime classpath for JVM box tests manually
Taking just the `jvmClasspathRoots` is not correct because it also
contains stuff needed for resolve to work correctly, such as JDK (full
or mock), stdlib (full or mock), reflect. JDK is obviously not needed in
the classpath, and stdlib/reflect are available via the parent class
loader, which is specifically reused across all tests to make them run
faster.

Also, don't try to create class loader for Java-only modules in
`JvmBoxRunner.processModule`. This happens, for example, for all tests
which were moved from `boxAgainstJava`.

(cherry picked from commit aaecb87d1b)
2021-02-17 14:41:57 +01:00
pyos
8b9867f2fb JVM: rename this$0 when regenerating nested objects too
In the old backend, this was unnecessary because nested objects would
reference their lambdas' captures through the original this$0. On
JVM_IR, using loose capture fields means a name/descriptor clash can
occur on any level of nesting, not just the top.

(cherry picked from commit 1310a65f0c)
2021-02-17 12:12:41 +01:00
Ilmir Usmanov
68d16d39dd Minor. Suppress errors in tests 2021-02-16 21:00:37 +01:00
Ilmir Usmanov
7ff2ad94d2 Raise RESERVED_VAR_PROPERTY_OF_VALUE_CLASS to error 2021-02-16 21:00:35 +01:00
Dmitry Petrov
252556d91a JVM_IR KT-44974 fix SAM-converted capturing extension lambda 2021-02-16 18:13:15 +03:00
Vladimir Dolzhenko
f47eac03b3 Fix NPE
#KTIJ-898 Fixed

Original commit: 12d8e88b846f29598ca3904b49996bd6a9891ccd

(cherry picked from commit 6352814d45)
2021-02-16 15:45:11 +01:00
Vladimir Dolzhenko
d667c2f8b9 Fixed NPE on StandaloneScriptRootsCache instantiation
Relates to ^EA-218043
#KTIJ-1137 Fixed

Original commit: 1d63a1b48d480b958ff44676c42b698a8ca5f64a

(cherry picked from commit 98ba379e07)
2021-02-16 15:43:59 +01:00
Victor Petukhov
9f4cd75e43 [all-open] Don't affect private declarations to change their modality to open 2021-02-16 17:01:15 +03:00
Victor Petukhov
20e82953d7 [all-open] Fix formatting 2021-02-16 17:01:15 +03:00
SokolovaMaria
d71d57a9e7 Copy typeParameters from original declaration to the exportedDefaultStubFun before substitution of type parameters 2021-02-16 00:20:33 +03:00
Dmitry Petrov
2b1148448e JVM_IR KT-44483 argument adaptation is already done in PSI2IR
(cherry picked from commit b1ab64e854)
2021-02-15 21:08:36 +03:00
Dmitry Petrov
f83860a135 JVM_IR KT-44627 fix bridge signature for parameter with primitive bound
(cherry picked from commit b262d09a81)
2021-02-15 19:26:04 +03:00
Alexander Udalov
7f991305e6 Remove kotlin-annotations-android
#KT-44815 Fixed

(cherry picked from commit 6e7a9441a6261d29e5cb59e43965ccbf00a6156b)
2021-02-15 17:23:10 +01:00
Alexander Udalov
c79ba4448c Remove tests on kotlin-annotations-android
#KT-44815

(cherry picked from commit e9985d86e6e48625743aedb93f5cd18cf3882eb8)
2021-02-15 17:23:07 +01:00
Alexander Udalov
c15c593136 Remove compiler support for kotlin-annotations-android
#KT-44815

(cherry picked from commit d4e2bca029648af116f59f79494631efc7c8cd1b)
2021-02-15 17:23:01 +01:00
Mikhail Glukhikh
020cd45050 FIR2IR: support adapted references for constructors
(cherry picked from commit fa0f967c83)
2021-02-15 19:18:56 +03:00
Mikhail Glukhikh
2da4a4ea6b FIR2IR: use information about callable reference adaptation from resolve
(cherry picked from commit 8bab208322)
2021-02-15 19:18:48 +03:00
Victor Petukhov
6d2be950a3 Fix FIR test lambdaParameterTypeInElvis
(cherry picked from commit fa1507fb91)
2021-02-15 18:52:53 +03:00
Andrei Klunnyi
dad762eb61 KT-44839 [Sealed interfaces]: restore move-tests for lang-version < 15
This commit restores tests removed in 690fb47c.
2021-02-15 16:31:46 +01:00
Andrei Klunnyi
09b239f4b9 KT-44839 [Sealed interfaces]: ability to specify compiler options in tests 2021-02-15 16:31:46 +01:00
Andrei Klunnyi
9c6238ff03 KT-44839 [Sealed interfaces]: move refactoring for language level < 1.5
This commit restores sealed-check-logic for language level < 1.5
mistakenly removed in 690fb47c.

^KT-44839 fixed
2021-02-15 16:31:45 +01:00
Dmitriy Novozhilov
aaf6494faa [FIR] Ignore failing FIR tests related to sealed classes 2021-02-15 17:21:01 +03:00
Dmitriy Novozhilov
bc23b04d16 [FE] Allow declaring protected constructors in sealed classes
#KT-44865 Fixed
2021-02-15 17:21:01 +03:00
Dmitriy Novozhilov
a843800b2a [FE] Make constructors of sealed classes protected instead of internal 2021-02-15 17:21:01 +03:00
Victor Petukhov
62ef7f65dd Don't fix type variables into Nothing in priority way
^KT-44546 Fixed
2021-02-15 15:09:30 +03:00
Victor Petukhov
87f5cedf7f Fix FIR test lambdaParameterTypeInElvis 2021-02-15 12:56:38 +03:00
Yaroslav Chernyshev
95c2762432 [Cocoapods] Fail import if project's version wasn't specified
#Fixed KT-44000
2021-02-15 12:41:17 +03:00
Vladimir Dolzhenko
315190cc1b Lightweight hashCode calc for LibraryInfo
#EA-6040509 Fixed
#KTIJ-696 Fixed

(cherry picked from commit bf9fa4c9da)
2021-02-15 10:39:53 +01:00
Victor Petukhov
355ae07667 Reformat TypeWithEnhancement.kt 2021-02-15 12:15:08 +03:00
Victor Petukhov
13a97b56c1 Add reporting of the warnings based on Java annotations for expanded type aliases
Before that, such warnings weren't reported as the corresponding errors were reported during type inference (only original types took part there)
2021-02-15 12:15:05 +03:00
Victor Petukhov
7857230aa5 Use upper bound checker for typealias expansion 2021-02-15 12:15:03 +03:00
Victor Petukhov
f939fdc154 Add test for errors reporting of UPPER_BOUND_VIOLATED 2021-02-15 12:15:00 +03:00
Victor Petukhov
53bc498da4 Report warnings or errors for violated type parameter's upper bounds from Java annotated with nullability annotations
^KT-43262 Fixed
2021-02-15 12:14:56 +03:00
Victor Petukhov
0d50b13a2c Propagate inference session into declaration analyzers
It prevents missing inference session for local declaration (local functions, local classes or objects)

^KT-44801 Fixed
2021-02-15 11:14:06 +03:00
Victor Petukhov
9f69fe86a0 Remove redundant extension receiver substitution during lambda's completion 2021-02-15 11:14:05 +03:00
Victor Petukhov
918c5e7d4f Clear request cache properly during disposing component 2021-02-15 11:14:04 +03:00
Dmitry Petrov
2375817c1d Minor: regenerate tests after cherry-pick 2021-02-12 20:34:26 +03:00
Dmitry Petrov
e4130cd12f JVM don't use indy by default for SAM conversions (wait for KT-44844)
KT-44278 KT-26060 KT-42621

(cherry picked from commit 6ba57abb8f)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
4d66d2ab98 JVM_IR nullability assertions test for indy lambdas
KT-44278 KT-26060 KT-42621

(cherry picked from commit 5013344bc4)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
6c514ac028 JVM_IR indy: minor: use toLowerCaseAsciiOnly for options
KT-44278 KT-26060 KT-42621

(cherry picked from commit 4ab242ed51)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
99a3979b27 JVM_IR indy: fix non-null assertions on indy lambda parameters
KT-44278 KT-26060 KT-42621

(cherry picked from commit afeb7e18cd)
2021-02-12 20:34:25 +03:00
Dmitry Petrov
19c742a0c2 JVM_IR indy: extract LambdaMetafactoryArguments code to separate file
KT-44278 KT-26060 KT-42621

(cherry picked from commit 43b1711010)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
c9258f5c40 JVM_IR indy: use 'CLASS' mode in SAM bytecode listing tests
KT-44278 KT-26060 KT-42621

(cherry picked from commit 3438d19c22)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
0ac096c108 JVM SamWrapperClassesAreSynthetic language feature
KT-44278 KT-26060 KT-42621

(cherry picked from commit 7564c9bb8c)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
544285aaea JVM_IR indy SAM conversions: update tests
KT-44278 KT-26060 KT-42621

(cherry picked from commit 052f6929c9)
2021-02-12 20:34:24 +03:00
Dmitry Petrov
ccb8385b36 JVM_IR: use indy SAM conversions in jvmTarget 1.8+, fix bridges
KT-44278 KT-26060 KT-42621

(cherry picked from commit 3ebeca5852)
2021-02-12 20:34:23 +03:00
Dmitry Petrov
05423910d2 Minor: LAMBDAS directive in old back-end tests
(cherry picked from commit 2535e5d5c9)
2021-02-12 20:34:23 +03:00
Dmitry Petrov
49a0bee762 JVM_IR indy-lambdas: minor updates and fixes
KT-44278 KT-26060 KT-42621

(cherry picked from commit ab20a8ffff)
2021-02-12 20:34:23 +03:00
Dmitry Petrov
06cf09f91d JVM_IR indy-lambdas: don't use indy for big arity lambdas
KT-44278 KT-26060 KT-42621

(cherry picked from commit 088448043a)
2021-02-12 20:34:22 +03:00
Dmitry Petrov
cdf2f853aa JVM_IR indy-lambdas: initial implementation and tests
KT-44278 KT-26060 KT-42621

(cherry picked from commit d94912ed62)
2021-02-12 20:34:22 +03:00
Sergey Igushkin
99f2194af6 Fix extracted metadata for IDE erased when scopes conflict, KT-44845
The root cause was that extractors for different scopes used the same
base directory, and each erased its contents. Using different base dirs
fixes the issue.

Issue #KT-44845

(cherry picked from commit a719656118)
2021-02-12 19:00:07 +03:00
Mikhael Bogdanov
609e355d55 Generate proper hashCode for fun interface wrappers
#KT-44875 Fixed

(cherry picked from commit e795c2c407)
2021-02-12 11:38:26 +01:00
Dmitriy Novozhilov
e7f5df1423 fixup! [Test] Make some functions of environment configurators public 2021-02-11 16:29:41 +03:00
Dmitriy Novozhilov
ed5f40ab83 [Test] Move extracting JVM_TARGET to provideConfigurationKeys 2021-02-11 16:23:45 +03:00
Dmitriy Novozhilov
7de2eeaad5 [Test] Replace remaining KOTLIN_CONFIGURATION_FLAGS directives with specific ones 2021-02-11 16:23:42 +03:00
Dmitriy Novozhilov
6517f1d389 Parse compiler configuration for android tests using new test infrastructure 2021-02-11 16:23:02 +03:00
Dmitriy Novozhilov
b5d24f38bc Add analysisFlags of LanguageVersionSettings to toString() method 2021-02-11 16:23:02 +03:00
Dmitriy Novozhilov
662f209862 [Test] Make some functions of environment configurators public
This is needed for using those methods from android tests
2021-02-11 16:23:02 +03:00
Dmitriy Novozhilov
daea75908b [Test] Cleanup JvmEnvironmentConfigurator 2021-02-11 16:23:01 +03:00
Dmitriy Novozhilov
3a9e75b162 [Test] Don't pass MockProject to environment configurators 2021-02-11 16:23:01 +03:00
Alexander Udalov
fe27514e62 Move around some codegen box tests
In tests merged from boxAgainstJava in 29b96aa1, some directories were
named slightly differently compared to box, e.g. "property" vs
"properties", "varargs" vs "vararg". This change renames these, moves
some of the tests to more fitting directories, and also renames
"visibility" to "javaVisibility" because it's about Java visibilities
specifically.

(cherry picked from commit 510b9e6f2a)
2021-02-11 14:18:01 +01:00
Alexander Udalov
1000eaedba Remove codegen tests on old language and API versions
(cherry picked from commit 2d60fa787d)
2021-02-11 14:16:50 +01:00
Alexander Udalov
2a773e1f8a Use TARGET_BACKEND instead of DONT_TARGET_EXACT_BACKEND in box against Java tests
"// TARGET_BACKEND: JVM" more clearly says that the test is
JVM-specific, rather than DONT_TARGET_EXACT_BACKEND which excludes all
other backends.

(cherry picked from commit 401f0ac583)
2021-02-11 14:16:46 +01:00
Mikhail Glukhikh
a7c4d13619 Skip JDK 6 in failing BB test (java.util.function in use)
(cherry picked from commit 57e06992c9)
2021-02-11 15:01:05 +03:00
Mikhail Glukhikh
bf045e3a04 FIR2IR: fix raw SAM conversion (avoid * in type arguments)
(cherry picked from commit cd483ad231)
2021-02-11 15:00:41 +03:00
Mikhail Glukhikh
a560f431b4 FIR2IR: expand type before getting nullability #KT-44803 Fixed
(cherry picked from commit 5f3102bf2f)
2021-02-11 14:58:06 +03:00
Mikhail Glukhikh
cbb06a0856 FIR2IR: enhance approximation of captured types
(cherry picked from commit 4bc630d82c)
2021-02-11 14:58:00 +03:00
Mikhail Glukhikh
bf32cdc1f2 FIR2IR: support substitution for SAM types
(cherry picked from commit 346ffb3acf)
2021-02-11 14:57:54 +03:00
Mikhail Glukhikh
745043c466 FIR2IR: use invariant projections for SAM_CONVERSION types
(cherry picked from commit 7050af9b79)
2021-02-11 14:57:48 +03:00
Dmitry Gridin
edecafd887 [i18n] copy-paste message from RefactoringBundle to fix missing resource in 202
^KT-44675 Fixed

(cherry picked from commit b9c33a0c6e)
2021-02-11 18:34:08 +07:00
Alexander Udalov
b27dd8e3fe Apply illegal-access=permit workaround for JDK 16+
Apparently, the openjdk commit that enabled JEP 396 (encapsulated JDK
defaults) is effective since jdk-16+28:

https://github.com/openjdk/jdk/commit/ed4c4ee7

(cherry picked from commit 80daf120e6)
2021-02-11 12:13:21 +01:00
Dmitriy Novozhilov
ccffa1a8bf [FE] Don't analyze members with CLASSIFIERS kind filter in AbstractLazyMemberScope
This commit introduces partial support of descriptorKindFilter in
  `AbstractPsiBasedDeclarationProvider`. Without it there may be an error
  in following case:

```
sealed class Base
class Derived : Base()

class Test<out V>(val x: Base) {
    private val y = when (x) {
        is Derived -> null
    }
}
```

Here we start to resolve type of `y`, then go to computation of inheritors
  of sealed class Base, which also may be inside Test, so we need get all
  nested classifiers in Test. But without this filtration we will start
  computing descriptor for `y` again, which leads to ReenteringLazyComputationException

#KT-44316 Fixed
2021-02-11 13:27:41 +03:00
Victor Petukhov
72409bfef9 Substitute captured types with inner intersection one (NewTypeSubstitutor)
^KT-44651 Fixed
2021-02-11 12:40:44 +03:00
Roman Artemev
d35f31de68 [Plugin API] Fix missed call in resolveBySignatureInModule 2021-02-11 11:56:29 +03:00
Ilya Gorbunov
1a5c5bc2f5 Remove kotlin-test-multiplatform special dependency handling
#KT-40225

(cherry picked from commit af8061a4dd)
2021-02-10 22:02:23 +03:00
Ilya Gorbunov
a4f188615b Remove obsolete diagnostics suppression
The diagnostic NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS is now
obsolete because internal constructors of inline classes became allowed.

(cherry picked from commit 87e130e77a)
2021-02-10 22:02:20 +03:00
Yaroslav Chernyshev
155c814a4a Mark obsolete Gradle JVM options as Deprecated with Error
Options `includeRuntime`, `noStdlib` and `noReflect` were affected
#Fixed KT-44361

(cherry picked from commit 17fc10a8af)
2021-02-10 21:23:20 +03:00
Pavel Kirpichenkov
796d7274e6 Split combined test into two to avoid flaky behaviour
Prevent simultaneous access to the library directory
2021-02-10 15:19:48 +03:00
Yahor Berdnikau
c163bdded3 Fix KaptWithoutKotlincTask task tries to get wrong properties. 2021-02-10 12:23:59 +01:00
Alexander Udalov
b857f46533 CLI: include META-INF/services/ from kotlin-reflect with -include-runtime
This is an addition to bd205317aa where we
started to add the contents of kotlin-reflect into the resulting jar if
-include-runtime is specified. Apparently kotlin-reflect doesn't work
without some services in META-INF/services/, which didn't satisfy the
condition for inclusion. The existing test didn't catch that because
loading class annotations does not always lead to those services being
loaded.

(cherry picked from commit e6588ee8a4)
2021-02-10 12:06:34 +01:00
Andrei Klunnyi
5e91b4eaab Compilation fix for KT-44487 2021-02-10 11:41:32 +01:00
Dmitry Petrov
162356f99b JVM_IR KT-44798 don't generate multiple stubs with same signature
(cherry picked from commit d0f26abd18)
2021-02-10 11:53:52 +03:00
Ilya Chernikov
f40e815e28 Implement forced script configuration reloading API for plugins
#KT-43288 fixed
2021-02-10 08:29:31 +01:00
Ilya Chernikov
4f38e08c39 Pass provided script configuration to refining code
when script compilation configuration refinement
happening during parsing, the updated configuration
passed to the script compiler/REPL compile function
is now used.
#KT-44580 fixed

(cherry picked from commit ef4fa3381d)
2021-02-10 08:29:13 +01:00
Ilya Chernikov
2ef1d9c542 [minor] fix warnings in the script compiler and tests 2021-02-10 08:29:06 +01:00
Vladimir Dolzhenko
ecf0c6ce15 Make checker tests independent of plugin version
Relates to #KT-37702 #KTI-433
2021-02-09 22:07:48 +01:00
Roman Artemev
25432bd33a [Plugin API] Add API to load top level declaration by its signature
- request from JP Compose, #KT-44100

(cherry picked from commit d97a2b13c0)
2021-02-09 19:49:24 +03:00
Roman Artemev
f13342a362 [IR] Fix IrType equality in case of complex variance
- reimplement type capturing on top of pure IrCaptureType
 - add captured type substitutor
 - fix #KT-43831

(cherry picked from commit 79f986bb75)
2021-02-09 19:49:24 +03:00
Roman Artemev
3762321406 [IR] Add IrCapturedType into IR type system
- support it in TypeSystemContext

(cherry picked from commit 4ed93d3dee)
2021-02-09 19:49:24 +03:00
Andrei Klunnyi
521c23cc02 KT-44487 [Sealed Interfaces]: sealed-inheritors-provider for MPP
(cherry picked from commit e3c1aa599d)
2021-02-09 13:59:08 +01:00
Svyatoslav Scherbina
787124cb06 Update Kotlin/Native: 1.5-M1-eap-19 2021-02-09 15:46:17 +03:00
Ilmir Usmanov
0f75a4edc3 Minor. Ignore test on WASM 2021-02-09 12:31:52 +01:00
Ilmir Usmanov
74ae3219f3 JVM_IR. Do not mangle callable reference constructor call
#KT-44703 Fixed
2021-02-09 12:31:49 +01:00
Ilya Goncharov
b65accec4e [JS IR] Add test with chain export--not-export--export
^KT-44616 fixed

(cherry picked from commit 19bffc694b)
2021-02-08 14:24:32 +03:00
Ilya Goncharov
81de9f851f [JS IR] Method of any is exported
^KT-44616 fixed

(cherry picked from commit 76b124a9c0)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
66bb5cdc6e [JS IR] Add exported method into exportNestedClass.kt
^KT-44616 fixed

(cherry picked from commit 7b4624aac4)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
110f278d5e [JS IR] Override method are not exported
[JS IR] Add test with jsexport overrides not js export method with stable name

^KT-44616 fixed

(cherry picked from commit 6c051b2be4)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
832d21fbdd [JS IR] Add test with fun interface call inside lambda
^KT-44433 fixed

(cherry picked from commit de3678a805)
2021-02-08 14:24:31 +03:00
Ilya Goncharov
30d9fafbc4 [JS IR] Use local scope for SAM if there are scopes
[JS IR] Use private for top level sam wrappers and local otherwise

^KT-44433 fixed

(cherry picked from commit d6e74b9620)
2021-02-08 13:57:04 +03:00
Victor Petukhov
ed20e2851c Report error about uninferred type parameter for all CallForImplicitInvoke psi calls
^KT-44368 Fixed
2021-02-08 10:41:53 +03:00
Yan Zhulanow
974654ec34 Remove unneeded artifacts for Kotlin IDE plugin
(cherry picked from commit 0d1f493b6c)
2021-02-05 16:04:06 +09:00
Ilmir Usmanov
ba786f5a46 JVM_IR. Do not unbox Result in inline lambda
Since JVM_IR generates inline lambdas differently from old backend,
in this case, it generates them as normal functions.
Thus, there is no need to unbox the lambda argument.
 #KT-44671 Fixed
2021-02-04 20:23:53 +01:00
Alexander Udalov
48592ec112 Do not create Array instance in kotlin-reflect where not necessary
Although the previous code of computing JVM internal name from a Class
instance was shorter, it led to unnecessary creation of array types,
which is less performant and makes configuration of kotlin-reflect for
GraalVM native-image more verbose.

Unfortunately I didn't succeed in writing a test for this, since
`Array.newInstance` calls a native method which doesn't record any trace
of it being called in the class loader: the resulting array type never
goes through findClass/loadClass, and is not visible via
findLoadedClass.

 #KT-44594 Fixed

(cherry picked from commit fb296b5b95)
2021-02-04 19:15:21 +01:00
Dmitriy Novozhilov
665a25f637 [Test] Print bytecode if DxCheckerHandler had failed 2021-02-04 11:15:11 +03:00
Dmitriy Novozhilov
c111f90251 [Test] Ignore multimodule tests in AbstractLightAnalysisModeTest 2021-02-04 11:15:11 +03:00
Dmitriy Novozhilov
da4bc74da3 [Test] Properly merge box against java testdata into codegen/box
Previous commit about it was 3199ce03 and it was completely wrong
2021-02-04 11:15:10 +03:00
Dmitriy Novozhilov
935f3b7659 [Test] Support different backends enumeration in DONT_TARGET_EXACT_BACKEND directive 2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
dcba27c3a8 [TD] Fix directive order in codegen testdata
(cherry picked from commit 4bf6e58f2b)
2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
1a68073292 [Test] Support new configuration directives in old codegen tests
(cherry picked from commit 571c4ce398)
2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
df0c050e4b [Test] Exclude multimodule tests from codegen tests on android
(cherry picked from commit 0ebb39a26e)
2021-02-04 11:07:49 +03:00
Dmitriy Novozhilov
4a0cb0aa5c [Test] Support skip of android codegen tests with new ASSERTION_MODE directive
(cherry picked from commit 17d59e0daa)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
1c1d41c864 [Test] Use javac for compilation test java files from runtime by default
(cherry picked from commit 81ba7aa833)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
3004b39304 [Build] Extract configuration of JUnit5 dependencies to common helper in buildSrc
(cherry picked from commit c432efc364)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
e77ad7f44f [Test] Add ability to stop test pipeline if there was an exception in handler
(cherry picked from commit dea3c954f1)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
06334aac59 [Test] Move fir backend tests back to :compiler:fir2ir module
(cherry picked from commit 2ae35b0b08)
2021-02-04 11:07:48 +03:00
Dmitriy Novozhilov
734495e9bf [Test] Don't generate extends clause for nested classes in generated tests for JUnit5
This is fine since all nested classes in tests are inners by JUnit5
  specification, so they will see `runTest` method from outer root class

(cherry picked from commit e79d02f482)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
98e23f4955 [Test] Migrate :tests-different-jdk on runners which are using JUnit5
(cherry picked from commit a4e9ab90a0)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
d9e2827e4c [Test] Set static field with application to null after tests are completed
(cherry picked from commit c969a34644)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
979bb3f67a [Test] Don't use PSI based class reading in codegen BB tests
#KT-34826 is rela ted

(cherry picked from commit 53e5aa4364)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
e7667b5397 [Test] Support various jdk targets in test infrastructure
(cherry picked from commit 09ec3f6eaf)
2021-02-04 11:07:47 +03:00
Dmitriy Novozhilov
3fafb2e9df [Test] Read default target version from sys property in new test infra
(cherry picked from commit 93741ced5c)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
22688b804f [Test] Support invoking box method in BB tests in separate process
(cherry picked from commit a3ad626f99)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
ba02081ebb [Test] Regenerate spec tests
(cherry picked from commit b351ca6bd4)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
ecf9fd0b8b [Test] Merge box against java testdata into codegen black box testsdata
(cherry picked from commit 3199ce03a6)
2021-02-04 11:07:46 +03:00
Dmitriy Novozhilov
98a31448c5 [TD] Ignore JS backends in boxAgainstJava tests
(cherry picked from commit e62b118351)
2021-02-04 11:07:45 +03:00
Dmitriy Novozhilov
465909f8c0 [Test] Merge box against java tests into codegen black box tests
(cherry picked from commit 99cb85ab00)
2021-02-04 11:07:43 +03:00
Dmitriy Novozhilov
232c260c9a [Test] Migrate AbstractIrCompileKotlinAgainstKotlinTest to new infrastructure
(cherry picked from commit 6f3713af5f)
2021-02-04 11:05:40 +03:00
Dmitriy Novozhilov
ebd8a9ea82 [Test] Enable SMAP dump handler in boxInline tests
(cherry picked from commit 49c2bfe637)
2021-02-04 11:05:40 +03:00
Dmitriy Novozhilov
69097dd444 [TD] Update testdata according to previous commit
(cherry picked from commit 64a300bfcd)
2021-02-04 11:05:40 +03:00
Dmitriy Novozhilov
1c5e61fb32 [Test] Migrate all jvm tests runners for boxInline tests
(cherry picked from commit 3a0eee64b8)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
f675081405 [TD] Update fir directives in boxInline tests
(cherry picked from commit 8973e3f362)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
0a3839c109 [Test] Implement SMAP dump handler
(cherry picked from commit 92e21e76ba)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
32f2d4939a [Test] Align lines in TestFile with lines in real testdata file
(cherry picked from commit e3ab3d6be3)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
620e823cc1 [Test] Introduce two module structure transformers for codegen test
(cherry picked from commit 60e0831c11)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
de7aade158 [Test] Add ability to freely transform module structure which was parsed from directive
Service ModuleStructureExtractor may break readabilty of test so it
  should be used very carefully

Originally it is created for box inline test where we have different
  runners on same testdata where one runner assumes that all files
  in test in same module and other that they in different ones

(cherry picked from commit 13a778fd9c)
2021-02-04 11:05:39 +03:00
Dmitriy Novozhilov
f7abb0b5c2 [Test] Support USE_OLD_INLINE_CLASSES_MANGLING_SCHEME directive
(cherry picked from commit fc83dc17fe)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
4efa634f37 [Test] Make BytecodeInliningHandler for new infrastructure
(cherry picked from commit 3f758a3fa2)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
db9bf8428d [TD] Fix friend modules
(cherry picked from commit 0768a7089c)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
2b297ccd7a [TD] Update directives in kotlinAgainstKotlin testdata
(cherry picked from commit 5075484c8e)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
8c18d88e61 [Test] Improve error reporting if there are too many values passed to directive
(cherry picked from commit 9ba41c5b88)
2021-02-04 11:05:38 +03:00
Dmitriy Novozhilov
ecfc1493d0 [Test] Move KotlinAgainstKotlin tests under BlackBoxCodegen tests
(cherry picked from commit 5c8d555808)
2021-02-04 11:05:37 +03:00
Dmitriy Novozhilov
64ccd3213c [Test] Support skip of android codegen tests with new ASSERTION_MODE directive
(cherry picked from commit f255f93ad9)
2021-02-04 11:05:37 +03:00
Alexander Udalov
4f0fc39c45 Do not generate $suspendImpl for JvmDefault functions in interfaces
#KT-44533 Fixed

(cherry picked from commit acd8c4503b)
2021-02-03 21:46:01 +01:00
Ilmir Usmanov
84076a11da JVM_IR: Box generic Result parameter in suspend lambda
#KT-44527 Fixed
2021-02-03 20:37:26 +01:00
Ilmir Usmanov
b73321b580 Minor. Throw exceptions in test coroutine builders 2021-02-03 20:37:24 +01:00
Dmitriy Dolovov
d8aafc0243 [Commonizer] Dump every module to disk immediately when it's ready
No need to retain all metadata modules in memory -> lesser memory consumption.
2021-02-03 20:43:56 +03:00
Ivan Gavrilovic
7b83677da5 Locate build history when file is outside of root project dir
Support use-cases when the build dir is outside of root project dir.
Many projects set up output dir as <root_project>/../out/<project_name>/build
to be able to clean build dir more easily. This commit adds support
to build history file detection and it tries to find build history
files for artifacts that are:
- under root project dir (a default structure)
- under root project's build dir parent (to support typical custom setup)

Fixes https://youtrack.jetbrains.com/issue/KT-40875

Test: BaseIncrementalCompilationMultiProjectIT
(cherry picked from commit 2fce6a4af9)
2021-02-03 15:22:27 +03:00
Alexander Udalov
449f9b1dfa Add -Xsuppress-deprecated-jvm-target-warning to modules compiled with 1.6
Currently this leads to an unknown argument warning, but it'll be
removed automatically on the next bootstrap.

(cherry picked from commit e0b6d4d917)
2021-02-03 12:54:10 +01:00
Alexander Udalov
632cfa7312 Deprecate JVM target 1.6
#KT-44650 Fixed

(cherry picked from commit 99b5e5a373)
2021-02-03 12:53:58 +01:00
Andrei Klunnyi
e407f4cff3 KT-44079 [Sealed Interfaces]: move refactoring update
The idea behind this commit is that Move Refactoring should warn
developers in case their intention potentially breaks sealed
hierarchies (members must share the same module and package).

Provided algorithm has two goals:
- prevent destruction of correct hierarchies
- help in fixing broken ones

^KT-44079 fixed
2021-02-03 12:04:58 +01:00
Dmitriy Dolovov
9e00b483bb [Commonizer] Force GC after each serialized target 2021-02-03 10:57:31 +03:00
Dmitriy Dolovov
347fd1e3c1 [Commonizer] Minor. Post-review changes, p.2 2021-02-03 10:57:30 +03:00
Dmitriy Dolovov
08dde21f02 [Commonizer] Minor. Post-review changes 2021-02-03 10:57:30 +03:00
Dmitriy Dolovov
e62eacce71 [Commonizer] Add tests for CommonizerTarget 2021-02-03 10:57:29 +03:00
Dmitriy Dolovov
900b15468b [Commonizer] Use kotlin/Any as the default supertype for commonized class 2021-02-03 10:57:28 +03:00
Dmitriy Dolovov
2734829513 [Commonizer] Dump every target to disk immediately when it's ready 2021-02-03 10:57:27 +03:00
Dmitriy Dolovov
5a43e1dcd3 [Commonizer] Ignore acceptable (minor) metadata mismatches in tests 2021-02-03 10:57:26 +03:00
Dmitriy Dolovov
f5553eef3e [Commonizer] Fix calculation of type parameter IDs for nested classes and their members 2021-02-03 10:57:26 +03:00
Dmitriy Dolovov
630f86d264 [Commonizer] Ignore constructors for enum entries 2021-02-03 10:57:25 +03:00
Dmitriy Dolovov
575ccab8b8 [Commonizer] Don't serialize kotlin/Any? as the single type parameter upper bound 2021-02-03 10:57:24 +03:00
Dmitriy Dolovov
c4c631f6e5 [Commonizer] Don't write IS_EXPECT flag for synthesized expect functions 2021-02-03 10:57:23 +03:00
Dmitriy Dolovov
a852608363 [Commonizer] Fix HAS_ANNOTATIONS flag calculation for serialized classes 2021-02-03 10:57:23 +03:00
Dmitriy Dolovov
49e96b11f8 [Commonizer] Minor. Improved diagnostics message in tests 2021-02-03 10:57:22 +03:00
Dmitriy Dolovov
1acdadf15e [Commonizer] Fix property backing/delegate field annotations serialization 2021-02-03 10:57:21 +03:00
Dmitriy Dolovov
5217bd1797 [Commonizer] Don't commonize built-ins 2021-02-03 10:57:20 +03:00
Dmitriy Dolovov
8feea385d5 [Commonizer] Drop descriptors for commonized declarations 2021-02-03 10:57:19 +03:00
Dmitriy Dolovov
5303713153 [Commonizer] Rework test infrastructure to compare metadata instead of descriptors 2021-02-03 10:57:19 +03:00
Dmitriy Dolovov
f0ec8c6e65 [Commonizer] Pretty target name output in console 2021-02-03 10:57:18 +03:00
Dmitriy Dolovov
e6412d6d75 [Commonizer] Fix approximation for aliases types 2021-02-03 10:57:17 +03:00
Dmitriy Dolovov
549f6f05f2 [Commonizer] Log stats during building metadata 2021-02-03 10:57:16 +03:00
Dmitriy Dolovov
72e0444d7c [Commonizer] Integrate metadata builder with the commonizer environment 2021-02-03 10:57:15 +03:00
Dmitriy Dolovov
daba02833c [Commonizer] Introduce metadata builder 2021-02-03 10:57:15 +03:00
Dmitriy Dolovov
4b4691518a Metadata: Chunked KlibModuleFragmentWriteStrategy implementation 2021-02-03 10:57:14 +03:00
Dmitriy Dolovov
7bf8949a24 [Commonizer] Introduce MetadataDeclarationsComparator for metadata-based comparison of KLIBs 2021-02-03 10:57:13 +03:00
Dmitriy Dolovov
12c766bf29 [Commonizer] Embed :kotlinx-metadata-klib into the commonizer Jar 2021-02-03 10:57:12 +03:00
Dmitriy Dolovov
b53320c587 [Commonizer] Restore lost nullability for underlying types in TAs 2021-02-03 10:57:12 +03:00
Dmitriy Dolovov
a8dd865f78 [Commonizer] Avoid leaking non-commonized underlying types in TAs 2021-02-03 10:57:11 +03:00
scaventz
d1c4ccd0b9 CLI: improve behavior of -include-runtime
1.fix KT-17344: Include kotlin-reflect to resulting jar if "-include-runtime" is specified, unless the -no-reflect option is specified.
2.fix KT-43220: -include-runtime should add .kotlin_builtins to the output

(cherry picked from commit bd205317aa)
2021-02-02 21:50:51 +01:00
Mads Ager
df5cf5ccb1 [JVM_IR] Fix accessibility bridges for static protected fields.
Super-qualifiers have to be taken into account. Otherwise, too
few accessibility bridges will be generated which can lead to
binary compatibility issues.

(cherry picked from commit 6a959fefd0)
2021-02-02 21:46:26 +01:00
Mikhael Bogdanov
e936bc466a Fix compilation against asm 7.0
(cherry picked from commit 206b38f0ab)
2021-02-02 18:51:52 +01:00
pyos
067cc9cba8 JVM_IR: give loops somewhat more debuggable labels
(cherry picked from commit bd3bc13e75)
2021-02-02 18:24:22 +01:00
pyos
fe4ab2c61e JVM: optimize temporary kotlin.jvm.internal.Refs as well
i.e. remove the condition that there must be an LVT entry. Such
temporary `Ref`s can be created, for example, by the JVM_IR backend
if a lambda inlined at an IR level (e.g. argument to `assert`/`Array`)
is the target of a non-local return from a function inlined at bytecode
level (e.g. `run`):

    IntArray(n) { i ->
        intOrNull?.let { return@IntArray it }
        someInt
    }

->

    val `tmp$0` = IntArray(n)
    for (i in 0 until `tmp$0`.size) {
        var `tmp$1`: Int
        do {
            intOrNull?.let {
                `tmp$1` = it // causes `tmp$1` to become an IntRef
                break
            }
            `tmp$1` = someInt
        } while (false)
        `tmp$0`[i] = `tmp$1`
    }

(cherry picked from commit ad53fc931e)
2021-02-02 18:24:22 +01:00
pyos
ab75917fbc JVM_IR: support non-local break/continue in the inliner
Not in the frontend or psi2ir, though, so this not a complete
implementation of KT-1436, but rather a part of it that is currently
useful to make other code compile. In particular, lambdas passed to
array constructors and JVM-style `assert` are inlined as IR returnable
blocks, which are then converted into `do { ... } while (false)` loops,
so non-local returns from them become non-local `break`s.

(cherry picked from commit 0f2ca5d84c)
2021-02-02 18:24:21 +01:00
Mikhael Bogdanov
32561fe41a Support proper frame maps for enumValues
(cherry picked from commit c13f38f6df)
2021-02-02 17:46:08 +01:00
Mikhael Bogdanov
f4b8261573 Support proper frame maps for enum valueOf
(cherry picked from commit 1a044e5af4)
2021-02-02 17:46:08 +01:00
Mikhael Bogdanov
9c7a5d61f9 JVM_IR. Generate additional checkcast for when/try epressions to avoid frame map problems on reification
(cherry picked from commit 5b64ceceb3)
2021-02-02 17:46:07 +01:00
Mikhael Bogdanov
0dc4f185e5 Don't remove checkcast for reified values
#KT-35511 Fixed

(cherry picked from commit 16928d6e3f)
2021-02-02 17:46:07 +01:00
Vladimir Dolzhenko
ac1d975fd3 Kotlin highlight passes are reworked
#KT-37702 Fixed

(cherry picked from commit 913c298be8)
2021-02-02 17:31:05 +01:00
Vladimir Dolzhenko
a6f8f60447 Lazy diagnostics API in frontend
Relates to #KT-37702

(cherry picked from commit 558338f997)
2021-02-02 17:31:05 +01:00
Zalim Bashorov
44301bd2d8 [JS] Replace usages of FileUtil.loadTextAndClose with functions from stdlib to avoid crashes on files larger than 10MiB
(cherry picked from commit 3f10914f05)
2021-02-02 18:48:37 +03:00
Anton Bannykh
cf3f984e75 JS DCE: use Multimaps to reduce Node fields RAM
(cherry picked from commit 165533fdb7)
2021-02-02 18:45:29 +03:00
Anton Bannykh
8036a257ce JS DCE: disable logging by default
Based on Vladislav Saifulin's PR #4031

(cherry picked from commit f42f2fa743)
2021-02-02 18:45:29 +03:00
Anton Bannykh
ad6ed3a10e JS DCE: inline Qualifier class to reduce RAM usage
(cherry picked from commit 26ce6b5131)
2021-02-02 18:45:29 +03:00
Anton Bannykh
5076734d3a JS DCE: use less LinkedHashSets
(cherry picked from commit bbc6d2b993)
2021-02-02 18:45:28 +03:00
Anton Bannykh
9036164902 JS DCE: create collections on demand
Based on Vladislav Saifulin's PR #4031

(cherry picked from commit 3c0b226344)
2021-02-02 18:45:28 +03:00
Steven Schäfer
e759649b56 JVM IR: Fix inline class mangling for calls to internal functions
...in a different module, e.g., using -Xfriend-paths.
2021-02-01 21:56:12 +01:00
Ilya Gorbunov
6abfbcaa0a Infer required kotlin-test jvm capability based on used test framework
Except when:
- the Gradle version is less than 6.0, it doesn't read the metadata
published by a newer Gradle by default.
- the requested dependency version is less than 1.5, because it doesn't
have metadata published.

Update integration tests to use kotlin-test common dependency.

KT-40225

(cherry picked from commit 4a17228621)
2021-02-01 23:23:20 +03:00
Ilya Gorbunov
cc31c7167e Disable metadata publishing for legacy common artifacts
When they are used explicitly in common source sets, they cannot be
resolved in platform ones after that since they only have
common kotlin-api variants in their metadata.

KT-40225

(cherry picked from commit cbeadba15d)
2021-02-01 23:23:18 +03:00
Ilya Gorbunov
a5a8c30089 Apply common configuration to custom publications in kotlin-test
To do that, extract parts of publishing setup into reusable functions.
This change makes signing and repository configuration applied to all
project publications, not just to the Main one.

Also:
- Get rid of dependencies from non-default variants in the root pom
- Add an empty javadoc jar

KT-40225

(cherry picked from commit 573aac7252)
2021-02-01 23:23:17 +03:00
Ilya Gorbunov
8a10ee4e8b Setup publications with MPP Gradle metadata for kotlin-test library
Move publication configuration from individual platform specific
kotlin-test- modules to the root module.

KT-40225

(cherry picked from commit a16aaa3824)
2021-02-01 23:23:15 +03:00
Ivan Gavrilovic
27e7a2fbee KT-43686: Make kapt Gradle task cacheable across machines
Use `@Classpath` for kotlin stdlib input property. This is to
allow cache hits when builds are running on different machines
and path to kotlin stdlib differs.

Test: BuildCacheRelocationIT
(cherry picked from commit 509ed64917)
2021-02-01 22:48:19 +03:00
Alexander Udalov
0d49acc1e6 Mute/unmute FIR box tests on functions with big arity 2021-02-01 18:27:44 +01:00
Dmitry Petrov
ca164bb8ad JVM_IR fix special bridge generation for inline classes
(cherry picked from commit 4ec369ac5b)
2021-02-01 18:00:13 +03:00
Alexander Udalov
565132b7a9 Change logic of applying JVM target from AGP options
Now that the default JVM target is 1.8, we have to add the JVM target
1.6 explicitly if the Android project is configured with source/target
1.6, and not do anything if it's configured with 1.8.

 #KT-31027

(cherry picked from commit e9436da858)
2021-02-01 11:57:06 +01:00
Alexander Udalov
0c5625e616 Light classes: use JVM target from the module
Using "JVM_1_8" always resulted in incorrect mapping of Kotlin
annotation targets to Java element types.

The change in AbstractKotlinRenderLogTest is needed because while
CliTraceHolder.module is technically a descriptor leak, it was never
detected by this test accidentally, because of the depth cutoff equal to
10, which started to not be enough after the minor refactoring of
replacing `Delegates.notNull` with `lateinit`.

(cherry picked from commit adfa8c788c)
2021-02-01 11:57:05 +01:00
Alexander Udalov
e502c1ad71 Light classes: map annotation targets depending on JVM target
Since the default JVM target (`JvmTarget.DEFAULT`) is now 1.8, the
changed test started to fail. This change fixes it.

(cherry picked from commit 64e97225b8)
2021-02-01 11:57:04 +01:00
Alexander Udalov
bd4d9491ba Switch default JVM target to 1.8
#KT-29405 Fixed

(cherry picked from commit d022bb0248)
2021-02-01 11:57:02 +01:00
Alexander Udalov
5d8bf3be87 Workaround illegal access problem in daemon for JDK 17-ea
Otherwise Kotlin cannot be used in Gradle since
https://github.com/openjdk/jdk/commit/ed4c4ee7 where JDK internals
started to be encapsulated by default.

For some reason, using

    listOf("--add-opens", "java.base/java.util=ALL-UNNAMED")

doesn't help, so use the more general `--illegal-access=permit`.

 #KT-43704

(cherry picked from commit e7cf34a2a9)
2021-02-01 11:56:17 +01:00
Alexander Udalov
c0ecb5c3c9 CLI: suppress warning on JDK 9+ with illegal access to ResourceBundle
The underlying issue is tracked in IDEA-248785.

 #KT-43704 Fixed

(cherry picked from commit f08733eb75)
2021-02-01 11:56:13 +01:00
Alexander Udalov
a4a2618cf7 CLI: do not pass -noverify to java process starting from JDK 13
#KT-44232 Fixed

(cherry picked from commit 2ef4ca4e6e)
2021-02-01 11:56:07 +01:00
Alexander Udalov
5c43a97e1e Update copyrights in CLI scripts
(cherry picked from commit 2bbe3db041)
2021-02-01 11:56:03 +01:00
Sergey Igushkin
497dacdc3c Add API version 1.5 to accepted values in MPP language settings 2021-02-01 12:42:53 +03:00
65851 changed files with 1274543 additions and 842142 deletions

5
.bunch
View File

@@ -1,3 +1,4 @@
202
203_202
as42
201
as41_201
as42

8
.gitignore vendored
View File

@@ -12,7 +12,6 @@
/android-studio/sdk
out/
/tmp
kotlin-ide/
workspace.xml
*.versionsBackup
/idea/testData/debugger/tinyApp/classes*
@@ -33,8 +32,6 @@ build/
.idea/modules
.idea/runConfigurations/JPS_*.xml
.idea/runConfigurations/PILL_*.xml
.idea/runConfigurations/_FP_*.xml
.idea/runConfigurations/_MT_*.xml
.idea/libraries
.idea/modules.xml
.idea/gradle.xml
@@ -57,8 +54,7 @@ build/
.idea/artifacts/kotlin_test_js_ir_*
.idea/artifacts/kotlin_stdlib_wasm_*
.idea/jarRepositories.xml
.idea/csv-plugin.xml
.idea/libraries-with-intellij-classes.xml
kotlin-ultimate/
node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
@@ -66,5 +62,3 @@ local.properties
buildSrcTmp/
distTmp/
outTmp/
/test.output
/kotlin-native/dist

View File

@@ -1,8 +0,0 @@
<component name="ArtifactManager">
<artifact type="jar" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT">
<output-path>$PROJECT_DIR$/kotlin-native/endorsedLibraries/kotlinx.cli/build/libs</output-path>
<root id="archive" name="kotlinx.cli-jvm-1.5.255-SNAPSHOT.jar">
<element id="module-output" name="kotlin.kotlin-native.endorsedLibraries.kotlinx.cli.jvmMain" />
</root>
</artifact>
</component>

View File

@@ -63,6 +63,27 @@
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="PROTO">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
@@ -80,4 +101,4 @@
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
</codeStyleSettings>
</code_scheme>
</component>
</component>

View File

@@ -1,8 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="igor">
<words>
<w>descr</w>
<w>exprs</w>
</words>
</dictionary>
</component>

View File

@@ -1,9 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="sebastiansellmair">
<words>
<w>cinterops</w>
<w>interops</w>
<w>klibrary</w>
</words>
</dictionary>
</component>

View File

@@ -2,7 +2,6 @@
<dictionary name="skuzmich">
<words>
<w>anyref</w>
<w>dataref</w>
<w>ushr</w>
<w>wasm</w>
</words>

4
.idea/misc.xml generated
View File

@@ -12,14 +12,10 @@
<item index="2" class="java.lang.String" itemvalue="org.gradle.api.tasks.options.Option" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="IdProvider" IDEtalkID="71A301FF1940049D6D82F12C40F1E1D5" />
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="JavadocGenerationManager">
<option name="OTHER_OPTIONS" value="" />
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<configuration default="false" name="Generate All Tests" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,24 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate FIR Checker Components and FIR/IDE Diagnostics" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":compiler:fir:checkers:generateCheckersComponents" />
<option value=":idea-frontend-fir:generateCode" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@@ -1,21 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate FIR tree" type="GradleRunConfiguration" factoryName="Gradle" folderName="Generators">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/compiler/fir/tree" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="generateTree" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<configuration default="false" name="Generate standard library sources" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/kotlin-stdlib-gen" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

20
.idea/runConfigurations/IDEA.xml generated Normal file
View File

@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA" type="GradleRunConfiguration" factoryName="Gradle" singleton="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method />
</configuration>
</component>

View File

@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-P intellijUltimateEnabled" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runUltimate" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method />
</configuration>
</component>

View File

@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-PnoPCE" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runUltimate" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method />
</configuration>
</component>

View File

@@ -0,0 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-PnoPCE" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method />
</configuration>
</component>

View File

@@ -0,0 +1,19 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="-Pidea.is.internal=false" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
</configuration>
</component>

View File

@@ -1,25 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: Commonizer" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.gradle.CommonizerHierarchicalIT&quot; --tests &quot;org.jetbrains.kotlin.gradle.CommonizerIT&quot; --tests &quot;org.jetbrains.kotlin.commonizer.**&quot;" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":native:kotlin-klib-commonizer-api:test" />
<option value=":native:kotlin-klib-commonizer:test" />
<option value=":kotlin-gradle-plugin-integration-tests:test" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@@ -1,23 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: Commonizer / Light" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":native:kotlin-klib-commonizer-api:test" />
<option value=":native:kotlin-klib-commonizer:test" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle" folderName="Tests">
<configuration default="false" name="Test: KMM" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -17,4 +17,4 @@
</ExternalSystemSettings>
<method v="2" />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<configuration default="false" name="Test: public API binary compatibility validator, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$/libraries/tools/binary-compatibility-validator" />
@@ -18,4 +18,4 @@
</ExternalSystemSettings>
<method />
</configuration>
</component>
</component>

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -19,4 +19,4 @@
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>
</component>

12
.idea/vcs.xml generated
View File

@@ -8,18 +8,6 @@
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>
<component name="GithubSharedProjectSettings">
<option name="branchProtectionPatterns">
<list>
<option value="master" />
<option value="1\.5\.0-M2" />
<option value="1\.5\.0" />
<option value="1\.5\.20" />
<option value="1\.5\.20-M1-release" />
<option value="1\.5\.20-RC-release" />
</list>
</option>
</component>
<component name="IssueNavigationConfiguration">
<option name="links">
<list>

View File

@@ -1,765 +1,136 @@
# CHANGELOG
## 1.5.21
### Compiler
- [`KT-47320`](https://youtrack.jetbrains.com/issue/KT-47320) "StringConcatException: Mismatched number of concat arguments" String concatenation fails when template contains special character
- [`KT-47445`](https://youtrack.jetbrains.com/issue/KT-47445) "definitely not null type parameters is only available since language version 1.6" error in cast expression
- [`KT-47446`](https://youtrack.jetbrains.com/issue/KT-47446) Improve warning message INTEGER_OPERATOR_RESOLVE_WILL_CHANGE
- [`KT-47447`](https://youtrack.jetbrains.com/issue/KT-47447) False positive INTEGER_OPERATOR_RESOLVE_WILL_CHANGE warning: "expression will be resolved to Int in future releases"
- [`KT-47449`](https://youtrack.jetbrains.com/issue/KT-47449) JVM / IR: ClassCastException IrStarProjectionImpl cannot be cast to IrTypeProjection
- [`KT-47459`](https://youtrack.jetbrains.com/issue/KT-47459) "IndexOutOfBoundsException: Index 0 out of bounds for length 0" caused by MarkertManager dependency
- [`KT-47480`](https://youtrack.jetbrains.com/issue/KT-47480) StackOverflowError: Recursion on erasion of raw type with interdependent type parameters
### Tools. Compiler Plugins
- [`KT-47161`](https://youtrack.jetbrains.com/issue/KT-47161) Serializable class can't be inherited from serializable class in other module with: e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node: write$Self
- [`KT-47455`](https://youtrack.jetbrains.com/issue/KT-47455) Kotlin lombok plugin NullPointerException
- [`KT-47513`](https://youtrack.jetbrains.com/issue/KT-47513) Lombok compiler plugin failed with 'Recursion detected in a lazy value under LockBasedStorageManager@1c21db60 (TopDownAnalyzer for JVM)'
### Tools. Gradle
- [`KT-47444`](https://youtrack.jetbrains.com/issue/KT-47444) Gradle Plugin: Publishing project with "maven-publish" fails when dependency versions are omitted (NPE in MppDependencyRewritingUtilsKt.associateDependenciesWithActualModuleDependencies)
### Tools. kapt
- [`KT-47416`](https://youtrack.jetbrains.com/issue/KT-47416) Kapt Gradle DSL ignores javaCompilerOptions in 1.5.20
## 1.5.20
### Compiler
#### New Features
- [`KT-43262`](https://youtrack.jetbrains.com/issue/KT-43262) No error for Java generic class @NotNull type parameter used in Kotlin with nullable type argument
- [`KT-44373`](https://youtrack.jetbrains.com/issue/KT-44373) FIR: support error / warning suppression
- [`KT-45189`](https://youtrack.jetbrains.com/issue/KT-45189) Support nullability annotations at module level
- [`KT-45284`](https://youtrack.jetbrains.com/issue/KT-45284) Emit warnings based on jspecify annotations
- [`KT-45525`](https://youtrack.jetbrains.com/issue/KT-45525) Allow to omit JvmInline annotation for expect value classes
- [`KT-46545`](https://youtrack.jetbrains.com/issue/KT-46545) Emit annotations on function type parameters into bytecode for -jvm-target 1.8 and above
#### Performance Improvements
- [`KT-36646`](https://youtrack.jetbrains.com/issue/KT-36646) Don't box primitive values in equality comparison with objects in JVM_IR
#### Fixes
- [`KT-8325`](https://youtrack.jetbrains.com/issue/KT-8325) Unresolved annotation should be an error
- [`KT-19455`](https://youtrack.jetbrains.com/issue/KT-19455) Type annotation unresolved on a type parameter of a supertype in anonymous object expression
- [`KT-24643`](https://youtrack.jetbrains.com/issue/KT-24643) Prohibit using a type parameter declared for an extension property inside delegate
- [`KT-25876`](https://youtrack.jetbrains.com/issue/KT-25876) Annotations on return types and supertypes are not analyzed
- [`KT-28449`](https://youtrack.jetbrains.com/issue/KT-28449) Annotation target is not analyzed in several cases for type annotations
- [`KT-36770`](https://youtrack.jetbrains.com/issue/KT-36770) Prohibit unsafe calls with expected @NotNull T and given Kotlin generic parameter with nullable bound
- [`KT-36880`](https://youtrack.jetbrains.com/issue/KT-36880) K/N IR: Reference to expect property in actual declaration is not remapped
- [`KT-38325`](https://youtrack.jetbrains.com/issue/KT-38325) IllegalStateException: No parameter with index 0-0 when iterating Scala 2.12.11 List
- [`KT-38342`](https://youtrack.jetbrains.com/issue/KT-38342) FIR: Consider renaming diagnostic from AMBIGUITY to OVERLOAD_RESOLUTION_AMBIGUITY
- [`KT-38476`](https://youtrack.jetbrains.com/issue/KT-38476) [FIR] Forgotten type approximation
- [`KT-38540`](https://youtrack.jetbrains.com/issue/KT-38540) Kotlin/Native Set<T>.contains fails with specific enum setup
- [`KT-40425`](https://youtrack.jetbrains.com/issue/KT-40425) IrGenerationExtension. Support simple reporting to compiler output (for development/debug)
- [`KT-41620`](https://youtrack.jetbrains.com/issue/KT-41620) ClassCastException: Class cannot be cast to java.lang.Void
- [`KT-41679`](https://youtrack.jetbrains.com/issue/KT-41679) NI: TYPE_MISMATCH wrong type inference of collection with type Any and integer literal
- [`KT-41818`](https://youtrack.jetbrains.com/issue/KT-41818) NI: False positive IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION leads to NothingValueException on delegated properties
- [`KT-42239`](https://youtrack.jetbrains.com/issue/KT-42239) IR: Report compilation error instead of throwing an exception (effectively crash compiler) when some declaration wasn't found while deserialization
- [`KT-42631`](https://youtrack.jetbrains.com/issue/KT-42631) ArrayIndexOutOfBoundsException was thrown during IR lowering
- [`KT-43258`](https://youtrack.jetbrains.com/issue/KT-43258) NI: False positive "Suspend function 'invoke' should be called only from a coroutine or another suspend function" when calling suspend operator fun on object property from last expression of a crossinlined suspend lambda
- [`KT-44036`](https://youtrack.jetbrains.com/issue/KT-44036) Enum initialization order
- [`KT-44511`](https://youtrack.jetbrains.com/issue/KT-44511) FIR DFA: smartcast after `if (nullable ?: boolean)`
- [`KT-44554`](https://youtrack.jetbrains.com/issue/KT-44554) RAW FIR: NPE in RawFirBuilder
- [`KT-44682`](https://youtrack.jetbrains.com/issue/KT-44682) raw FIR: incorrect source for qualified access
- [`KT-44695`](https://youtrack.jetbrains.com/issue/KT-44695) *_TYPE_MISMATCH_ON_OVERRIDE checkers do not work for anonymous objects
- [`KT-44699`](https://youtrack.jetbrains.com/issue/KT-44699) FIR: incorrect lambda return type (led to a false alarm: PROPERTY_TYPE_MISMATCH_ON_OVERRIDE)
- [`KT-44802`](https://youtrack.jetbrains.com/issue/KT-44802) FIR bootstrap: trying to access package private class
- [`KT-44813`](https://youtrack.jetbrains.com/issue/KT-44813) FIR bootstrap: various errors in collection-like classes
- [`KT-44814`](https://youtrack.jetbrains.com/issue/KT-44814) FIR bootstrap: incorrect cast in when branch
- [`KT-44942`](https://youtrack.jetbrains.com/issue/KT-44942) [FIR] ClassCastException in boostrap tests
- [`KT-44995`](https://youtrack.jetbrains.com/issue/KT-44995) FIR: false positive for ANNOTATION_ARGUMENT_MUST_BE_CONST
- [`KT-45010`](https://youtrack.jetbrains.com/issue/KT-45010) FIR: lambda arguments of inapplicable call is not resolved
- [`KT-45048`](https://youtrack.jetbrains.com/issue/KT-45048) FIR bootstrap: VerifyError on KtUltraLightClass
- [`KT-45052`](https://youtrack.jetbrains.com/issue/KT-45052) FIR bootstrap: inapplicable candidate in GenerateSpecTests.kt
- [`KT-45121`](https://youtrack.jetbrains.com/issue/KT-45121) FIR IDE: redundant vararg parameter type transformation
- [`KT-45136`](https://youtrack.jetbrains.com/issue/KT-45136) Native: dividing Int.MIN_VALUE by -1 crashes or hangs
- [`KT-45236`](https://youtrack.jetbrains.com/issue/KT-45236) JVM / IR: "IllegalStateException: Symbol with IrTypeParameterSymbolImpl is unbound" caused by contracts and sealed class
- [`KT-45308`](https://youtrack.jetbrains.com/issue/KT-45308) Psi2ir: "AssertionError: TypeAliasDescriptor expected" caused by using typealias from one module as a type in another module without a transitive dependency
- [`KT-45316`](https://youtrack.jetbrains.com/issue/KT-45316) [FIR] Ambiguity between two implicit invokes with receiver
- [`KT-45344`](https://youtrack.jetbrains.com/issue/KT-45344) FIR: Wrong inferred type for nullable type parameter
- [`KT-45385`](https://youtrack.jetbrains.com/issue/KT-45385) FIR: false positive MUST_BE_INITIALIZED_OR_BE_ABSTRACT after rethrow
- [`KT-45475`](https://youtrack.jetbrains.com/issue/KT-45475) [FIR] No smartcast after throw in if inside try block
- [`KT-45508`](https://youtrack.jetbrains.com/issue/KT-45508) False negative ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED on a fake override with an abstract super class member
- [`KT-45578`](https://youtrack.jetbrains.com/issue/KT-45578) REPL: Unresolved imports are cached for the subsequent compilations
- [`KT-45685`](https://youtrack.jetbrains.com/issue/KT-45685) JVM IR: capturing a variable into crossinline suspend lambda makes the function inside inline function no longer unbox Result
- [`KT-45584`](https://youtrack.jetbrains.com/issue/KT-45584) [FIR] Fix overriding property and java function in java class
- [`KT-45697`](https://youtrack.jetbrains.com/issue/KT-45697) JVM IR: ISE "Function has no body" on getter of private field in a class present both in sources and dependencies
- [`KT-45842`](https://youtrack.jetbrains.com/issue/KT-45842) Compiler doesn't allow a shared class to inherit a platform-specific sealed class
- [`KT-45848`](https://youtrack.jetbrains.com/issue/KT-45848) False negative [SEALED_INHERITOR_IN_DIFFERENT_MODULE] error in compiler for a platform-specific inheritor of a shared sealed class
- [`KT-45931`](https://youtrack.jetbrains.com/issue/KT-45931) There is no warning based on nullability java annotation
- [`KT-45998`](https://youtrack.jetbrains.com/issue/KT-45998) JVM IR: AE when an accessor to a protected companion object member is being generated in child class
- [`KT-46048`](https://youtrack.jetbrains.com/issue/KT-46048) Enum entries init order in companion object
- [`KT-46074`](https://youtrack.jetbrains.com/issue/KT-46074) FIR: private-in-file fun interface is considered invisible in this file
- [`KT-46173`](https://youtrack.jetbrains.com/issue/KT-46173) No error reporting on annotations on target type of `as` expression in return
- [`KT-46235`](https://youtrack.jetbrains.com/issue/KT-46235) JVM IR: Stack overflow error on large expressions
- [`KT-46270`](https://youtrack.jetbrains.com/issue/KT-46270) [FIR] Support `@PublishedAPI` in inline checker
- [`KT-46539`](https://youtrack.jetbrains.com/issue/KT-46539) Generate annotations on type parameters bounds in bytecode
- [`KT-46578`](https://youtrack.jetbrains.com/issue/KT-46578) JVM IR: IllegalAccessError accessing property delegated to java super class protected field reference
- [`KT-46597`](https://youtrack.jetbrains.com/issue/KT-46597) JVM IR: AssertionError: SyntheticAccessorLowering should not attempt to modify other files - crossinline accessor
- [`KT-46601`](https://youtrack.jetbrains.com/issue/KT-46601) JVM / IR: IllegalStateException: "Can't find method 'invokeinvoke`" when default lambda takes inline class parameters
- [`KT-46670`](https://youtrack.jetbrains.com/issue/KT-46670) StackOverflowError on inheritance from raw type where class has protobuf-like recursive generics
- [`KT-46715`](https://youtrack.jetbrains.com/issue/KT-46715) JVM / IR: "AssertionError: Unbound symbols not allowed IrConstructorSymbolImpl" with enum classes with the same name in test and src folders
- [`KT-46759`](https://youtrack.jetbrains.com/issue/KT-46759) JVM IR: CCE in LateinitUsageLowering on @JvmStatic lateinit property in object
- [`KT-46777`](https://youtrack.jetbrains.com/issue/KT-46777) [Native] [IR] Support suspend function as super type
- [`KT-46802`](https://youtrack.jetbrains.com/issue/KT-46802) JVM / IR: "UnsupportedOperationException: Unknown structure of ADAPTER_FOR_CALLABLE_REFERENCE" caused by function reference on @JvmStatic function with unused default parameters
- [`KT-46813`](https://youtrack.jetbrains.com/issue/KT-46813) JVM / IR: "ClassCastException: Integer cannot be cast to class Result" with Flow and `fold` method
- [`KT-46822`](https://youtrack.jetbrains.com/issue/KT-46822) JVM IR: StackOverflowError on compiling a large data class
- [`KT-46837`](https://youtrack.jetbrains.com/issue/KT-46837) Backend Internal error: Exception during IR lowering: assert at IrOverridingUtilKt.buildFakeOverrideMember
- [`KT-46921`](https://youtrack.jetbrains.com/issue/KT-46921) JVM / IR: "IndexOutOfBoundsException: Cannot pop operand off an empty stack" caused by crossinline parameter and label return
- [`KT-46984`](https://youtrack.jetbrains.com/issue/KT-46984) Type parameter bounds aren't used to report corresponding mismatch warnings
- [`KT-46985`](https://youtrack.jetbrains.com/issue/KT-46985) There aren't warnings by java nullability annotations
- [`KT-46986`](https://youtrack.jetbrains.com/issue/KT-46986) There aren't warnings by java nullability annotations
- [`KT-46989`](https://youtrack.jetbrains.com/issue/KT-46989) There aren't warnings by java nullability annotations
- [`KT-46990`](https://youtrack.jetbrains.com/issue/KT-46990) There aren't warnings by java nullability annotations on method's violated type arguments
- [`KT-47019`](https://youtrack.jetbrains.com/issue/KT-47019) K/N: IrProperty.overriddenSymbols can't be used in common IR backend modules yet because it doesn't fully work in Native
### Docs & Examples
- [`KT-33783`](https://youtrack.jetbrains.com/issue/KT-33783) Document when a range created with rangeTo is empty
### IDE
- [`KT-44638`](https://youtrack.jetbrains.com/issue/KT-44638) `clone()` call is unresolved in JVM module of a multiplatform project
- [`KT-45629`](https://youtrack.jetbrains.com/issue/KT-45629) [ULC] KtUltraLightFieldForSourceDeclaration.nameIdentifier returns null
- [`KT-44825`](https://youtrack.jetbrains.com/issue/KT-44825) Can't open Kotlin compiler settings in newly created project
- [`KT-45908`](https://youtrack.jetbrains.com/issue/KT-45908) Reproduciable 'org.jetbrains.kotlin.idea.caches.resolve.KotlinIdeaResolutionException: Kotlin resolution encountered a problem while analyzing KtNameReferenceExpression'
### IDE. FIR
- [`KT-45175`](https://youtrack.jetbrains.com/issue/KT-45175) FIR IDE: Exception with local property in `init` block
- [`KT-45199`](https://youtrack.jetbrains.com/issue/KT-45199) FIR IDE: Error while collecting diagnostic on stale element after replacing element in quickfix
- [`KT-45312`](https://youtrack.jetbrains.com/issue/KT-45312) FIR IDE: FIR plugin throws exception on synthetic function
### IDE. Gradle Integration
- [`KT-34401`](https://youtrack.jetbrains.com/issue/KT-34401) KotlinGradleModelBuilder builds models for non-kotlin modules and always trigger full task configuration.
- [`KT-45277`](https://youtrack.jetbrains.com/issue/KT-45277) Wrong jvm target in gradle module in IDEA
- [`KT-46488`](https://youtrack.jetbrains.com/issue/KT-46488) Import of a multiplatform project with MPP module depending on Kotlin/JVM one fails
### IDE. Inspections and Intentions
- [`KT-45075`](https://youtrack.jetbrains.com/issue/KT-45075) Inspection: Redundant creation of Json format
- [`KT-45347`](https://youtrack.jetbrains.com/issue/KT-45347) Sealed interfaces: quickfix to move to package/module of sealed class/interface should not be shown in case of read-only declaration
- [`KT-45348`](https://youtrack.jetbrains.com/issue/KT-45348) Sealed interfaces: show error for usage of sealed class/interface from a library in Java source code
- [`KT-46063`](https://youtrack.jetbrains.com/issue/KT-46063) In multiplatform code, suggest to generate remaining `when` branches at least for shared sealed classes
### IDE. Refactorings
- [`KT-44431`](https://youtrack.jetbrains.com/issue/KT-44431) Quickfix to move class/interface to proper location: it is allowed to choose test source in JPS project while compiler does not allow it
### IDE. Native
- [`KT-39320`](https://youtrack.jetbrains.com/issue/KT-39320) [Commonizer] Reduce memory consumption
### JavaScript
- [`KT-40235`](https://youtrack.jetbrains.com/issue/KT-40235) KJS: IR. Broken support for external interface companion
- [`KT-40689`](https://youtrack.jetbrains.com/issue/KT-40689) KJS / IR: strange and slow code for kotlin.math.max and kotlin.math.min for Double
- [`KT-44138`](https://youtrack.jetbrains.com/issue/KT-44138) KJS / IR: Constant folding works incorrectly with unsigned arithmetic
- [`KT-44394`](https://youtrack.jetbrains.com/issue/KT-44394) KJS / IR: `null` companion object for existed stdlib interfaces `NodeFilter` and `SVGUnitTypes`
- [`KT-44950`](https://youtrack.jetbrains.com/issue/KT-44950) KJS / IR: "IllegalStateException: Can't find name for declaration" in case of extending export declared class without @JsExport annotation
- [`KT-45057`](https://youtrack.jetbrains.com/issue/KT-45057) KJS / IR: "ClassCastException" when using `js` function in init block
- [`KT-45361`](https://youtrack.jetbrains.com/issue/KT-45361) KJS / IR: `IrConstructorCall` representing annotation always returns `Unit`
- [`KT-46608`](https://youtrack.jetbrains.com/issue/KT-46608) KJS: "Could not load content..." for source maps
- [`KT-45655`](https://youtrack.jetbrains.com/issue/KT-45655) KJS: "REINTERPRET_CAST" is not copyable
- [`KT-45866`](https://youtrack.jetbrains.com/issue/KT-45866) Default parameter with generic in expect-actual declarations
- [`KT-46859`](https://youtrack.jetbrains.com/issue/KT-46859) Exception during IR lowering: NullPointerException was thrown at: optimizations.FoldConstantLowering.tryFoldingUnaryOps
### KMM Plugin
- [`KT-43899`](https://youtrack.jetbrains.com/issue/KT-43899) KMM: Fix "stale framework" usage by XCode & AppCode in default build script
### Libraries
- [`KT-43701`](https://youtrack.jetbrains.com/issue/KT-43701) Stdlib: Expand KDoc of inc() and dec() for operators
- [`KT-46002`](https://youtrack.jetbrains.com/issue/KT-46002) Support all Unicode digit chars in digitToInt (JS and Native)
- [`KT-46183`](https://youtrack.jetbrains.com/issue/KT-46183) Add default value for ignoreCase in K/N String.replace/replaceFirst
- [`KT-46184`](https://youtrack.jetbrains.com/issue/KT-46184) Equivalize isLowerCase and isUpperCase behavior in all platforms
### Native
- [`KT-33175`](https://youtrack.jetbrains.com/issue/KT-33175) IR: String constants with incorrect surrogate pairs aren't preserved during serialization/deserialization
- [`KT-44799`](https://youtrack.jetbrains.com/issue/KT-44799) Different behavior with functional interfaces in Kotlin/Native on iOS
### Native. C Export
- [`KT-42796`](https://youtrack.jetbrains.com/issue/KT-42796) [Reverse C Interop] Package with no public methods generate empty struct in the header, leading to an error
### Native. ObjC Export
- [`KT-38600`](https://youtrack.jetbrains.com/issue/KT-38600) Kotlin MP iOS Target doesn't contain kdoc comments
- [`KT-45127`](https://youtrack.jetbrains.com/issue/KT-45127) KMM: hard to pass an error to Kotlin code from implementation of Kotlin method in Swift code
### Native. Runtime. Memory
- [`KT-45063`](https://youtrack.jetbrains.com/issue/KT-45063) Profiling indicates that a lot of time is spent on updateHeapRef on Apple platforms when running KMP code
### Reflection
- [`KT-10838`](https://youtrack.jetbrains.com/issue/KT-10838) Provide sensible toString() for property accessors in reflection
- [`KT-13490`](https://youtrack.jetbrains.com/issue/KT-13490) Equality doesn't work for KProperty.Accessor implementations
### Tools. CLI
- [`KT-14772`](https://youtrack.jetbrains.com/issue/KT-14772) ISE (FNFE "Not a directory") on compilation with destination argument clashing with an existing file which is not a directory
- [`KT-18184`](https://youtrack.jetbrains.com/issue/KT-18184) CompileEnvironmentException: Invalid jar path on "-d" with .jar in non-existing directory
- [`KT-40977`](https://youtrack.jetbrains.com/issue/KT-40977) Report a readable diagnostic on empty -J argument in CLI
### Tools. Commonizer
- [`KT-45497`](https://youtrack.jetbrains.com/issue/KT-45497) [Commonizer] c-interop commonization: Dependency commonization
- [`KT-46077`](https://youtrack.jetbrains.com/issue/KT-46077) [Commonizer] Add `commonizer_target` to commonized klib's manifest
- [`KT-46107`](https://youtrack.jetbrains.com/issue/KT-46107) [Commonizer] CInteropCommonizerTask receives faulty dependencies in multi module projects containing multiple c-interops
- [`KT-46248`](https://youtrack.jetbrains.com/issue/KT-46248) MPP: Compile KotlinMetadata fails with Unresolved reference if only one native platform from shared source set is available
- [`KT-46856`](https://youtrack.jetbrains.com/issue/KT-46856) [Commonizer] Many targets can fail with 'filename too long'
### Tools. Compiler Plugins
- [`KT-7112`](https://youtrack.jetbrains.com/issue/KT-7112) Support calling Lombok-generated methods within same module
- [`KT-45538`](https://youtrack.jetbrains.com/issue/KT-45538) Serialization, JVM IR: "AssertionError: No such type argument slot in IrConstructorCallImpl" with inner classes
- [`KT-45541`](https://youtrack.jetbrains.com/issue/KT-45541) JVM / IR / Serialization: NullPointerException caused by "Serializable" annotation and local data class
- [`KT-46469`](https://youtrack.jetbrains.com/issue/KT-46469) Kotlin Lombok: accessors with `AccessLevel.MODULE` fail to resolve
- [`KT-46529`](https://youtrack.jetbrains.com/issue/KT-46529) Kotlin Lombok: with `@Accessors` without explicit `prefix` the prefix from lombok.config is not taken into account
- [`KT-46531`](https://youtrack.jetbrains.com/issue/KT-46531) Kotlin Lombok: `lombok.getter.noIsPrefix` is processed depending on character case
- [`KT-46920`](https://youtrack.jetbrains.com/issue/KT-46920) NullPointerException in CodeGeneratorVisitor when packing for xcode
### Tools. Gradle
- [`KT-24533`](https://youtrack.jetbrains.com/issue/KT-24533) Kapt should not run when annotation processors are not configured
- [`KT-43988`](https://youtrack.jetbrains.com/issue/KT-43988) Enable plugin validation during build
- [`KT-45301`](https://youtrack.jetbrains.com/issue/KT-45301) Gradle: Empty `build/kotlin` dir with custom build directory
- [`KT-45519`](https://youtrack.jetbrains.com/issue/KT-45519) loadAndroidPluginVersion() impacts performance negatively and noticeably in multimodule Android build
- [`KT-45744`](https://youtrack.jetbrains.com/issue/KT-45744) Create Kotlin Gradle Plugin JUnit5 basic test setup
- [`KT-45834`](https://youtrack.jetbrains.com/issue/KT-45834) Gradle Plugin read system property related to kotlinCompilerClasspath breaks use of configuration cache
- [`KT-46401`](https://youtrack.jetbrains.com/issue/KT-46401) Deprecate 'kotlin.parallel.tasks.in.project' build property
- [`KT-46820`](https://youtrack.jetbrains.com/issue/KT-46820) Gradle: kotlinc (1.5.0) race condition causes a NullPointerException
- [`KT-47317`](https://youtrack.jetbrains.com/issue/KT-47317) Restore 'kotlinPluginVersion' property in 'KotlinBasePluginWrapper'
### Tools. Gradle. JS
- [`KT-42911`](https://youtrack.jetbrains.com/issue/KT-42911) Support Gradle configuration cache for K/JS tasks
- [`KT-45294`](https://youtrack.jetbrains.com/issue/KT-45294) KJS / Gradle: Number of modules in project affects JS tasks configuration cache state size
- [`KT-45754`](https://youtrack.jetbrains.com/issue/KT-45754) KJS / IR: Remove adding option of source maps in Gradle plugin
- [`KT-46178`](https://youtrack.jetbrains.com/issue/KT-46178) KJS / Dukat: Added as a dependency always without condition
- [`KT-46976`](https://youtrack.jetbrains.com/issue/KT-46976) KJS: Broken support for dynamically created `webpack.config.d`
- [`KT-47045`](https://youtrack.jetbrains.com/issue/KT-47045) [Gradle, JS] Task requirements are added to all compilations with same name
### Tools. Gradle. Multiplatform
- [`KT-36679`](https://youtrack.jetbrains.com/issue/KT-36679) MPP Gradle plugin: Improve messaging for the commonizer
- [`KT-45832`](https://youtrack.jetbrains.com/issue/KT-45832) CInteropCommonization: Filter out illegal dependencies
- [`KT-46394`](https://youtrack.jetbrains.com/issue/KT-46394) Multiplatform: Gradle 7 support
- [`KT-46517`](https://youtrack.jetbrains.com/issue/KT-46517) Add kotlin-project-model as api dependency to kotlin-gradle-plugin-api
### Tools. Gradle. Native
- [`KT-27240`](https://youtrack.jetbrains.com/issue/KT-27240) MPP Gradle plugin: Provide a framework packing task for Kotlin/Native
- [`KT-39016`](https://youtrack.jetbrains.com/issue/KT-39016) Missing stdlib when the downloading process was aborted
- [`KT-40907`](https://youtrack.jetbrains.com/issue/KT-40907) Xcode error after switching between device and simulator: Building for iOS, but the linked and embedded framework was built for iOS Simulator.
- [`KT-44059`](https://youtrack.jetbrains.com/issue/KT-44059) iosSimTest tasks are never up-to-date
- [`KT-45801`](https://youtrack.jetbrains.com/issue/KT-45801) compileIosMainKotlinMetadata compilation property of gradle task is not initialized and fails with `Execution failed for task ':shared:generateProjectStructureMetadata'`
- [`KT-46680`](https://youtrack.jetbrains.com/issue/KT-46680) Register concrete "embedAndSign" tasks instead umbrella
- [`KT-46892`](https://youtrack.jetbrains.com/issue/KT-46892) Kotlin Multiplatform Gradle Plugin: EmbedAndSign task always contains a default framework name
### Tools. Incremental Compile
- [`KT-44741`](https://youtrack.jetbrains.com/issue/KT-44741) Incremental compilation: inspectClassesForKotlinIC doesn't determine changes with imported constant
### Tools. JPS
- [`KT-34351`](https://youtrack.jetbrains.com/issue/KT-34351) KotlinTargetsIndex creation takes too long even if project doesn't have any kotlin
- [`KT-45191`](https://youtrack.jetbrains.com/issue/KT-45191) [JPS] Marking method as "default" in Java SAM interface doesn't affect dependencies
- [`KT-46242`](https://youtrack.jetbrains.com/issue/KT-46242) Support Lombok kotlin plugin in JPS and maven
### Tools. kapt
#### Performance Improvements
- [`KT-28901`](https://youtrack.jetbrains.com/issue/KT-28901) Consider caching annotation processors classloaders
#### Fixes
- [`KT-27123`](https://youtrack.jetbrains.com/issue/KT-27123) kapt: missing space in error log makes location non-clickable
- [`KT-29929`](https://youtrack.jetbrains.com/issue/KT-29929) [Kapt] Stub generator uses constant value in method annotation instead of constant name 2.
- [`KT-31146`](https://youtrack.jetbrains.com/issue/KT-31146) kapt: executableElement.getAnnotation(JvmOverloads::class.java) returns null
- [`KT-32202`](https://youtrack.jetbrains.com/issue/KT-32202) Gradle task kaptKotlin fails: "module not found" in Java 11 modular application
- [`KT-34838`](https://youtrack.jetbrains.com/issue/KT-34838) Kapt: 'cannot find symbol' for a top-level property with anonymous delegate
- [`KT-35104`](https://youtrack.jetbrains.com/issue/KT-35104) Support @JvmStatic in KAPT stubs
- [`KT-35167`](https://youtrack.jetbrains.com/issue/KT-35167) Kapt Gradle plugin doesn't handle --module-path javac argument
- [`KT-37586`](https://youtrack.jetbrains.com/issue/KT-37586) KAPT: When delegated property use an unknown type (to-be-generated class), `correctTypeError` will mess up the `$delegate` field type
- [`KT-39060`](https://youtrack.jetbrains.com/issue/KT-39060) Kapt: correctErrorTypes don't retain return type of getter in Java stub
- [`KT-39715`](https://youtrack.jetbrains.com/issue/KT-39715) KaptGenerateStubsTask resolves annotation processor options too early (before execution time)
- [`KT-41581`](https://youtrack.jetbrains.com/issue/KT-41581) Kapt doesn't have line breaks between warnings
- [`KT-43804`](https://youtrack.jetbrains.com/issue/KT-43804) Kapt fails to preserve parameter names in open suspend functions
- [`KT-43686`](https://youtrack.jetbrains.com/issue/KT-43686) KaptWithoutKotlincTask should use `@CompileClasspath` for `kotlinStdlibClasspath` for cache relocateability.
- [`KT-45032`](https://youtrack.jetbrains.com/issue/KT-45032) Kapt: NullPointerException: insnList.first must not be null
- [`KT-46176`](https://youtrack.jetbrains.com/issue/KT-46176) Kapt: "java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 3" with delegation and property reference
## 1.5.10
### Compiler
#### Fixes
- [`KT-41078`](https://youtrack.jetbrains.com/issue/KT-41078) Incorrect type substitution in contracts with type parameters
- [`KT-44770`](https://youtrack.jetbrains.com/issue/KT-44770) JVM / IR: "IllegalArgumentException: Unrecognized Type: [null]" Jackson doesn't recognize type
- [`KT-45084`](https://youtrack.jetbrains.com/issue/KT-45084) JVM IR: "NoSuchElementException: Sequence contains no element matching the predicate" when inline class is passed to lambda with >22 parameters
- [`KT-45779`](https://youtrack.jetbrains.com/issue/KT-45779) JVM / IR: java.lang.NoSuchMethodError: 'int java.lang.Integer.plus(int)' caused by function reference
- [`KT-45941`](https://youtrack.jetbrains.com/issue/KT-45941) JVM IR: local functions use generic type parameters of the outer class in the bytecode, which breaks Bytebuddy and MockK
- [`KT-46149`](https://youtrack.jetbrains.com/issue/KT-46149) Generate synthetic classes for SAM adapters with erased instead of generic supertype
- [`KT-46189`](https://youtrack.jetbrains.com/issue/KT-46189) JVM IR: tailrec function with capturing lambda in default parameter value leads to NoSuchMethodError at runtime
- [`KT-46214`](https://youtrack.jetbrains.com/issue/KT-46214) JVM / IR: "IllegalStateException: No mapping for symbol: VALUE_PARAMETER INSTANCE_RECEIVER" on a suspend function in an inner class
- [`KT-46238`](https://youtrack.jetbrains.com/issue/KT-46238) JVM IR: BootstrapMethodError in JDK 11+ on intersection type passed in arguments of SAM adapter where SAM interface's type parameter has a non-trivial upper bound
- [`KT-46259`](https://youtrack.jetbrains.com/issue/KT-46259) JVM IR: local function for adapted function reference is not declared as ACC_SYNTHETIC
- [`KT-46284`](https://youtrack.jetbrains.com/issue/KT-46284) JVM IR: "Unbound private symbol IrClassSymbol" on class reference to script class
- [`KT-46402`](https://youtrack.jetbrains.com/issue/KT-46402) IllegalAccessError: "CapturedLambdaInterpreter (in unnamed module @0x71b06418) cannot access class jdk.internal.org.objectweb.asm.Type" caused by inline function with a suspend parameter in Maven project
- [`KT-46408`](https://youtrack.jetbrains.com/issue/KT-46408) JVM IR: BootstrapMethodError due to missing bridge for subclass of generic Java interface
- [`KT-46426`](https://youtrack.jetbrains.com/issue/KT-46426) JVM IR: Corrupted .class file when passing Array constructor reference as (inline) lambda
- [`KT-46455`](https://youtrack.jetbrains.com/issue/KT-46455) OOM on parsing invalid code with string interpolation
- [`KT-46503`](https://youtrack.jetbrains.com/issue/KT-46503) JVM IR: "AssertionError: Unexpected variance in super type argument: out @1"
- [`KT-46505`](https://youtrack.jetbrains.com/issue/KT-46505) JVM IR: NullPointerException caused by a callable reference with nullable inline value class parameter
- [`KT-46512`](https://youtrack.jetbrains.com/issue/KT-46512) JVM / IR: NoSuchMethodError on SAM conversion of a function reference
- [`KT-46515`](https://youtrack.jetbrains.com/issue/KT-46515) IndexOutOfBoundsException: "Empty list doesn't contain element at index 0." on bad variable name in 1.5.0
- [`KT-46516`](https://youtrack.jetbrains.com/issue/KT-46516) JVM IR: "AnalyzerException: Expected I, but found R" on subclassing AbstractMutableList<Int>
- [`KT-46524`](https://youtrack.jetbrains.com/issue/KT-46524) Cannot use unsigned literals with api-version < 1.5 even with opt-in
- [`KT-46537`](https://youtrack.jetbrains.com/issue/KT-46537) JVM / IR: "IllegalStateException: No noarg super constructor for CLASS" caused by "No-arg" plugin with annotation on child class
- [`KT-46540`](https://youtrack.jetbrains.com/issue/KT-46540) JVM / IR: AnalyzerException: Expected an object reference, but found J caused by java.function.Supplier
- [`KT-46554`](https://youtrack.jetbrains.com/issue/KT-46554) JVM IR: "IllegalStateException: No mapping for symbol: VAR IR_TEMPORARY_VARIABLE" with value class constructor delegation call
- [`KT-46555`](https://youtrack.jetbrains.com/issue/KT-46555) JVM IR: IllegalAccessError when using Java method reference
- [`KT-46562`](https://youtrack.jetbrains.com/issue/KT-46562) Kotlin 1.5.0 generates non-serializable lambdas when they should be serializable
- [`KT-46568`](https://youtrack.jetbrains.com/issue/KT-46568) JVM IR: "AssertionError: IrCall expected inside JvmStatic wrapper" on compiling protected static function with return type Nothing inside companion object of abstract class
- [`KT-46574`](https://youtrack.jetbrains.com/issue/KT-46574) JVM / IR: ClassCastException caused by runBlocking awaiting call while returning Kotlin.Result type.
- [`KT-46579`](https://youtrack.jetbrains.com/issue/KT-46579) JVM IR: "IllegalArgumentException: Sequence contains more than one matching element" for Java enum with overloaded values() static method
- [`KT-46584`](https://youtrack.jetbrains.com/issue/KT-46584) JVM IR: Intrinsics.needClassReification (UnsupportedOperationException thrown). Property delegate provider crossinline lambda inlining/reification issue
- [`KT-46751`](https://youtrack.jetbrains.com/issue/KT-46751) JVM / IR:"ClassCastException: java.lang.String cannot be cast to java.lang.Void" in extension function in Kotlin 1.5
### IDE
- [`KT-45981`](https://youtrack.jetbrains.com/issue/KT-45981) failed to analyze: java.lang.AssertionError: diagnostic callback has been already registered: Code analysis get stuck in AS 2020.3.1.14 & Kotlin v1.5.0-M2
- [`KT-46622`](https://youtrack.jetbrains.com/issue/KT-46622) 60+ second freezes with Kotlin plugin 1.5.0: GetModuleInfoKt.findJvmStdlibAcrossDependencies
### IDE. Gradle Integration
- [`KT-46417`](https://youtrack.jetbrains.com/issue/KT-46417) [UNRESOLVED_REFERENCE] For project to project dependencies of native platform test source sets
### Libraries
- [`KT-46280`](https://youtrack.jetbrains.com/issue/KT-46280) JvmRecord annotation missing constructor in common
### Middle-end. IR
- [`KT-44013`](https://youtrack.jetbrains.com/issue/KT-44013) NPE: When calling constructor of a function type while inheriting from it, despite it's an interface
### Tools. Android Extensions
- [`KT-46590`](https://youtrack.jetbrains.com/issue/KT-46590) Kotlin Android Extensions 1.5.0 generates bad writeToParcel() method for nullable Array types
### Tools. Gradle
- [`KT-41142`](https://youtrack.jetbrains.com/issue/KT-41142) Kotlin version conflict when using Kotlin Gradle plugins in pre-compiled script plugin
- [`KT-46353`](https://youtrack.jetbrains.com/issue/KT-46353) Optimizations disabled in Gradle 7 for KAPT when generating sources
- [`KT-46368`](https://youtrack.jetbrains.com/issue/KT-46368) Memory leak with 1.5.0-RC when building with Gradle
- [`KT-46689`](https://youtrack.jetbrains.com/issue/KT-46689) Track -Xuse-old-backend flag usage
### Tools. Gradle. JS
- [`KT-46006`](https://youtrack.jetbrains.com/issue/KT-46006) KJS \ Gradle: Task without declaring an explicit or implicit dependency on `jsGenerateExternalsIntegrated` in Gradle 7
- [`KT-46162`](https://youtrack.jetbrains.com/issue/KT-46162) KJS: Exported items unavailable on dev server
- [`KT-46331`](https://youtrack.jetbrains.com/issue/KT-46331) KJS: With `kotlin.js.webpack.major.version=4` browserXRun tasks fail
### Tools. Parcelize
- [`KT-46567`](https://youtrack.jetbrains.com/issue/KT-46567) Kotlin 1.5.0 parcelize compilation fails in new backend when using TypeParceller with nested generics
### Tools. kapt
- [`KT-45532`](https://youtrack.jetbrains.com/issue/KT-45532) Do not create Kapt stubs directory during configuration time
## 1.5.0
### Backend. Native
- [`KT-42053`](https://youtrack.jetbrains.com/issue/KT-42053) Support compiler caches for linux_x64
- [`KT-43690`](https://youtrack.jetbrains.com/issue/KT-43690) Support compiler caches for ios_arm64
### Backend. IR
- [`KT-42684`](https://youtrack.jetbrains.com/issue/KT-42684) StackOverflowError on recursive inline arguments in inline fun
## 1.5.0-RC
### Compiler
#### New Features
- [`KT-28791`](https://youtrack.jetbrains.com/issue/KT-28791) Kotlin serialization with inline classes
- [`KT-30222`](https://youtrack.jetbrains.com/issue/KT-30222) Support JVM target version selection in Kotlin bytecode tool window
- [`KT-41884`](https://youtrack.jetbrains.com/issue/KT-41884) Support 'file' target for JvmSynthetic annotation
- [`KT-43677`](https://youtrack.jetbrains.com/issue/KT-43677) Support for Java records
- [`KT-43920`](https://youtrack.jetbrains.com/issue/KT-43920) Support loading binary Java annotations on fields
- [`KT-44278`](https://youtrack.jetbrains.com/issue/KT-44278) Generate SAM-converted lambdas and function references using 'invokedynamic' on JDK 1.8+
- [`KT-44650`](https://youtrack.jetbrains.com/issue/KT-44650) Deprecate JVM target version 1.6
- [`KT-44787`](https://youtrack.jetbrains.com/issue/KT-44787) Suspend functions in fun interfaces
- [`KT-44865`](https://youtrack.jetbrains.com/issue/KT-44865) Allow to declare protected constructors in sealed classes
- [`KT-44869`](https://youtrack.jetbrains.com/issue/KT-44869) Compiling sealed interface with version less than 1.5: error message from future could be provided
#### Performance Improvements
- [`KT-6336`](https://youtrack.jetbrains.com/issue/KT-6336) Optimize generation of local functions
- [`KT-7307`](https://youtrack.jetbrains.com/issue/KT-7307) Optimize infix call of String.plus
- [`KT-18692`](https://youtrack.jetbrains.com/issue/KT-18692) Optimize '<optimizable_range> step x' for-in loop
- [`KT-19978`](https://youtrack.jetbrains.com/issue/KT-19978) Inefficient bytecode generated for function references undergoing Java SAM conversion
- [`KT-23565`](https://youtrack.jetbrains.com/issue/KT-23565) OperationsMapGenerated.kt generates unreasonable amount of bytecode
- [`KT-23825`](https://youtrack.jetbrains.com/issue/KT-23825) Tail suspend call utilizing elvis operator does not take advantage of suspend tail call optimization
- [`KT-23826`](https://youtrack.jetbrains.com/issue/KT-23826) A suspend function on the right side of a returned || condition is not tail call optimized
- [`KT-25348`](https://youtrack.jetbrains.com/issue/KT-25348) No compile time unsigned integer conversion when using hex literal
- [`KT-26060`](https://youtrack.jetbrains.com/issue/KT-26060) Support a compiler mode to compile lambda expressions using `invokedynamic` instruction
- [`KT-26590`](https://youtrack.jetbrains.com/issue/KT-26590) Do not generate create method for suspend lambdas if its arity >= 2
- [`KT-27427`](https://youtrack.jetbrains.com/issue/KT-27427) Optimize nullable check introduced with 'as' cast
- [`KT-28246`](https://youtrack.jetbrains.com/issue/KT-28246) Redundant boxing/unboxing isn't eliminated by the compiler in case of inline classes and javaClass intrinsic
- [`KT-30605`](https://youtrack.jetbrains.com/issue/KT-30605) Constant folding doesn't evaluate inv() function
- [`KT-36845`](https://youtrack.jetbrains.com/issue/KT-36845) Generate enum-based TABLESWITCH/LOOKUPSWITCH on a value with smart cast to enum in JVM_IR
- [`KT-39585`](https://youtrack.jetbrains.com/issue/KT-39585) JVM BE generates redundant accessor calls when accessing static final field lifted from companion
- [`KT-40886`](https://youtrack.jetbrains.com/issue/KT-40886) Old JVM BE unspills ACONST_NULL from continuation
- [`KT-42621`](https://youtrack.jetbrains.com/issue/KT-42621) Kotlin binary size considerably larger for code extensively using stream API
- [`KT-44153`](https://youtrack.jetbrains.com/issue/KT-44153) NI: Low Memory and IntelliJ hangs when quotes in split() are missed
- [`KT-45410`](https://youtrack.jetbrains.com/issue/KT-45410) JVM / IR: Extreme performance regression on arithmetic operations inside a loop
#### Fixes
- [`KT-6007`](https://youtrack.jetbrains.com/issue/KT-6007) Support changed return type of inlined generic function when lambda returns anonymous object
- [`KT-6055`](https://youtrack.jetbrains.com/issue/KT-6055) Failed invoke plus assign on array element accessed via several args through local get/set convention extensions
- [`KT-6879`](https://youtrack.jetbrains.com/issue/KT-6879) CompilationException when local classes hierarchy is placed within other local or inner declaration
- [`KT-8120`](https://youtrack.jetbrains.com/issue/KT-8120) NoSuchMethodError on local class constructor call inside a local class
- [`KT-8199`](https://youtrack.jetbrains.com/issue/KT-8199) "Cannot pop operand off an empty stack" for local class using a captured variable as default value for constructor parameter
- [`KT-10835`](https://youtrack.jetbrains.com/issue/KT-10835) "AssertionError: Non-outer parameter incorrectly mapped to outer" when inlining object literal extending inner class
- [`KT-12790`](https://youtrack.jetbrains.com/issue/KT-12790) Don't generate synthetic accessors for private inline function/properties
- [`KT-13213`](https://youtrack.jetbrains.com/issue/KT-13213) IllegalArgumentException in ByteVector.putUTF8 on attempt to compile file with moderately long string literal
- [`KT-14628`](https://youtrack.jetbrains.com/issue/KT-14628) "UnsupportedOperationException: Don't know how to generate outer expression" for nested class inheriting from inner class with a companion object
- [`KT-14833`](https://youtrack.jetbrains.com/issue/KT-14833) JVM internal error: Augment assignment and increment are not supported for local delegated properties and inline properties
- [`KT-15403`](https://youtrack.jetbrains.com/issue/KT-15403) Suspend operator get wrong code generated by BE (NoSuchMethodError)
- [`KT-15404`](https://youtrack.jetbrains.com/issue/KT-15404) Suspend operator set wrong code generated
- [`KT-16084`](https://youtrack.jetbrains.com/issue/KT-16084) Proguard can't find enclosing class of let closure inside apply closure
- [`KT-16151`](https://youtrack.jetbrains.com/issue/KT-16151) Internal compiler error when using plusAssign operator with mutable map
- [`KT-16221`](https://youtrack.jetbrains.com/issue/KT-16221) Support in/!in suspend operators
- [`KT-16282`](https://youtrack.jetbrains.com/issue/KT-16282) "Cannot pop operand off an empty stack" for plusAssign with default parameters in setter operator
- [`KT-16445`](https://youtrack.jetbrains.com/issue/KT-16445) `java.lang.VerifyError: Bad type on operand stack` when delegating an interface through a private reified function inside an object
- [`KT-16520`](https://youtrack.jetbrains.com/issue/KT-16520) Invalid bytecode semantics for set call by convention with default parameters
- [`KT-16567`](https://youtrack.jetbrains.com/issue/KT-16567) Inliner creates redundant objects on source inlining
- [`KT-16752`](https://youtrack.jetbrains.com/issue/KT-16752) Delegating function interface to function reference does not work
- [`KT-17554`](https://youtrack.jetbrains.com/issue/KT-17554) Incorrect cast to Unit generated on annotated when-expression with a single-branch if inside
- [`KT-17738`](https://youtrack.jetbrains.com/issue/KT-17738) Java cannot extend class implementing kotlin.collections.Map
- [`KT-17753`](https://youtrack.jetbrains.com/issue/KT-17753) Strange behavior of if and return statements
- [`KT-18583`](https://youtrack.jetbrains.com/issue/KT-18583) "ISE: Recursive call in a lazy value" for generic sealed class with nested subclass in a `when(this)` with inferred return type
- [`KT-19861`](https://youtrack.jetbrains.com/issue/KT-19861) "IllegalStateException: Label wasn't found during iterating through instructions" for `plusAssign` with safe call
- [`KT-35224`](https://youtrack.jetbrains.com/issue/KT-35224) It's possible to pass non-spread arrays after arguments with SAM-conversion
- [`KT-36853`](https://youtrack.jetbrains.com/issue/KT-36853) IR: UninitializedPropertyAccessException on tailrec with object expression in default argument
- [`KT-41056`](https://youtrack.jetbrains.com/issue/KT-41056) Increase stub version due to new "contract" keyword
- [`KT-43887`](https://youtrack.jetbrains.com/issue/KT-43887) Problem with FunctionReferenceLowering$FunctionReferenceBuilder in kotlin native
- [`KT-44210`](https://youtrack.jetbrains.com/issue/KT-44210) KJS / IR: "AssertionError: Undefined parameter referenced: <this> defined" caused by plus assign operators in build blocks
- [`KT-44947`](https://youtrack.jetbrains.com/issue/KT-44947) Sealed interfaces: Sealed fun interface leads to "NoWhenBranchMatchedException"
- [`KT-44993`](https://youtrack.jetbrains.com/issue/KT-44993) JVM IR: VerifyError on getfield with Kotlin generic field and elvis operator
- [`KT-45139`](https://youtrack.jetbrains.com/issue/KT-45139) Inline class: AssertionError: Expected top level inline class
- [`KT-45195`](https://youtrack.jetbrains.com/issue/KT-45195) JVM IR: annotation methods are generated as default interface methods if `allopen` is used
- [`KT-45446`](https://youtrack.jetbrains.com/issue/KT-45446) JVM / IR: NullPointerException caused by unreachable code and comparison
- [`KT-45721`](https://youtrack.jetbrains.com/issue/KT-45721) JVM / IR: "Unbound symbols not allowed" caused by class reference in sequence lambda
- [`KT-45853`](https://youtrack.jetbrains.com/issue/KT-45853) JVM / IR: "Accidental override" caused by inheriting Throwable.getCause from Java interface
- [`KT-45861`](https://youtrack.jetbrains.com/issue/KT-45861) Turning warnings into errors for calls with type parameters annotated by @OnlyInputTypes
- [`KT-45868`](https://youtrack.jetbrains.com/issue/KT-45868) JVM IR: ClassCastException with SAM function in init block when SAM is generated via invokedynamic
- [`KT-45920`](https://youtrack.jetbrains.com/issue/KT-45920) JVM IR: "Accidental override" on redefining `get()` in custom Map class
- [`KT-45963`](https://youtrack.jetbrains.com/issue/KT-45963) JVM / IR: "AbstractMethodError: Receiver class does not define or inherit an implementation of the resolved method" in Dokka tests
- [`KT-45967`](https://youtrack.jetbrains.com/issue/KT-45967) JVM IR: "IllegalAccessError" with invokedynamic to Java SAM over callable reference to private function
- [`KT-45982`](https://youtrack.jetbrains.com/issue/KT-45982) Wrong subtyping result on captured types with postponed type variables
### IDE. Inspections and Intentions
- [`KT-38155`](https://youtrack.jetbrains.com/issue/KT-38155) Lift assignment out of 'if' produces type mismatch without manually adding a semicolon
### JavaScript
- [`KT-44796`](https://youtrack.jetbrains.com/issue/KT-44796) KJS / IR: default parameter of function with @JsName leads to "RangeError: Maximum call stack size exceeded"
### Libraries
- [`KT-39177`](https://youtrack.jetbrains.com/issue/KT-39177) Make CharCategory available in common multiplatform code
- [`KT-43772`](https://youtrack.jetbrains.com/issue/KT-43772) Kotlin/Native unfinished workers detected.
### Tools. Gradle
- [`KT-43605`](https://youtrack.jetbrains.com/issue/KT-43605) Kotlin Gradle Plugin 1.4.20 undeclared system property reads cause problems with Gradle configuration cache enabled
- [`KT-44462`](https://youtrack.jetbrains.com/issue/KT-44462) Kotlin Gradle plugin creates `compile` configuration with Gradle 7.0
- [`KT-44949`](https://youtrack.jetbrains.com/issue/KT-44949) Compatibility with Gradle 7.0
- [`KT-44957`](https://youtrack.jetbrains.com/issue/KT-44957) gradle - target.compilations seems to be deprecated
- [`KT-45340`](https://youtrack.jetbrains.com/issue/KT-45340) Update minimal supported version of Kotlin Gradle Plugin to 6.1
### Tools. Gradle. Multiplatform
- [`KT-44900`](https://youtrack.jetbrains.com/issue/KT-44900) Support gradle configuration cache with kotlin.multiplatform plugin
### Tools. kapt
- [`KT-43686`](https://youtrack.jetbrains.com/issue/KT-43686) KaptWithoutKotlincTask should use `@CompileClasspath` for `kotlinStdlibClasspath` for cache relocateability.
- [`KT-44130`](https://youtrack.jetbrains.com/issue/KT-44130) KAPT changes field order in 1.4.30-M1
## 1.5.0-M2
### Compiler
#### New Features
- [`KT-30222`](https://youtrack.jetbrains.com/issue/KT-30222) Support JVM target version selection in Kotlin bytecode tool window
- [`KT-41884`](https://youtrack.jetbrains.com/issue/KT-41884) Support 'file' target for JvmSynthetic annotation
- [`KT-44278`](https://youtrack.jetbrains.com/issue/KT-44278) Generate SAM-converted lambdas and function references using 'invokedynamic' on JDK 1.8+
#### Performance Improvements
- [`KT-26060`](https://youtrack.jetbrains.com/issue/KT-26060) Support a compiler mode to compile lambda expressions using `invokedynamic` instruction
- [`KT-42621`](https://youtrack.jetbrains.com/issue/KT-42621) Kotlin binary size considerably larger for code extensively using stream API
#### Fixes
- [`KT-20306`](https://youtrack.jetbrains.com/issue/KT-20306) Make 'when' over an 'expect' enum class non-exhaustive
- [`KT-20869`](https://youtrack.jetbrains.com/issue/KT-20869) kotlin.jvm.internal.DefaultConstructorMarker should be public
- [`KT-20996`](https://youtrack.jetbrains.com/issue/KT-20996) IllegalStateException: Cannot get FQ name of local class: class <no name provided> in metadata serialization for common code
- [`KT-21014`](https://youtrack.jetbrains.com/issue/KT-21014) Incorrect bytecode generated for 'PrimitiveArray::size'
- [`KT-21092`](https://youtrack.jetbrains.com/issue/KT-21092) Reference `javaClass` for generic property: "couldn't transform method node: get()"
- [`KT-21778`](https://youtrack.jetbrains.com/issue/KT-21778) "IllegalStateException: Couldn't build context" for inline function inside an anonymous object
- [`KT-21900`](https://youtrack.jetbrains.com/issue/KT-21900) VerifyError on equals on generic primitive type
- [`KT-22098`](https://youtrack.jetbrains.com/issue/KT-22098) "UnsupportedOperationException: Don't know how to generate outer expression" on extension function call inside lambda in anonymous object super constructor call
- [`KT-22488`](https://youtrack.jetbrains.com/issue/KT-22488) Bad line numbers generated for '&&' expression
- [`KT-22972`](https://youtrack.jetbrains.com/issue/KT-22972) A compiler bug(?) in Number class descendants
- [`KT-23619`](https://youtrack.jetbrains.com/issue/KT-23619) Transform stateless singleton lambda during inline
- [`KT-23881`](https://youtrack.jetbrains.com/issue/KT-23881) Declaration of lambda in inlined apply block holds reference to superfluous references causing leak
- [`KT-24135`](https://youtrack.jetbrains.com/issue/KT-24135) Calling invoke on crossinline suspend lambda leads to no state-machine
- [`KT-24193`](https://youtrack.jetbrains.com/issue/KT-24193) NoClassDefFoundError: java/lang/Cloneable$DefaultImpls on inheritance from Cloneable through an interface
- [`KT-24305`](https://youtrack.jetbrains.com/issue/KT-24305) ClassNotFoundException when using Java reflection on local class in an inlined lambda
- [`KT-24564`](https://youtrack.jetbrains.com/issue/KT-24564) Custom operator fun set on ByteArray resolves properly but is miscompiled
- [`KT-25400`](https://youtrack.jetbrains.com/issue/KT-25400) "NoClassDefFoundError: kotlin/KotlinPackage" with Turkish system locale on macOS
- [`KT-26130`](https://youtrack.jetbrains.com/issue/KT-26130) Incorrect method signature for a generic function with inline class as a type parameter upper bound
- [`KT-26360`](https://youtrack.jetbrains.com/issue/KT-26360) "Method from super interface has a different signature" for Interface that extends both interfaces with and without @JvmDefault
- [`KT-26473`](https://youtrack.jetbrains.com/issue/KT-26473) Error on compiling inline class with calls of super methods equals(), hashCode(), toString()
- [`KT-26474`](https://youtrack.jetbrains.com/issue/KT-26474) VE “Bad type on operand stack” at runtime on calling toString() method of inline class with calls of super methods (toString(), equals(), hashCode()) inside
- [`KT-26592`](https://youtrack.jetbrains.com/issue/KT-26592) Do not generate private suspend functions as synthetic package-private
- [`KT-27449`](https://youtrack.jetbrains.com/issue/KT-27449) NoSuchMethodError for local suspend function with suspend lambda parameter with default value
- [`KT-27469`](https://youtrack.jetbrains.com/issue/KT-27469) "Cannot pop operand off an empty stack" for compound assignment (plusAssign) with a `vararg` operator get
- [`KT-27825`](https://youtrack.jetbrains.com/issue/KT-27825) Gradually prohibit non-abstract classes containing abstract members invisible from that classes (internal/package-private)
- [`KT-27830`](https://youtrack.jetbrains.com/issue/KT-27830) "Incompatible stack heights" with suspend inline function in do while loop that executes suspend lambda
- [`KT-28042`](https://youtrack.jetbrains.com/issue/KT-28042) "Cannot pop operand off an empty stack" for a bound callable reference of lambda inside inline function
- [`KT-28166`](https://youtrack.jetbrains.com/issue/KT-28166) "Argument 1: expected I, but found R" for generic method with generic parameter or receiver with inline class upper bound
- [`KT-28331`](https://youtrack.jetbrains.com/issue/KT-28331) Consider generating accessors for lateinit properties to avoid assertion on each call
- [`KT-28573`](https://youtrack.jetbrains.com/issue/KT-28573) Inliner does not update references to transformed object
- [`KT-29331`](https://youtrack.jetbrains.com/issue/KT-29331) "AnalyzerException: Argument 1: expected R, but found I" with local generic extension property called on `Int` receiver
- [`KT-29595`](https://youtrack.jetbrains.com/issue/KT-29595) NoClassDefFoundError with inline reified function with lambda argument returning anonymous object
- [`KT-29802`](https://youtrack.jetbrains.com/issue/KT-29802) Incorrect reification when the same type parameter name is used for different reified types
- [`KT-30041`](https://youtrack.jetbrains.com/issue/KT-30041) "AnalyzerException: Expected an object reference, but found ." on nested suspend function calls outer suspend function
- [`KT-30066`](https://youtrack.jetbrains.com/issue/KT-30066) Consider adding annotations to ConeKotlinType
- [`KT-30280`](https://youtrack.jetbrains.com/issue/KT-30280) Inline class class literal gets unwrapped in annotation arguments
- [`KT-30402`](https://youtrack.jetbrains.com/issue/KT-30402) Constant folding works incorrectly with unsigned arithmetics
- [`KT-30548`](https://youtrack.jetbrains.com/issue/KT-30548) "java.lang.IndexOutOfBoundsException: Cannot pop operand off an empty stack" while compiling access to a private lateinit companion field
- [`KT-30629`](https://youtrack.jetbrains.com/issue/KT-30629) `java.lang.VerifyError: Bad type on operand stack` when using a function reference to a generic property
- [`KT-30933`](https://youtrack.jetbrains.com/issue/KT-30933) Inline function produces IllegalAccessError on property reference from different package
- [`KT-31136`](https://youtrack.jetbrains.com/issue/KT-31136) "AnalyzerException: Argument 1: expected R, but found I" on x::javaClass when x is inline class object built around primitive type
- [`KT-31227`](https://youtrack.jetbrains.com/issue/KT-31227) Prohibit using array based on non-reified type parameters as reified type arguments on JVM
- [`KT-31592`](https://youtrack.jetbrains.com/issue/KT-31592) NoSuchMethodException when inlining public function accessing a protected static Java class member
- [`KT-31727`](https://youtrack.jetbrains.com/issue/KT-31727) Object expression captures all variables used in constructor
- [`KT-32023`](https://youtrack.jetbrains.com/issue/KT-32023) "AnalyzerException: Expected I, but found R" with inline suspend function used with callable reference
- [`KT-32115`](https://youtrack.jetbrains.com/issue/KT-32115) NPE during initialization of enum class with delegated property
- [`KT-32153`](https://youtrack.jetbrains.com/issue/KT-32153) "AnalyzerException: Expected an object reference, but found ." with recursive suspend local function
- [`KT-32351`](https://youtrack.jetbrains.com/issue/KT-32351) ClassNotFoundException for anonymous object implementing interface inside a lambda with data class and inline methods
- [`KT-32384`](https://youtrack.jetbrains.com/issue/KT-32384) Safe cast to generic type argument with inline class upper-bound throws NPE instead of ClassCastException
- [`KT-32579`](https://youtrack.jetbrains.com/issue/KT-32579) java.lang.VerifyError: Bad type on operand stack on calling inner class of inherited class in super class when casting to inherited class
- [`KT-32749`](https://youtrack.jetbrains.com/issue/KT-32749) "VerifyError: Call to wrong <init> method" with inline function and accessing class field from anonymous object
- [`KT-32793`](https://youtrack.jetbrains.com/issue/KT-32793) Generated code crashes by ClassCastException with local suspend function and inline class
- [`KT-32812`](https://youtrack.jetbrains.com/issue/KT-32812) "AnalyzerException: Argument 1: expected R, but found I" invoking function with default parameter inherited by inline class
- [`KT-32821`](https://youtrack.jetbrains.com/issue/KT-32821) Missing unboxing of inline class for complex hierarchy of suspend calls
- [`KT-33155`](https://youtrack.jetbrains.com/issue/KT-33155) ClassNotFoundException for qualified this in anonymous object and as a result of inline function call
- [`KT-33173`](https://youtrack.jetbrains.com/issue/KT-33173) Internal error: "AnalyzerException: Expected I, but found R" for supercall inside inline lambda from HashSet.remove implementation
- [`KT-33577`](https://youtrack.jetbrains.com/issue/KT-33577) NoSuchFieldError with nested anonymous objects accessing outer instance property
- [`KT-33836`](https://youtrack.jetbrains.com/issue/KT-33836) Wrong code generated for a local tailrec suspend function.
- [`KT-33873`](https://youtrack.jetbrains.com/issue/KT-33873) ClassCastException invoking UByte setter function via reflection
- [`KT-34018`](https://youtrack.jetbrains.com/issue/KT-34018) "Cannot pop operand off an empty stack" with inline lambda with callable reference
- [`KT-34186`](https://youtrack.jetbrains.com/issue/KT-34186) JDK11: class file contains malformed variable arity method for vararg sealed class constructor
- [`KT-34202`](https://youtrack.jetbrains.com/issue/KT-34202) IllegalAccessError on callable reference of function from multifile facade from standard library
- [`KT-34255`](https://youtrack.jetbrains.com/issue/KT-34255) @JvmStatic tailrec function: "Cannot pop operand off an empty stack"
- [`KT-34507`](https://youtrack.jetbrains.com/issue/KT-34507) Incorrect generated code for mutable collection stub methods in case of presence of functions with similar signature
- [`KT-34665`](https://youtrack.jetbrains.com/issue/KT-34665) Possible index overflow in optimized "for" loop over withIndex()
- [`KT-34754`](https://youtrack.jetbrains.com/issue/KT-34754) Flow builder: "AnalyzerException: Expected an object reference, but found ." with recursive suspend local function
- [`KT-34816`](https://youtrack.jetbrains.com/issue/KT-34816) "AnalyzerException: Expected an object reference, but found I" on "this" in inline class member extension suspend function
- [`KT-34841`](https://youtrack.jetbrains.com/issue/KT-34841) ClassNotFoundException when invoke param function inside anonymous object method
- [`KT-35008`](https://youtrack.jetbrains.com/issue/KT-35008) "AnalyzerException: Expected an object reference, but found I" in inline class companion calling private constructor
- [`KT-35166`](https://youtrack.jetbrains.com/issue/KT-35166) `NoSuchMethodError` at runtime with local property delegate on anonymous object referencing another anonymous object
- [`KT-35224`](https://youtrack.jetbrains.com/issue/KT-35224) It's possible to pass non-spread arrays after arguments with SAM-conversion
- [`KT-35301`](https://youtrack.jetbrains.com/issue/KT-35301) MethodInliner fails with "AssertionError: <init> call doesn't correspond to object transformation info" for qualified this in SAM constructor used as parameter of anonymous object inside inline lambda
- [`KT-35419`](https://youtrack.jetbrains.com/issue/KT-35419) `Failed to generate expression: KtNamedFunction` for local suspend tailrec function with receiver
- [`KT-35511`](https://youtrack.jetbrains.com/issue/KT-35511) VerifyError: "Bad type on operand stack" after reification
- [`KT-35553`](https://youtrack.jetbrains.com/issue/KT-35553) Kotlin compiler generates methods that always have line number 1 for Inline Classes
- [`KT-35725`](https://youtrack.jetbrains.com/issue/KT-35725) "AssertionError: Couldn't find a context for a super-call" for `super` member call in property initializer of companion object
- [`KT-36420`](https://youtrack.jetbrains.com/issue/KT-36420) ClassCastException with inline class Foo extending generic Comparable<Foo>
- [`KT-36713`](https://youtrack.jetbrains.com/issue/KT-36713) AnalyzerException: "Incompatible stack heights" with suspend and inline suspend functions
- [`KT-36794`](https://youtrack.jetbrains.com/issue/KT-36794) Move $assertionsDisabled field to the top-level class
- [`KT-36853`](https://youtrack.jetbrains.com/issue/KT-36853) IR: UninitializedPropertyAccessException on tailrec with object expression in default argument
- [`KT-36875`](https://youtrack.jetbrains.com/issue/KT-36875) "RuntimeException: Trying to access skipped parameter" on synthetic local variable access from inline function
- [`KT-36916`](https://youtrack.jetbrains.com/issue/KT-36916) AnalyzerException: Argument 1: expected I, but found R when using inline class with rxjava
- [`KT-36957`](https://youtrack.jetbrains.com/issue/KT-36957) Exception during codegen: cannot pop operand off an empty stack (Nothing variable in string interpolation)
- [`KT-36984`](https://youtrack.jetbrains.com/issue/KT-36984) SAM adapter classes should be generated as anonymous inner classes in JVM_IR
- [`KT-37704`](https://youtrack.jetbrains.com/issue/KT-37704) Incorrect SMAP syntax
- [`KT-37716`](https://youtrack.jetbrains.com/issue/KT-37716) "AssertionError: <init> call doesn't correspond to object transformation info" with inline reified type parameter, anonymous object and lambda in constructor call
- [`KT-37972`](https://youtrack.jetbrains.com/issue/KT-37972) IllegalAccessError on initializing property reference for a property declared in JvmMultifileClass with -Xmultifile-parts-inherit
- [`KT-38100`](https://youtrack.jetbrains.com/issue/KT-38100) Support local delegated properties (not inlined) in new JVM default modes
- [`KT-38833`](https://youtrack.jetbrains.com/issue/KT-38833) JVM: java.lang.ClassCastException when loop variable is nullable in for loop over unsigned progression
- [`KT-38849`](https://youtrack.jetbrains.com/issue/KT-38849) Read-only variable initialized in non-inline lambda using contract callsInPlace EXACTLY_ONCE is not captured correctly in nested lambdas
- [`KT-38869`](https://youtrack.jetbrains.com/issue/KT-38869) JVM BE produces invalid bytecode when inheriting from AbstractList and declaring methods that look like MutableList implementors (but they aren't)
- [`KT-38965`](https://youtrack.jetbrains.com/issue/KT-38965) "UnsupportedOperationException: Don't know how to generate outer expression: Closure" with reference to local variable in block argument of anonymous object `by` delegation
- [`KT-39289`](https://youtrack.jetbrains.com/issue/KT-39289) CCE in if-else inside annotated 'if' statement
- [`KT-39425`](https://youtrack.jetbrains.com/issue/KT-39425) AbstractMethodError: "Receiver class does not define or inherit an implementation of the resolved method" using classes with complex Java and Kotlin inheritance hierarchies.
- [`KT-39434`](https://youtrack.jetbrains.com/issue/KT-39434) IllegalAccessError with local delegated property in lambda in inlined function
- [`KT-39687`](https://youtrack.jetbrains.com/issue/KT-39687) "Couldn't find captured this" when more than 3 inline functions are nested
- [`KT-39784`](https://youtrack.jetbrains.com/issue/KT-39784) "IndexOutOfBoundsException: Cannot pop operand off an empty stack" caused by JvmOverloads annotation inside an inline class
- [`KT-40165`](https://youtrack.jetbrains.com/issue/KT-40165) ClassCastException caused by SAM conversion used on a functional interface with suspended function
- [`KT-40179`](https://youtrack.jetbrains.com/issue/KT-40179) "VerifyError: Bad type on operand stack" with parent class `get` extension function and child class `set` extension function which used inside child class `plusAssign` extension function
- [`KT-40277`](https://youtrack.jetbrains.com/issue/KT-40277) Fix generic types in special bridge methods
- [`KT-40308`](https://youtrack.jetbrains.com/issue/KT-40308) NoSuchFieldError for multiple delegated extension properties with the same name in a companion object
- [`KT-40338`](https://youtrack.jetbrains.com/issue/KT-40338) NoSuchFieldError on property without backing field that is called as function reference
- [`KT-40392`](https://youtrack.jetbrains.com/issue/KT-40392) Deprecate JvmDefault annotation and old -Xjvm-default modes
- [`KT-40396`](https://youtrack.jetbrains.com/issue/KT-40396) NI: Exceptions when ambiguous type argument and generic invoke
- [`KT-40510`](https://youtrack.jetbrains.com/issue/KT-40510) "AssertionError: DELEGATION slice must override something" for ByteBuffer delegation
- [`KT-40601`](https://youtrack.jetbrains.com/issue/KT-40601) VerifyError: "interface method reference is in an indirect superinterface" when calling @JvmDefault suspend method
- [`KT-40809`](https://youtrack.jetbrains.com/issue/KT-40809) "Couldn't find captured field" compiler error with local function with recursive call through method reference
- [`KT-41056`](https://youtrack.jetbrains.com/issue/KT-41056) Increase stub version due to new "contract" keyword
- [`KT-41105`](https://youtrack.jetbrains.com/issue/KT-41105) IllegalStateException: 'Couldn't find declaration file <class name>' with inline delegate declared in another file
- [`KT-41165`](https://youtrack.jetbrains.com/issue/KT-41165) "IllegalStateException: Concrete fake override public final fun" when an enum class inherits an interface with a variable 'name' or 'ordinal'
- [`KT-41222`](https://youtrack.jetbrains.com/issue/KT-41222) "IllegalStateException: Concrete fake override public final fun" when a class property is inherited as merged 'var' from 'val' and 'var' from parent abstract class and interface properties
- [`KT-41255`](https://youtrack.jetbrains.com/issue/KT-41255) JDK 11: "VerifyError: Bad type on operand stack" with long function body with annotated `when` expression
- [`KT-41427`](https://youtrack.jetbrains.com/issue/KT-41427) NoSuchMethodError caused by implementation by delegation to function reference
- [`KT-41508`](https://youtrack.jetbrains.com/issue/KT-41508) ClassNotFoundException caused by object with overridden function inside a lambda with safe cast receiver
- [`KT-41750`](https://youtrack.jetbrains.com/issue/KT-41750) Inline classes: ClassCastExceptionError when calling .withIndex() on Iterator over Array
- [`KT-41758`](https://youtrack.jetbrains.com/issue/KT-41758) Deprecate kotlin.Metadata.bytecodeVersion and avoid using it in the compiler
- [`KT-41770`](https://youtrack.jetbrains.com/issue/KT-41770) AssertionError: "Asm parameter types should be the same length as Kotlin parameter types" cause by fun interface
- [`KT-41874`](https://youtrack.jetbrains.com/issue/KT-41874) "IllegalStateException: Couldn't obtain compiled function body" on extension delegated property with inline operator getValue in a different file
- [`KT-41917`](https://youtrack.jetbrains.com/issue/KT-41917) [FIR] Incorrect calculating property type for override from intersection scope
- [`KT-42012`](https://youtrack.jetbrains.com/issue/KT-42012) IllegalAccess to protected field instead of getter
- [`KT-42017`](https://youtrack.jetbrains.com/issue/KT-42017) "AssertionError: Unsigned type expected: UInt?" during codegen when a variable of nullable unsigned type is checking for presence in the range
- [`KT-42032`](https://youtrack.jetbrains.com/issue/KT-42032) "AnalyzerException: Expected I, but found R" while using Flow.reduce() with suspend function reference
- [`KT-42034`](https://youtrack.jetbrains.com/issue/KT-42034) ArrayIndexOutOfBoundsException in PopBackwardPropagationTransformer on external override of function in inline class
- [`KT-42064`](https://youtrack.jetbrains.com/issue/KT-42064) "Parameter specified as non-null is null" with default value of the parameter in operator fun
- [`KT-42069`](https://youtrack.jetbrains.com/issue/KT-42069) JVM IR: -Xreport-output-files doesn't report any source files for META-INF/*.kotlin_module files
- [`KT-42083`](https://youtrack.jetbrains.com/issue/KT-42083) AbstractMethodError when 'remove' with irrelevant generic parameter but matching JVM signature is present in Kotlin collection class
- [`KT-42092`](https://youtrack.jetbrains.com/issue/KT-42092) JVM / IR: "AnalyzerException: Argument 1: expected R, but found J" when trying to add to ArrayList the result of a function applied to int
- [`KT-42175`](https://youtrack.jetbrains.com/issue/KT-42175) Psi2ir: "AssertionError: Undefined parameter referenced: <this>" on augmented assignment on this in a BuilderInference lambda
- [`KT-42179`](https://youtrack.jetbrains.com/issue/KT-42179) Platform declaration clash when extending abstract Java class implementing 'java.util.Collection' by abstract Kotlin class implementing Kotlin Set or List
- [`KT-42321`](https://youtrack.jetbrains.com/issue/KT-42321) JVM IR: do not cast integer value based on the type of a literal receiver of an operator call
- [`KT-42337`](https://youtrack.jetbrains.com/issue/KT-42337) NoSuchMethodError in JVM backend with inheritance of private functions in the interface
- [`KT-42404`](https://youtrack.jetbrains.com/issue/KT-42404) "Supertypes of the following classes cannot be resolved" in Rider project
- [`KT-42472`](https://youtrack.jetbrains.com/issue/KT-42472) No TYPE_INFERENCE_UPPER_BOUND_VIOLATED for Delegated Properties do not check types (in Kotlin 1.4.10)
- [`KT-42487`](https://youtrack.jetbrains.com/issue/KT-42487) "IndexOutOfBoundsException: Cannot pop operand off an empty stack" caused by USELESS_IS_CHECK of Double type
- [`KT-42533`](https://youtrack.jetbrains.com/issue/KT-42533) `(N until MIN_VALUE).reversed()` should be an empty progression in for loops
- [`KT-42588`](https://youtrack.jetbrains.com/issue/KT-42588) "IllegalStateException: Concrete fake override public open fun" caused by `val` override with `var` with delegation.
- [`KT-42634`](https://youtrack.jetbrains.com/issue/KT-42634) Different bridges and abstract stubs behavior in abstract class implementing Map<K, String> in JVM and JVM_IR
- [`KT-42635`](https://youtrack.jetbrains.com/issue/KT-42635) ClassCastException with inline class in for loop
- [`KT-42662`](https://youtrack.jetbrains.com/issue/KT-42662) AbstractMethodError when using partially specialized generic Map class
- [`KT-42694`](https://youtrack.jetbrains.com/issue/KT-42694) @get:Synchronized causes the JVM getter method not to be generated
- [`KT-42753`](https://youtrack.jetbrains.com/issue/KT-42753) "VerifyError: Bad invokespecial instruction: interface method reference is in an indirect superinterface" with `jvm-default=all`
- [`KT-42879`](https://youtrack.jetbrains.com/issue/KT-42879) JVM: Declaration clash in fun interface implementation returning an inline class
- [`KT-42900`](https://youtrack.jetbrains.com/issue/KT-42900) "VerifyError: Bad return type" incorrect bytecode when a property and an extension property in inline class have the same names
- [`KT-42946`](https://youtrack.jetbrains.com/issue/KT-42946) FIR2IR: Fix super-calls to Java overrides of special built-in
- [`KT-42971`](https://youtrack.jetbrains.com/issue/KT-42971) JVM: "AssertionError: Unsigned type expected: T" with UInt loop range
- [`KT-42990`](https://youtrack.jetbrains.com/issue/KT-42990) "AssertionError: Next value after NEW should be one generated by DUP" caused by extension properties with accessors annotataed as @JvmStatic
- [`KT-43034`](https://youtrack.jetbrains.com/issue/KT-43034) AssertionError: Compiler fails with complicated tailrec + inline case
- [`KT-43048`](https://youtrack.jetbrains.com/issue/KT-43048) JVM_IR: Implement coroutines state clearing
- [`KT-43050`](https://youtrack.jetbrains.com/issue/KT-43050) JVM IR: incorrect mangling for method with type parameter with inline class bound in the signature
- [`KT-43059`](https://youtrack.jetbrains.com/issue/KT-43059) Different bridges behavior in class implementing Map<String, String> in JVM and JVM_IR
- [`KT-43063`](https://youtrack.jetbrains.com/issue/KT-43063) Redundant DefaultImpls delegate is generated in old JVM backend on explicit "duplicate" inheritance from interface
- [`KT-43069`](https://youtrack.jetbrains.com/issue/KT-43069) JVM: incorrect generic signature for method with implicit return type Nothing overriding a method from Collection
- [`KT-43099`](https://youtrack.jetbrains.com/issue/KT-43099) Tailrec call in not tail-call position leads to internal compiler error
- [`KT-43106`](https://youtrack.jetbrains.com/issue/KT-43106) JVM: custom `remove` in Iterator subclass results in a synthetic bridge
- [`KT-43120`](https://youtrack.jetbrains.com/issue/KT-43120) JVM: "Expected an object reference, but found ." caused by function which is passed as reference to suspend parameter
- [`KT-43167`](https://youtrack.jetbrains.com/issue/KT-43167) JVM IR, serialization: "No mapping for symbol: VALUE_PARAMETER INSTANCE_RECEIVER" with data class containing property defined in body
- [`KT-43255`](https://youtrack.jetbrains.com/issue/KT-43255) Verify error when inheriting from an abstract class implementing Collection with stub-like method in superclass
- [`KT-43303`](https://youtrack.jetbrains.com/issue/KT-43303) NI: False negative TYPE_INFERENCE_UPPER_BOUND_VIOLATED when inferred type argument is not a subtype of type parameter upper bound
- [`KT-43333`](https://youtrack.jetbrains.com/issue/KT-43333) AbstractMethodError when calling 'toArray' from Java on a Kotlin Collection with custom internal 'toArray'
- [`KT-43334`](https://youtrack.jetbrains.com/issue/KT-43334) AbstractMethodError when calling 'remove' from Java on a Kotlin Collection with custom internal 'remove'
- [`KT-43342`](https://youtrack.jetbrains.com/issue/KT-43342) [FIR2IR] No getter or backing field found for delegated member call
- [`KT-43347`](https://youtrack.jetbrains.com/issue/KT-43347) [FIR] Synthetic setter with unmatched parameter type isn't found
- [`KT-43401`](https://youtrack.jetbrains.com/issue/KT-43401) JVM_IR. Additional `synchronized` flag on JvmOverloads-generated adapter for Synchronized function
- [`KT-43405`](https://youtrack.jetbrains.com/issue/KT-43405) Turkish locale, Linux Mint: "NoSuchMethodError: 'int[] kotlin.jvm.internal.Intrinsics$Kotlin.intArrayOf(int[])'" with `intArrayOf` function call
- [`KT-43460`](https://youtrack.jetbrains.com/issue/KT-43460) JVM: redundant private setter is generated in case of multifile facade
- [`KT-43473`](https://youtrack.jetbrains.com/issue/KT-43473) "VerifyError: Bad type on operand stack" caused by operator `get` with optional argument in superclass when called via square brackets on subclass
- [`KT-43518`](https://youtrack.jetbrains.com/issue/KT-43518) JVM_IR. Additional `strictfp` flag on JvmOverloads-generated adapter for Strictfp function
- [`KT-43569`](https://youtrack.jetbrains.com/issue/KT-43569) FIR: inapplicable candidate(s): kotlin/collections/set
- [`KT-43616`](https://youtrack.jetbrains.com/issue/KT-43616) [FIR] Nullable type parameter-based type after merge in if
- [`KT-43669`](https://youtrack.jetbrains.com/issue/KT-43669) FIR: No real overrides for FUN IR_EXTERNAL_DECLARATION_STUB
- [`KT-43682`](https://youtrack.jetbrains.com/issue/KT-43682) Inline extension method of a multifile library inline class not found
- [`KT-43687`](https://youtrack.jetbrains.com/issue/KT-43687) FIR: UnusedChecker does not take annotation arguments into account
- [`KT-43688`](https://youtrack.jetbrains.com/issue/KT-43688) FIR: unused checker doesn't handle invokes properly
- [`KT-43749`](https://youtrack.jetbrains.com/issue/KT-43749) "UnsupportedOperationException: Don't know how to generate outer expression: Closure" caused by Flow and collect method with function reference as a parameter
- [`KT-43812`](https://youtrack.jetbrains.com/issue/KT-43812) JVM IR: SAM wrapper class with generic supertype mentions missing type parameter in the signature
- [`KT-43832`](https://youtrack.jetbrains.com/issue/KT-43832) JVM IR: missing bridges for inheritance of class from interface in a complex generic diamond hierarchy
- [`KT-43851`](https://youtrack.jetbrains.com/issue/KT-43851) JVM IR: function call returning object instance is removed during constant propagation
- [`KT-43864`](https://youtrack.jetbrains.com/issue/KT-43864) JVM: "Assertion error after mandatory stack transformations: incorrect bytecode" with lateinit property of type T, which has a primitive type upperbound
- [`KT-43887`](https://youtrack.jetbrains.com/issue/KT-43887) Problem with FunctionReferenceLowering$FunctionReferenceBuilder in kotlin native
- [`KT-43912`](https://youtrack.jetbrains.com/issue/KT-43912) JVM internal error: Augment assignment and increment are not supported for local delegated properties and inline properties
- [`KT-43915`](https://youtrack.jetbrains.com/issue/KT-43915) Back-end (JVM) Internal error: wrong bytecode generated for default method
- [`KT-43938`](https://youtrack.jetbrains.com/issue/KT-43938) NSME when calling 'kotlin.Number' methods on instance of Java class extending Kolin abstract class extending 'kotlin.Number'
- [`KT-43942`](https://youtrack.jetbrains.com/issue/KT-43942) org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate function
- [`KT-43949`](https://youtrack.jetbrains.com/issue/KT-43949) FIR: unresolved callable reference as lambda return
- [`KT-43983`](https://youtrack.jetbrains.com/issue/KT-43983) IllegalStateException: "Couldn't obtain compiled function body for public final suspend inline fun" after moving inline extension function to library
- [`KT-43984`](https://youtrack.jetbrains.com/issue/KT-43984) FIR: recursion in overridden symbols
- [`KT-43984`](https://youtrack.jetbrains.com/issue/KT-43984) FIR: recursion in overridden symbols
- [`KT-44010`](https://youtrack.jetbrains.com/issue/KT-44010) FIR: Inapplicable constructor due to an unresolved reference
- [`KT-44030`](https://youtrack.jetbrains.com/issue/KT-44030) FIR2IR: uncached type parameters in delegated property
- [`KT-44032`](https://youtrack.jetbrains.com/issue/KT-44032) FIR2IR: uncached type parameters in Java field
- [`KT-44050`](https://youtrack.jetbrains.com/issue/KT-44050) FIR: anonymous object as IR parent
- [`KT-44054`](https://youtrack.jetbrains.com/issue/KT-44054) FIR2IR: incorrect IR origin for substituted override function
- [`KT-44058`](https://youtrack.jetbrains.com/issue/KT-44058) CompilationException: open suspend fun with @JvmStatic in open class companion
- [`KT-44069`](https://youtrack.jetbrains.com/issue/KT-44069) please remove deprecated usages
- [`KT-44066`](https://youtrack.jetbrains.com/issue/KT-44066) FIR Java: override ambiguity with vararg value type
- [`KT-44114`](https://youtrack.jetbrains.com/issue/KT-44114) CompilationException when inlining a extension suspend function declared in interface companion with 'this' reference to extension receiver
- [`KT-44131`](https://youtrack.jetbrains.com/issue/KT-44131) "UnsupportedOperationException: Don't know how to generate outer expression: Closure" when using suspend lambda and a function reference
- [`KT-44140`](https://youtrack.jetbrains.com/issue/KT-44140) JVM IR: compilation of kotlin.Result crashes with IOOBE while generating toString-impl
- [`KT-44141`](https://youtrack.jetbrains.com/issue/KT-44141) JVM IR: "ISE: There should be underlying type for inline class type" on usage of type parameter with Result upper bound inside a lambda
- [`KT-44192`](https://youtrack.jetbrains.com/issue/KT-44192) Allow a greater number of constants in an enum class
- [`KT-44202`](https://youtrack.jetbrains.com/issue/KT-44202) "ClassCastException" when getting delegated property with inline class and Any/Any? type
- [`KT-44210`](https://youtrack.jetbrains.com/issue/KT-44210) KJS / IR: "AssertionError: Undefined parameter referenced: <this> defined" caused by plus assign operators in build blocks
- [`KT-44233`](https://youtrack.jetbrains.com/issue/KT-44233) [IR] Collection Stub generation not correctly considering java.util Collection iterators
- [`KT-44234`](https://youtrack.jetbrains.com/issue/KT-44234) Private companion property with explicit setter generates invalid bytecode
- [`KT-44269`](https://youtrack.jetbrains.com/issue/KT-44269) "[TAILREC_ON_VIRTUAL_MEMBER_ERROR] Tailrec is not allowed on open members" with Spring annotation and private tailrec function
- [`KT-44284`](https://youtrack.jetbrains.com/issue/KT-44284) Make Kotlin binaries publicly unavailable (set KotlinCompilerVersion.IS_PRE_RELEASE = true)
- [`KT-44316`](https://youtrack.jetbrains.com/issue/KT-44316) ReenteringLazyValueComputationException when analyzing complex lazy delegate
- [`KT-44347`](https://youtrack.jetbrains.com/issue/KT-44347) Back-end (JVM) Internal error: Couldn't transform method node for suspend function with wrong local for Continuation
- [`KT-44368`](https://youtrack.jetbrains.com/issue/KT-44368) "IllegalStateException: Error type encountered" when inlining 'invoke' operator without enough information on type variable
- [`KT-44412`](https://youtrack.jetbrains.com/issue/KT-44412) JVM IR backend fails to compile break in condition of do while
- [`KT-44420`](https://youtrack.jetbrains.com/issue/KT-44420) False NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATION with 1.4.30-RC
- [`KT-44429`](https://youtrack.jetbrains.com/issue/KT-44429) JVM IR: unnecessary integer unboxing leads to NPE when using mockito-kotlin
- [`KT-44439`](https://youtrack.jetbrains.com/issue/KT-44439) Type inference of generic types failing java interop
- [`KT-44440`](https://youtrack.jetbrains.com/issue/KT-44440) Too many Nothings in inferred type
- [`KT-44471`](https://youtrack.jetbrains.com/issue/KT-44471) Fix failing script tests after switching to 1.5
- [`KT-44474`](https://youtrack.jetbrains.com/issue/KT-44474) Compiler expects sealed type inheritors from platform specific source-sets in when expression in common source-set
- [`KT-44483`](https://youtrack.jetbrains.com/issue/KT-44483) JVM IR: CCE on calling generic vararg function reference with Array expected type
- [`KT-44527`](https://youtrack.jetbrains.com/issue/KT-44527) Suspend function with kotlin.Result: ClassCastException class kotlin.Result cannot be cast to class ...
- [`KT-44529`](https://youtrack.jetbrains.com/issue/KT-44529) Inline class calls wrong iterator method in for loop
- [`KT-44533`](https://youtrack.jetbrains.com/issue/KT-44533) JVM IR: ClassFormatError on synthetic $suspendImpl method generated in interface for a @JvmDefault function
- [`KT-44540`](https://youtrack.jetbrains.com/issue/KT-44540) Regression in 1.4.30 in intellij-community: type mismatch for generic function call with generic Java class
- [`KT-44546`](https://youtrack.jetbrains.com/issue/KT-44546) NI: changed variable fixation order (that can lead to changed resolution)
- [`KT-44550`](https://youtrack.jetbrains.com/issue/KT-44550) KotlinBinaryClassCache leaks Kotlin plugin classloader on plugin unload
- [`KT-44563`](https://youtrack.jetbrains.com/issue/KT-44563) Type Inference loosing type annotations in lambda type expectation for function calls with block parameters
- [`KT-44546`](https://youtrack.jetbrains.com/issue/KT-44546) NI: changed variable fixation order (that can lead to changed resolution)
- [`KT-44583`](https://youtrack.jetbrains.com/issue/KT-44583) "Supertypes of the following classes cannot be resolved" error message gives no context
- [`KT-44627`](https://youtrack.jetbrains.com/issue/KT-44627) JVM IR: ACCIDENTAL_OVERRIDE when overriding a generic field where the type parameter has a primitive bound
- [`KT-44631`](https://youtrack.jetbrains.com/issue/KT-44631) "IndexOutOfBoundsException: Cannot pop operand off an empty stack" caused by a default param in inner class constructor which uses method or field from receiver
- [`KT-44647`](https://youtrack.jetbrains.com/issue/KT-44647) "IllegalAccessError: class TestKt tried to access private method" with String Builder `get` and `inc` operator
- [`KT-44651`](https://youtrack.jetbrains.com/issue/KT-44651) JVM / IR: "IllegalStateException: Illegal type substitutor" with if-else inside class constructor argument inside another if-else
- [`KT-44660`](https://youtrack.jetbrains.com/issue/KT-44660) Internal inline functions in companion object with inline class return type fails compilation
- [`KT-44671`](https://youtrack.jetbrains.com/issue/KT-44671) JVM_IR: ClassCastException: Result$Failure cannot be cast to Result with multithreaded coroutines
- [`KT-44703`](https://youtrack.jetbrains.com/issue/KT-44703) JVM / IR: "IllegalStateException: Unhandled special name in mangledNameFor" caused by a reference to inline class inside interface's companion with lazy initialization
- [`KT-44712`](https://youtrack.jetbrains.com/issue/KT-44712) JVM / IR: Behavior change after enabling with Mockito
- [`KT-44714`](https://youtrack.jetbrains.com/issue/KT-44714) Debugger / Coroutines: Local variables are trimmed out too aggressively
- [`KT-44722`](https://youtrack.jetbrains.com/issue/KT-44722) JVM IR: ClassCastException with inline class, let and bound function reference
- [`KT-44726`](https://youtrack.jetbrains.com/issue/KT-44726) JVM IR: Incorrect KType nullability for platform type reified as non-null
- [`KT-44781`](https://youtrack.jetbrains.com/issue/KT-44781) JVM IR: java.lang.NoSuchFieldError: $noName_0 when calling a crossinline lambda within a suspending lambda
- [`KT-44798`](https://youtrack.jetbrains.com/issue/KT-44798) JVM IR: Inherited platform declarations clash for class implementing both List and Set
- [`KT-44801`](https://youtrack.jetbrains.com/issue/KT-44801) 1.4.30 JVM IR: Unbound symbols not allowed with anonymous object
- [`KT-44803`](https://youtrack.jetbrains.com/issue/KT-44803) FIR bootstrap: incorrect nullability is set for type alias-based type
- [`KT-44827`](https://youtrack.jetbrains.com/issue/KT-44827) Non-existing outer class is written in anonymous class for SAM wrapper in inline lambda with capture
- [`KT-44837`](https://youtrack.jetbrains.com/issue/KT-44837) JVM / IR: ClassCastException with Result object when it is used by a generic method in a suspend call
- [`KT-44875`](https://youtrack.jetbrains.com/issue/KT-44875) JVM_IR. `hashCode` call is generated on interface target in fun interface equality
- [`KT-44878`](https://youtrack.jetbrains.com/issue/KT-44878) JVM_IR: "IllegalStateException: Unexpected types" when checking non-nullable variable is `in` range between nullable ones with smart-cast
- [`KT-44926`](https://youtrack.jetbrains.com/issue/KT-44926) MPP: Actual typealias to compiled inline class incompatible with expect inline class
- [`KT-44947`](https://youtrack.jetbrains.com/issue/KT-44947) Sealed interfaces: Sealed fun interface leads to "NoWhenBranchMatchedException"
- [`KT-44993`](https://youtrack.jetbrains.com/issue/KT-44993) JVM IR: VerifyError on getfield with Kotlin generic field and elvis operator
- [`KT-44974`](https://youtrack.jetbrains.com/issue/KT-44974) LambdaConversionException in case of SAM-converted captuing extension lambda
- [`KT-45008`](https://youtrack.jetbrains.com/issue/KT-45008) JVM IR: hashCode is generated as invokeinterface if smart cast to interface is present
- [`KT-45011`](https://youtrack.jetbrains.com/issue/KT-45011) JVM / IR: "AssertionError: Unbound symbols not allowed"
- [`KT-45022`](https://youtrack.jetbrains.com/issue/KT-45022) IR: "AssertionError: Undefined variable referenced" from psi2ir caused by plusAssign operator of object
- [`KT-45064`](https://youtrack.jetbrains.com/issue/KT-45064) JVM IR: "java.lang.AssertionError: SyntheticAccessorLowering should not attempt to modify other files!" with member reference to property in another file with private setter
- [`KT-45067`](https://youtrack.jetbrains.com/issue/KT-45067) "IllegalArgumentException: Wildcard mast have a bound for annotation of WILDCARD_BOUND position" with BEAM SDK 2.27
- [`KT-45069`](https://youtrack.jetbrains.com/issue/KT-45069) JVM / IR: New SAM conversions mode fails when converting from Unit to Any
- [`KT-45131`](https://youtrack.jetbrains.com/issue/KT-45131) JVM / IR: "RuntimeException: Lambda, SAM or anonymous object should have only one constructor" caused by inline class that type cast to reified type parameter inside lambda in inline function
- [`KT-45139`](https://youtrack.jetbrains.com/issue/KT-45139) Inline class: AssertionError: Expected top level inline class
- [`KT-45166`](https://youtrack.jetbrains.com/issue/KT-45166) JVM / IR: "AbstractMethodError: Receiver class does not define or inherit an implementation of the resolved method of interface" caused by interface with suspend function
- [`KT-45187`](https://youtrack.jetbrains.com/issue/KT-45187) JVM / IR: ClassCastException caused by substituting generic type of vararg parameter with java.lang.Void
- [`KT-45195`](https://youtrack.jetbrains.com/issue/KT-45195) JVM IR: annotation methods are generated as default interface methods if `allopen` is used
- [`KT-45243`](https://youtrack.jetbrains.com/issue/KT-45243) "IllegalStateException: Lambdas shouldn't be visited by ESExpressionVisitor" caused by lambda inside `kotlin.test.assertNotNull`
- [`KT-45259`](https://youtrack.jetbrains.com/issue/KT-45259) JVM: ClassCastException caused by Result as lambda parameter type
- [`KT-45292`](https://youtrack.jetbrains.com/issue/KT-45292) AssertionError with recursive inline extension property
- [`KT-45300`](https://youtrack.jetbrains.com/issue/KT-45300) Deprecate super calls in public-api inline functions
- [`KT-45409`](https://youtrack.jetbrains.com/issue/KT-45409) Rename jspecify annotations package and default not null annotation
- [`KT-45446`](https://youtrack.jetbrains.com/issue/KT-45446) JVM / IR: NullPointerException caused by unreachable code and comparison
- [`KT-45721`](https://youtrack.jetbrains.com/issue/KT-45721) JVM / IR: "Unbound symbols not allowed" caused by class reference in sequence lambda
- [`KT-45853`](https://youtrack.jetbrains.com/issue/KT-45853) JVM / IR: "Accidental override" caused by inheriting Throwable.getCause from Java interface
- [`KT-45861`](https://youtrack.jetbrains.com/issue/KT-45861) Turning warnings into errors for calls with type parameters annotated by @OnlyInputTypes
- [`KT-45865`](https://youtrack.jetbrains.com/issue/KT-45865) JVM IR: "VerifyError: Bad type on operand stack" with `enumValueOf` on a value from a list of strings
- [`KT-45868`](https://youtrack.jetbrains.com/issue/KT-45868) JVM IR: ClassCastException with SAM function in init block when SAM is generated via invokedynamic
- [`KT-45920`](https://youtrack.jetbrains.com/issue/KT-45920) JVM IR: "Accidental override" on redefining `get()` in custom Map class
- [`KT-45934`](https://youtrack.jetbrains.com/issue/KT-45934) JVM IR: "java.lang.IllegalStateException: Function has no body" for class implementing interface by delegation
- [`KT-45945`](https://youtrack.jetbrains.com/issue/KT-45945) JVM / IR: "AssertionError: Unexpected variance in super type argument" with contravariance and intersection types
- [`KT-45963`](https://youtrack.jetbrains.com/issue/KT-45963) JVM / IR: "AbstractMethodError: Receiver class does not define or inherit an implementation of the resolved method" in Dokka tests
- [`KT-45967`](https://youtrack.jetbrains.com/issue/KT-45967) JVM IR: "IllegalAccessError" with invokedynamic to Java SAM over callable reference to private function
- [`KT-45982`](https://youtrack.jetbrains.com/issue/KT-45982) Wrong subtyping result on captured types with postponed type variables
- [`KT-46007`](https://youtrack.jetbrains.com/issue/KT-46007) JVM / IR: "ClassCastException: kotlin.Unit cannot be cast to java.lang.String" caused by default suspend function in interface
- [`KT-46060`](https://youtrack.jetbrains.com/issue/KT-46060) JVM IR: NullPointerException from RangeContainsLowering when `contains` is a @JvmStatic function in object
- [`KT-46069`](https://youtrack.jetbrains.com/issue/KT-46069) JVM IR: unbound type parameter on generic bound adapted function reference
- [`KT-46092`](https://youtrack.jetbrains.com/issue/KT-46092) JVM IR: AssertionError "Array type expected: @[FlexibleNullability] kotlin.CharArray?" on super call to Java constructor with primitive vararg
- [`KT-46104`](https://youtrack.jetbrains.com/issue/KT-46104) The message on inline -> value class migration should not say that inline classes are deprecated
- [`KT-46131`](https://youtrack.jetbrains.com/issue/KT-46131) Kotlin 1.5.0-RC errors when reading class file
- [`KT-46160`](https://youtrack.jetbrains.com/issue/KT-46160) JVM IR: IllegalAccessException at runtime for member reference to JvmMultifileClass member from stdlib
- [`KT-46186`](https://youtrack.jetbrains.com/issue/KT-46186) Type inference regression in Kotlin 1.5 with constrained generic return types
### Docs & Examples
- [`KT-45884`](https://youtrack.jetbrains.com/issue/KT-45884) Incorrect description for JVM `toUpperCase` method
### IDE
- [`KT-33233`](https://youtrack.jetbrains.com/issue/KT-33233) Use dependency of library to build built-ins in IDE, instead of loading them from the current classloader
- [`KT-34023`](https://youtrack.jetbrains.com/issue/KT-34023) kotlin.KotlinNullPointerException at org.jetbrains.kotlin.backend.common.FunctionsFromAnyGenerator.getPrimaryConstructorProperties(FunctionsFromAnyGenerator.kt:66)
- [`KT-35947`](https://youtrack.jetbrains.com/issue/KT-35947) KFunctionN.call is unresolved in IDE in Kotlin/JVM project
- [`KT-37702`](https://youtrack.jetbrains.com/issue/KT-37702) Code analysis speed: on-the-fly analysis diagnostics reporting
- [`KT-41048`](https://youtrack.jetbrains.com/issue/KT-41048) [FIR-IDE] Properly implement methods in KtFirPackageScope
- [`KT-41671`](https://youtrack.jetbrains.com/issue/KT-41671) Missing nullability information in properties using type inference from get()
- [`KT-43824`](https://youtrack.jetbrains.com/issue/KT-43824) KtLightClassForSourceDeclaration#isInheritor works in a different way than java implementation
- [`KT-44128`](https://youtrack.jetbrains.com/issue/KT-44128) IDE: Kotlin JVM record has incorrect property accessors as seen from Java
- [`KT-44487`](https://youtrack.jetbrains.com/issue/KT-44487) MPP, IDE: No error in IDE when sealed class inheritor from common source-set is not used in exhaustive when expression in platform source-set
- [`KT-45254`](https://youtrack.jetbrains.com/issue/KT-45254) Highlighting for files with certain errors appears only on second opening
- [`KT-46097`](https://youtrack.jetbrains.com/issue/KT-46097) Light classes: Incomplete nullability information for a getter method of a kotlin property defined in private constructor
### IDE. Decompiler, Indexing, Stubs
@@ -769,18 +140,6 @@
### IDE. Gradle Integration
- [`KT-37127`](https://youtrack.jetbrains.com/issue/KT-37127) Implement precise importing of platforms of root source sets (commonMain/commonTest) when hierarchical multiplatform support is enabled
- [`KT-42048`](https://youtrack.jetbrains.com/issue/KT-42048) KJS / Gradle integration: Could not determine the dependencies of task ':webApp:testPackageJson' in Android Studio 4.2 Canary 11
### IDE. Gradle. Script
- [`KT-46215`](https://youtrack.jetbrains.com/issue/KT-46215) Dead lock on closing project during the import in IJ211 through ScriptDefinitionsManager
### IDE. Inspections and Intentions
- [`KT-23824`](https://youtrack.jetbrains.com/issue/KT-23824) Return lifted out of if condition causes suspend tail call optimization to no longer apply
- [`KT-38155`](https://youtrack.jetbrains.com/issue/KT-38155) Lift assignment out of 'if' produces type mismatch without manually adding a semicolon
- [`KT-44821`](https://youtrack.jetbrains.com/issue/KT-44821) IDE: False positive NO_ELSE_IN_WHEN caused by sealed class and when in another module
- [`KT-46088`](https://youtrack.jetbrains.com/issue/KT-46088) [IDEA] Incorrect behavior of replace inline class with value class intention
### IDE. Misc
@@ -788,7 +147,6 @@
### IDE. Refactorings
- [`KT-44079`](https://youtrack.jetbrains.com/issue/KT-44079) Sealed Interfaces: Move refactoring should warn about violation of hierarchy restrictions
- [`KT-44839`](https://youtrack.jetbrains.com/issue/KT-44839) Sealed interfaces: move refactoring warnings works with "more freedom for sealed classes" rules for language level < 1.5
### IDE. Script
@@ -799,29 +157,17 @@
- [`KT-39272`](https://youtrack.jetbrains.com/issue/KT-39272) KJS / IR: Can't use javascript keywords as JsName
- [`KT-41650`](https://youtrack.jetbrains.com/issue/KT-41650) JS IR BE: `default` should be a reserved identifier
- [`KT-42176`](https://youtrack.jetbrains.com/issue/KT-42176) KJS / IR: Interface default method in sub-interface not resolved correctly from extension on super-interface
- [`KT-44103`](https://youtrack.jetbrains.com/issue/KT-44103) [JSIR] TypeError when bumping from 1.4.20 to 1.4.30-M1
- [`KT-44180`](https://youtrack.jetbrains.com/issue/KT-44180) KJS / IR: NPE in ConstTransformer of compileDevelopmentExecutableKotlinJs/compileProductionExecutableKotlinJs tasks
- [`KT-44415`](https://youtrack.jetbrains.com/issue/KT-44415) Kotlin/JS with IR and kotlin-react: "too much recursion" error in runtime in browser
- [`KT-44433`](https://youtrack.jetbrains.com/issue/KT-44433) KJS IR: support function interfaces with suspend member
- [`KT-44469`](https://youtrack.jetbrains.com/issue/KT-44469) KJS / IR: Incorrect export functions with bridges
- [`KT-44718`](https://youtrack.jetbrains.com/issue/KT-44718) MPP/ KJS: "IllegalStateException: Unsupported operation" with serialization plugin and incremental compilation
- [`KT-44796`](https://youtrack.jetbrains.com/issue/KT-44796) KJS / IR: default parameter of function with @JsName leads to "RangeError: Maximum call stack size exceeded"
- [`KT-45059`](https://youtrack.jetbrains.com/issue/KT-45059) KJS / IR: Add possibility for runtime diagnostics of DCE result
### Libraries
- [`KT-12109`](https://youtrack.jetbrains.com/issue/KT-12109) Add stdlib method that combines mapNotNull() and first/firstOrNull()
- [`KT-25571`](https://youtrack.jetbrains.com/issue/KT-25571) Make random implementations serializable
- [`KT-26234`](https://youtrack.jetbrains.com/issue/KT-26234) Floored division and remainder function for numeric types
- [`KT-32996`](https://youtrack.jetbrains.com/issue/KT-32996) kotlin.test: add assertContentEquals for comparing content of arrays, iterables, sequences
- [`KT-39177`](https://youtrack.jetbrains.com/issue/KT-39177) Make CharCategory available in common multiplatform code
- [`KT-40225`](https://youtrack.jetbrains.com/issue/KT-40225) Support adding kotlin-test as a single dependency, as it should be with a multiplatform library
- [`KT-42071`](https://youtrack.jetbrains.com/issue/KT-42071) Strict version of String.toBoolean()
- [`KT-42720`](https://youtrack.jetbrains.com/issue/KT-42720) Kotlin ArrayDeque on JVM: provide optimized toArray method
- [`KT-42840`](https://youtrack.jetbrains.com/issue/KT-42840) Commonize and generalize String.contentEquals that is currently JVM-only
- [`KT-43772`](https://youtrack.jetbrains.com/issue/KT-43772) Kotlin/Native unfinished workers detected.
- [`KT-44168`](https://youtrack.jetbrains.com/issue/KT-44168) Prevent storing NaN and negative zero in kotlin.time.Duration
- [`KT-44369`](https://youtrack.jetbrains.com/issue/KT-44369) Commonize Char.titlecaseChar() and Char.titlecase() that are currently JVM-only
- [`KT-44783`](https://youtrack.jetbrains.com/issue/KT-44783) Add IS_VALUE flag for value classes to kotlinx-metadata-jvm
- [`KT-44815`](https://youtrack.jetbrains.com/issue/KT-44815) Remove kotlin-annotations-android and JVM compiler support for @ParameterName/@DefaultValue/@DefaultNull
@@ -829,27 +175,17 @@
### Middle-end. IR
- [`KT-43831`](https://youtrack.jetbrains.com/issue/KT-43831) Compilation failed, IrSimpleFunctionPublicSymbolImpl is already bound
- [`KT-44100`](https://youtrack.jetbrains.com/issue/KT-44100) KJS / IR: Top level declarations added in IR plugin are not referenceable from other modules
- [`KT-45170`](https://youtrack.jetbrains.com/issue/KT-45170) IR: "AssertionError: Single expression value for GET_OBJECT" caused by inc operator of field inside scope function inside object
### Native
- [`KT-42446`](https://youtrack.jetbrains.com/issue/KT-42446) Native: SIGSEGV in Kotlin_Array_get on linuxArm64
- [`KT-43502`](https://youtrack.jetbrains.com/issue/KT-43502) [K/N] relocation R_X86_64_PC32 cannot be used against symbol __environ; recompile with -fPIC
- [`KT-44295`](https://youtrack.jetbrains.com/issue/KT-44295) 1.4.21 Kotlin native ndk compiler crash
- [`KT-44774`](https://youtrack.jetbrains.com/issue/KT-44774) ld fails with CALL16 reloc at 0x48f00 not against global symbol (Linux MIPS)
- [`KT-44746`](https://youtrack.jetbrains.com/issue/KT-44746) Different hashCode() results for Kotlin/Native stdlib
### Native. C and ObjC Import
- [`KT-44824`](https://youtrack.jetbrains.com/issue/KT-44824) cinterop tool no longer appends .klib to produced klibs
### Native. C Export
- [`KT-36639`](https://youtrack.jetbrains.com/issue/KT-36639) MPP: Build ios "staticLib" or "sharedLib" binary failed if interface contains member extension function
- [`KT-41725`](https://youtrack.jetbrains.com/issue/KT-41725) Dynamic library doesn't load on raspberrypi
### Native. ObjC Export
- [`KT-44549`](https://youtrack.jetbrains.com/issue/KT-44549) In the Xcode debug session, call stack is missing a frame when the iOS app fails
@@ -863,62 +199,21 @@
- [`KT-44594`](https://youtrack.jetbrains.com/issue/KT-44594) Avoid using unnecessary array types reflection in kotlin-reflect
- [`KT-44782`](https://youtrack.jetbrains.com/issue/KT-44782) Add KClass.isValue to kotlin-reflect
### Tools. Ant
- [`KT-16227`](https://youtrack.jetbrains.com/issue/KT-16227) Ant task: do not include runtime by default if destination is a jar
- [`KT-44293`](https://youtrack.jetbrains.com/issue/KT-44293) Support fork mode in kotlinc Ant task
### Tools. CLI
- [`KT-17344`](https://youtrack.jetbrains.com/issue/KT-17344) Include kotlin-reflect to resulting jar if "-include-runtime" is specified
- [`KT-43220`](https://youtrack.jetbrains.com/issue/KT-43220) -include-runtime should add .kotlin_builtins to the output
- [`KT-43704`](https://youtrack.jetbrains.com/issue/KT-43704) Illegal reflective access by com.intellij.util.ReflectionUtil to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
- [`KT-44078`](https://youtrack.jetbrains.com/issue/KT-44078) Do not include module-info.class of kotlin-stdlib.jar to the resulting jar with -include-runtime
- [`KT-44232`](https://youtrack.jetbrains.com/issue/KT-44232) CLI: do not pass -noverify to java process starting from JDK 13
- [`KT-45566`](https://youtrack.jetbrains.com/issue/KT-45566) JDK 16 - e: java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel
### Tools. CLI. Native
- [`KT-43874`](https://youtrack.jetbrains.com/issue/KT-43874) Native / CLI: provide a way to show difference between Jvm and Native compilers
### Tools. Compiler Plugins
- [`KT-45783`](https://youtrack.jetbrains.com/issue/KT-45783) Serialization: "AnalyzerException: Expected an object reference, but found I" caused by `JvmInline` and `Serializable` annotations
### Tools. Gradle
- [`KT-31027`](https://youtrack.jetbrains.com/issue/KT-31027) java.lang.NoSuchMethodError: No static method hashCode(Z)I in class Ljava/lang/Boolean; or its super classes (declaration of 'java.lang.Boolean' appears in /system/framework/core-libart.jar)
- [`KT-43605`](https://youtrack.jetbrains.com/issue/KT-43605) Kotlin Gradle Plugin 1.4.20 undeclared system property reads cause problems with Gradle configuration cache enabled
- [`KT-44204`](https://youtrack.jetbrains.com/issue/KT-44204) Kotlin Gradle Plugin 1.4.21 makes impossible to use ANTLR in other plugins
- [`KT-44361`](https://youtrack.jetbrains.com/issue/KT-44361) Gradle: deprecate options includeRuntime, noStdlib, noReflect
- [`KT-44462`](https://youtrack.jetbrains.com/issue/KT-44462) Kotlin Gradle plugin creates `compile` configuration with Gradle 7.0
- [`KT-44834`](https://youtrack.jetbrains.com/issue/KT-44834) Gradle Kotlin DSL: Add `languageSettings` configuration lambda without `apply` call
- [`KT-44949`](https://youtrack.jetbrains.com/issue/KT-44949) Compatibility with Gradle 7.0
- [`KT-44957`](https://youtrack.jetbrains.com/issue/KT-44957) gradle - target.compilations seems to be deprecated
- [`KT-45340`](https://youtrack.jetbrains.com/issue/KT-45340) Update minimal supported version of Kotlin Gradle Plugin to 6.1
### Tools. Gradle. JS
- [`KT-43237`](https://youtrack.jetbrains.com/issue/KT-43237) KJS: `-jsLegacy` Naming Convention is incompatible with NPM
- [`KT-43869`](https://youtrack.jetbrains.com/issue/KT-43869) Error in webpack configuration not displayed
- [`KT-44614`](https://youtrack.jetbrains.com/issue/KT-44614) Update Node.JS and Yarn versions
- [`KT-44616`](https://youtrack.jetbrains.com/issue/KT-44616) Kotlin/JS: IR backend with React: "Uncaught TypeError: _this__0 is undefined" runtime error in browser
- [`KT-45574`](https://youtrack.jetbrains.com/issue/KT-45574) Sync Kotlin/JS compile tasks into one folder (build/js/packages/<package>/kotlin)
### Tools. Gradle. Multiplatform
- [`KT-42098`](https://youtrack.jetbrains.com/issue/KT-42098) Commonizer is re-launched for every included Gradle build
- [`KT-43116`](https://youtrack.jetbrains.com/issue/KT-43116) Merge together MultiplatformHighlightingTest and MultiplatformAnalysisTest
- [`KT-44322`](https://youtrack.jetbrains.com/issue/KT-44322) KotlinTargetComponent maintenance for -sources.jar
- [`KT-44900`](https://youtrack.jetbrains.com/issue/KT-44900) Support gradle configuration cache with kotlin.multiplatform plugin
### Tools. Gradle. Native
- [`KT-46122`](https://youtrack.jetbrains.com/issue/KT-46122) kotlinx-serialization and kotlinx-datetime can't be built with 1.5.0-RC
### Tools. JPS
- [`KT-13631`](https://youtrack.jetbrains.com/issue/KT-13631) Compilation fails on Turkish locale because of locale-sensitive uppercasing
- [`KT-44644`](https://youtrack.jetbrains.com/issue/KT-44644) Mark all `@JvmMultifileClass` parts compiled in the previous round as dirty in the JPS plugin, similarly to how its done in the Gradle plugin
### Tools. Scripts
@@ -928,14 +223,10 @@
### Tools. kapt
- [`KT-43686`](https://youtrack.jetbrains.com/issue/KT-43686) KaptWithoutKotlincTask should use `@CompileClasspath` for `kotlinStdlibClasspath` for cache relocateability.
- [`KT-44130`](https://youtrack.jetbrains.com/issue/KT-44130) KAPT changes field order in 1.4.30-M1
- [`KT-44909`](https://youtrack.jetbrains.com/issue/KT-44909) Kapt: ReenteringLazyValueComputationException without stacktrace caused by `when` expression with sealed class function without explicit return type
- [`KT-45168`](https://youtrack.jetbrains.com/issue/KT-45168) KAPT: Java stubs generated for Kotlin files generated by annotation processors
## Recent ChangeLogs:
### [ChangeLog-1.4.X](docs/changelogs/ChangeLog-1.4.X.md)
### [ChangeLog-1.3.X](docs/changelogs/ChangeLog-1.3.X.md)
### [ChangeLog-1.2.X](docs/changelogs/ChangeLog-1.2.X.md)
### [ChangeLog-1.1.X](docs/changelogs/ChangeLog-1.1.X.md)

View File

@@ -4,7 +4,7 @@
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.jetbrains.com/scans?search.rootProjectNames=Kotlin)
# Kotlin Programming Language
# Kotlin Programming Language!!!
Welcome to [Kotlin](https://kotlinlang.org/)!
It is an open-source, statically typed programming language supported and developed by [JetBrains](https://www.jetbrains.com/) and open-source contributors.
@@ -35,36 +35,32 @@ Support for multiplatform programming is one of Kotlins key benefits. It redu
## Editing Kotlin
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html) ([source code](https://github.com/JetBrains/intellij-community/tree/master/plugins/kotlin))
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
* [Kotlin Eclipse Plugin](https://kotlinlang.org/docs/tutorials/getting-started-eclipse.html)
* [Kotlin Sublime Text Package](https://github.com/vkostyukov/kotlin-sublime-package)
## Build environment requirements
This repository is using [Gradle toolchains](https://docs.gradle.org/current/userguide/toolchains.html) feature
to select and auto-provision required JDKs from [AdoptOpenJdk](https://adoptopenjdk.net) project.
In order to build Kotlin distribution you need to have:
Unfortunately [AdoptOpenJdk](https://adoptopenjdk.net) project does not provide required JDK 1.6 and 1.7 images,
so you could either download them manually and provide path to installation via `JDK_16` and `JDK_17` environment variables or
use following SDK managers:
- [Asdf-vm](https://asdf-vm.com/)
- [Jabba](https://github.com/shyiko/jabba)
- [SDKMAN!](https://sdkman.io/)
- JDK 1.6, 1.7, 1.8 and 9
- Setup environment variables as following:
Alternatively, it is still possible to only provide required JDKs via environment variables
(see [gradle.properties](./gradle.properties#L5) for supported variable names). To ensure Gradle uses only JDKs
from environmental variables - disable Gradle toolchain auto-detection by passing `-Porg.gradle.java.installations.auto-detect=false` option
(or put it into `$GRADLE_USER_HOME/gradle.properties`).
JAVA_HOME="path to JDK 1.8"
JDK_16="path to JDK 1.6"
JDK_17="path to JDK 1.7"
JDK_18="path to JDK 1.8"
JDK_9="path to JDK 9"
For local development, if you're not working on bytecode generation or the standard library, it's OK to avoid installing JDK 1.6 and JDK 1.7.
Add `kotlin.build.isObsoleteJdkOverrideEnabled=true` to the `local.properties` file, so build will only use JDK 1.8+. Note, that in this
case, build will have Gradle remote build cache misses for some tasks.
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 1.8 and JDK 9 installed, and to point `JDK_16` and `JDK_17` environment variables to your JDK 1.8 installation.
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties) to setup `JDK_*` variables.
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
```bash
$ brew tap homebrew/cask-versions
$ brew install --cask java6
$ brew tap caskroom/versions
$ brew cask install java6
```
On Windows you might need to add long paths setting to the repo:
@@ -97,28 +93,29 @@ command line parameters on the first run:
- `clean` - clean build results
- `dist` - assembles the compiler distribution into `dist/kotlinc/` folder
- `ideaPlugin` - assembles the Kotlin IDEA plugin distribution into `dist/artifacts/ideaPlugin/Kotlin/` folder
- `install` - build and install all public artifacts into local maven repository
- `runIde` - build IDEA plugin and run IDEA with it
- `coreLibsTest` - build and run stdlib, reflect and kotlin-test tests
- `gradlePluginTest` - build and run gradle plugin tests
- `compilerTest` - build and run all compiler tests
- `ideaPluginTest` - build and run all IDEA plugin tests
To reproduce TeamCity build use `-Pteamcity=true` flag. Local builds don't run proguard and have jar compression disabled by default.
**OPTIONAL:** Some artifacts, mainly Maven plugin ones, are built separately with Maven.
Refer to [libraries/ReadMe.md](libraries/ReadMe.md) for details.
To build Kotlin/Native, see
[kotlin-native/README.md](kotlin-native/README.md#building-from-source).
### Building for different versions of IntelliJ IDEA and Android Studio
Kotlin plugin is intended to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, the project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting a non-default platform.
Kotlin plugin is intended to work with several recent versions of IntelliJ IDEA and Android Studio. Each platform is allowed to have a different set of features and might provide a slightly different API. Instead of using several parallel Git branches, project stores everything in a single branch, but files may have counterparts with version extensions (\*.as32, \*.172, \*.181). The primary file is expected to be replaced with its counterpart when targeting non-default platform.
A More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
More detailed description of this scheme can be found at https://github.com/JetBrains/bunches/blob/master/ReadMe.md.
Usually, there's no need to care about multiple platforms as all features are enabled everywhere by default. Additional counterparts should be created if there's an expected difference in behavior or an incompatible API usage is required **and** there's no reasonable workaround to save source compatibility. Kotlin plugin contains a pre-commit check that shows a warning if a file has been updated without its counterparts.
Development for some particular platform is possible after 'switching' that can be done with the [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
Development for some particular platform is possible after 'switching' that can be done with [Bunch Tool](https://github.com/JetBrains/bunches/releases) from the command line.
```sh
cd kotlin-project-dir
@@ -140,6 +137,37 @@ To be able to run tests from IntelliJ easily, check `Delegate IDE build/run acti
At this time, you can use the latest released `1.3.x` version of the Kotlin plugin for working with the code. To make sure you have the latest version installed, use `Tools` -> `Kotlin` -> `Configure Kotlin Plugin Updates`.
### Compiling and running
From this root project there are Run/Debug Configurations for running `IDEA` or the `Generate Compiler Tests` for example; so if you want to try out the latest and greatest IDEA plugin
* `VCS` -> `Git` -> `Pull`
* Run the `IDEA` run configuration in the project
* A child IntelliJ IDEA with the Kotlin plugin will then startup
### Including into composite build
To include kotlin compiler into [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) you need to define `dependencySubstitution` for `kotlin-compiler` module in `settings.gradle.kts`
```Kotlin
includeBuild("/path/to/kotlin") {
dependencySubstitution {
substitute(module("org.jetbrains.kotlin:kotlin-compiler"))
.with(project(":include:kotlin-compiler"))
}
}
```
or in `settings.gradle`
```Groovy
includeBuild('/path/to/kotlin') {
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
}
}
```
### Dependency verification
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the

View File

@@ -1,11 +1,11 @@
import kotlinx.benchmark.gradle.benchmark
val benchmarks_version = "0.3.1"
val benchmarks_version = "0.3.0"
plugins {
java
kotlin("jvm")
id("org.jetbrains.kotlinx.benchmark") version "0.3.1"
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
}
dependencies {
@@ -67,16 +67,18 @@ benchmark {
}
}
tasks.matching { it is Zip && it.name == "mainBenchmarkJar" }.configureEach {
this as Zip
isZip64 = true
archiveFileName.set("benchmarks.jar")
}
val benchmarkTasks = listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark")
tasks.matching { it is JavaExec && it.name in benchmarkTasks }.configureEach {
this as JavaExec
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
tasks.named("classes") {
doLast {
tasks.named("mainBenchmarkJar", Zip::class.java) {
isZip64 = true
archiveName = "benchmarks.jar"
}
listOf("mainBenchmark", "mainFirBenchmark", "mainNiBenchmark").forEach {
tasks.named(it, JavaExec::class.java) {
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
}
}
}
}
tasks.register<JavaExec>("runBenchmark") {

View File

@@ -12,7 +12,6 @@ import com.intellij.psi.PsiFileFactory
import com.intellij.psi.impl.PsiFileFactoryImpl
import com.intellij.psi.search.GlobalSearchScope
import com.intellij.testFramework.LightVirtualFile
import org.jetbrains.kotlin.ObsoleteTestInfrastructure
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
@@ -25,9 +24,8 @@ import org.jetbrains.kotlin.context.withModule
import org.jetbrains.kotlin.context.withProject
import org.jetbrains.kotlin.descriptors.impl.ModuleDescriptorImpl
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.fir.builder.PsiHandlingMode
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.createSessionForTests
import org.jetbrains.kotlin.fir.createSession
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
@@ -149,13 +147,12 @@ abstract class AbstractSimpleFileBenchmark {
bh.consume(result.shouldGenerateCode)
}
@OptIn(ObsoleteTestInfrastructure::class)
private fun analyzeGreenFileIr(bh: Blackhole) {
val scope = GlobalSearchScope.filesScope(env.project, listOf(file.virtualFile))
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSessionForTests(env, scope)
val session = createSession(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, PsiHandlingMode.COMPILER)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
val totalTransformer = FirTotalResolveProcessor(session)
val firFile = builder.buildFirFile(file).also(firProvider::recordFile)

View File

@@ -23,6 +23,9 @@ dependencies {
testCompile(commonDep("junit:junit"))
testCompile(protobufFull())
testCompile(kotlinStdlib())
Platform[193].orLower {
testCompileOnly(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testRuntime(project(":kotlin-reflect"))
}

View File

@@ -40,7 +40,7 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
): T
fun create(args: CommonCompilerArguments): T {
val languageVersion = args.languageVersion?.let { LanguageVersion.fromVersionString(it) } ?: LanguageVersion.LATEST_STABLE
val languageVersion = args.languageVersion?.let((LanguageVersion)::fromVersionString) ?: LanguageVersion.LATEST_STABLE
return create(
isEAP = languageVersion.isPreRelease(),
@@ -51,7 +51,7 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
ownVersion = OWN_VERSION,
coroutinesVersion = COROUTINES_VERSION,
multiplatformVersion = MULTIPLATFORM_VERSION,
metadataVersionArray = args.metadataVersion?.let { BinaryVersion.parseVersionArray(it) }
metadataVersionArray = args.metadataVersion?.let((BinaryVersion)::parseVersionArray)
)
}

View File

@@ -26,17 +26,15 @@ open class GeneratedFile(
val outputFile: File
) {
val sourceFiles = sourceFiles.sortedBy { it.path }
override fun toString(): String = "${this::class.java.simpleName}: $outputFile"
}
class GeneratedJvmClass(
sourceFiles: Collection<File>,
outputFile: File
class GeneratedJvmClass (
sourceFiles: Collection<File>,
outputFile: File
) : GeneratedFile(sourceFiles, outputFile) {
val outputClass = LocalFileKotlinClass.create(outputFile).sure {
"Couldn't load KotlinClass from $outputFile; it may happen because class doesn't have valid Kotlin annotations"
}
}
fun File.isModuleMappingFile() = extension == ModuleMapping.MAPPING_FILE_EXT && parentFile.name == "META-INF"
fun File.isModuleMappingFile() = extension == ModuleMapping.MAPPING_FILE_EXT && parentFile.name == "META-INF"

View File

@@ -17,7 +17,6 @@ enum class BuildAttributeKind : Serializable {
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
NO_BUILD_HISTORY(BuildAttributeKind.REBUILD_REASON),
NO_ABI_SNAPSHOT(BuildAttributeKind.REBUILD_REASON),
CACHE_CORRUPTION(BuildAttributeKind.REBUILD_REASON),
UNKNOWN_CHANGES_IN_GRADLE_INPUTS(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNTRACKED_FILE_IS_REMOVED(BuildAttributeKind.REBUILD_REASON),

View File

@@ -9,7 +9,6 @@ import java.io.Serializable
@Suppress("Reformat")
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
GRADLE_TASK_ACTION,
GRADLE_TASK,
CLEAR_OUTPUT(GRADLE_TASK),
BACKUP_OUTPUT(GRADLE_TASK),
@@ -21,10 +20,6 @@ enum class BuildTime(val parent: BuildTime? = null) : Serializable {
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
INCREMENTAL_COMPILATION(RUN_COMPILER),
STORE_BUILD_INFO(INCREMENTAL_COMPILATION),
JAR_SNAPSHOT(INCREMENTAL_COMPILATION),
SET_UP_ABI_SNAPSHOTS(JAR_SNAPSHOT),
IC_ANALYZE_JAR_FILES(JAR_SNAPSHOT),
IC_CALCULATE_INITIAL_DIRTY_SET(INCREMENTAL_COMPILATION),
IC_ANALYZE_CHANGES_IN_DEPENDENCIES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_FIND_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),

View File

@@ -30,28 +30,6 @@ class ChangesCollector {
private val changedMembers = hashMapOf<FqName, MutableSet<String>>()
private val areSubclassesAffected = hashMapOf<FqName, Boolean>()
//TODO for test only: ProtoData or ProtoBuf
private val storage = hashMapOf<FqName, ProtoData>()
private val removed = ArrayList<FqName>()
//TODO change to immutable map
fun protoDataChanges(): Map<FqName, ProtoData> = storage
fun protoDataRemoved(): List<FqName> = removed
companion object {
fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>) =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {
return proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Class::getConstructorList,
ProtoBuf.Class::getFunctionList,
ProtoBuf.Class::getPropertyList
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
}
}
fun changes(): List<ChangeInfo> {
val changes = arrayListOf<ChangeInfo>()
@@ -79,7 +57,7 @@ class ChangesCollector {
}
private fun <T, R> MutableMap<T, MutableSet<R>>.getSet(key: T) =
getOrPut(key) { HashSet() }
getOrPut(key) { HashSet() }
private fun collectChangedMember(scope: FqName, name: String) {
changedMembers.getSet(scope).add(name)
@@ -101,35 +79,11 @@ class ChangesCollector {
}
}
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?, collectAllMembersForNewClass: Boolean = false, packageProtoKey: String? = null) {
fun collectProtoChanges(oldData: ProtoData?, newData: ProtoData?, collectAllMembersForNewClass: Boolean = false) {
if (oldData == null && newData == null) {
throw IllegalStateException("Old and new value are null")
}
if (newData != null) {
when (newData) {
is ClassProtoData -> {
val fqName = newData.nameResolver.getClassId(newData.proto.fqName).asSingleFqName()
storage[fqName] = newData
}
is PackagePartProtoData -> {
//TODO fqName is not unique. It's package and can be present in both java and kotlin
val fqName = newData.packageFqName
storage[packageProtoKey?.let { FqName(it) } ?: fqName] = newData
}
}
} else if (oldData != null) {
when (oldData) {
is ClassProtoData -> {
removed.add(oldData.nameResolver.getClassId(oldData.proto.fqName).asSingleFqName())
}
is PackagePartProtoData -> {
//TODO fqName is not unique. It's package and can be present in both java and kotlin
removed.add(packageProtoKey?.let { FqName(it) } ?: oldData.packageFqName)
}
}
}
if (oldData == null) {
newData!!.collectAll(isRemoved = false, isAdded = true, collectAllMembersForNewClass = collectAllMembersForNewClass)
return
@@ -171,8 +125,8 @@ class ChangesCollector {
}
}
fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>) =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
private fun <T> T.getNonPrivateNames(nameResolver: NameResolver, vararg members: T.() -> List<MessageLite>): Set<String> =
members.flatMap { this.it().filterNot { it.isPrivate }.names(nameResolver) }.toSet()
//TODO remember all sealed parent classes
private fun ProtoData.collectAll(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) =
@@ -183,15 +137,16 @@ class ChangesCollector {
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
val memberNames =
proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Package::getFunctionList,
ProtoBuf.Package::getPropertyList
)
proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Package::getFunctionList,
ProtoBuf.Package::getPropertyList
)
if (isRemoved) {
collectRemovedMembers(packageFqName, memberNames)
} else {
}
else {
collectChangedMembers(packageFqName, memberNames)
}
}
@@ -206,7 +161,8 @@ class ChangesCollector {
val collectMember = if (isRemoved) this@ChangesCollector::collectRemovedMember else this@ChangesCollector::collectChangedMember
collectMember(classFqName.parent(), classFqName.shortName().asString())
memberNames.forEach { collectMember(classFqName, it) }
} else {
}
else {
if (!isRemoved && collectAllMembersForNewClass) {
val memberNames = getNonPrivateMemberNames()
memberNames.forEach { this@ChangesCollector.collectChangedMember(classFqName, it) }
@@ -233,6 +189,15 @@ class ChangesCollector {
addChangedParents(fqName, changedParentsFqNames)
}
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {
return proto.getNonPrivateNames(
nameResolver,
ProtoBuf.Class::getConstructorList,
ProtoBuf.Class::getFunctionList,
ProtoBuf.Class::getPropertyList
) + proto.enumEntryList.map { nameResolver.getString(it.name) }
}
fun collectMemberIfValueWasChanged(scope: FqName, name: String, oldValue: Any?, newValue: Any?) {
if (oldValue == null && newValue == null) {
throw IllegalStateException("Old and new value are null for $scope#$name")
@@ -240,7 +205,8 @@ class ChangesCollector {
if (oldValue != null && newValue == null) {
collectRemovedMember(scope, name)
} else if (oldValue != newValue) {
}
else if (oldValue != newValue) {
collectChangedMember(scope, name)
}
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.name.FqName
import java.io.ObjectInputStream
import java.io.ObjectOutputStream
import java.io.Serializable
/**
* Changes to the classpath of the `KotlinCompile` task, used to compute the source files that need to be recompiled during an incremental
* run.
*/
sealed class ClasspathChanges : Serializable {
class Available() : ClasspathChanges() {
lateinit var lookupSymbols: List<LookupSymbol>
private set
lateinit var fqNames: List<FqName>
private set
constructor(lookupSymbols: List<LookupSymbol>, fqNames: List<FqName>) : this() {
this.lookupSymbols = lookupSymbols
this.fqNames = fqNames
}
private fun writeObject(out: ObjectOutputStream) {
out.writeInt(lookupSymbols.size)
lookupSymbols.forEach {
out.writeUTF(it.name)
out.writeUTF(it.scope)
}
out.writeInt(fqNames.size)
fqNames.forEach {
out.writeUTF(it.asString())
}
}
private fun readObject(ois: ObjectInputStream) {
val lookupSymbolsSize = ois.readInt()
val lookupSymbols = ArrayList<LookupSymbol>(lookupSymbolsSize)
repeat(lookupSymbolsSize) {
val name = ois.readUTF()
val scope = ois.readUTF()
lookupSymbols.add(LookupSymbol(name, scope))
}
this.lookupSymbols = lookupSymbols
val fqNamesSize = ois.readInt()
val fqNames = ArrayList<FqName>(fqNamesSize)
repeat(fqNamesSize) {
val fqNameString = ois.readUTF()
fqNames.add(FqName(fqNameString))
}
this.fqNames = fqNames
}
companion object {
private const val serialVersionUID = 0L
}
}
sealed class NotAvailable : ClasspathChanges() {
object UnableToCompute : NotAvailable()
object ForNonIncrementalRun : NotAvailable()
object ClasspathSnapshotIsDisabled : NotAvailable()
object ReservedForTestsOnly : NotAvailable()
object ForJSCompiler : NotAvailable()
}
}

View File

@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.incremental
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.incremental.js.IncrementalResultsConsumerImpl
import org.jetbrains.kotlin.incremental.js.IrTranslationResultValue
import org.jetbrains.kotlin.incremental.js.TranslationResultValue
@@ -49,7 +48,6 @@ open class IncrementalJsCache(
private const val INLINE_FUNCTIONS = "inline-functions"
private const val HEADER_FILE_NAME = "header.meta"
private const val PACKAGE_META_FILE = "packages-meta"
private const val SOURCE_TO_JS_OUTPUT = "source-to-js-output"
fun hasHeaderFile(cachesDir: File) = File(cachesDir, HEADER_FILE_NAME).exists()
}
@@ -62,7 +60,6 @@ open class IncrementalJsCache(
private val irTranslationResults = registerMap(IrTranslationResultMap(IR_TRANSLATION_RESULT_MAP.storageFile, pathConverter))
private val inlineFunctions = registerMap(InlineFunctionsMap(INLINE_FUNCTIONS.storageFile, pathConverter))
private val packageMetadata = registerMap(PackageMetadataMap(PACKAGE_META_FILE.storageFile))
private val sourceToJsOutputsMap = registerMap(SourceToJsOutputMap(SOURCE_TO_JS_OUTPUT.storageFile, pathConverter))
private val dirtySources = hashSetOf<File>()
@@ -78,7 +75,6 @@ open class IncrementalJsCache(
override fun markDirty(removedAndCompiledSources: Collection<File>) {
removedAndCompiledSources.forEach { sourceFile ->
sourceToJsOutputsMap.remove(sourceFile)
// The common prefix of all FQN parents has to be the file package
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minByOrNull { it.length }?.let {
packageMetadata.remove(it)
@@ -99,10 +95,6 @@ open class IncrementalJsCache(
}
}
fun getOutputsBySource(sourceFile: File): Collection<File> {
return sourceToJsOutputsMap.get(sourceFile)
}
fun compareAndUpdate(incrementalResults: IncrementalResultsConsumerImpl, changesCollector: ChangesCollector) {
val translatedFiles = incrementalResults.packageParts
@@ -137,8 +129,8 @@ open class IncrementalJsCache(
}
for ((srcFile, irData) in incrementalResults.irFileData) {
val (fileData, types, signatures, strings, declarations, bodies, fqn, debugInfos) = irData
irTranslationResults.put(srcFile, fileData, types, signatures, strings, declarations, bodies, fqn, debugInfos)
val (fileData, types, signatures, strings, declarations, bodies, fqn) = irData
irTranslationResults.put(srcFile, fileData, types, signatures, strings, declarations, bodies, fqn)
}
}
@@ -183,17 +175,6 @@ open class IncrementalJsCache(
}
}
}
fun updateSourceToOutputMap(
generatedFiles: Iterable<GeneratedFile>,
) {
for (generatedFile in generatedFiles) {
for (source in generatedFile.sourceFiles) {
if (dirtySources.contains(source))
sourceToJsOutputsMap.add(source, generatedFile.outputFile)
}
}
}
}
private object TranslationResultValueExternalizer : DataExternalizer<TranslationResultValue> {
@@ -234,20 +215,17 @@ private class TranslationResultMap(
override fun dumpValue(value: TranslationResultValue): String =
"Metadata: ${value.metadata.md5()}, Binary AST: ${value.binaryAst.md5()}, InlineData: ${value.inlineData.md5()}"
@Synchronized
fun put(sourceFile: File, newMetadata: ByteArray, newBinaryAst: ByteArray, newInlineData: ByteArray) {
storage[pathConverter.toPath(sourceFile)] =
TranslationResultValue(metadata = newMetadata, binaryAst = newBinaryAst, inlineData = newInlineData)
}
@Synchronized
operator fun get(sourceFile: File): TranslationResultValue? =
storage[pathConverter.toPath(sourceFile)]
fun keys(): Collection<File> =
storage.keys.map { pathConverter.toFile(it) }
@Synchronized
fun remove(sourceFile: File, changesCollector: ChangesCollector) {
val path = pathConverter.toPath(sourceFile)
val protoBytes = storage[path]!!.metadata
@@ -269,7 +247,6 @@ private object IrTranslationResultValueExternalizer : DataExternalizer<IrTransla
output.writeArray(value.declarations)
output.writeArray(value.bodies)
output.writeArray(value.fqn)
value.debugInfo?.let { output.writeArray(it) }
}
private fun DataOutput.writeArray(array: ByteArray) {
@@ -284,17 +261,6 @@ private object IrTranslationResultValueExternalizer : DataExternalizer<IrTransla
return filedata
}
private fun DataInput.readArrayOrNull(): ByteArray? {
try {
val dataSize = readInt()
val filedata = ByteArray(dataSize)
readFully(filedata)
return filedata
} catch (e: Throwable) {
return null
}
}
override fun read(input: DataInput): IrTranslationResultValue {
val fileData = input.readArray()
val types = input.readArray()
@@ -303,9 +269,8 @@ private object IrTranslationResultValueExternalizer : DataExternalizer<IrTransla
val declarations = input.readArray()
val bodies = input.readArray()
val fqn = input.readArray()
val debugInfos = input.readArrayOrNull()
return IrTranslationResultValue(fileData, types, signatures, strings, declarations, bodies, fqn, debugInfos)
return IrTranslationResultValue(fileData, types, signatures, strings, declarations, bodies, fqn)
}
}
@@ -330,11 +295,10 @@ private class IrTranslationResultMap(
newStrings: ByteArray,
newDeclarations: ByteArray,
newBodies: ByteArray,
fqn: ByteArray,
debugInfos: ByteArray?
fqn: ByteArray
) {
storage[pathConverter.toPath(sourceFile)] =
IrTranslationResultValue(newFiledata, newTypes, newSignatures, newStrings, newDeclarations, newBodies, fqn, debugInfos)
IrTranslationResultValue(newFiledata, newTypes, newSignatures, newStrings, newDeclarations, newBodies, fqn)
}
operator fun get(sourceFile: File): IrTranslationResultValue? =
@@ -395,7 +359,6 @@ private class InlineFunctionsMap(
storageFile: File,
private val pathConverter: FileToPathConverter
) : BasicStringMap<Map<String, Long>>(storageFile, StringToLongMapExternalizer) {
@Synchronized
fun process(srcFile: File, newMap: Map<String, Long>, changesCollector: ChangesCollector) {
val key = pathConverter.toPath(srcFile)
val oldMap = storage[key] ?: emptyMap()
@@ -413,7 +376,6 @@ private class InlineFunctionsMap(
}
}
@Synchronized
fun remove(sourceFile: File) {
storage.remove(pathConverter.toPath(sourceFile))
}

View File

@@ -33,7 +33,6 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.metadata.jvm.deserialization.ModuleMapping
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.org.objectweb.asm.*
@@ -185,7 +184,7 @@ open class IncrementalJvmCache(
sourceToClassesMap.add(source, jvmClassName)
val (proto, nameResolver) = serializedJavaClass.toProtoData()
addToClassStorage(proto, nameResolver, source)
// collector.addJavaProto(ClassProtoData(proto, nameResolver))
dirtyOutputClassesMap.notDirty(jvmClassName)
}
@@ -308,7 +307,7 @@ open class IncrementalJvmCache(
storage[key] = newData
val packageFqName = kotlinClass.className.packageFqName
changesCollector.collectProtoChanges(oldData?.toProtoData(packageFqName), newData.toProtoData(packageFqName), packageProtoKey = key)
changesCollector.collectProtoChanges(oldData?.toProtoData(packageFqName), newData.toProtoData(packageFqName))
}
operator fun contains(className: JvmClassName): Boolean =
@@ -400,9 +399,7 @@ open class IncrementalJvmCache(
}
for (const in oldMap.keys + newMap.keys) {
//Constant can be declared via companion object or via const field declaration
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = true), const, oldMap[const], newMap[const])
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(companion = false), const, oldMap[const], newMap[const])
changesCollector.collectMemberIfValueWasChanged(kotlinClass.scopeFqName(), const, oldMap[const], newMap[const])
}
}
@@ -602,12 +599,11 @@ sealed class ChangeInfo(val fqName: FqName) {
}
}
private fun LocalFileKotlinClass.scopeFqName(companion: Boolean = false) = when (classHeader.kind) {
KotlinClassHeader.Kind.CLASS -> {
className.fqNameForClassNameWithoutDollars.let { if (companion) it.child(DEFAULT_NAME_FOR_COMPANION_OBJECT) else it }
private fun LocalFileKotlinClass.scopeFqName() =
when (classHeader.kind) {
KotlinClassHeader.Kind.CLASS -> className.fqNameForClassNameWithoutDollars
else -> className.packageFqName
}
else -> className.packageFqName
}
fun ByteArray.md5(): Long {
val d = MessageDigest.getInstance("MD5").digest(this)!!

View File

@@ -12,8 +12,7 @@ data class IncrementalModuleEntry(
private val projectPath: String,
val name: String,
val buildDir: File,
val buildHistoryFile: File,
val abiSnapshot: File
val buildHistoryFile: File
) : Serializable {
companion object {
private const val serialVersionUID = 0L
@@ -27,9 +26,7 @@ class IncrementalModuleInfo(
val nameToModules: Map<String, Set<IncrementalModuleEntry>>,
val jarToClassListFile: Map<File, File>,
// only for js and mpp
val jarToModule: Map<File, IncrementalModuleEntry>,
//for JVM only
val jarToAbiSnapshot: Map<File, File>
val jarToModule: Map<File, IncrementalModuleEntry>
) : Serializable {
companion object {
private const val serialVersionUID = 1L

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.incremental
import com.intellij.openapi.diagnostic.Logger
import com.intellij.util.containers.MultiMap
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.incremental.components.LookupTracker
@@ -34,8 +33,6 @@ open class LookupStorage(
targetDataDir: File,
pathConverter: FileToPathConverter
) : BasicMapsOwner(targetDataDir) {
val LOG = Logger.getInstance("#org.jetbrains.kotlin.jps.build.KotlinBuilder")
companion object {
private val DELETED_TO_SIZE_TRESHOLD = 0.5
private val MINIMUM_GARBAGE_COLLECTIBLE_SIZE = 10000
@@ -44,44 +41,36 @@ open class LookupStorage(
private val countersFile = "counters".storageFile
private val idToFile = registerMap(IdToFileMap("id-to-file".storageFile, pathConverter))
private val fileToId = registerMap(FileToIdMap("file-to-id".storageFile, pathConverter))
val lookupMap = registerMap(LookupMap("lookups".storageFile))
private val lookupMap = registerMap(LookupMap("lookups".storageFile))
@Volatile
private var size: Int = 0
@Volatile
private var deletedCount: Int = 0
init {
try {
if (countersFile.exists()) {
val lines = countersFile.readLines()
size = lines[0].toInt()
deletedCount = lines[1].toInt()
}
} catch (e: Exception) {
throw IOException("Could not read $countersFile", e)
}
}
@Synchronized
fun get(lookupSymbol: LookupSymbol): Collection<String> {
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
val fileIds = lookupMap[key] ?: return emptySet()
val paths = mutableSetOf<String>()
val filtered = mutableSetOf<Int>()
for (fileId in fileIds) {
val path = idToFile[fileId]?.path
if (path != null) {
paths.add(path)
filtered.add(fileId)
}
return fileIds.mapNotNull {
// null means it's outdated
idToFile[it]?.path
}
if (size > MINIMUM_GARBAGE_COLLECTIBLE_SIZE && filtered.size.toDouble() / fileIds.size.toDouble() < DELETED_TO_SIZE_TRESHOLD) {
lookupMap[key] = filtered
}
return paths
}
@Synchronized
@@ -92,8 +81,8 @@ open class LookupStorage(
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
val paths = lookups[lookupSymbol]
val fileIds = paths.mapTo(TreeSet()) { pathToId[it]!! }
lookupMap.append(key, fileIds)
fileIds.addAll(lookupMap[key] ?: emptySet())
lookupMap[key] = fileIds
}
}
@@ -103,6 +92,7 @@ open class LookupStorage(
val id = fileToId[file] ?: continue
idToFile.remove(id)
fileToId.remove(file)
deletedCount++
}
}
@@ -113,6 +103,7 @@ open class LookupStorage(
}
size = 0
deletedCount = 0
super.clean()
}
@@ -120,15 +111,18 @@ open class LookupStorage(
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
try {
removeGarbageIfNeeded()
if (size > 0) {
if (!countersFile.exists()) {
countersFile.parentFile.mkdirs()
countersFile.createNewFile()
}
countersFile.writeText("$size\n")
countersFile.writeText("$size\n$deletedCount")
}
} finally {
}
finally {
super.flush(memoryCachesOnly)
}
}
@@ -143,7 +137,13 @@ open class LookupStorage(
return id
}
private fun removeGarbageForTests() {
private fun removeGarbageIfNeeded(force: Boolean = false) {
if (force || (size > MINIMUM_GARBAGE_COLLECTIBLE_SIZE && deletedCount.toDouble() / size > DELETED_TO_SIZE_TRESHOLD)) {
doRemoveGarbage()
}
}
private fun doRemoveGarbage() {
for (hash in lookupMap.keys) {
lookupMap[hash] = lookupMap[hash]!!.filter { it in idToFile }.toSet()
}
@@ -153,6 +153,7 @@ open class LookupStorage(
idToFile.clean()
fileToId.clean()
size = 0
deletedCount = 0
for ((file, oldId) in oldFileToId.entries.sortedBy { it.key.path }) {
val newId = addFileIfNeeded(file)
@@ -164,16 +165,15 @@ open class LookupStorage(
if (fileIds.isEmpty()) {
lookupMap.remove(lookup)
} else {
}
else {
lookupMap[lookup] = fileIds
}
}
}
@TestOnly
fun forceGC() {
removeGarbageForTests()
@TestOnly fun forceGC() {
removeGarbageIfNeeded(force = true)
flush(false)
}

View File

@@ -1104,11 +1104,6 @@ open class ProtoCompareGenerated(
if (!checkEquals(old.setter, new.setter)) return false
}
if (old.hasDelegateMethod() != new.hasDelegateMethod()) return false
if (old.hasDelegateMethod()) {
if (!checkEquals(old.delegateMethod, new.delegateMethod)) return false
}
return true
}
@@ -2358,10 +2353,6 @@ fun JvmProtoBuf.JvmPropertySignature.hashCode(stringIndexes: (Int) -> Int, fqNam
hashCode = 31 * hashCode + setter.hashCode(stringIndexes, fqNameIndexes, typeById)
}
if (hasDelegateMethod()) {
hashCode = 31 * hashCode + delegateMethod.hashCode(stringIndexes, fqNameIndexes, typeById)
}
return hashCode
}

View File

@@ -255,23 +255,22 @@ fun withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon>
): Set<FqName> {
val typesToProccess = LinkedHashSet(listOf(typeFqName))
val proccessedTypes = hashSetOf<FqName>()
val types = LinkedHashSet(listOf(typeFqName))
val subtypes = hashSetOf<FqName>()
while (typesToProccess.isNotEmpty()) {
val iterator = typesToProccess.iterator()
while (types.isNotEmpty()) {
val iterator = types.iterator()
val unprocessedType = iterator.next()
iterator.remove()
caches.asSequence()
.flatMap { it.getSubtypesOf(unprocessedType) }
.filter { it !in proccessedTypes }
.forEach { typesToProccess.add(it) }
.filter { it !in subtypes }
.forEach { types.add(it) }
proccessedTypes.add(unprocessedType)
subtypes.add(unprocessedType)
}
return proccessedTypes
return subtypes
}

View File

@@ -47,16 +47,10 @@ abstract class BasicMap<K : Comparable<K>, V>(
storage.flush(memoryCachesOnly)
}
// avoid unsynchronized close
fun close() {
storage.close()
}
@TestOnly
fun closeForTest() {
close()
}
@TestOnly
fun dump(): String {
return with(StringBuilder()) {

View File

@@ -34,6 +34,7 @@ class CachingLazyStorage<K, V>(
) : LazyStorage<K, V> {
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
@@ -45,36 +46,32 @@ class CachingLazyStorage<K, V>(
return null
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
@Synchronized
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
@Synchronized
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
@Synchronized
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
@Synchronized
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
@Synchronized
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
@Synchronized
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key, { valueExternalizer.save(it, value) })
}
@@ -106,11 +103,7 @@ class CachingLazyStorage<K, V>(
@Synchronized
override fun close() {
try {
storage?.close()
} finally {
storage = null
}
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> = PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)

View File

@@ -28,7 +28,6 @@ internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collec
storage.append(key.asString(), listOf(value.asString()))
}
@Synchronized
operator fun get(key: FqName): Collection<FqName> =
storage[key.asString()]?.map(::FqName) ?: setOf()

View File

@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.incremental.storage
import java.io.File
class LookupMap(storage: File) : BasicMap<LookupSymbolKey, Collection<Int>>(storage, LookupSymbolKeyDescriptor, IntCollectionExternalizer) {
internal class LookupMap(storage: File) : BasicMap<LookupSymbolKey, Collection<Int>>(storage, LookupSymbolKeyDescriptor, IntCollectionExternalizer) {
override fun dumpKey(key: LookupSymbolKey): String = key.toString()
override fun dumpValue(value: Collection<Int>): String = value.toString()
@@ -27,10 +27,6 @@ class LookupMap(storage: File) : BasicMap<LookupSymbolKey, Collection<Int>>(stor
storage.append(LookupSymbolKey(name, scope), listOf(fileId))
}
fun append(lookup: LookupSymbolKey, fileIds: Collection<Int>) {
storage.append(lookup, fileIds)
}
operator fun get(key: LookupSymbolKey): Collection<Int>? = storage[key]
operator fun set(key: LookupSymbolKey, fileIds: Set<Int>) {

View File

@@ -31,6 +31,7 @@ class NonCachingLazyStorage<K, V>(
) : LazyStorage<K, V> {
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
@@ -42,6 +43,7 @@ class NonCachingLazyStorage<K, V>(
return null
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
@@ -51,28 +53,22 @@ class NonCachingLazyStorage<K, V>(
}
override val keys: Collection<K>
@Synchronized
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
@Synchronized
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
@Synchronized
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
@Synchronized
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
@Synchronized
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
@Synchronized
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
}
@@ -104,11 +100,7 @@ class NonCachingLazyStorage<K, V>(
@Synchronized
override fun close() {
try {
storage?.close()
} finally {
storage = null
}
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =

View File

@@ -1,43 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.incremental.storage
import org.jetbrains.kotlin.incremental.dumpCollection
import java.io.File
class SourceToJsOutputMap(storageFile: File, private val pathConverter: FileToPathConverter) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
@Synchronized
fun add(key: File, value: File) {
storage.append(pathConverter.toPath(key), listOf(pathConverter.toPath(value)))
}
operator fun get(sourceFile: File): Collection<File> =
storage[pathConverter.toPath(sourceFile)]?.map { pathConverter.toFile(it) } ?: setOf()
@Synchronized
operator fun set(key: File, values: Collection<File>) {
if (values.isEmpty()) {
remove(key)
return
}
storage[pathConverter.toPath(key)] = values.map { pathConverter.toPath(it) }
}
@Synchronized
fun remove(key: File) {
storage.remove(pathConverter.toPath(key))
}
@Synchronized
fun removeValues(key: File, removed: Set<File>) {
val notRemoved = this[key].filter { it !in removed }
this[key] = notRemoved
}
}

View File

@@ -21,49 +21,23 @@ import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.EnumeratorStringDescriptor
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.cli.common.toBooleanLenient
import java.io.DataInput
import java.io.DataInputStream
import java.io.DataOutput
import java.io.File
import java.util.*
/**
* Storage versioning:
* 0 - only name and value hashes are saved
* 1 - name and scope are saved
*/
object LookupSymbolKeyDescriptor : KeyDescriptor<LookupSymbolKey> {
override fun read(input: DataInput): LookupSymbolKey {
val version = input.readByte()
return when (version.toInt()) {
0 -> {
val name = input.readUTF()
val scope = input.readUTF()
LookupSymbolKey(name.hashCode(), scope.hashCode(), name, scope)
}
1 -> {
val first = input.readInt()
val second = input.readInt()
LookupSymbolKey(first, second, "", "")
}
else -> throw RuntimeException("Unknown version of LookupSymbolKeyDescriptor=${version}")
}
val first = input.readInt()
val second = input.readInt()
return LookupSymbolKey(first, second)
}
private val storeFullFqName = CompilerSystemProperties.COMPILE_INCREMENTAL_WITH_CLASSPATH_SHAPSHOTS.value.toBooleanLenient() ?: false
override fun save(output: DataOutput, value: LookupSymbolKey) {
if (storeFullFqName) {
output.writeByte(0)
output.writeUTF(value.name)
output.writeUTF(value.scope)
} else {
output.writeByte(1)
output.writeInt(value.nameHash)
output.writeInt(value.scopeHash)
}
output.writeInt(value.nameHash)
output.writeInt(value.scopeHash)
}
override fun getHashCode(value: LookupSymbolKey): Int = value.hashCode()

View File

@@ -16,8 +16,8 @@
package org.jetbrains.kotlin.incremental.storage
data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int, val name:String, val scope:String) : Comparable<LookupSymbolKey> {
constructor(name: String, scope: String) : this(name.hashCode(), scope.hashCode(), name, scope)
data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int) : Comparable<LookupSymbolKey> {
constructor(name: String, scope: String) : this(name.hashCode(), scope.hashCode())
override fun compareTo(other: LookupSymbolKey): Int {
val nameCmp = nameHash.compareTo(other.nameHash)
@@ -26,26 +26,6 @@ data class LookupSymbolKey(val nameHash: Int, val scopeHash: Int, val name:Strin
return scopeHash.compareTo(other.scopeHash)
}
override fun hashCode(): Int {
var result = nameHash
result = 31 * result + scopeHash
return result
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as LookupSymbolKey
if (nameHash != other.nameHash) return false
if (scopeHash != other.scopeHash) return false
return true
}
}
data class ProtoMapValue(val isPackageFacade: Boolean, val bytes: ByteArray, val strings: Array<String>)

View File

@@ -23,8 +23,7 @@ data class BuildLogFinder(
private val isGradleEnabled: Boolean = false,
private val isJsEnabled: Boolean = false,
private val isScopeExpansionEnabled: Boolean = false,
private val isKlibEnabled: Boolean = false,
private val isFirEnabled: Boolean = false
private val isKlibEnabled: Boolean = false
) {
companion object {
private const val JS_LOG = "js-build.log"
@@ -33,8 +32,6 @@ data class BuildLogFinder(
private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
const val JS_JPS_LOG = "js-jps-build.log"
private const val FIR_LOG = "fir-build.log"
private const val GRADLE_FIR_LOG = "gradle-fir-build.log"
private const val SIMPLE_LOG = "build.log"
fun isJpsLogFile(file: File): Boolean =
@@ -48,8 +45,6 @@ data class BuildLogFinder(
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
isJsEnabled && JS_LOG in files -> JS_LOG
isGradleEnabled && isFirEnabled && GRADLE_FIR_LOG in files -> GRADLE_FIR_LOG
isFirEnabled && FIR_LOG in files -> FIR_LOG
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
isJsEnabled && JS_JPS_LOG in files -> JS_JPS_LOG
isDataContainerBuildLogEnabled && DATA_CONTAINER_LOG in files -> DATA_CONTAINER_LOG

View File

@@ -10,21 +10,17 @@ public final class DebugKlibMetadataProtoBuf {
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.packageFqName);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classFile);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.classUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.constructorUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionFile);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.functionUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyGetterAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertySetterAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.compileTimeValue);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyFile);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyKdoc);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.propertyUniqId);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryAnnotation);
registry.add(org.jetbrains.kotlin.library.metadata.DebugKlibMetadataProtoBuf.enumEntryOrdinal);
@@ -3167,17 +3163,6 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int CLASS_KDOC_FIELD_NUMBER = 176;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class,
java.lang.String> classKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int CLASS_UNIQ_ID_FIELD_NUMBER = 171;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
@@ -3200,17 +3185,6 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.class,
org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.getDefaultInstance());
public static final int CONSTRUCTOR_KDOC_FIELD_NUMBER = 173;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Constructor,
java.lang.String> constructorKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int CONSTRUCTOR_UNIQ_ID_FIELD_NUMBER = 172;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Constructor { ... }</code>
@@ -3244,17 +3218,6 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int FUNCTION_KDOC_FIELD_NUMBER = 174;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Function,
java.lang.String> functionKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int FUNCTION_UNIQ_ID_FIELD_NUMBER = 173;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Function { ... }</code>
@@ -3321,17 +3284,6 @@ public final class DebugKlibMetadataProtoBuf {
.newFileScopedGeneratedExtension(
java.lang.Integer.class,
null);
public static final int PROPERTY_KDOC_FIELD_NUMBER = 180;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
*/
public static final
org.jetbrains.kotlin.protobuf.GeneratedMessage.GeneratedExtension<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Property,
java.lang.String> propertyKdoc = org.jetbrains.kotlin.protobuf.GeneratedMessage
.newFileScopedGeneratedExtension(
java.lang.String.class,
null);
public static final int PROPERTY_UNIQ_ID_FIELD_NUMBER = 179;
/**
* <code>extend .org.jetbrains.kotlin.metadata.Property { ... }</code>
@@ -3528,79 +3480,72 @@ public final class DebugKlibMetadataProtoBuf {
".metadata.Class\030\252\001 \003(\0132).org.jetbrains.k" +
"otlin.metadata.Annotation:?\n\nclass_file\022",
"$.org.jetbrains.kotlin.metadata.Class\030\257\001" +
" \001(\005B\004\200\265\030\001:?\n\nclass_kdoc\022$.org.jetbrains" +
".kotlin.metadata.Class\030\260\001 \001(\tB\004\200\265\030\001:u\n\rc" +
"lass_uniq_id\022$.org.jetbrains.kotlin.meta" +
"data.Class\030\253\001 \001(\01327.org.jetbrains.kotlin" +
".library.metadata.DescriptorUniqId:v\n\026co" +
"nstructor_annotation\022*.org.jetbrains.kot" +
"lin.metadata.Constructor\030\252\001 \003(\0132).org.je" +
"tbrains.kotlin.metadata.Annotation:K\n\020co" +
"nstructor_kdoc\022*.org.jetbrains.kotlin.me",
"tadata.Constructor\030\255\001 \001(\tB\004\200\265\030\001:\201\001\n\023cons" +
"tructor_uniq_id\022*.org.jetbrains.kotlin.m" +
"etadata.Constructor\030\254\001 \001(\01327.org.jetbrai" +
"ns.kotlin.library.metadata.DescriptorUni" +
"qId:p\n\023function_annotation\022\'.org.jetbrai" +
"ns.kotlin.metadata.Function\030\252\001 \003(\0132).org" +
".jetbrains.kotlin.metadata.Annotation:E\n" +
"\rfunction_file\022\'.org.jetbrains.kotlin.me" +
"tadata.Function\030\254\001 \001(\005B\004\200\265\030\001:E\n\rfunction" +
"_kdoc\022\'.org.jetbrains.kotlin.metadata.Fu",
"nction\030\256\001 \001(\tB\004\200\265\030\001:{\n\020function_uniq_id\022" +
"\'.org.jetbrains.kotlin.metadata.Function" +
"\030\255\001 \001(\01327.org.jetbrains.kotlin.library.m" +
"etadata.DescriptorUniqId:p\n\023property_ann" +
"otation\022\'.org.jetbrains.kotlin.metadata." +
"Property\030\252\001 \003(\0132).org.jetbrains.kotlin.m" +
"etadata.Annotation:w\n\032property_getter_an" +
"notation\022\'.org.jetbrains.kotlin.metadata" +
".Property\030\261\001 \003(\0132).org.jetbrains.kotlin." +
"metadata.Annotation:w\n\032property_setter_a",
"nnotation\022\'.org.jetbrains.kotlin.metadat" +
"a.Property\030\262\001 \003(\0132).org.jetbrains.kotlin" +
".metadata.Annotation:~\n\022compile_time_val" +
"ue\022\'.org.jetbrains.kotlin.metadata.Prope" +
"rty\030\255\001 \001(\01328.org.jetbrains.kotlin.metada" +
"ta.Annotation.Argument.Value:E\n\rproperty" +
"_file\022\'.org.jetbrains.kotlin.metadata.Pr" +
"operty\030\260\001 \001(\005B\004\200\265\030\001:E\n\rproperty_kdoc\022\'.o" +
"rg.jetbrains.kotlin.metadata.Property\030\264\001" +
" \001(\tB\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jet",
"brains.kotlin.metadata.Property\030\263\001 \001(\01327" +
".org.jetbrains.kotlin.library.metadata.D" +
"escriptorUniqId:s\n\025enum_entry_annotation" +
"\022(.org.jetbrains.kotlin.metadata.EnumEnt" +
"ry\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
"a.Annotation:E\n\022enum_entry_ordinal\022(.org" +
".jetbrains.kotlin.metadata.EnumEntry\030\253\001 " +
"\001(\005:~\n\022enum_entry_uniq_id\022(.org.jetbrain" +
"s.kotlin.metadata.EnumEntry\030\254\001 \001(\01327.org" +
".jetbrains.kotlin.library.metadata.Descr",
"iptorUniqId:w\n\024parameter_annotation\022-.or" +
"g.jetbrains.kotlin.metadata.ValueParamet" +
"er\030\252\001 \003(\0132).org.jetbrains.kotlin.metadat" +
"a.Annotation:h\n\017type_annotation\022#.org.je" +
"tbrains.kotlin.metadata.Type\030\252\001 \003(\0132).or" +
"g.jetbrains.kotlin.metadata.Annotation:{" +
"\n\031type_parameter_annotation\022,.org.jetbra" +
"ins.kotlin.metadata.TypeParameter\030\252\001 \003(\013" +
"2).org.jetbrains.kotlin.metadata.Annotat" +
"ion:\202\001\n\022type_param_uniq_id\022,.org.jetbrai",
"ns.kotlin.metadata.TypeParameter\030\253\001 \001(\0132" +
"7.org.jetbrains.kotlin.library.metadata." +
"DescriptorUniqId:U\n\026package_fragment_fil" +
"es\022..org.jetbrains.kotlin.metadata.Packa" +
"geFragment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..or" +
"g.jetbrains.kotlin.metadata.PackageFragm" +
"ent\030\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.ko" +
"tlin.metadata.PackageFragment\030\255\001 \001(\t:G\n\n" +
"class_name\022..org.jetbrains.kotlin.metada" +
"ta.PackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_al",
"ias_uniq_id\022(.org.jetbrains.kotlin.metad" +
"ata.TypeAlias\030\203\001 \001(\01327.org.jetbrains.kot" +
"lin.library.metadata.DescriptorUniqIdB\033B" +
"\031DebugKlibMetadataProtoBuf"
" \001(\005B\004\200\265\030\001:u\n\rclass_uniq_id\022$.org.jetbra" +
"ins.kotlin.metadata.Class\030\253\001 \001(\01327.org.j" +
"etbrains.kotlin.library.metadata.Descrip" +
"torUniqId:v\n\026constructor_annotation\022*.or" +
"g.jetbrains.kotlin.metadata.Constructor\030" +
"\252\001 \003(\0132).org.jetbrains.kotlin.metadata.A" +
"nnotation:\201\001\n\023constructor_uniq_id\022*.org." +
"jetbrains.kotlin.metadata.Constructor\030\254\001" +
" \001(\01327.org.jetbrains.kotlin.library.meta",
"data.DescriptorUniqId:p\n\023function_annota" +
"tion\022\'.org.jetbrains.kotlin.metadata.Fun" +
"ction\030\252\001 \003(\0132).org.jetbrains.kotlin.meta" +
"data.Annotation:E\n\rfunction_file\022\'.org.j" +
"etbrains.kotlin.metadata.Function\030\254\001 \001(\005" +
"B\004\200\265\030\001:{\n\020function_uniq_id\022\'.org.jetbrai" +
"ns.kotlin.metadata.Function\030\255\001 \001(\01327.org" +
".jetbrains.kotlin.library.metadata.Descr" +
"iptorUniqId:p\n\023property_annotation\022\'.org" +
".jetbrains.kotlin.metadata.Property\030\252\001 \003",
"(\0132).org.jetbrains.kotlin.metadata.Annot" +
"ation:w\n\032property_getter_annotation\022\'.or" +
"g.jetbrains.kotlin.metadata.Property\030\261\001 " +
"\003(\0132).org.jetbrains.kotlin.metadata.Anno" +
"tation:w\n\032property_setter_annotation\022\'.o" +
"rg.jetbrains.kotlin.metadata.Property\030\262\001" +
" \003(\0132).org.jetbrains.kotlin.metadata.Ann" +
"otation:~\n\022compile_time_value\022\'.org.jetb" +
"rains.kotlin.metadata.Property\030\255\001 \001(\01328." +
"org.jetbrains.kotlin.metadata.Annotation",
".Argument.Value:E\n\rproperty_file\022\'.org.j" +
"etbrains.kotlin.metadata.Property\030\260\001 \001(\005" +
"B\004\200\265\030\001:{\n\020property_uniq_id\022\'.org.jetbrai" +
"ns.kotlin.metadata.Property\030\263\001 \001(\01327.org" +
".jetbrains.kotlin.library.metadata.Descr" +
"iptorUniqId:s\n\025enum_entry_annotation\022(.o" +
"rg.jetbrains.kotlin.metadata.EnumEntry\030\252" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:E\n\022enum_entry_ordinal\022(.org.jet" +
"brains.kotlin.metadata.EnumEntry\030\253\001 \001(\005:",
"~\n\022enum_entry_uniq_id\022(.org.jetbrains.ko" +
"tlin.metadata.EnumEntry\030\254\001 \001(\01327.org.jet" +
"brains.kotlin.library.metadata.Descripto" +
"rUniqId:w\n\024parameter_annotation\022-.org.je" +
"tbrains.kotlin.metadata.ValueParameter\030\252" +
"\001 \003(\0132).org.jetbrains.kotlin.metadata.An" +
"notation:h\n\017type_annotation\022#.org.jetbra" +
"ins.kotlin.metadata.Type\030\252\001 \003(\0132).org.je" +
"tbrains.kotlin.metadata.Annotation:{\n\031ty" +
"pe_parameter_annotation\022,.org.jetbrains.",
"kotlin.metadata.TypeParameter\030\252\001 \003(\0132).o" +
"rg.jetbrains.kotlin.metadata.Annotation:" +
"\202\001\n\022type_param_uniq_id\022,.org.jetbrains.k" +
"otlin.metadata.TypeParameter\030\253\001 \001(\01327.or" +
"g.jetbrains.kotlin.library.metadata.Desc" +
"riptorUniqId:U\n\026package_fragment_files\022." +
".org.jetbrains.kotlin.metadata.PackageFr" +
"agment\030\252\001 \003(\005B\004\200\265\030\001:A\n\010is_empty\022..org.je" +
"tbrains.kotlin.metadata.PackageFragment\030" +
"\254\001 \001(\010:@\n\007fq_name\022..org.jetbrains.kotlin",
".metadata.PackageFragment\030\255\001 \001(\t:G\n\nclas" +
"s_name\022..org.jetbrains.kotlin.metadata.P" +
"ackageFragment\030\256\001 \003(\005B\002\020\001:~\n\022type_alias_" +
"uniq_id\022(.org.jetbrains.kotlin.metadata." +
"TypeAlias\030\203\001 \001(\01327.org.jetbrains.kotlin." +
"library.metadata.DescriptorUniqIdB\033B\031Deb" +
"ugKlibMetadataProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -3637,34 +3582,30 @@ public final class DebugKlibMetadataProtoBuf {
packageFqName.internalInit(descriptor.getExtensions().get(0));
classAnnotation.internalInit(descriptor.getExtensions().get(1));
classFile.internalInit(descriptor.getExtensions().get(2));
classKdoc.internalInit(descriptor.getExtensions().get(3));
classUniqId.internalInit(descriptor.getExtensions().get(4));
constructorAnnotation.internalInit(descriptor.getExtensions().get(5));
constructorKdoc.internalInit(descriptor.getExtensions().get(6));
constructorUniqId.internalInit(descriptor.getExtensions().get(7));
functionAnnotation.internalInit(descriptor.getExtensions().get(8));
functionFile.internalInit(descriptor.getExtensions().get(9));
functionKdoc.internalInit(descriptor.getExtensions().get(10));
functionUniqId.internalInit(descriptor.getExtensions().get(11));
propertyAnnotation.internalInit(descriptor.getExtensions().get(12));
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(13));
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(14));
compileTimeValue.internalInit(descriptor.getExtensions().get(15));
propertyFile.internalInit(descriptor.getExtensions().get(16));
propertyKdoc.internalInit(descriptor.getExtensions().get(17));
propertyUniqId.internalInit(descriptor.getExtensions().get(18));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(19));
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(20));
enumEntryUniqId.internalInit(descriptor.getExtensions().get(21));
parameterAnnotation.internalInit(descriptor.getExtensions().get(22));
typeAnnotation.internalInit(descriptor.getExtensions().get(23));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(24));
typeParamUniqId.internalInit(descriptor.getExtensions().get(25));
packageFragmentFiles.internalInit(descriptor.getExtensions().get(26));
isEmpty.internalInit(descriptor.getExtensions().get(27));
fqName.internalInit(descriptor.getExtensions().get(28));
className.internalInit(descriptor.getExtensions().get(29));
typeAliasUniqId.internalInit(descriptor.getExtensions().get(30));
classUniqId.internalInit(descriptor.getExtensions().get(3));
constructorAnnotation.internalInit(descriptor.getExtensions().get(4));
constructorUniqId.internalInit(descriptor.getExtensions().get(5));
functionAnnotation.internalInit(descriptor.getExtensions().get(6));
functionFile.internalInit(descriptor.getExtensions().get(7));
functionUniqId.internalInit(descriptor.getExtensions().get(8));
propertyAnnotation.internalInit(descriptor.getExtensions().get(9));
propertyGetterAnnotation.internalInit(descriptor.getExtensions().get(10));
propertySetterAnnotation.internalInit(descriptor.getExtensions().get(11));
compileTimeValue.internalInit(descriptor.getExtensions().get(12));
propertyFile.internalInit(descriptor.getExtensions().get(13));
propertyUniqId.internalInit(descriptor.getExtensions().get(14));
enumEntryAnnotation.internalInit(descriptor.getExtensions().get(15));
enumEntryOrdinal.internalInit(descriptor.getExtensions().get(16));
enumEntryUniqId.internalInit(descriptor.getExtensions().get(17));
parameterAnnotation.internalInit(descriptor.getExtensions().get(18));
typeAnnotation.internalInit(descriptor.getExtensions().get(19));
typeParameterAnnotation.internalInit(descriptor.getExtensions().get(20));
typeParamUniqId.internalInit(descriptor.getExtensions().get(21));
packageFragmentFiles.internalInit(descriptor.getExtensions().get(22));
isEmpty.internalInit(descriptor.getExtensions().get(23));
fqName.internalInit(descriptor.getExtensions().get(24));
className.internalInit(descriptor.getExtensions().get(25));
typeAliasUniqId.internalInit(descriptor.getExtensions().get(26));
org.jetbrains.kotlin.protobuf.ExtensionRegistry registry =
org.jetbrains.kotlin.protobuf.ExtensionRegistry.newInstance();
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
@@ -3672,10 +3613,6 @@ public final class DebugKlibMetadataProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipInComparison);
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor
.internalUpdateFileDescriptor(descriptor, registry);
org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor();

View File

@@ -3443,34 +3443,6 @@ public final class DebugJvmProtoBuf {
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature setter = 4;</code>
*/
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignatureOrBuilder getSetterOrBuilder();
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
boolean hasDelegateMethod();
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature getDelegateMethod();
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignatureOrBuilder getDelegateMethodOrBuilder();
}
/**
* Protobuf type {@code org.jetbrains.kotlin.metadata.jvm.JvmPropertySignature}
@@ -3576,19 +3548,6 @@ public final class DebugJvmProtoBuf {
bitField0_ |= 0x00000008;
break;
}
case 42: {
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
subBuilder = delegateMethod_.toBuilder();
}
delegateMethod_ = input.readMessage(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(delegateMethod_);
delegateMethod_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -3725,48 +3684,11 @@ public final class DebugJvmProtoBuf {
return setter_;
}
public static final int DELEGATE_METHOD_FIELD_NUMBER = 5;
private org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature delegateMethod_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public boolean hasDelegateMethod() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature getDelegateMethod() {
return delegateMethod_;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignatureOrBuilder getDelegateMethodOrBuilder() {
return delegateMethod_;
}
private void initFields() {
field_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmFieldSignature.getDefaultInstance();
syntheticMethod_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance();
getter_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance();
setter_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance();
delegateMethod_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -3793,9 +3715,6 @@ public final class DebugJvmProtoBuf {
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeMessage(4, setter_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeMessage(5, delegateMethod_);
}
getUnknownFields().writeTo(output);
}
@@ -3821,10 +3740,6 @@ public final class DebugJvmProtoBuf {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(4, setter_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(5, delegateMethod_);
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -3938,7 +3853,6 @@ public final class DebugJvmProtoBuf {
getSyntheticMethodFieldBuilder();
getGetterFieldBuilder();
getSetterFieldBuilder();
getDelegateMethodFieldBuilder();
}
}
private static Builder create() {
@@ -3971,12 +3885,6 @@ public final class DebugJvmProtoBuf {
setterBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000008);
if (delegateMethodBuilder_ == null) {
delegateMethod_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance();
} else {
delegateMethodBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
@@ -4037,14 +3945,6 @@ public final class DebugJvmProtoBuf {
} else {
result.setter_ = setterBuilder_.build();
}
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
to_bitField0_ |= 0x00000010;
}
if (delegateMethodBuilder_ == null) {
result.delegateMethod_ = delegateMethod_;
} else {
result.delegateMethod_ = delegateMethodBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -4073,9 +3973,6 @@ public final class DebugJvmProtoBuf {
if (other.hasSetter()) {
mergeSetter(other.getSetter());
}
if (other.hasDelegateMethod()) {
mergeDelegateMethod(other.getDelegateMethod());
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -4603,167 +4500,6 @@ public final class DebugJvmProtoBuf {
return setterBuilder_;
}
private org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature delegateMethod_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance();
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature, org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.Builder, org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignatureOrBuilder> delegateMethodBuilder_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public boolean hasDelegateMethod() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature getDelegateMethod() {
if (delegateMethodBuilder_ == null) {
return delegateMethod_;
} else {
return delegateMethodBuilder_.getMessage();
}
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public Builder setDelegateMethod(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature value) {
if (delegateMethodBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
delegateMethod_ = value;
onChanged();
} else {
delegateMethodBuilder_.setMessage(value);
}
bitField0_ |= 0x00000010;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public Builder setDelegateMethod(
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.Builder builderForValue) {
if (delegateMethodBuilder_ == null) {
delegateMethod_ = builderForValue.build();
onChanged();
} else {
delegateMethodBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00000010;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public Builder mergeDelegateMethod(org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature value) {
if (delegateMethodBuilder_ == null) {
if (((bitField0_ & 0x00000010) == 0x00000010) &&
delegateMethod_ != org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance()) {
delegateMethod_ =
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.newBuilder(delegateMethod_).mergeFrom(value).buildPartial();
} else {
delegateMethod_ = value;
}
onChanged();
} else {
delegateMethodBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00000010;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public Builder clearDelegateMethod() {
if (delegateMethodBuilder_ == null) {
delegateMethod_ = org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.getDefaultInstance();
onChanged();
} else {
delegateMethodBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00000010);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.Builder getDelegateMethodBuilder() {
bitField0_ |= 0x00000010;
onChanged();
return getDelegateMethodFieldBuilder().getBuilder();
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
public org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignatureOrBuilder getDelegateMethodOrBuilder() {
if (delegateMethodBuilder_ != null) {
return delegateMethodBuilder_.getMessageOrBuilder();
} else {
return delegateMethod_;
}
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.jvm.JvmMethodSignature delegate_method = 5;</code>
*
* <pre>
* The delegate field of delegated properties may be optimized out; `getDelegate` should
* then call this method instead
* </pre>
*/
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature, org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.Builder, org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignatureOrBuilder>
getDelegateMethodFieldBuilder() {
if (delegateMethodBuilder_ == null) {
delegateMethodBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature, org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignature.Builder, org.jetbrains.kotlin.metadata.jvm.DebugJvmProtoBuf.JvmMethodSignatureOrBuilder>(
getDelegateMethod(),
getParentForChildren(),
isClean());
delegateMethod_ = null;
}
return delegateMethodBuilder_;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.metadata.jvm.JvmPropertySignature)
}
@@ -5004,7 +4740,7 @@ public final class DebugJvmProtoBuf {
"\020DESC_TO_CLASS_ID\020\002\"<\n\022JvmMethodSignatur" +
"e\022\022\n\004name\030\001 \001(\005B\004\230\265\030\001\022\022\n\004desc\030\002 \001(\005B\004\230\265\030" +
"\001\";\n\021JvmFieldSignature\022\022\n\004name\030\001 \001(\005B\004\230\265" +
"\030\001\022\022\n\004desc\030\002 \001(\005B\004\230\265\030\001\"\212\003\n\024JvmPropertySi" +
"\030\001\022\022\n\004desc\030\002 \001(\005B\004\230\265\030\001\"\272\002\n\024JvmPropertySi" +
"gnature\022C\n\005field\030\001 \001(\01324.org.jetbrains.k" +
"otlin.metadata.jvm.JvmFieldSignature\022O\n\020",
"synthetic_method\030\002 \001(\01325.org.jetbrains.k" +
@@ -5012,13 +4748,11 @@ public final class DebugJvmProtoBuf {
"\006getter\030\003 \001(\01325.org.jetbrains.kotlin.met" +
"adata.jvm.JvmMethodSignature\022E\n\006setter\030\004" +
" \001(\01325.org.jetbrains.kotlin.metadata.jvm" +
".JvmMethodSignature\022N\n\017delegate_method\030\005" +
" \001(\01325.org.jetbrains.kotlin.metadata.jvm" +
".JvmMethodSignature:\200\001\n\025constructor_sign" +
"ature\022*.org.jetbrains.kotlin.metadata.Co" +
"nstructor\030d \001(\01325.org.jetbrains.kotlin.m",
"nstructor\030d \001(\01325.org.jetbrains.kotlin.m" +
"etadata.jvm.JvmMethodSignature:x\n\020method" +
"_signature\022\'.org.jetbrains.kotlin.metada" +
"_signature\022\'.org.jetbrains.kotlin.metada",
"ta.Function\030d \001(\01325.org.jetbrains.kotlin" +
".metadata.jvm.JvmMethodSignature:O\n\030lamb" +
"da_class_origin_name\022\'.org.jetbrains.kot" +
@@ -5026,9 +4760,9 @@ public final class DebugJvmProtoBuf {
"perty_signature\022\'.org.jetbrains.kotlin.m" +
"etadata.Property\030d \001(\01327.org.jetbrains.k" +
"otlin.metadata.jvm.JvmPropertySignature:" +
"9\n\005flags\022\'.org.jetbrains.kotlin.metadata",
"9\n\005flags\022\'.org.jetbrains.kotlin.metadata" +
".Property\030e \001(\005:\0010:g\n\017type_annotation\022#." +
"org.jetbrains.kotlin.metadata.Type\030d \003(\013" +
"org.jetbrains.kotlin.metadata.Type\030d \003(\013",
"2).org.jetbrains.kotlin.metadata.Annotat" +
"ion:3\n\006is_raw\022#.org.jetbrains.kotlin.met" +
"adata.Type\030e \001(\010:z\n\031type_parameter_annot" +
@@ -5036,9 +4770,9 @@ public final class DebugJvmProtoBuf {
"peParameter\030d \003(\0132).org.jetbrains.kotlin" +
".metadata.Annotation:E\n\021class_module_nam" +
"e\022$.org.jetbrains.kotlin.metadata.Class\030" +
"e \001(\005B\004\230\265\030\001:k\n\024class_local_variable\022$.or",
"e \001(\005B\004\230\265\030\001:k\n\024class_local_variable\022$.or" +
"g.jetbrains.kotlin.metadata.Class\030f \003(\0132" +
"\'.org.jetbrains.kotlin.metadata.Property" +
"\'.org.jetbrains.kotlin.metadata.Property",
":P\n\034anonymous_object_origin_name\022$.org.j" +
"etbrains.kotlin.metadata.Class\030g \001(\005B\004\230\265" +
"\030\001:@\n\017jvm_class_flags\022$.org.jetbrains.ko" +
@@ -5046,7 +4780,7 @@ public final class DebugJvmProtoBuf {
"module_name\022&.org.jetbrains.kotlin.metad" +
"ata.Package\030e \001(\005B\004\230\265\030\001:o\n\026package_local" +
"_variable\022&.org.jetbrains.kotlin.metadat" +
"a.Package\030f \003(\0132\'.org.jetbrains.kotlin.m",
"a.Package\030f \003(\0132\'.org.jetbrains.kotlin.m" +
"etadata.PropertyB\022B\020DebugJvmProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
@@ -5092,7 +4826,7 @@ public final class DebugJvmProtoBuf {
internal_static_org_jetbrains_kotlin_metadata_jvm_JvmPropertySignature_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_metadata_jvm_JvmPropertySignature_descriptor,
new java.lang.String[] { "Field", "SyntheticMethod", "Getter", "Setter", "DelegateMethod", });
new java.lang.String[] { "Field", "SyntheticMethod", "Getter", "Setter", });
constructorSignature.internalInit(descriptor.getExtensions().get(0));
methodSignature.internalInit(descriptor.getExtensions().get(1));
lambdaClassOriginName.internalInit(descriptor.getExtensions().get(2));

View File

@@ -1,6 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.crypto.checksum.Checksum
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import proguard.gradle.ProGuardTask
buildscript {
@@ -13,11 +14,8 @@ buildscript {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/plugins.gradle.org/m2")
maven("https://cache-redirector.jetbrains.com/repo.maven.apache.org/maven2")
} else {
maven("https://plugins.gradle.org/m2")
mavenCentral()
}
}
@@ -29,13 +27,18 @@ buildscript {
dependencies {
bootstrapCompilerClasspath(kotlin("compiler-embeddable", bootstrapKotlinVersion))
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.31")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath(kotlin("gradle-plugin", bootstrapKotlinVersion))
classpath(kotlin("serialization", bootstrapKotlinVersion))
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.17.2")
}
}
if (kotlinBuildProperties.buildScanServer != null) {
apply(from = "gradle/buildScanUserData.gradle")
}
plugins {
base
idea
@@ -49,12 +52,20 @@ pill {
excludedDirs(
"out",
"buildSrc/build",
"buildSrc/prepare-deps/android-dx/build",
"buildSrc/prepare-deps/intellij-sdk/build"
)
}
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
val configuredJdks: List<JdkId> =
getConfiguredJdks().also {
it.forEach { jdkId ->
logger.info("Using ${jdkId.majorVersion} home: ${jdkId.homeDir}")
}
}
val defaultSnapshotVersion: String by extra
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
val kotlinVersion by extra(
@@ -80,8 +91,10 @@ val distKotlinHomeDir by extra("$distDir/kotlinc")
val distLibDir = "$distKotlinHomeDir/lib"
val commonLocalDataDir = "$rootDir/local"
val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
val artifactsDir = "$distDir/artifacts"
val ideaPluginDir = "$artifactsDir/ideaPlugin/Kotlin"
val ideaUltimatePluginDir = "$artifactsDir/ideaUltimatePlugin/Kotlin"
extra["ktorExcludesForDaemon"] = listOf(
"org.jetbrains.kotlin" to "kotlin-reflect",
@@ -99,11 +112,39 @@ extra["distLibDir"] = project.file(distLibDir)
extra["libsDir"] = project.file(distLibDir)
extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
extra["ideaPluginDir"] = project.file(ideaPluginDir)
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
extra["isSonatypeRelease"] = false
val kotlinNativeVersionObject = project.kotlinNativeVersionValue()
subprojects {
extra["kotlinNativeVersion"] = kotlinNativeVersionObject
// Work-around necessary to avoid setting null javaHome. Will be removed after support of lazy task configuration
val jdkNotFoundConst = "JDK NOT FOUND"
if (isTeamcityBuild) {
extra["JDK_16"] = jdkPath("1.6")
extra["JDK_17"] = jdkPath("1.7")
} else {
extra["JDK_16"] = jdkPath("1.6", "1.8")
extra["JDK_17"] = jdkPath("1.7", "1.8")
}
extra["JDK_18"] = jdkPath("1.8")
extra["JDK_9"] = jdkPath("9")
extra["JDK_10"] = jdkPath("10")
extra["JDK_11"] = jdkPath("11")
// allow opening the project without setting up all env variables (see KT-26413)
if (!kotlinBuildProperties.isInIdeaSync) {
checkJDK()
}
fun checkJDK() {
val missingEnvVars = JdkMajorVersion.values()
.filter { it.isMandatory() && extra[it.name] == jdkNotFoundConst }
.mapTo(ArrayList()) { it.name }
if (missingEnvVars.isNotEmpty()) {
throw GradleException("Required environment variables are missing: ${missingEnvVars.joinToString()}")
}
}
rootProject.apply {
@@ -114,7 +155,6 @@ rootProject.apply {
from(rootProject.file("gradle/checkArtifacts.gradle.kts"))
from(rootProject.file("gradle/checkCacheability.gradle.kts"))
from(rootProject.file("gradle/retryPublishing.gradle.kts"))
from(rootProject.file("gradle/modularizedTestConfigurations.gradle.kts"))
}
IdeVersionConfigurator.setCurrentIde(project)
@@ -128,9 +168,8 @@ extra["versions.junit"] = "4.12"
extra["versions.javaslang"] = "2.0.6"
extra["versions.ant"] = "1.10.7"
extra["versions.android"] = "2.3.1"
extra["versions.kotlinx-coroutines-core"] = "1.5.0"
extra["versions.kotlinx-coroutines-core-jvm"] = "1.5.0"
extra["versions.kotlinx-coroutines-jdk8"] = "1.5.0"
extra["versions.kotlinx-coroutines-core"] = "1.3.8"
extra["versions.kotlinx-coroutines-jdk8"] = "1.3.8"
extra["versions.json"] = "20160807"
extra["versions.native-platform"] = "0.14"
extra["versions.robolectric"] = "4.0"
@@ -139,7 +178,7 @@ extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.3"
extra["versions.r8"] = "2.2.64"
extra["versions.r8"] = "2.1.75"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -148,11 +187,13 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.6.0-dev-248"
extra["versions.kotlin-native"] = "1.5-rc1-41"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false)
val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false)
val useJvmIrBackend by extra(project.kotlinBuildProperties.useIR)
val useJvmFir by extra(project.kotlinBuildProperties.useFir)
val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false
@@ -162,7 +203,6 @@ extra["intellijSeparateSdks"] = intellijSeparateSdks
extra["IntellijCoreDependencies"] =
listOf(
when {
Platform[203].orHigher() -> "asm-all-9.0"
Platform[202].orHigher() -> "asm-all-8.0.1"
else -> "asm-all-7.0.1"
},
@@ -170,6 +210,7 @@ extra["IntellijCoreDependencies"] =
"jdom",
"jna",
"log4j",
if (Platform[201].orHigher()) null else "picocontainer",
"snappy-in-java",
"streamex",
"trove4j"
@@ -189,7 +230,6 @@ extra["compilerModules"] = arrayOf(
":compiler:frontend",
":compiler:frontend.common",
":compiler:frontend.java",
":compiler:frontend:cfg",
":compiler:cli-common",
":compiler:ir.tree",
":compiler:ir.tree.impl",
@@ -197,7 +237,6 @@ extra["compilerModules"] = arrayOf(
":compiler:ir.psi2ir",
":compiler:ir.backend.common",
":compiler:backend.jvm",
":compiler:backend.jvm:backend.jvm.entrypoint",
":compiler:backend.js",
":compiler:backend.wasm",
":compiler:ir.serialization.common",
@@ -217,7 +256,6 @@ extra["compilerModules"] = arrayOf(
":compiler:incremental-compilation-impl",
":compiler:compiler.version",
":js:js.ast",
":js:js.sourcemap",
":js:js.serializer",
":js:js.parser",
":js:js.config",
@@ -253,7 +291,6 @@ extra["compilerModules"] = arrayOf(
":compiler:fir:java",
":compiler:fir:jvm",
":compiler:fir:checkers",
":compiler:fir:checkers:checkers.jvm",
":compiler:fir:entrypoint",
":compiler:fir:analysis-tests",
":compiler:fir:analysis-tests:legacy-fir-tests",
@@ -273,6 +310,7 @@ extra["compilerModulesForJps"] = listOf(
":core:compiler.common.jvm",
":core:descriptors",
":core:descriptors.jvm",
":idea:idea-jps-common",
":kotlin-preloader",
":compiler:util",
":compiler:config",
@@ -282,54 +320,21 @@ extra["compilerModulesForJps"] = listOf(
":compiler:compiler.version"
)
extra["compilerArtifactsForIde"] = listOf(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide",
":prepare:ide-plugin-dependencies:js-ir-runtime-for-ide",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide",
":prepare:ide-plugin-dependencies:kotlin-compiler-cli-for-ide",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide",
":prepare:ide-plugin-dependencies:compiler-components-for-jps",
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide",
":prepare:ide-plugin-dependencies:lombok-compiler-plugin-for-ide",
":prepare:ide-plugin-dependencies:kotlin-compiler-tests-for-ide",
":prepare:ide-plugin-dependencies:kotlin-compiler-testdata-for-ide",
":prepare:ide-plugin-dependencies:kotlin-stdlib-minimal-for-test-for-ide",
":prepare:ide-plugin-dependencies:low-level-api-fir-for-ide",
":prepare:ide-plugin-dependencies:high-level-api-for-ide",
":prepare:ide-plugin-dependencies:high-level-api-fir-for-ide",
":prepare:ide-plugin-dependencies:high-level-api-fir-tests-for-ide",
":kotlin-script-runtime",
":kotlin-script-util",
":kotlin-scripting-common",
":kotlin-scripting-jvm",
":kotlin-scripting-compiler",
":kotlin-scripting-compiler-impl",
":kotlin-android-extensions-runtime",
":kotlin-stdlib-common",
":kotlin-stdlib",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-reflect",
":kotlin-main-kts"
)
// TODO: fix remaining warnings and remove this property.
extra["tasksWithWarnings"] = listOf(
":kotlin-stdlib:compileTestKotlin",
":kotlin-stdlib-jdk7:compileTestKotlin",
":kotlin-stdlib-jdk8:compileTestKotlin",
":plugins:uast-kotlin-base:compileKotlin",
":plugins:uast-kotlin-base:compileTestKotlin",
":compiler:cli:compileKotlin",
":compiler:frontend:compileKotlin",
":compiler:fir:tree:compileKotlin",
":compiler:fir:resolve:compileKotlin",
":compiler:fir:checkers:compileKotlin",
":compiler:fir:java:compileKotlin",
":kotlin-scripting-compiler:compileKotlin",
":plugins:uast-kotlin:compileKotlin",
":plugins:uast-kotlin:compileTestKotlin",
":plugins:uast-kotlin-fir:compileKotlin",
":plugins:uast-kotlin-fir:compileTestKotlin"
":plugins:uast-kotlin-idea:compileKotlin"
)
val tasksWithWarnings: List<String> by extra
@@ -351,17 +356,6 @@ val coreLibProjects = listOfNotNull(
":kotlin-reflect"
)
val projectsWithDisabledFirBootstrap = coreLibProjects + listOf(
":kotlin-gradle-plugin",
":kotlinx-metadata",
":kotlinx-metadata-jvm",
// For some reason stdlib isn't imported correctly for this module
// Probably it's related to kotlin-test module usage
":kotlin-gradle-statistics",
// Requires serialization plugin
":wasm:wasm.ir"
)
val gradlePluginProjects = listOf(
":kotlin-gradle-plugin",
":kotlin-gradle-plugin-api",
@@ -369,8 +363,7 @@ val gradlePluginProjects = listOf(
":kotlin-annotation-processing-gradle",
":kotlin-noarg",
":kotlin-sam-with-receiver",
":kotlin-parcelize-compiler",
":kotlin-lombok"
":kotlin-parcelize-compiler"
)
apply {
@@ -379,7 +372,7 @@ apply {
}
apply {
if (extra["isDeployStagingRepoGenerationRequired"] as? Boolean == true) {
if (extra["isSonatypeRelease"] as? Boolean == true) {
logger.info("Applying configuration for sonatype release")
from("libraries/prepareSonatypeStaging.gradle")
}
@@ -393,9 +386,39 @@ fun Task.listConfigurationContents(configName: String) {
}
}
val defaultJvmTarget = "1.8"
val defaultJavaHome = jdkPath(if (Platform[203].orHigher()) "11" else defaultJvmTarget)
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
allprojects {
configurations.maybeCreate("embedded").apply {
isCanBeConsumed = false
isCanBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
configurations.maybeCreate("embeddedElements").apply {
extendsFrom(configurations["embedded"])
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named("embedded-java-runtime"))
}
}
jvmTarget = defaultJvmTarget
javaHome = defaultJavaHome
// There are problems with common build dir:
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
// - idea seems unable to exclude common buildDir from indexing
// therefore it is disabled by default
// buildDir = File(commonBuildDir, project.name)
val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString()
repositories {
@@ -416,38 +439,7 @@ allprojects {
jcenter()
}
if (path.startsWith(":kotlin-ide.")) {
return@allprojects
}
configurations.maybeCreate("embedded").apply {
isCanBeConsumed = false
isCanBeResolved = true
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME))
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
}
}
configurations.maybeCreate("embeddedElements").apply {
extendsFrom(configurations["embedded"])
isCanBeConsumed = true
isCanBeResolved = false
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named("embedded-java-runtime"))
}
}
// There are problems with common build dir:
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
// - idea seems unable to exclude common buildDir from indexing
// therefore it is disabled by default
// buildDir = File(commonBuildDir, project.name)
project.configureJvmDefaultToolchain()
plugins.withId("java-base") {
project.configureShadowJarSubstitutionInCompileClasspath()
}
configureJvmProject(javaHome!!, jvmTarget!!)
val commonCompilerArgs = listOfNotNull(
"-Xopt-in=kotlin.RequiresOptIn",
@@ -474,7 +466,11 @@ allprojects {
kotlinOptions {
freeCompilerArgs = commonCompilerArgs + jvmCompilerArgs
if (useJvmFir && this@allprojects.path !in projectsWithDisabledFirBootstrap) {
if (useJvmIrBackend) {
useIR = true
}
if (useJvmFir) {
freeCompilerArgs += "-Xuse-fir"
freeCompilerArgs += "-Xabi-stability=stable"
}
@@ -517,16 +513,12 @@ allprojects {
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
}
if (isConfigurationCacheDisabled) {
// Custom input normolization isn't supported by configuration cache at the moment
// See https://github.com/gradle/gradle/issues/13706
normalization {
runtimeClasspath {
ignore("META-INF/MANIFEST.MF")
ignore("META-INF/compiler.version")
ignore("META-INF/plugin.xml")
ignore("kotlin/KotlinVersionCurrentValue.class")
}
normalization {
runtimeClasspath {
ignore("META-INF/MANIFEST.MF")
ignore("META-INF/compiler.version")
ignore("META-INF/plugin.xml")
ignore("kotlin/KotlinVersionCurrentValue.class")
}
}
@@ -541,9 +533,12 @@ allprojects {
register("checkBuild")
}
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
afterEvaluate {
if (javaHome != defaultJavaHome || jvmTarget != defaultJvmTarget) {
logger.info("configuring project $name to compile to the target jvm version $jvmTarget using jdk: $javaHome")
configureJvmProject(javaHome!!, jvmTarget!!)
} // else we will actually fail during the first task execution. We could not fail before configuration is done due to impact on import in IDE
fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path
fun FileCollection.printClassPath(role: String) =
@@ -572,10 +567,27 @@ allprojects {
?.exclude("org.jetbrains.kotlin", "kotlin-scripting-compiler-embeddable")
}
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
apply(from = "$rootDir/gradle/testRetry.gradle.kts")
}
}
gradle.buildFinished {
val taskGraph = gradle?.taskGraph
if (taskGraph != null) {
taskGraph.allTasks
.filterIsInstance<SourceTask>()
.filter { it.didWork }
.forEach {
it.source.visit {
if (file.isDirectory && file.listFiles()?.isEmpty() == true) {
logger.warn("Empty source directories may cause build cache misses: " + file.absolutePath)
}
}
}
}
}
gradle.taskGraph.whenReady {
fun Boolean.toOnOff(): String = if (this) "on" else "off"
val profile = if (isTeamcityBuild) "CI" else "Local"
@@ -616,12 +628,17 @@ val ideaPlugin by task<Task> {
}
tasks {
named<Delete>("clean") {
delete += setOf("$buildDir/repo", distDir)
named("clean") {
doLast {
delete("$buildDir/repo")
delete(distDir)
}
}
register<Delete>("cleanupArtifacts") {
delete = setOf(artifactsDir)
register("cleanupArtifacts") {
doLast {
delete(artifactsDir)
}
}
listOf("clean", "assemble", "install").forEach { taskName ->
@@ -734,6 +751,8 @@ tasks {
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
dependsOn(":kotlin-main-kts-test:test")
dependsOn(":kotlin-main-kts-test:testWithIr")
dependsOn(":kotlin-scripting-ide-services-test:test")
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
dependsOn(":kotlin-scripting-js-test:test")
}
@@ -745,7 +764,6 @@ tasks {
register("miscCompilerTest") {
dependsOn("nativeCompilerTest")
dependsOn("firCompilerTest")
dependsOn(":kotlin-daemon-tests:test")
dependsOn("scriptingTest")
@@ -757,15 +775,11 @@ tasks {
dependsOn("jvmCompilerIntegrationTest")
dependsOn(":plugins:parcelize:parcelize-compiler:test")
dependsOn(":kotlin-util-io:test")
dependsOn(":kotlin-util-klib:test")
}
register("toolsTest") {
dependsOn(":tools:kotlinp:test")
dependsOn(":native:kotlin-klib-commonizer:test")
dependsOn(":native:kotlin-klib-commonizer-api:test")
}
register("examplesTest") {
@@ -777,7 +791,6 @@ tasks {
register("distTest") {
dependsOn("compilerTest")
dependsOn("frontendApiTests")
dependsOn("toolsTest")
dependsOn("gradlePluginTest")
dependsOn("examplesTest")
@@ -801,6 +814,7 @@ tasks {
dependsOn("dist")
dependsOn(
":idea:idea-maven:test",
":j2k:test",
":nj2k:test",
":idea:jvm-debugger:jvm-debugger-core:test",
":idea:jvm-debugger:jvm-debugger-evaluation:test",
@@ -839,22 +853,12 @@ tasks {
dependsOn("dist")
dependsOn(
":idea:idea-fir:test",
":idea:idea-frontend-fir:fir-low-level-api-ide-impl:test",
":plugins:uast-kotlin-fir:test",
":idea:idea-fir-fe10-binding:test"
":idea:idea-frontend-api:test",
":idea:idea-frontend-fir:test",
":idea:idea-frontend-fir:idea-fir-low-level-api:test"
)
}
register("frontendApiTests") {
dependsOn("dist")
dependsOn(
":idea-frontend-api:test",
":idea-frontend-fir:test",
":idea-frontend-fir:idea-fir-low-level-api:test"
)
}
register("android-ide-tests") {
dependsOn("dist")
@@ -896,11 +900,18 @@ tasks {
if (Ide.IJ()) {
dependsOn(
":libraries:tools:new-project-wizard:test",
":libraries:tools:new-project-wizard:new-project-wizard-cli:test"
":libraries:tools:new-project-wizard:new-project-wizard-cli:test",
":idea:idea-new-project-wizard:test" // Temporary here. Remove after enabling builds for ideaIntegrationsTests
)
}
}
register("ideaIntegrationsTests") {
if (Ide.IJ()) {
dependsOn(":idea:idea-new-project-wizard:test")
}
}
register("kaptIdeTest") {
dependsOn(":kotlin-annotation-processing:test")
dependsOn(":kotlin-annotation-processing-base:test")
@@ -914,6 +925,22 @@ tasks {
)
}
register("kmmTest", AggregateTest::class) {
dependsOn(
":idea:idea-gradle:test",
":idea:test",
":compiler:test",
":compiler:container:test",
":js:js.tests:test"
)
dependsOn(":kotlin-gradle-plugin-integration-tests:test")
if (Ide.AS40.orHigher())
dependsOn(":kotlin-ultimate:ide:android-studio-native:test")
testPatternFile = file("tests/mpp/kmm-patterns.csv")
}
register("test") {
doLast {
throw GradleException("Don't use directly, use aggregate tasks *-check instead")
@@ -932,21 +959,34 @@ tasks {
}
}
register("publishGradlePluginArtifacts") {
idePluginDependency {
dependsOnKotlinGradlePluginPublish()
}
}
register("publishIdeArtifacts") {
idePluginDependency {
dependsOn((rootProject.extra["compilerArtifactsForIde"] as List<String>).map { "$it:publish" })
}
}
register("installIdeArtifacts") {
idePluginDependency {
dependsOn((rootProject.extra["compilerArtifactsForIde"] as List<String>).map { "$it:install" })
dependsOn(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-gradle-statistics-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlinx-serialization-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:noarg-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:sam-with-receiver-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:compiler-components-for-jps:publish",
":prepare:ide-plugin-dependencies:parcelize-compiler-plugin-for-ide:publish",
":kotlin-script-runtime:publish",
":kotlin-script-util:publish",
":kotlin-scripting-common:publish",
":kotlin-scripting-jvm:publish",
":kotlin-scripting-compiler:publish",
":kotlin-scripting-compiler-impl:publish",
":kotlin-android-extensions-runtime:publish",
":kotlin-stdlib-common:publish",
":kotlin-stdlib:publish",
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish"
)
}
}
}
@@ -998,7 +1038,8 @@ val zipTestData by task<Zip> {
val zipPlugin by task<Zip> {
val src = when (project.findProperty("pluginArtifactDir") as String?) {
"Kotlin" -> ideaPluginDir
null -> ideaPluginDir
"KotlinUltimate" -> ideaUltimatePluginDir
null -> if (project.hasProperty("ultimate")) ideaUltimatePluginDir else ideaPluginDir
else -> error("Unsupported plugin artifact dir")
}
val destPath = project.findProperty("pluginZipPath") as String?
@@ -1055,6 +1096,66 @@ configure<IdeaModel> {
}
}
fun jdkPathOrNull(version: String): String? {
val jdkName = "JDK_${version.replace(".", "")}"
val jdkMajorVersion = JdkMajorVersion.valueOf(jdkName)
return configuredJdks.find { it.majorVersion == jdkMajorVersion }?.homeDir?.canonicalPath
}
fun jdkPath(version: String, vararg replacementVersions: String): String {
return jdkPathOrNull(version) ?: run {
replacementVersions.asSequence().map { jdkPathOrNull(it) }.find { it != null }
} ?: jdkNotFoundConst
}
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
val currentJavaHome = File(System.getProperty("java.home")!!).canonicalPath
val shouldFork = !currentJavaHome.startsWith(File(javaHome).canonicalPath)
tasks.withType<JavaCompile> {
if (name != "compileJava9Java") {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
options.isFork = shouldFork
options.forkOptions.javaHome = file(javaHome)
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.jdkHome = javaHome
kotlinOptions.jvmTarget = javaVersion
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
tasks.withType<Test> {
executable = File(javaHome, "bin/java").canonicalPath
}
plugins.withId("java-base") {
configureShadowJarSubstitutionInCompileClasspath()
}
}
fun Project.configureShadowJarSubstitutionInCompileClasspath() {
val substitutionMap = mapOf(":kotlin-reflect" to ":kotlin-reflect-api")
fun configureSubstitution(substitution: DependencySubstitution) {
val requestedProject = (substitution.requested as? ProjectComponentSelector)?.projectPath ?: return
val replacementProject = substitutionMap[requestedProject] ?: return
substitution.useTarget(project(replacementProject), "Non-default shadow jars should not be used in compile classpath")
}
sourceSets.all {
for (configName in listOf(compileOnlyConfigurationName, compileClasspathConfigurationName)) {
configurations.getByName(configName).resolutionStrategy.dependencySubstitution {
all(::configureSubstitution)
}
}
}
}
tasks.register("findShadowJarsInClasspath") {
doLast {
fun Collection<File>.printSorted(indent: String = " ") {
@@ -1110,8 +1211,7 @@ val Jar.outputFile: File
val Project.sourceSetsOrNull: SourceSetContainer?
get() = convention.findPlugin(JavaPluginConvention::class.java)?.sourceSets
val disableVerificationTasks = providers.systemProperty("disable.verification.tasks")
.forUseAtConfigurationTime().orNull?.toBoolean() ?: false
val disableVerificationTasks = System.getProperty("disable.verification.tasks") == "true"
if (disableVerificationTasks) {
gradle.taskGraph.whenReady {
allTasks.forEach {
@@ -1122,19 +1222,3 @@ if (disableVerificationTasks) {
}
}
}
plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class) {
extensions.configure(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension::class.java) {
nodeVersion = "16.2.0"
}
}
afterEvaluate {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension>().downloadBaseUrl =
"https://cache-redirector.jetbrains.com/github.com/yarnpkg/yarn/releases/download"
}
}
}

View File

@@ -11,8 +11,10 @@ buildscript {
repositories {
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/jcenter.bintray.com")
maven("https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
} else {
jcenter()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
}
@@ -22,12 +24,14 @@ buildscript {
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.31")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-sam-with-receiver:${project.bootstrapKotlinVersion}")
}
}
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
logger.info("buildSrcKotlinVersion: " + extra["bootstrapKotlinVersion"])
logger.info("buildSrc kotlin compiler version: " + org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION)
logger.info("buildSrc stdlib version: " + KotlinVersion.CURRENT)
@@ -35,7 +39,6 @@ logger.info("buildSrc stdlib version: " + KotlinVersion.CURRENT)
apply {
plugin("kotlin")
plugin("kotlin-sam-with-receiver")
plugin("groovy")
from("../gradle/checkCacheability.gradle.kts")
}
@@ -69,6 +72,7 @@ rootProject.apply {
}
val isTeamcityBuild = kotlinBuildProperties.isTeamcityBuild
val intellijUltimateEnabled by extra(kotlinBuildProperties.intellijUltimateEnabled)
val intellijSeparateSdks by extra(project.getBooleanProperty("intellijSeparateSdks") ?: false)
extra["intellijReleaseType"] = when {
@@ -78,10 +82,11 @@ extra["intellijReleaseType"] = when {
}
extra["versions.androidDxSources"] = "5.0.0_r2"
extra["customDepsOrg"] = "kotlin.build"
repositories {
mavenCentral()
jcenter()
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
gradlePluginPortal()
@@ -91,60 +96,11 @@ repositories {
}
}
val generateCompilerVersion by tasks.registering(VersionGenerator::class) {
kotlinNativeVersionInResources=true
defaultVersionFileLocation()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(generateCompilerVersion)
}
tasks.clean {
doFirst {
val versionSourceDirectory = project.konanVersionGeneratedSrc()
if (versionSourceDirectory.exists()) {
versionSourceDirectory.delete()
}
}
}
sourceSets["main"].withConvention(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet::class) {
kotlin.srcDir("src/main/kotlin")
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
kotlin.srcDir("../kotlin-native/shared/src/library/kotlin")
kotlin.srcDir("../kotlin-native/shared/src/main/kotlin")
kotlin.srcDir("../kotlin-native/build-tools/src/main/kotlin")
kotlin.srcDir("../kotlin-native/tools/kotlin-native-gradle-plugin/src/main/kotlin")
kotlin.srcDir("../compiler/util-klib/src")
kotlin.srcDir("../native/utils/src")
}
kotlin.srcDir(project.kotlinNativeVersionSrc())
/**
* TODO: mentioned bellow and Co it'd be better to move to :kotlin-native:performance:buildSrc,
* because all this relates to benchmarking.
*/
kotlin.exclude("**/benchmark/*.kt")
kotlin.exclude("**/kotlin/MPPTools.kt")
kotlin.exclude("**/kotlin/RegressionsReporter.kt")
kotlin.exclude("**/kotlin/RunJvmTask.kt")
kotlin.exclude("**/kotlin/RunKotlinNativeTask.kt")
kotlin.exclude("**/kotlin/BuildRegister.kt")
kotlin.exclude("**/kotlin/benchmarkUtils.kt")
}
tasks.validatePlugins.configure {
enabled = false
}
java {
disableAutoTargetJvm()
}
dependencies {
implementation(kotlin("stdlib", embeddedKotlinVersion))
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.bootstrapKotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.31")
implementation("com.gradle.publish:plugin-publish-plugin:0.14.0")
implementation("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
implementation("com.gradle.publish:plugin-publish-plugin:0.12.0")
implementation("net.rubygrapefruit:native-platform:${property("versions.native-platform")}")
implementation("net.rubygrapefruit:native-platform-windows-amd64:${property("versions.native-platform")}")
@@ -155,31 +111,10 @@ dependencies {
implementation("net.sf.proguard:proguard-gradle:6.2.2")
implementation("org.jetbrains.intellij.deps:asm-all:8.0.1")
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.0.1")
implementation("gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:0.5")
implementation("org.gradle:test-retry-gradle-plugin:1.2.0")
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:2.1")
compileOnly(gradleApi())
val kotlinVersion = project.bootstrapKotlinVersion
val ktorVersion = "1.2.1"
val slackApiVersion = "1.2.0"
val metadataVersion = "0.0.1-dev-10"
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("com.ullink.slack:simpleslackapi:$slackApiVersion")
implementation("io.ktor:ktor-client-auth:$ktorVersion")
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-metadata-klib:$metadataVersion")
if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
implementation("org.jetbrains.kotlin:kotlin-native-utils:${project.bootstrapKotlinVersion}")
}
implementation("org.gradle:test-retry-gradle-plugin:1.1.9")
implementation("com.gradle.enterprise:test-distribution-gradle-plugin:1.2.1")
}
samWithReceiver {
@@ -195,26 +130,11 @@ java {
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.allWarningsAsErrors = true
kotlinOptions.freeCompilerArgs += listOf(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xskip-runtime-version-check",
"-Xsuppress-version-warnings",
"-Xopt-in=kotlin.ExperimentalStdlibApi"
)
kotlinOptions.freeCompilerArgs +=
listOf("-Xopt-in=kotlin.RequiresOptIn", "-Xskip-runtime-version-check")
}
tasks["build"].dependsOn(":prepare-deps:build")
sourceSets["main"].withConvention(org.gradle.api.tasks.GroovySourceSet::class) {
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
groovy.srcDir("../kotlin-native/build-tools/src/main/groovy")
}
}
tasks.named("compileGroovy", GroovyCompile::class.java) {
classpath += project.files(tasks.named("compileKotlin", org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java))
dependsOn(tasks.named("compileKotlin"))
}
allprojects {
tasks.register("checkBuild")
@@ -223,40 +143,3 @@ allprojects {
apply(from = "$rootDir/../gradle/cacheRedirector.gradle.kts")
}
}
gradlePlugin {
plugins {
create("compileToBitcode") {
id = "compile-to-bitcode"
implementationClass = "org.jetbrains.kotlin.bitcode.CompileToBitcodePlugin"
}
create("runtimeTesting") {
id = "runtime-testing"
implementationClass = "org.jetbrains.kotlin.testing.native.RuntimeTestingPlugin"
}
create("konan") {
id = "konan"
implementationClass = "org.jetbrains.kotlin.gradle.plugin.konan.KonanPlugin"
}
// We bundle a shaded version of kotlinx-serialization plugin
create("kotlinx-serialization-native") {
id = "kotlinx-serialization-native"
implementationClass = "shadow.org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin"
}
create("org.jetbrains.kotlin.konan") {
id = "org.jetbrains.kotlin.konan"
implementationClass = "org.jetbrains.kotlin.gradle.plugin.konan.KonanPlugin"
}
create("native") {
id = "native"
implementationClass = "org.jetbrains.gradle.plugins.tools.NativePlugin"
}
create("native-interop-plugin") {
id = "native-interop-plugin"
implementationClass = "org.jetbrains.kotlin.NativeInteropPlugin"
}
}
}

View File

@@ -15,28 +15,30 @@ plugins {
base
}
val intellijUltimateEnabled: Boolean by rootProject.extra
val intellijReleaseType: String by rootProject.extra
val intellijVersion = rootProject.extra["versions.intellijSdk"] as String
val intellijVersionForIde = rootProject.intellijSdkVersionForIde()
val asmVersion = rootProject.findProperty("versions.jar.asm-all") as String?
val androidStudioRelease = rootProject.findProperty("versions.androidStudioRelease") as String?
val androidStudioBuild = rootProject.findProperty("versions.androidStudioBuild") as String?
val intellijSeparateSdks: Boolean by rootProject.extra
val installIntellijCommunity = !intellijUltimateEnabled || intellijSeparateSdks
val installIntellijUltimate = intellijUltimateEnabled && androidStudioRelease == null
fun checkIntellijVersion(intellijVersion: String) {
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
if (intellijVersionDelimiterIndex == -1) {
error("Invalid IDEA version $intellijVersion")
}
val intellijVersionDelimiterIndex = intellijVersion.indexOfAny(charArrayOf('.', '-'))
if (intellijVersionDelimiterIndex == -1) {
error("Invalid IDEA version $intellijVersion")
}
checkIntellijVersion(intellijVersion)
intellijVersionForIde?.let { checkIntellijVersion(it) }
val platformBaseVersion = intellijVersion.substring(0, intellijVersionDelimiterIndex)
logger.info("intellijUltimateEnabled: $intellijUltimateEnabled")
logger.info("intellijVersion: $intellijVersion")
logger.info("intellijVersionForIde: $intellijVersionForIde")
logger.info("androidStudioRelease: $androidStudioRelease")
logger.info("androidStudioBuild: $androidStudioBuild")
logger.info("intellijSeparateSdks: $intellijSeparateSdks")
logger.info("installIntellijCommunity: $installIntellijCommunity")
logger.info("installIntellijUltimate: $installIntellijUltimate")
val androidStudioOs by lazy {
when {
@@ -71,14 +73,11 @@ repositories {
}
val intellij by configurations.creating
val intellijForIde by configurations.creating
val intellijUltimate by configurations.creating
val androidStudio by configurations.creating
val sources by configurations.creating
val sourcesForIde by configurations.creating
val jpsStandalone by configurations.creating
val jpsStandaloneForIde by configurations.creating
val intellijCore by configurations.creating
val intellijCoreForIde by configurations.creating
val nodeJSPlugin by configurations.creating
/**
@@ -94,6 +93,7 @@ val dependenciesDir = (findProperty("kotlin.build.dependencies.dir") as String?)
val customDepsRepoDir = dependenciesDir.resolve("repo")
val customDepsOrg: String by rootProject.extra
val customDepsRevision = intellijVersion
val repoDir = File(customDepsRepoDir, customDepsOrg)
dependencies {
@@ -105,8 +105,12 @@ dependencies {
androidStudio("google:android-studio-ide:$androidStudioBuild@$extension")
} else {
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
intellijVersionForIde?.let { intellijForIde("com.jetbrains.intellij.idea:ideaIC:$it") }
if (installIntellijCommunity) {
intellij("com.jetbrains.intellij.idea:ideaIC:$intellijVersion")
}
if (installIntellijUltimate) {
intellijUltimate("com.jetbrains.intellij.idea:ideaIU:$intellijVersion")
}
}
if (asmVersion != null) {
@@ -114,104 +118,102 @@ dependencies {
}
sources("com.jetbrains.intellij.idea:ideaIC:$intellijVersion:sources@jar")
intellijVersionForIde?.let { sourcesForIde("com.jetbrains.intellij.idea:ideaIC:$it:sources@jar") }
jpsStandalone("com.jetbrains.intellij.idea:jps-standalone:$intellijVersion")
intellijVersionForIde?.let { jpsStandaloneForIde("com.jetbrains.intellij.idea:jps-standalone:$it") }
intellijCore("com.jetbrains.intellij.idea:intellij-core:$intellijVersion")
intellijVersionForIde?.let { intellijCoreForIde("com.jetbrains.intellij.idea:intellij-core:$it") }
if (intellijUltimateEnabled) {
nodeJSPlugin("com.jetbrains.plugins:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}@zip")
}
}
fun prepareDeps(
intellij: Configuration,
intellijCore: Configuration,
sources: Configuration,
jpsStandalone: Configuration,
intellijVersion: String
) {
val makeIntellijCore = buildIvyRepositoryTask(intellijCore, customDepsOrg, customDepsRepoDir)
val makeIntellijCore = buildIvyRepositoryTask(intellijCore, customDepsOrg, customDepsRepoDir)
val makeIntellijAnnotations = tasks.register("makeIntellijAnnotations${intellij.name.capitalize()}", Copy::class) {
dependsOn(makeIntellijCore)
val makeIntellijAnnotations by tasks.registering(Copy::class) {
dependsOn(makeIntellijCore)
val intellijCoreRepo = CleanableStore[repoDir.resolve("intellij-core").absolutePath][intellijVersion].use()
from(intellijCoreRepo.resolve("artifacts/annotations.jar"))
val intellijCoreRepo = CleanableStore[repoDir.resolve("intellij-core").absolutePath][intellijVersion].use()
from(intellijCoreRepo.resolve("artifacts/annotations.jar"))
val annotationsStore = CleanableStore[repoDir.resolve(intellijRuntimeAnnotations).absolutePath]
val targetDir = annotationsStore[intellijVersion].use()
into(targetDir)
val annotationsStore = CleanableStore[repoDir.resolve(intellijRuntimeAnnotations).absolutePath]
val targetDir = annotationsStore[intellijVersion].use()
into(targetDir)
val ivyFile = File(targetDir, "$intellijRuntimeAnnotations.ivy.xml")
outputs.files(ivyFile)
val ivyFile = File(targetDir, "$intellijRuntimeAnnotations.ivy.xml")
outputs.files(ivyFile)
doFirst {
annotationsStore.cleanStore()
}
doLast {
writeIvyXml(
customDepsOrg,
intellijRuntimeAnnotations,
intellijVersion,
intellijRuntimeAnnotations,
targetDir,
targetDir,
targetDir,
allowAnnotations = true
)
}
doFirst {
annotationsStore.cleanStore()
}
val mergeSources = tasks.create("mergeSources${intellij.name.capitalize()}", Jar::class.java) {
dependsOn(sources)
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
isZip64 = true
if (!kotlinBuildProperties.isTeamcityBuild) {
from(provider { sources.map(::zipTree) })
}
destinationDirectory.set(File(repoDir, sources.name))
archiveBaseName.set("intellij")
archiveClassifier.set("sources")
archiveVersion.set(intellijVersion)
}
val sourcesFile = mergeSources.outputs.files.singleFile
val makeIde = if (androidStudioBuild != null) {
buildIvyRepositoryTask(
androidStudio,
doLast {
writeIvyXml(
customDepsOrg,
customDepsRepoDir,
if (androidStudioOs == "mac")
::skipContentsDirectory
else
::skipToplevelDirectory
)
} else {
val task = buildIvyRepositoryTask(intellij, customDepsOrg, customDepsRepoDir, null, sourcesFile)
task.configure {
dependsOn(mergeSources)
}
task
}
val buildJpsStandalone = buildIvyRepositoryTask(jpsStandalone, customDepsOrg, customDepsRepoDir, null, sourcesFile)
tasks.named("build") {
dependsOn(
makeIntellijCore,
makeIde,
buildJpsStandalone,
makeIntellijAnnotations
intellijRuntimeAnnotations,
intellijVersion,
intellijRuntimeAnnotations,
targetDir,
targetDir,
targetDir,
allowAnnotations = true
)
}
}
prepareDeps(intellij, intellijCore, sources, jpsStandalone, intellijVersion)
if (intellijVersionForIde != null) {
prepareDeps(intellijForIde, intellijCoreForIde, sourcesForIde, jpsStandaloneForIde, intellijVersionForIde)
val mergeSources by tasks.creating(Jar::class.java) {
dependsOn(sources)
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
isZip64 = true
if (!kotlinBuildProperties.isTeamcityBuild) {
from(provider { sources.map(::zipTree) })
}
destinationDirectory.set(File(repoDir, sources.name))
archiveBaseName.set("intellij")
archiveClassifier.set("sources")
archiveVersion.set(intellijVersion)
}
val sourcesFile = mergeSources.outputs.files.singleFile
val makeIde = if (androidStudioBuild != null) {
buildIvyRepositoryTask(
androidStudio,
customDepsOrg,
customDepsRepoDir,
if (androidStudioOs == "mac")
::skipContentsDirectory
else
::skipToplevelDirectory
)
} else {
val task = if (installIntellijUltimate) {
buildIvyRepositoryTask(intellijUltimate, customDepsOrg, customDepsRepoDir, null, sourcesFile)
} else {
buildIvyRepositoryTask(intellij, customDepsOrg, customDepsRepoDir, null, sourcesFile)
}
task.configure {
dependsOn(mergeSources)
}
task
}
val buildJpsStandalone = buildIvyRepositoryTask(jpsStandalone, customDepsOrg, customDepsRepoDir, null, sourcesFile)
tasks.named("build") {
dependsOn(
makeIntellijCore,
makeIde,
buildJpsStandalone,
makeIntellijAnnotations
)
}
if (installIntellijUltimate) {
val buildNodeJsPlugin =
buildIvyRepositoryTask(nodeJSPlugin, customDepsOrg, customDepsRepoDir, ::skipToplevelDirectory, sourcesFile)
tasks.named("build") { dependsOn(buildNodeJsPlugin) }
}
tasks.named<Delete>("clean") {
@@ -398,11 +400,6 @@ fun skipToplevelDirectory(path: String) = path.substringAfter('/')
fun skipContentsDirectory(path: String) = path.substringAfter("Contents/")
fun Project.intellijSdkVersionForIde(): String? {
val majorVersion = kotlinBuildProperties.getOrNull("attachedIntellijVersion") as? String ?: return null
return rootProject.findProperty("versions.intellijSdk.forIde.$majorVersion") as? String
}
class XMLWriter(private val outputStreamWriter: OutputStreamWriter) : Closeable {
private val xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(outputStreamWriter)

View File

@@ -18,11 +18,55 @@ buildscript {
} else {
maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies" }
}
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.30")
classpath("org.jetbrains.kotlin:kotlin-build-gradle-plugin:0.0.21")
}
}
include "prepare-deps"
def buildProperties = BuildPropertiesKt.getKotlinBuildPropertiesForSettings(settings)
def projectVersions = file("../gradle/versions.properties").text
include "prepare-deps"
def target_AppCode_Clion = buildProperties.includeCidrPlugins && !projectVersions.contains("versions.androidStudioRelease")
def target_AndroidStudio = buildProperties.includeCidrPlugins && projectVersions.contains("versions.androidStudioRelease")
def target_IdeaUltimate = buildProperties.includeUltimate
if (target_AppCode_Clion) {
logger.info("Including modules for AC and CL in buildSrc/settings.gradle")
include ":prepare-deps:kotlin-native-platform-deps"
include ":prepare-deps:native-debug-plugin"
project(":prepare-deps:kotlin-native-platform-deps").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/kotlin-native-platform-deps")
project(":prepare-deps:native-debug-plugin").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/native-debug-plugin")
} else if (target_AndroidStudio) {
logger.info("Including modules for AS (mobile plugin) in buildSrc/settings.gradle")
include ":prepare-deps:appcode-binaries"
include ":prepare-deps:lldb-framework"
include ":prepare-deps:lldb-frontend"
project(":prepare-deps:appcode-binaries").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/appcode-binaries")
project(":prepare-deps:lldb-framework").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-framework")
project(":prepare-deps:lldb-frontend").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-frontend")
} else if (target_IdeaUltimate) {
logger.info("Including modules for IU in buildSrc/settings.gradle")
include ":prepare-deps:lldb-frontend"
include ":prepare-deps:native-debug-plugin"
project(":prepare-deps:lldb-frontend").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/lldb-frontend")
project(":prepare-deps:native-debug-plugin").projectDir =
file("${buildProperties.propertiesProvider.rootProjectDir}/kotlin-ultimate/buildSrc/prepare-deps/native-debug-plugin")
} else {
logger.info("Not including extra modules in buildSrc/settings.gradle")
}

View File

@@ -1,17 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.konan
import java.io.*
val VERSION_PATH = "/META-INF/kotlin-native.compiler.version"
val CompilerVersion.Companion.CURRENT: CompilerVersion
get() {
return InputStreamReader(this::class.java.getResourceAsStream(VERSION_PATH)).use {
it.readLines().single().parseCompilerVersion()
}
}
val currentCompilerVersion = CompilerVersion.CURRENT

View File

@@ -19,7 +19,4 @@ val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.bui
val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild)
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", false)
val KotlinBuildProperties.isObsoleteJdkOverrideEnabled: Boolean
get() = getBoolean("kotlin.build.isObsoleteJdkOverrideEnabled", false)
val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", isTeamcityBuild)

View File

@@ -4,36 +4,32 @@
*/
import groovy.lang.Closure
import org.gradle.api.JavaVersion
import org.gradle.api.file.FileCollection
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.*
import org.gradle.jvm.toolchain.JavaLauncher
import org.gradle.kotlin.dsl.property
import org.gradle.internal.jvm.Jvm
import org.gradle.internal.jvm.inspection.JvmVersionDetector
import proguard.ClassSpecification
import java.io.File
import javax.inject.Inject
@CacheableTask
open class CacheableProguardTask : proguard.gradle.ProGuardTask() {
open class CacheableProguardTask @Inject constructor(
private val jvmVersionDetector: JvmVersionDetector
) : proguard.gradle.ProGuardTask() {
@get:Internal
val javaLauncher: Property<JavaLauncher> = project.objects.property()
@get:Internal
val jdkHomePath: Provider<File> = javaLauncher.map { it.metadata.installationPath.asFile }
@Internal
var jdkHome: File? = null
@get:Optional
@get:Input
internal val jdkMajorVersion: Provider<JavaVersion> = javaLauncher.map {
JavaVersion.toVersion(it.metadata.languageVersion.toString())
}
internal val jdkMajorVersion: String?
get() = jdkHome?.let { jvmVersionDetector.getJavaVersion(Jvm.forHome(jdkHome)) }?.majorVersion
@CompileClasspath
override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection()
.filter { libraryFile ->
jdkHomePath.orNull?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true
}
override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection().filter { libraryFile ->
jdkHome?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true
}
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)

View File

@@ -81,12 +81,3 @@ fun Task.singleOutputFile(): File = when (this) {
is ProGuardTask -> project.file(outJarFiles.single()!!)
else -> outputs.files.singleFile
}
val Project.isConfigurationCacheDisabled
get() = (gradle.startParameter as? org.gradle.api.internal.StartParameterInternal)?.isConfigurationCache != true
val Project.isIdeaActive
get() = providers.systemProperty("idea.active").forUseAtConfigurationTime().isPresent
val Project.intellijCommunityDir: File
get() = rootDir.resolve("kotlin-ide/intellij/community").takeIf { it.isDirectory } ?: rootDir.resolve("kotlin-ide/intellij")

View File

@@ -1,144 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import com.github.jengelman.gradle.plugins.shadow.relocation.RelocateClassContext
import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext
import org.gradle.api.file.FileTreeElement
import shadow.org.apache.tools.zip.ZipEntry
import shadow.org.apache.tools.zip.ZipOutputStream
import shadow.org.codehaus.plexus.util.IOUtil
import shadow.org.codehaus.plexus.util.ReaderFactory
import shadow.org.codehaus.plexus.util.WriterFactory
import shadow.org.codehaus.plexus.util.xml.Xpp3Dom
import shadow.org.codehaus.plexus.util.xml.Xpp3DomBuilder
import shadow.org.codehaus.plexus.util.xml.Xpp3DomWriter
import java.io.*
import java.lang.Exception
import java.util.LinkedHashMap
/**
* A resource processor that aggregates plexus `components.xml` files.
*
* Fixed version of [com.github.jengelman.gradle.plugins.shadow.transformers.ComponentsXmlResourceTransformer],
* may be dropped after [the fix in ShadowJAR](https://github.com/johnrengelman/shadow/pull/678/files) will be accepted
*/
class ComponentsXmlResourceTransformerPatched : Transformer {
private val components: MutableMap<String, Xpp3Dom> =
LinkedHashMap<String, Xpp3Dom>()
override fun canTransformResource(element: FileTreeElement): Boolean {
val path = element.relativePath.pathString
return COMPONENTS_XML_PATH == path
}
override fun transform(context: TransformerContext) {
val newDom: Xpp3Dom = try {
val bis: BufferedInputStream = object : BufferedInputStream(context.getIs()) {
override fun close() {
// leave ZIP open
}
}
val reader: Reader = ReaderFactory.newXmlReader(bis)
Xpp3DomBuilder.build(reader)
} catch (e: Exception) {
throw (IOException("Error parsing components.xml in " + context.getIs()).initCause(e) as IOException)
}
// Only try to merge in components if there are some elements in the component-set
if (newDom.getChild("components") == null) {
return
}
val children: Array<Xpp3Dom>? = newDom.getChild("components")?.getChildren("component")
children?.forEach { component ->
var role: String? = getValue(component, "role")
role = getRelocatedClass(role, context)
setValue(component, "role", role)
val roleHint = getValue(component, "role-hint")
var impl: String? = getValue(component, "implementation")
impl = getRelocatedClass(impl, context)
setValue(component, "implementation", impl)
val key = "$role:$roleHint"
if (components.containsKey(key)) {
// configuration carry over
val dom: Xpp3Dom? = components[key]
if (dom?.getChild("configuration") != null) {
component.addChild(dom.getChild("configuration"))
}
}
val requirements: Xpp3Dom? = component.getChild("requirements")
if (requirements != null && requirements.childCount > 0) {
for (r in requirements.childCount - 1 downTo 0) {
val requirement: Xpp3Dom = requirements.getChild(r)
var requiredRole: String? = getValue(requirement, "role")
requiredRole = getRelocatedClass(requiredRole, context)
setValue(requirement, "role", requiredRole)
}
}
components[key] = component
}
}
override fun modifyOutputStream(os: ZipOutputStream, preserveFileTimestamps: Boolean) {
val data = transformedResource
val entry = ZipEntry(COMPONENTS_XML_PATH)
entry.time = TransformerContext.getEntryTimestamp(preserveFileTimestamps, entry.time)
os.putNextEntry(entry)
IOUtil.copy(data, os)
components.clear()
}
override fun hasTransformedResource(): Boolean {
return components.isNotEmpty()
}
private val transformedResource: ByteArray
get() {
val baos = ByteArrayOutputStream(1024 * 4)
val writer: Writer = WriterFactory.newXmlWriter(baos)
try {
val dom = Xpp3Dom("component-set")
val componentDom = Xpp3Dom("components")
dom.addChild(componentDom)
for (component in components.values) {
componentDom.addChild(component)
}
Xpp3DomWriter.write(writer, dom)
} finally {
IOUtil.close(writer)
}
return baos.toByteArray()
}
companion object {
private const val COMPONENTS_XML_PATH = "META-INF/plexus/components.xml"
private fun getRelocatedClass(className: String?, context: TransformerContext): String? {
val relocators = context.relocators
val stats = context.stats
if (className != null && className.isNotEmpty() && relocators != null) {
for (relocator in relocators) {
if (relocator.canRelocateClass(className)) {
val relocateClassContext = RelocateClassContext(className, stats)
return relocator.relocateClass(relocateClassContext)
}
}
}
return className
}
private fun getValue(dom: Xpp3Dom, element: String): String {
val child: Xpp3Dom? = dom.getChild(element)
return if (child?.value != null) child.value else ""
}
private fun setValue(dom: Xpp3Dom, element: String, value: String?) {
val child: Xpp3Dom? = dom.getChild(element)
if (value == null || value.isEmpty()) {
return
}
child?.value = value
}
}
}

View File

@@ -26,7 +26,7 @@ fun CompatibilityPredicate.or(other: CompatibilityPredicate): CompatibilityPredi
}
enum class Platform : CompatibilityPredicate {
P202, P203;
P183, P191, P192, P193, P201, P202, P203;
val version: Int = name.drop(1).toInt()
@@ -43,9 +43,17 @@ enum class Platform : CompatibilityPredicate {
}
enum class Ide(val platform: Platform) : CompatibilityPredicate {
IJ191(Platform.P191),
IJ192(Platform.P192),
IJ193(Platform.P193),
IJ201(Platform.P201),
IJ202(Platform.P202),
IJ203(Platform.P203),
AS35(Platform.P183),
AS36(Platform.P192),
AS40(Platform.P193),
AS41(Platform.P201),
AS42(Platform.P202);
val kind = Kind.values().first { it.shortName == name.take(2) }

View File

@@ -1,51 +0,0 @@
import org.gradle.api.Action
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withGroovyBuilder
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
class InstrumentJava(@Transient val javaInstrumentator: Configuration, @Transient val sourceSet: SourceSet) : Action<Task> {
private val instrumentatorClasspath: String by lazy {
javaInstrumentator.asPath
}
private val srcDirs: FileCollection by lazy {
sourceSet.allJava.sourceDirectories
}
override fun execute(task: Task) {
require(task is JavaCompile) { "$task is not of type JavaCompile!" }
task.doLast {
task.ant.withGroovyBuilder {
"taskdef"(
"name" to "instrumentIdeaExtensions",
"classpath" to instrumentatorClasspath,
"loaderref" to "java2.loader",
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
)
}
val javaSourceDirectories = srcDirs.filter { it.exists() }
task.ant.withGroovyBuilder {
javaSourceDirectories.forEach { directory ->
"instrumentIdeaExtensions"(
"srcdir" to directory,
"destdir" to task.destinationDir,
"classpath" to task.classpath.asPath,
"includeantruntime" to false,
"instrumentNotNull" to true
)
}
}
}
}
}

View File

@@ -1,183 +0,0 @@
@file:JvmName("JvmToolchain")
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.jvm.toolchain.*
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
enum class JdkMajorVersion(
val majorVersion: Int,
val targetName: String = majorVersion.toString(),
val overrideMajorVersion: Int? = null,
private val mandatory: Boolean = true
) {
JDK_1_6(6, targetName = "1.6", overrideMajorVersion = 8),
JDK_1_7(7, targetName = "1.7", overrideMajorVersion = 8),
JDK_1_8(8, targetName = "1.8"),
JDK_9(9, overrideMajorVersion = 11),
JDK_10(10, mandatory = false, overrideMajorVersion = 11),
JDK_11(11, mandatory = false),
JDK_15(15, mandatory = false),
JDK_16(16, mandatory = false);
fun isMandatory(): Boolean = mandatory
companion object {
fun fromMajorVersion(majorVersion: Int) = values().first { it.majorVersion == majorVersion }
}
}
fun Project.configureJvmDefaultToolchain() {
configureJvmToolchain(JdkMajorVersion.JDK_1_8)
}
fun Project.shouldOverrideObsoleteJdk(
jdkVersion: JdkMajorVersion
): Boolean = kotlinBuildProperties.isObsoleteJdkOverrideEnabled &&
jdkVersion.overrideMajorVersion != null
fun Project.configureJvmToolchain(
jdkVersion: JdkMajorVersion
) {
// Ensure java only modules also set default toolchain
configureJavaOnlyToolchain(jdkVersion)
plugins.withId("org.jetbrains.kotlin.jvm") {
val kotlinExtension = extensions.getByType<KotlinTopLevelExtension>()
if (shouldOverrideObsoleteJdk(jdkVersion)) {
kotlinExtension.jvmToolchain {
(this as JavaToolchainSpec).languageVersion
.set(JavaLanguageVersion.of(jdkVersion.overrideMajorVersion!!))
}
updateJvmTarget(jdkVersion.targetName)
} else {
kotlinExtension.jvmToolchain {
(this as JavaToolchainSpec).languageVersion
.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
}
}
tasks
.matching { it.name != "compileJava9Java" && it is JavaCompile }
.configureEach {
with(this as JavaCompile) {
options.compilerArgs.add("-proc:none")
options.encoding = "UTF-8"
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
}
}
}
fun Project.configureJavaOnlyToolchain(
jdkVersion: JdkMajorVersion
) {
plugins.withId("java-base") {
val javaExtension = extensions.getByType<JavaPluginExtension>()
if (shouldOverrideObsoleteJdk(jdkVersion)) {
javaExtension.toolchain {
languageVersion.set(
JavaLanguageVersion.of(jdkVersion.overrideMajorVersion!!)
)
}
tasks.withType<JavaCompile>().configureEach {
targetCompatibility = jdkVersion.targetName
sourceCompatibility = jdkVersion.targetName
}
} else {
javaExtension.toolchain {
languageVersion.set(
JavaLanguageVersion.of(jdkVersion.majorVersion)
)
}
}
}
}
fun KotlinCompile.configureTaskToolchain(
jdkVersion: JdkMajorVersion
) {
if (project.shouldOverrideObsoleteJdk(jdkVersion)) {
kotlinJavaToolchain.toolchain.use(
project.getToolchainLauncherFor(
JdkMajorVersion.fromMajorVersion(
jdkVersion.overrideMajorVersion!!
)
)
)
kotlinOptions {
jvmTarget = jdkVersion.targetName
}
} else {
kotlinJavaToolchain.toolchain.use(
project.getToolchainLauncherFor(jdkVersion)
)
}
}
fun JavaCompile.configureTaskToolchain(
jdkVersion: JdkMajorVersion
) {
if (project.shouldOverrideObsoleteJdk(jdkVersion)) {
javaCompiler.set(
project.getToolchainCompilerFor(
JdkMajorVersion.fromMajorVersion(
jdkVersion.overrideMajorVersion!!
)
)
)
targetCompatibility = jdkVersion.targetName
sourceCompatibility = jdkVersion.targetName
} else {
javaCompiler.set(project.getToolchainCompilerFor(jdkVersion))
}
}
fun Project.updateJvmTarget(
jvmTarget: String
) {
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = jvmTarget
}
tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = jvmTarget
targetCompatibility = jvmTarget
}
}
private fun Project.getToolchainCompilerFor(
jdkVersion: JdkMajorVersion
): Provider<JavaCompiler> {
val service = project.extensions.getByType<JavaToolchainService>()
return service.compilerFor {
this.languageVersion.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
}
}
fun Project.getToolchainLauncherFor(
jdkVersion: JdkMajorVersion
): Provider<JavaLauncher> {
val service = project.extensions.getByType<JavaToolchainService>()
val jdkVersionWithOverride = project.getJdkVersionWithOverride(jdkVersion)
return service.launcherFor {
this.languageVersion.set(JavaLanguageVersion.of(jdkVersionWithOverride.majorVersion))
}
}
fun Project.getJdkVersionWithOverride(jdkVersion: JdkMajorVersion): JdkMajorVersion {
return if (project.shouldOverrideObsoleteJdk(jdkVersion)) {
JdkMajorVersion.fromMajorVersion(jdkVersion.overrideMajorVersion!!)
} else {
jdkVersion
}
}

View File

@@ -1,75 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:JvmName("LibrariesCommon")
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.provideDelegate
import org.gradle.kotlin.dsl.withType
import org.gradle.process.CommandLineArgumentProvider
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@JvmOverloads
fun Project.configureJava9Compilation(
moduleName: String,
moduleOutputs: Collection<FileCollection> = setOf(sourceSets["main"].output)
) {
configurations["java9CompileClasspath"].extendsFrom(configurations["compileClasspath"])
tasks.named("compileJava9Java", JavaCompile::class.java) {
dependsOn(moduleOutputs)
targetCompatibility = JavaVersion.VERSION_1_9.toString()
sourceCompatibility = JavaVersion.VERSION_1_9.toString()
configureTaskToolchain(JdkMajorVersion.JDK_9)
// module-info.java should be in java9 source set by convention
val java9SourceSet = sourceSets["java9"].java
destinationDir = file("${java9SourceSet.outputDir}/META-INF/versions/9")
options.sourcepath = files(java9SourceSet.srcDirs)
val compileClasspath = configurations["java9CompileClasspath"]
val moduleFiles = objects.fileCollection().from(moduleOutputs)
val modulePath = compileClasspath.filter { it !in moduleFiles.files }
classpath = objects.fileCollection().from()
options.compilerArgumentProviders.add(
Java9AdditionalArgumentsProvider(
moduleName,
moduleFiles,
modulePath
)
)
}
}
private class Java9AdditionalArgumentsProvider(
private val moduleName: String,
private val moduleFiles: FileCollection,
private val modulePath: FileCollection
) : CommandLineArgumentProvider {
override fun asArguments(): Iterable<String> = listOf(
"--module-path", modulePath.asPath,
"--patch-module", "$moduleName=${moduleFiles.asPath}",
"-Xlint:-requires-transitive-automatic" // suppress automatic module transitive dependencies in kotlin.test
)
}
fun Project.disableDeprecatedJvmTargetWarning() {
if (!kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) {
val tasksWithWarnings: List<String> by rootProject.extra
tasks.withType<KotlinCompile>().configureEach {
if (!tasksWithWarnings.contains(path)) {
kotlinOptions {
allWarningsAsErrors = true
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
}
}
}
}
}

View File

@@ -1,6 +1,6 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import com.gradle.publish.PublishTask
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.ConfigurablePublishArtifact
@@ -22,12 +22,13 @@ import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.tasks.GenerateModuleMetadata
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.Upload
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer
import plugins.KotlinBuildPublishingPlugin
import plugins.mainPublicationName
private const val MAGIC_DO_NOT_CHANGE_TEST_JAR_TASK_NAME = "testJar"
@@ -62,6 +63,8 @@ fun Project.removeArtifacts(configuration: Configuration, task: Task) {
fun Project.noDefaultJar() {
tasks.named("jar").configure {
enabled = false
actions = emptyList()
configurations.forEach { cfg ->
removeArtifacts(cfg, this)
}
@@ -110,8 +113,6 @@ fun <T : Jar> Project.runtimeJar(task: TaskProvider<T>, body: T.() -> Unit = {})
addVariantsFromConfiguration(runtimeJar) { }
}
(components.findByName("java") as AdhocComponentWithVariants?)?.addVariantsFromConfiguration(runtimeJar) { }
return task
}
@@ -225,20 +226,24 @@ fun Project.publish(moduleMetadata: Boolean = false, configure: MavenPublication
val publication = extensions.findByType<PublishingExtension>()
?.publications
?.findByName(mainPublicationName) as MavenPublication
?.findByName(KotlinBuildPublishingPlugin.PUBLICATION_NAME) as MavenPublication
publication.configure()
}
fun Project.publishGradlePlugin() {
mainPublicationName = "pluginMaven"
publish()
fun Project.publishWithLegacyMavenPlugin(body: Upload.() -> Unit = {}): Upload {
apply<plugins.PublishedKotlinModule>()
if (artifactsRemovedDiagnosticFlag) {
error("`publish()` should be called before removing artifacts typically done in `noDefaultJar()` or `runtimeJar()` call")
}
afterEvaluate {
tasks.withType<PublishTask> {
// Makes plugin publication task reuse poms and metadata from publication named "pluginMaven"
useAutomatedPublishing()
useGradleModuleMetadataIfAvailable()
}
if (configurations.findByName("classes-dirs") != null)
throw GradleException("classesDirsArtifact() is incompatible with publish(), see sources comments for details")
}
return (tasks.getByName("uploadArchives") as Upload).apply {
body()
}
}
@@ -249,41 +254,6 @@ fun Project.idePluginDependency(block: () -> Unit) {
}
}
fun Project.publishJarsForIde(projects: List<String>, libraryDependencies: List<String> = emptyList()) {
idePluginDependency {
publishProjectJars(projects, libraryDependencies)
}
configurations.all {
// Don't allow `ideaIC` from compiler to leak into Kotlin plugin modules. Compiler and
// plugin may depend on different versions of IDEA and it will lead to version conflict
exclude(module = ideModuleName())
}
dependencies {
projects.forEach {
jpsLikeJarDependency(project(it), JpsDepScope.COMPILE, { isTransitive = false }, exported = true)
}
libraryDependencies.forEach {
jpsLikeJarDependency(it, JpsDepScope.COMPILE, exported = true)
}
}
}
fun Project.publishTestJarsForIde(projectNames: List<String>) {
idePluginDependency {
publishTestJar(projectNames)
}
configurations.all {
// Don't allow `ideaIC` from compiler to leak into Kotlin plugin modules. Compiler and
// plugin may depend on different versions of IDEA and it will lead to version conflict
exclude(module = ideModuleName())
}
dependencies {
for (projectName in projectNames) {
jpsLikeJarDependency(projectTests(projectName), JpsDepScope.COMPILE, exported = true)
}
}
}
fun Project.publishProjectJars(projects: List<String>, libraryDependencies: List<String> = emptyList()) {
apply<JavaPlugin>()
@@ -322,15 +292,13 @@ fun Project.publishProjectJars(projects: List<String>, libraryDependencies: List
javadocJar()
}
fun Project.publishTestJar(projects: List<String>) {
fun Project.publishTestJar(projectName: String) {
apply<JavaPlugin>()
val fatJarContents by configurations.creating
dependencies {
for (projectName in projects) {
fatJarContents(project(projectName, configuration = "tests-jar")) { isTransitive = false }
}
fatJarContents(project(projectName, configuration = "tests-jar")) { isTransitive = false }
}
publish()
@@ -347,7 +315,7 @@ fun Project.publishTestJar(projects: List<String>) {
sourcesJar {
from {
projects.map { project(it).testSourceSet.allSource }
project(projectName).testSourceSet.allSource
}
}

View File

@@ -8,37 +8,48 @@ package tasks
import groovy.util.Node
import groovy.util.XmlParser
import org.gradle.api.DefaultTask
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.Project
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import java.io.File
import java.util.*
abstract class WriteCopyrightToFile : DefaultTask() {
open class WriteCopyrightToFile : DefaultTask() {
@InputFile
val path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
var path = project.file("${project.rootDir}/.idea/copyright/apache.xml")
@get:OutputFile
abstract val outputFile: RegularFileProperty
@OutputFile
var outputFile: File? = null
@get:Input
val commented: Property<Boolean> = project.objects.property(Boolean::class.java).convention(true)
@Input
var commented: Boolean = true
@TaskAction
fun write() {
val file = outputFile.asFile.get()
file.writeText(if (commented.get()) readCopyrightCommented() else readCopyright())
if (commented) {
outputFile!!.writeText(project.readCopyrightCommented())
} else {
outputFile!!.writeText(project.readCopyright())
}
}
private fun readCopyright(): String {
assert(path.exists()) {
"File $path with copyright not found"
fun Project.readCopyright(): String {
val file = rootDir.resolve(".idea/copyright/apache.xml")
assert(file.exists()) {
"File $file with copyright not found"
}
val xmlParser = XmlParser()
val node = xmlParser.parse(path)
val node = xmlParser.parse(file)
assert(node.attribute("name") == "CopyrightManager") {
"Format changed occasionally?"
}
@@ -48,7 +59,7 @@ abstract class WriteCopyrightToFile : DefaultTask() {
return noticeNode.attribute("value").toString().replace("&#36;today.year", GregorianCalendar()[Calendar.YEAR].toString())
}
private fun readCopyrightCommented(): String {
fun Project.readCopyrightCommented(): String {
return "/*\n" + readCopyright().prependIndent(" * ") + "\n */"
}
}

View File

@@ -9,15 +9,13 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.*
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ExternalModuleDependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.internal.jvm.Jvm
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
import org.gradle.kotlin.dsl.closureOf
import org.gradle.kotlin.dsl.exclude
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -36,7 +34,7 @@ val Project.internalBootstrapRepo: String? get() =
when {
bootstrapKotlinRepo?.startsWith("https://buildserver.labs.intellij.net") == true ->
bootstrapKotlinRepo!!.replace("artifacts/content/maven", "artifacts/content/internal/repo")
else -> "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Aggregate),number:$bootstrapKotlinVersion," +
else -> "https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_KotlinPublic_Compiler),number:$bootstrapKotlinVersion," +
"branch:default:any/artifacts/content/internal/repo/"
}
@@ -91,6 +89,12 @@ fun Project.preloadedDeps(
return files(*matchingFiles.map { it.canonicalPath }.toTypedArray())
}
fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir: String? = null): ConfigurableFileCollection {
val ultimateDepsDir = fileFrom(rootDir, "ultimate", "dependencies")
return if (ultimateDepsDir.isDirectory) preloadedDeps(*artifactBaseNames, baseDir = ultimateDepsDir, subdir = subdir)
else files()
}
fun Project.kotlinDep(artifactBaseName: String, version: String, classifier: String? = null): String =
listOfNotNull("org.jetbrains.kotlin:kotlin-$artifactBaseName:$version", classifier).joinToString(":")
@@ -111,100 +115,10 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
enum class JpsDepScope {
COMPILE, TEST, RUNTIME, PROVIDED
}
fun DependencyHandler.add(configurationName: String, dependencyNotation: Any, configure: (ModuleDependency.() -> Unit)?) {
// Avoid `dependencyNotation` to `ModuleDependency` class cast exception if possible
if (configure != null) {
add(configurationName, dependencyNotation, closureOf(configure))
} else {
add(configurationName, dependencyNotation)
}
}
fun Project.disableDependencyVerification() {
configurations.all {
resolutionStrategy {
disableDependencyVerification()
}
}
}
fun DependencyHandler.jpsLikeJarDependency(
dependencyNotation: Any,
scope: JpsDepScope,
dependencyConfiguration: (ModuleDependency.() -> Unit)? = null,
exported: Boolean = false
) {
when (scope) {
JpsDepScope.COMPILE -> {
if (exported) {
add("api", dependencyNotation, dependencyConfiguration)
add("testCompile", dependencyNotation, dependencyConfiguration)
} else {
add("implementation", dependencyNotation, dependencyConfiguration)
}
}
JpsDepScope.TEST -> {
if (exported) {
add("testCompile", dependencyNotation, dependencyConfiguration)
} else {
add("testImplementation", dependencyNotation, dependencyConfiguration)
}
}
JpsDepScope.RUNTIME -> {
add("testRuntimeOnly", dependencyNotation, dependencyConfiguration)
}
JpsDepScope.PROVIDED -> {
if (exported) {
add("compileOnlyApi", dependencyNotation, dependencyConfiguration)
add("testCompile", dependencyNotation, dependencyConfiguration)
} else {
add("compileOnly", dependencyNotation, dependencyConfiguration)
add("testImplementation", dependencyNotation, dependencyConfiguration)
}
}
}
}
fun DependencyHandler.jpsLikeModuleDependency(moduleName: String, scope: JpsDepScope, exported: Boolean = false) {
jpsLikeJarDependency(project(moduleName), scope, exported = exported)
when (scope) {
JpsDepScope.COMPILE -> {
if (exported) {
add("testCompile", projectTests(moduleName))
} else {
add("testImplementation", projectTests(moduleName))
}
}
JpsDepScope.TEST -> {
if (exported) {
add("testCompile", projectTests(moduleName))
} else {
add("testImplementation", projectTests(moduleName))
}
}
JpsDepScope.RUNTIME -> {
add("runtimeOnly", projectTests(moduleName))
}
JpsDepScope.PROVIDED -> {
if (exported) {
add("testCompile", projectTests(moduleName))
} else {
add("testImplementation", projectTests(moduleName))
}
}
}
}
fun Project.testApiJUnit5(
vintageEngine: Boolean = false,
runner: Boolean = false,
suiteApi: Boolean = false,
jupiterParams: Boolean = false
suiteApi: Boolean = false
) {
with(dependencies) {
val platformVersion = commonVer("org.junit", "junit-bom")
@@ -213,11 +127,6 @@ fun Project.testApiJUnit5(
if (vintageEngine) {
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
}
if (jupiterParams) {
testApi("org.junit.jupiter:junit-jupiter-params:$platformVersion")
}
val componentsVersion = commonVer("org.junit.platform", "")
val components = mutableListOf(
@@ -289,16 +198,14 @@ fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = Fi
fun Project.toolsJarApi(): Any =
if (kotlinBuildProperties.isInJpsBuildIdeaSync)
toolsJar()
files(toolsJarFile() ?: error("tools.jar is not found!"))
else
dependencies.project(":dependencies:tools-jar-api")
fun Project.toolsJar(): FileCollection = files(
getToolchainLauncherFor(JdkMajorVersion.JDK_1_8)
.map {
Jvm.forHome(it.metadata.installationPath.asFile).toolsJar ?: throw GradleException("tools.jar not found!")
}
)
fun Project.toolsJar(): FileCollection = files(toolsJarFile() ?: error("tools.jar is not found!"))
fun Project.toolsJarFile(jdkHome: File = File(this.property("JDK_18") as String)): File? =
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
val compilerManifestClassPath
get() = "annotations-13.0.jar kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar trove4j.jar"

View File

@@ -2,8 +2,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Project
import org.gradle.api.artifacts.DependencySubstitution
import org.gradle.api.artifacts.component.ProjectComponentSelector
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.TaskProvider
import org.gradle.jvm.tasks.Jar
@@ -82,24 +80,6 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
}
}
fun Project.configureShadowJarSubstitutionInCompileClasspath() {
val substitutionMap = mapOf(":kotlin-reflect" to ":kotlin-reflect-api")
fun configureSubstitution(substitution: DependencySubstitution) {
val requestedProject = (substitution.requested as? ProjectComponentSelector)?.projectPath ?: return
val replacementProject = substitutionMap[requestedProject] ?: return
substitution.useTarget(project(replacementProject), "Non-default shadow jars should not be used in compile classpath")
}
sourceSets.all {
for (configName in listOf(compileOnlyConfigurationName, compileClasspathConfigurationName)) {
configurations.getByName(configName).resolutionStrategy.dependencySubstitution {
all(::configureSubstitution)
}
}
}
}
fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider<out ShadowJar> =
compilerShadowJar(taskName) {
configureEmbeddableCompilerRelocation()
@@ -113,6 +93,7 @@ fun Project.compilerDummyForDependenciesRewriting(
exclude(packagesToExcludeFromDummy)
body()
}
const val COMPILER_DUMMY_JAR_CONFIGURATION_NAME = "compilerDummyJar"
fun Project.compilerDummyJar(task: TaskProvider<out Jar>, body: Jar.() -> Unit = {}) {
@@ -147,6 +128,7 @@ fun Project.rewriteDepsToShadedJar(
archiveClassifier.set("original")
}
val compilerDummyJarFile by lazy { configurations.getAt("compilerDummyJar").singleFile }
shadowJarTask.configure {
dependsOn(originalJarTask)
@@ -154,8 +136,7 @@ fun Project.rewriteDepsToShadedJar(
// When Gradle traverses the inputs, reject the shaded compiler JAR,
// which leads to the content of that JAR being excluded as well:
val compilerDummyJarFile = project.provider { configurations.getByName("compilerDummyJar").singleFile }
exclude { it.file == compilerDummyJarFile.get() }
exclude { it.file == compilerDummyJarFile }
archiveClassifier.set("original")
body()

View File

@@ -1,52 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
}
publishGradlePlugin()
standardPublicJars()
extensions.extraProperties["kotlin.stdlib.default.dependency"] = "false"
dependencies {
compileOnly(kotlinStdlib())
compileOnly(gradleApi())
}
// These dependencies will be provided by Gradle and we should prevent version conflict
fun Configuration.excludeGradleCommonDependencies() {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-script-runtime")
}
configurations {
"implementation" {
excludeGradleCommonDependencies()
}
"api" {
excludeGradleCommonDependencies()
}
}
tasks.withType<KotlinCompile> {
kotlinOptions.languageVersion = "1.3"
kotlinOptions.apiVersion = "1.3"
kotlinOptions.freeCompilerArgs += listOf(
"-Xskip-prerelease-check",
"-Xskip-runtime-version-check",
"-Xsuppress-version-warnings",
"-Xuse-ir" // Needed as long as languageVersion is less than 1.5.
)
}
tasks.named<Jar>("jar") {
callGroovy("manifestAttributes", manifest, project)
}

View File

@@ -24,16 +24,16 @@ fun ProjectSettings.compiler(block: IdeaCompilerConfiguration.() -> Unit) =
fun ProjectSettings.delegateActions(block: ActionDelegationConfig.() -> Unit) =
(this@delegateActions as ExtensionAware).extensions.configure(block)
fun ProjectSettings.runConfigurations(block: RunConfigurationContainer.() -> Unit) =
fun ProjectSettings.runConfigurations(block: DefaultRunConfigurationContainer.() -> Unit) =
(this@runConfigurations as ExtensionAware).extensions.configure("runConfigurations", block)
inline fun <reified T: RunConfiguration> RunConfigurationContainer.defaults(noinline block: T.() -> Unit) =
inline fun <reified T: RunConfiguration> DefaultRunConfigurationContainer.defaults(noinline block: T.() -> Unit) =
defaults(T::class.java, block)
fun RunConfigurationContainer.junit(name: String, block: JUnit.() -> Unit) =
fun DefaultRunConfigurationContainer.junit(name: String, block: JUnit.() -> Unit) =
create(name, JUnit::class.java, block)
fun RunConfigurationContainer.application(name: String, block: Application.() -> Unit) =
fun DefaultRunConfigurationContainer.application(name: String, block: Application.() -> Unit) =
create(name, Application::class.java, block)
fun ProjectSettings.ideArtifacts(block: NamedDomainObjectContainer<org.jetbrains.gradle.ext.TopLevelArtifact>.() -> Unit) =

View File

@@ -21,18 +21,15 @@ import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.internal.ConventionTask
import org.gradle.api.plugins.ExtensionAware
import org.gradle.api.tasks.*
import org.gradle.api.tasks.compile.AbstractCompile
import org.gradle.kotlin.dsl.*
import java.io.File
import javax.inject.Inject
fun Project.configureFormInstrumentation() {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.configureEach {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
// When we change the output classes directory, Gradle will automatically configure
// the test compile tasks to use the instrumented classes. Normally this is fine,
// however, it causes problems for Kotlin projects:
@@ -45,36 +42,31 @@ fun Project.configureFormInstrumentation() {
// This fails when we change the classes dir. The easiest fix is to prepend the
// classes from the "friendly directory" to the compile classpath.
if (!tasks.names.contains("compileTestKotlin")) return@configureEach
val testCompile = tasks.findByName("compileTestKotlin") as AbstractCompile?
testCompile?.doFirst {
val originalClassesDirs = files((mainSourceSet as ExtensionAware).extra.get("classesDirsCopy"))
tasks.named<AbstractCompile>("compileTestKotlin") {
val objects = project.objects
val classesDirs = project.mainSourceSet.output.classesDirs
val classesDirsCopy = project.provider { (mainSourceSet as ExtensionAware).extra.get("classesDirsCopy") }
doFirst {
val originalClassesDirs = objects.fileCollection().from(classesDirsCopy)
testCompile.classpath = (testCompile.classpath
- mainSourceSet.output.classesDirs
+ originalClassesDirs)
classpath = (classpath
- classesDirs
+ originalClassesDirs)
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
// -Xfriend-paths compiler argument as well.
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
// Since Kotlin 1.3.60, the friend paths available to the test compile task are calculated as the main source set's
// output.classesDirs. Since the classesDirs are excluded from the classpath (replaced by the originalClassesDirs),
// in order to be able to access the internals of 'main', tests need to receive the original classes dirs as a
// -Xfriend-paths compiler argument as well.
fun addFreeCompilerArgs(kotlinCompileTask: AbstractCompile, vararg args: String) {
val getKotlinOptions = kotlinCompileTask::class.java.getMethod("getKotlinOptions")
val kotlinOptions = getKotlinOptions(kotlinCompileTask)
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
val getFreeCompilerArgs = kotlinOptions::class.java.getMethod("getFreeCompilerArgs")
val freeCompilerArgs = getFreeCompilerArgs(kotlinOptions) as List<*>
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
}
addFreeCompilerArgs(this as AbstractCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
val setFreeCompilerArgs = kotlinOptions::class.java.getMethod("setFreeCompilerArgs", List::class.java)
setFreeCompilerArgs(kotlinOptions, freeCompilerArgs + args)
}
addFreeCompilerArgs(testCompile, "-Xfriend-paths=" + originalClassesDirs.joinToString(",") { it.absolutePath })
}
}
val instrumentationClasspathCfg = configurations.create("instrumentationClasspath")
@@ -84,7 +76,7 @@ fun Project.configureFormInstrumentation() {
}
afterEvaluate {
sourceSets.forEach { sourceSetParam ->
sourceSets.all { sourceSetParam ->
// This copy will ignore filters, but they are unlikely to be used.
val classesDirs = (sourceSetParam.output.classesDirs as ConfigurableFileCollection).from as Collection<Any>
@@ -96,82 +88,66 @@ fun Project.configureFormInstrumentation() {
(sourceSetParam.output.classesDirs as ConfigurableFileCollection).setFrom(instrumentedClassesDir)
val instrumentTask =
project.tasks.register(sourceSetParam.getTaskName("instrument", "classes"), IntelliJInstrumentCodeTask::class.java) {
dependsOn(sourceSetParam.classesTaskName)
compileClasspath.from(sourceSetParam.compileClasspath)
sourceDirs.from(project.files({ sourceSetParam.allSource.srcDirs.filter { !sourceSetParam.resources.contains(it) && it.exists() } }))
instrumentationClasspathConfiguration = instrumentationClasspathCfg
originalClassesDirs.from(classesDirsCopy)
output.set(instrumentedClassesDir)
dependsOn(sourceSetParam.classesTaskName).onlyIf { !classesDirsCopy.isEmpty }
sourceSet = sourceSetParam
instrumentationClasspath = instrumentationClasspathCfg
originalClassesDirs = classesDirsCopy
output = instrumentedClassesDir
outputs.dir(instrumentedClassesDir)
}
// Ensure that our task is invoked when the source set is built
sourceSetParam.compiledBy(instrumentTask)
@Suppress("UNUSED_EXPRESSION")
true
}
}
}
@CacheableTask
abstract class IntelliJInstrumentCodeTask : ConventionTask() {
open class IntelliJInstrumentCodeTask : ConventionTask() {
companion object {
private const val FILTER_ANNOTATION_REGEXP_CLASS = "com.intellij.ant.ClassFilterAnnotationRegexp"
private const val LOADER_REF = "java2.loader"
}
@Transient
@Internal
lateinit var instrumentationClasspathConfiguration: Configuration
@Classpath
var instrumentationClasspath: Configuration? = null
@get:Classpath
val instrumentationClasspath: String by lazy {
instrumentationClasspathConfiguration.asPath
}
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:SkipWhenEmpty
abstract val originalClassesDirs: ConfigurableFileCollection
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
var originalClassesDirs: FileCollection? = null
@get:Input
var instrumentNotNull: Boolean = false
@get:InputFiles
@get:Classpath
abstract val compileClasspath: ConfigurableFileCollection
// Instrumentation needs to have access to sources of forms for inclusion
private val depSourceDirectorySets by lazy {
project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
}
@Internal
var sourceSet: SourceSet? = null
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val sourceDirs: ConfigurableFileCollection
val sourceDirs: FileCollection
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@get:OutputDirectory
abstract val output: RegularFileProperty
@get:Inject
abstract val fs: FileSystemOperations
lateinit var output: File
@TaskAction
fun instrumentClasses() {
logger.info(
"input files are: ${
originalClassesDirs.joinToString(
"; ",
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })
}"
"input files are: ${originalClassesDirs?.joinToString(
"; ",
transform = { "'${it.name}'${if (it.exists()) "" else " (does not exists)"}" })}"
)
output.asFile.get().deleteRecursively()
output.deleteRecursively()
copyOriginalClasses()
val classpath = instrumentationClasspath
val classpath = instrumentationClasspath!!
ant.withGroovyBuilder {
"taskdef"(
"name" to "instrumentIdeaExtensions",
"classpath" to classpath,
"classpath" to classpath.asPath,
"loaderref" to LOADER_REF,
"classname" to "com.intellij.ant.InstrumentIdeaExtensions"
)
@@ -179,14 +155,14 @@ abstract class IntelliJInstrumentCodeTask : ConventionTask() {
logger.info("Compiling forms and instrumenting code with nullability preconditions")
if (instrumentNotNull) {
prepareNotNullInstrumenting(classpath)
prepareNotNullInstrumenting(classpath.asPath)
}
instrumentCode(sourceDirs, instrumentNotNull)
}
private fun copyOriginalClasses() {
fs.copy {
project.copy {
from(originalClassesDirs)
into(output)
}
@@ -205,10 +181,12 @@ abstract class IntelliJInstrumentCodeTask : ConventionTask() {
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
val headlessOldValue = System.setProperty("java.awt.headless", "true")
val output = output.get().asFile
// Instrumentation needs to have access to sources of forms for inclusion
val depSourceDirectorySets = project.configurations["compile"].dependencies.withType(ProjectDependency::class.java)
.map { p -> p.dependencyProject.mainSourceSet.allSource.sourceDirectories }
val instrumentationClasspath =
depSourceDirectorySets.fold(compileClasspath as FileCollection) { acc, v -> acc + v }.asPath.also {
depSourceDirectorySets.fold(sourceSet!!.compileClasspath) { acc, v -> acc + v }.asPath.also {
logger.info("Using following dependency source dirs: $it")
}

View File

@@ -0,0 +1,193 @@
@file:Suppress("unused") // usages in build scripts are not tracked properly
import net.rubygrapefruit.platform.Native
import net.rubygrapefruit.platform.WindowsRegistry
import org.gradle.api.GradleException
import org.gradle.api.Project
import java.nio.file.Paths
import java.io.File
import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
import org.gradle.internal.os.OperatingSystem
enum class JdkMajorVersion(private val mandatory: Boolean = true) {
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false);
fun isMandatory(): Boolean = mandatory
}
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"))
data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var version: String, var homeDir: File)
fun Project.getConfiguredJdks(): List<JdkId> {
val res = arrayListOf<JdkId>()
for (jdkMajorVersion in JdkMajorVersion.values()) {
val explicitJdkEnvVal = findProperty(jdkMajorVersion.name)?.toString()
?: System.getenv(jdkMajorVersion.name)
?: jdkAlternativeVarNames[jdkMajorVersion]?.mapNotNull { System.getenv(it) }?.firstOrNull()
?: continue
val explicitJdk = Paths.get(explicitJdkEnvVal).toRealPath().toFile()
if (!explicitJdk.isDirectory) {
throw GradleException("Invalid environment value $jdkMajorVersion: $explicitJdkEnvVal, expecting JDK home path")
}
res.add(JdkId(true, jdkMajorVersion, "X", explicitJdk))
}
if (res.size < JdkMajorVersion.values().size) {
res.discoverJdks(this)
}
return res
}
// see JEP 223
private val javaMajorVersionRegex = Regex("""(?:1\.)?(\d+).*""")
private val javaVersionRegex = Regex("""(?:1\.)?(\d+)(\.\d+)?([+-_]\w+){0,3}""")
fun MutableCollection<JdkId>.addIfBetter(project: Project, version: String, id: String, homeDir: File): Boolean {
val matchString = javaMajorVersionRegex.matchEntire(version)?.groupValues?.get(1)
val majorJdkVersion = when (matchString) {
"6" -> JdkMajorVersion.JDK_16
"7" -> JdkMajorVersion.JDK_17
"8" -> JdkMajorVersion.JDK_18
"9" -> JdkMajorVersion.JDK_9
else -> {
project.logger.info("Cannot recognize version string '$version' (found version '$matchString')")
return false
}
}
val prev = find { it.majorVersion == majorJdkVersion }
if (prev == null) {
add(JdkId(false, majorJdkVersion, version, homeDir))
return true
}
if (prev.explicit) return false
val versionsComparisonRes = compareVersions(prev.version, version)
if (versionsComparisonRes < 0 || (versionsComparisonRes == 0 && id.contains("64"))) { // prefer 64-bit
prev.version = version
prev.homeDir = homeDir
return true
}
return false
}
private fun compareVersions(left: String, right: String): Int {
if (left == right) return 0
fun MatchResult.extractNumVer(): List<Int> =
groups.drop(2).map {
it?.value?.filter { it in '0'..'9' }?.toIntOrNull() ?: 0
}
val lmi = (javaVersionRegex.matchEntire(left)?.extractNumVer() ?: emptyList()).iterator()
val rmi = (javaVersionRegex.matchEntire(right)?.extractNumVer() ?: emptyList()).iterator()
while (lmi.hasNext() && rmi.hasNext()) {
val l = lmi.next()
val r = rmi.next()
when {
l < r -> return -1
l > r -> return 1
}
}
return when {
rmi.hasNext() -> -1
lmi.hasNext() -> 1
else -> 0
}
}
fun MutableCollection<JdkId>.discoverJdks(project: Project) {
val os = OperatingSystem.current()
when {
os.isWindows -> discoverJdksOnWindows(project)
os.isMacOsX -> discoverJdksOnMacOS(project)
else -> discoverJdksOnUnix(project)
}
}
private val macOsJavaHomeOutRegexes =
listOf(
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)""")
)
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)
val process = procBuilder.start()
val retCode = process.waitFor()
if (retCode != 0) throw GradleException("Unable to run 'java_home', return code $retCode")
process.inputStream.bufferedReader().forEachLine { line ->
for (rex in macOsJavaHomeOutRegexes) {
val matchResult = rex.matchEntire(line)
if (matchResult != null) {
addIfBetter(project, matchResult.groupValues[1], matchResult.groupValues[0], File(matchResult.groupValues[3]))
break
}
}
}
}
private val unixConventionalJdkLocations = listOf(
"/usr/lib/jvm", // *deb, Arch
"/opt", // *rpm, Gentoo, HP/UX
"/usr/lib", // Slackware 32
"/usr/lib64", // Slackware 64
"/usr/local", // OpenBSD, FreeBSD
"/usr/pkg/java", // NetBSD
"/usr/jdk/instances") // Solaris
private val unixConventionalJdkDirRex = Regex("jdk|jre|java|zulu")
fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
for (loc in unixConventionalJdkLocations) {
val installedJdks = File(loc).listFiles { dir ->
dir.isDirectory &&
unixConventionalJdkDirRex.containsMatchIn(dir.name) &&
fileFrom(dir, "bin", "java").isFile
} ?: continue
for (dir in installedJdks) {
val versionMatch = javaVersionRegex.find(dir.name)
if (versionMatch == null) {
project.logger.info("Unable to extract version from possible JDK dir: $dir")
}
else {
addIfBetter(project, versionMatch.value, dir.name, dir)
}
}
}
}
private val windowsConventionalJdkRegistryPaths = listOf(
"SOFTWARE\\JavaSoft\\Java Development Kit",
"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit",
"SOFTWARE\\JavaSoft\\JDK",
"SOFTWARE\\Wow6432Node\\JavaSoft\\JDK")
fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
val registry = Native.get(WindowsRegistry::class.java)
for (regPath in windowsConventionalJdkRegistryPaths) {
val jdkKeys = try {
registry.getSubkeys(HKEY_LOCAL_MACHINE, regPath)
} catch (e: RuntimeException) {
// ignore missing nodes
continue
}
for (jdkKey in jdkKeys) {
try {
val javaHome = registry.getStringValue(HKEY_LOCAL_MACHINE, regPath + "\\" + jdkKey, "JavaHome")
val versionMatch = javaVersionRegex.find(jdkKey)
if (versionMatch == null) {
project.logger.info("Unable to extract version from possible JDK location: $javaHome ($jdkKey)")
}
else {
javaHome.takeIf { it.isNotEmpty() }
?.let { File(it) }
?.takeIf { it.isDirectory && fileFrom(it, "bin", "java.exe").isFile }
?.let {
addIfBetter(project, versionMatch.value, jdkKey, it)
}
}
}
catch (e: RuntimeException) {
// Ignore
}
}
}
}

View File

@@ -17,11 +17,16 @@
// usages in build scripts are not tracked properly
@file:Suppress("unused")
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.ModuleDependency
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.tasks.JavaExec
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.DependencyHandlerScope
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.register
import java.io.File
private fun Project.kotlinBuildLocalDependenciesDir(): File =
@@ -30,26 +35,16 @@ private fun Project.kotlinBuildLocalDependenciesDir(): File =
private fun Project.kotlinBuildLocalRepoDir(): File = kotlinBuildLocalDependenciesDir().resolve("repo")
fun Project.ideModuleName() = when (IdeVersionConfigurator.currentIde.kind) {
private fun Project.ideModuleName() = when (IdeVersionConfigurator.currentIde.kind) {
Ide.Kind.AndroidStudio -> "android-studio-ide"
Ide.Kind.IntelliJ -> "ideaIC"
}
private fun Project.ideModuleVersion(forIde: Boolean) = when (IdeVersionConfigurator.currentIde.kind) {
Ide.Kind.AndroidStudio -> rootProject.findProperty("versions.androidStudioBuild")
Ide.Kind.IntelliJ -> {
if (forIde) {
intellijSdkVersionForIde()
?: error("Please specify 'attachedIntellijVersion' in your local.properties")
} else {
rootProject.findProperty("versions.intellijSdk")
}
if (kotlinBuildProperties.intellijUltimateEnabled) "ideaIU" else "ideaIC"
}
}
fun Project.intellijSdkVersionForIde(): String? {
val majorVersion = kotlinBuildProperties.getOrNull("attachedIntellijVersion") as? String ?: return null
return rootProject.findProperty("versions.intellijSdk.forIde.$majorVersion") as? String
private fun Project.ideModuleVersion() = when (IdeVersionConfigurator.currentIde.kind) {
Ide.Kind.AndroidStudio -> rootProject.findProperty("versions.androidStudioBuild")
Ide.Kind.IntelliJ -> rootProject.findProperty("versions.intellijSdk")
}
fun RepositoryHandler.kotlinBuildLocalRepo(project: Project): IvyArtifactRepository = ivy {
@@ -63,7 +58,6 @@ fun RepositoryHandler.kotlinBuildLocalRepo(project: Project): IvyArtifactReposit
artifact("[organisation]/[module]/[revision]/artifacts/lib/[artifact](-[classifier]).[ext]")
artifact("[organisation]/[module]/[revision]/artifacts/[artifact](-[classifier]).[ext]")
artifact("[organisation]/intellij-core/[revision]/artifacts/[artifact](-[classifier]).[ext]")
artifact("[organisation]/${project.ideModuleName()}/[revision]/artifacts/plugins/[module]/lib/[artifact](-[classifier]).[ext]") // bundled plugins
artifact("[organisation]/sources/[artifact]-[revision](-[classifier]).[ext]")
artifact("[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]")
@@ -74,9 +68,7 @@ fun RepositoryHandler.kotlinBuildLocalRepo(project: Project): IvyArtifactReposit
}
}
@JvmOverloads
fun Project.intellijDep(module: String? = null, forIde: Boolean = false) =
"kotlin.build:${module ?: ideModuleName()}:${ideModuleVersion(forIde)}"
fun Project.intellijDep(module: String? = null) = "kotlin.build:${module ?: ideModuleName()}:${ideModuleVersion()}"
fun Project.intellijCoreDep() = "kotlin.build:intellij-core:${rootProject.extra["versions.intellijSdk"]}"
@@ -84,6 +76,8 @@ fun Project.jpsStandalone() = "kotlin.build:jps-standalone:${rootProject.extra["
fun Project.nodeJSPlugin() = "kotlin.build:NodeJS:${rootProject.extra["versions.idea.NodeJS"]}"
fun Project.androidDxJar() = "org.jetbrains.kotlin:android-dx:${rootProject.extra["versions.androidBuildTools"]}"
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}"
@@ -101,7 +95,11 @@ fun Project.kotlinxCollectionsImmutable() = "org.jetbrains.kotlinx:kotlinx-colle
*/
fun Project.intellijRuntimeAnnotations() = "kotlin.build:intellij-runtime-annotations:${rootProject.extra["versions.intellijSdk"]}"
fun Project.intellijPluginDep(plugin: String, forIde: Boolean = false) = intellijDep(plugin, forIde)
fun Project.intellijPluginDep(plugin: String) = intellijDep(plugin)
fun Project.intellijUltimateDep() = intellijDep("ideaIU")
fun Project.intellijUltimatePluginDep(plugin: String) = intellijDep(plugin)
fun ModuleDependency.includeJars(vararg names: String, rootProject: Project? = null) {
names.forEach {
@@ -129,7 +127,7 @@ object IntellijRootUtils {
fun getIntellijRootDir(project: Project): File = with(project.rootProject) {
return File(
getRepositoryRootDir(this),
"${ideModuleName()}/${ideModuleVersion(forIde = false)}/artifacts"
"${ideModuleName()}/${ideModuleVersion()}/artifacts"
)
}
}
@@ -141,4 +139,83 @@ fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFi
rootProject = project.rootProject
)
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
fun Project.isIntellijCommunityAvailable() =
!(rootProject.extra["intellijUltimateEnabled"] as Boolean) || rootProject.extra["intellijSeparateSdks"] as Boolean
fun Project.isIntellijUltimateSdkAvailable() = (rootProject.extra["intellijUltimateEnabled"] as Boolean)
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
fun Project.intellijUltimateRootDir() =
if (isIntellijUltimateSdkAvailable())
File(kotlinBuildLocalRepoDir(), "kotlin.build/ideaIU/${rootProject.extra["versions.intellijSdk"]}/artifacts")
else
throw GradleException("intellij ultimate SDK is not available")
fun DependencyHandlerScope.excludeInAndroidStudio(rootProject: Project, block: DependencyHandlerScope.() -> Unit) {
if (!rootProject.extra.has("versions.androidStudioRelease")) {
block()
}
}
fun Project.runIdeTask(name: String, ideaPluginDir: File, ideaSandboxDir: File, body: JavaExec.() -> Unit): TaskProvider<JavaExec> {
return tasks.register<JavaExec>(name) {
val ideaSandboxConfigDir = File(ideaSandboxDir, "config")
classpath = mainSourceSet.runtimeClasspath
mainClass.set("com.intellij.idea.Main")
workingDir = File(intellijRootDir(), "bin")
jvmArgs(
"-Xmx1250m",
"-XX:ReservedCodeCacheSize=240m",
"-XX:+HeapDumpOnOutOfMemoryError",
"-ea",
"-Didea.debug.mode=true",
"-Didea.system.path=$ideaSandboxDir",
"-Didea.config.path=$ideaSandboxConfigDir",
"-Didea.tooling.debug=true",
"-Dfus.internal.test.mode=true",
"-Dapple.laf.useScreenMenuBar=true",
"-Dapple.awt.graphics.UseQuartz=true",
"-Dsun.io.useCanonCaches=false",
"-Dplugin.path=${ideaPluginDir.absolutePath}"
)
if (Platform[201].orHigher() && !isIntellijUltimateSdkAvailable()) {
jvmArgs("-Didea.platform.prefix=Idea")
}
if (rootProject.findProperty("versions.androidStudioRelease") != null) {
jvmArgs("-Didea.platform.prefix=AndroidStudio")
}
if (project.hasProperty("noPCE")) {
jvmArgs("-Didea.ProcessCanceledException=disabled")
}
jvmArgs("-Didea.is.internal=${project.findProperty("idea.is.internal") ?: true}")
project.findProperty("idea.args")?.let { arguments ->
jvmArgs(arguments.toString().split(" "))
}
args()
doFirst {
val disabledPluginsFile = File(ideaSandboxConfigDir, "disabled_plugins.txt")
val disabledPluginsContents = disabledPluginsFile.takeIf { it.isFile }?.readLines()
val filteredContents = disabledPluginsContents?.filterNot { it.contains("org.jetbrains.kotlin") }
if (filteredContents != null && filteredContents.size != disabledPluginsContents.size) {
with(disabledPluginsFile.printWriter()) {
filteredContents.forEach(this::println)
}
}
}
body()
}
}

View File

@@ -1,228 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.gradle.plugins.tools
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.file.FileCollection
import org.gradle.api.plugins.BasePlugin
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.withType
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.jetbrains.kotlin.konan.target.HostManager.Companion.hostIsMac
import org.jetbrains.kotlin.konan.target.HostManager.Companion.hostIsMingw
import java.io.File
import kotlin.collections.List
import kotlin.collections.MutableMap
import kotlin.collections.addAll
import kotlin.collections.drop
import kotlin.collections.first
import kotlin.collections.flatMap
import kotlin.collections.forEach
import kotlin.collections.listOf
import kotlin.collections.map
import kotlin.collections.mutableListOf
import kotlin.collections.mutableMapOf
import kotlin.collections.plusAssign
import kotlin.collections.set
import kotlin.collections.toTypedArray
open class NativePlugin : Plugin<Project> {
override fun apply(project: Project) {
project.apply<BasePlugin>()
project.extensions.create("native", NativeToolsExtension::class.java, project)
}
}
abstract class ToolExecutionTask : DefaultTask() {
@get:OutputFile
abstract var output: File
@get:InputFiles
abstract var input: List<File>
@get:Input
abstract var cmd: String
@get:Input
abstract var args: List<String>
@TaskAction
fun action() {
project.exec {
executable(cmd)
args(*this@ToolExecutionTask.args.toTypedArray())
}
}
}
class ToolPatternImpl(val extension: NativeToolsExtension, val output:String, vararg val input: String):ToolPattern {
val tool = mutableListOf<String>()
val args = mutableListOf<String>()
override fun ruleOut(): String = output
override fun ruleInFirst(): String = input.first()
override fun ruleInAll(): Array<String> = arrayOf(*input)
override fun flags(vararg args: String) {
this.args.addAll(args)
}
override fun tool(vararg arg: String) {
tool.addAll(arg)
}
override fun env(name: String) = emptyArray<String>()
fun configure(task: ToolExecutionTask, configureDepencies:Boolean) {
extension.cleanupfiles += output
task.input = input.map {
extension.project.file(it)
}
task.dependsOn(":kotlin-native:dependencies:update")
if (configureDepencies)
task.input.forEach { task.dependsOn(it.name) }
val file = extension.project.file(output)
file.parentFile.mkdirs()
task.output = file
task.cmd = tool.first()
task.args = listOf(*tool.drop(1).toTypedArray(), *args.toTypedArray())
}
}
open class SourceSet(
val sourceSets: SourceSets,
val name: String,
val initialDirectory: File = sourceSets.project.projectDir,
val initialSourceSet: SourceSet? = null,
val rule: Pair<String, String>? = null
) {
var collection = sourceSets.project.objects.fileCollection() as FileCollection
fun file(path: String) {
collection = collection.plus(sourceSets.project.files("${initialDirectory.absolutePath}/$path"))
}
fun dir(path: String) {
sourceSets.project.fileTree("${initialDirectory.absolutePath}/$path").files.forEach {
collection = collection.plus(sourceSets.project.files(it))
}
}
fun transform(suffixes: Pair<String, String>): SourceSet {
return SourceSet(
sourceSets,
name,
sourceSets.project.file("${sourceSets.project.buildDir}/$name/${suffixes.first}_${suffixes.second}/"),
this,
suffixes
)
}
fun implicitTasks(): Array<TaskProvider<*>> {
rule ?: return emptyArray()
initialSourceSet?.implicitTasks()
return initialSourceSet!!.collection
.filter { !it.isDirectory() }
.filter { it.name.endsWith(rule.first) }
.map { it.relativeTo(initialSourceSet.initialDirectory) }
.map { it.path }
.map { it to (it.substring(0, it.lastIndexOf(rule.first)) + rule.second) }
.map {
file(it.second)
sourceSets.project.file("${initialSourceSet.initialDirectory.path}/${it.first}") to sourceSets.project.file("${initialDirectory.path}/${it.second}")
}.map {
sourceSets.project.tasks.register<ToolExecutionTask>(it.second.name, ToolExecutionTask::class.java) {
val toolConfiguration = ToolPatternImpl(sourceSets.extension, it.second.path, it.first.path)
sourceSets.extension.toolPatterns[rule]!!.invoke(toolConfiguration)
toolConfiguration.configure(this, initialSourceSet.rule != null)
}
}.toTypedArray()
}
}
class SourceSets(val project: Project, val extension: NativeToolsExtension, val sources: MutableMap<String, SourceSet>) :
MutableMap<String, SourceSet> by sources {
operator fun String.invoke(initialDirectory: File = project.projectDir, configuration: SourceSet.() -> Unit) {
sources[this] = SourceSet(this@SourceSets, this, initialDirectory).also {
configuration(it)
}
}
}
interface Environment {
operator fun String.invoke(vararg values: String)
}
interface ToolPattern {
fun ruleOut(): String
fun ruleInFirst(): String
fun ruleInAll(): Array<String>
fun flags(vararg args: String): Unit
fun tool(vararg arg: String): Unit
fun env(name: String): Array<String>
}
typealias ToolPatternConfiguration = ToolPattern.() -> Unit
typealias EnvironmentConfiguration = Environment.() -> Unit
class ToolConfigurationPatterns(
val extension: NativeToolsExtension,
val patterns: MutableMap<Pair<String, String>, ToolPatternConfiguration>
) : MutableMap<Pair<String, String>, ToolPatternConfiguration> by patterns {
operator fun Pair<String, String>.invoke(configuration: ToolPatternConfiguration) {
patterns[this] = configuration
}
}
open class NativeToolsExtension(val project: Project) {
val sourceSets = SourceSets(project, this, mutableMapOf<String, SourceSet>())
val toolPatterns = ToolConfigurationPatterns(this, mutableMapOf<Pair<String, String>, ToolPatternConfiguration>())
val cleanupfiles = mutableListOf<String>()
fun sourceSet(configuration: SourceSets.() -> Unit) {
sourceSets.configuration()
}
var environmentConfiguration: EnvironmentConfiguration? = null
fun environment(configuration: EnvironmentConfiguration) {
environmentConfiguration = configuration
}
fun suffixes(configuration: ToolConfigurationPatterns.() -> Unit) = toolPatterns.configuration()
fun target(name: String, vararg objSet: SourceSet, configuration: ToolPatternConfiguration) {
project.tasks.withType<Delete>().named(LifecycleBasePlugin.CLEAN_TASK_NAME).configure {
doLast {
delete(*this@NativeToolsExtension.cleanupfiles.toTypedArray())
}
}
sourceSets.project.tasks.create<ToolExecutionTask>(name, ToolExecutionTask::class.java) {
objSet.forEach {
dependsOn(it.implicitTasks())
}
val deps = objSet.flatMap { it.collection.files }.map { it.path }
val toolConfiguration = ToolPatternImpl(sourceSets.extension, "${project.buildDir.path}/$name", *deps.toTypedArray())
toolConfiguration.configuration()
toolConfiguration.configure(this, false )
}
}
}
fun solib(name: String) = when {
hostIsMingw -> "$name.dll"
hostIsMac -> "lib$name.dylib"
else -> "lib$name.so"
}
fun lib(name:String) = when {
hostIsMingw -> "$name.lib"
else -> "lib$name.a"
}

View File

@@ -10,16 +10,31 @@ import java.io.File
import org.gradle.api.Project
open class PillExtension {
/*
* Here's how you can specify a custom variant:
* `./gradlew pill -Dpill.variant=<NAME>`
*/
enum class Variant {
BASE, // Includes compiler and IDE (default)
FULL, // Includes compiler, IDE and Gradle plugin
// Default variant (./gradlew pill)
BASE() {
override val includes = setOf(BASE)
},
// Full variant (./gradlew pill -Dpill.variant=full)
FULL() {
override val includes = setOf(BASE, FULL)
},
// Do not import the project to JPS model, but set some options for it
NONE() {
override val includes = emptySet<Variant>()
},
// 'BASE' if the "jps-compatible" plugin is applied, 'NONE' otherwise
DEFAULT() {
override val includes = emptySet<Variant>()
};
abstract val includes: Set<Variant>
}
open var variant: Variant? = null
open var variant: Variant = Variant.DEFAULT
open var excludedDirs: List<File> = emptyList()
@@ -30,7 +45,7 @@ open class PillExtension {
@Suppress("unused")
fun serialize() = mapOf<String, Any?>(
"variant" to variant?.name,
"variant" to variant.name,
"excludedDirs" to excludedDirs
)
}

View File

@@ -14,7 +14,6 @@ import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*
import plugins.KotlinBuildPublishingPlugin
import plugins.configureRepository
import plugins.mainPublicationName
import java.util.*
internal const val PLUGIN_MARKER_SUFFIX = ".gradle.plugin"
@@ -27,7 +26,7 @@ fun Project.publishPluginMarkers(withEmptyJars: Boolean = true) {
val pluginDevelopment = extensions.getByType<PluginBundleExtension>()
val publishingExtension = extensions.getByType<PublishingExtension>()
val mainPublication = publishingExtension.publications[mainPublicationName] as MavenPublication
val mainPublication = publishingExtension.publications[KotlinBuildPublishingPlugin.PUBLICATION_NAME] as MavenPublication
pluginDevelopment.plugins.forEach { declaration ->
val markerPublication = createMavenMarkerPublication(declaration, mainPublication, publishingExtension.publications)
@@ -65,9 +64,6 @@ private fun createMavenMarkerPublication(
): MavenPublication {
return publications.create<MavenPublication>(declaration.name.toString() + "PluginMarkerMaven") {
val pluginId: String = declaration.id
val cGroupId = coordinates.groupId
val cArtifactId = coordinates.artifactId
val cVersion = coordinates.version
artifactId = pluginId + PLUGIN_MARKER_SUFFIX
groupId = pluginId
pom.withXml {
@@ -76,11 +72,11 @@ private fun createMavenMarkerPublication(
val dependencies = root.appendChild(document.createElement("dependencies"))
val dependency = dependencies.appendChild(document.createElement("dependency"))
val groupId = dependency.appendChild(document.createElement("groupId"))
groupId.textContent = cGroupId
groupId.textContent = coordinates.groupId
val artifactId = dependency.appendChild(document.createElement("artifactId"))
artifactId.textContent = cArtifactId
artifactId.textContent = coordinates.artifactId
val version = dependency.appendChild(document.createElement("version"))
version.textContent = cVersion
version.textContent = coordinates.version
}
pom.name.set(declaration.displayName)

View File

@@ -6,15 +6,12 @@
import com.jakewharton.dex.*
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.jvm.tasks.Jar
import java.io.File
@CacheableTask
abstract class DexMethodCount : DefaultTask() {
open class DexMethodCount : DefaultTask() {
data class Counts(
val total: Int,
@@ -27,18 +24,16 @@ abstract class DexMethodCount : DefaultTask() {
@Classpath
lateinit var jarFile: File
@get:Optional
@get:Input
abstract val ownPackages: ListProperty<String>
@Optional
@Input
var ownPackages: List<String>? = null
@Internal
var artifactName: String? = null
private val projectName = project.name
@get:Input
val artifactOrArchiveName: String
get() = artifactName ?: projectName
get() = artifactName ?: project.name
fun from(jar: Jar) {
jarFile = jar.archiveFile.get().asFile
@@ -50,9 +45,8 @@ abstract class DexMethodCount : DefaultTask() {
lateinit var counts: Counts
@get:OutputFile
val detailOutputFile: File by lazy {
project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
}
val detailOutputFile: File
get() = project.buildDir.resolve("$artifactOrArchiveName-method-count.txt")
@TaskAction
fun invoke() {
@@ -65,9 +59,9 @@ abstract class DexMethodCount : DefaultTask() {
val byPackage = this.groupingBy { it.`package` }.eachCount()
val byClass = this.groupingBy { it.declaringType }.eachCount()
val ownPackages = ownPackages.map { list -> list.map { "$it." } }
val byOwnPackages = if (ownPackages.isPresent) {
this.partition { method -> ownPackages.get().any { method.declaringType.startsWith(it) } }.let {
val ownPackages = ownPackages?.map { "$it." }
val byOwnPackages = if (ownPackages != null) {
this.partition { method -> ownPackages.any { method.declaringType.startsWith(it) } }.let {
it.first.size to it.second.size
}
} else (null to null)
@@ -84,7 +78,7 @@ abstract class DexMethodCount : DefaultTask() {
private fun outputDetails(counts: Counts) {
detailOutputFile.printWriter().use { writer ->
writer.println("${counts.total.padRight()}\tTotal methods")
ownPackages.orNull?.let { packages ->
ownPackages?.let { packages ->
writer.println("${counts.totalOwnPackages?.padRight()}\tTotal methods from packages ${packages.joinToString { "$it.*" }}")
writer.println("${counts.totalOtherPackages?.padRight()}\tTotal methods from other packages")
}
@@ -102,24 +96,23 @@ abstract class DexMethodCount : DefaultTask() {
}
}
abstract class DexMethodCountStats : DefaultTask() {
open class DexMethodCountStats : DefaultTask() {
@Internal
lateinit var from: TaskProvider<DexMethodCount>
@get:InputFile
internal abstract val inputFile: RegularFileProperty
@get:Input
internal abstract val artifactOrArchiveName: Property<String>
@get:Input
@get:Optional
internal abstract val ownPackages: ListProperty<String>
internal val inputFile
get() = from.get().detailOutputFile
@TaskAction
private fun printStats() {
val artifactOrArchiveName = artifactOrArchiveName.get()
inputFile.get().asFile.reader().useLines { lines ->
val artifactOrArchiveName = from.get().artifactOrArchiveName
inputFile.reader().useLines { lines ->
fun String.getStatValue() = substringBefore("\t").trim()
val statsLineCount = if (!ownPackages.isPresent) 1 else 3
val ownPackages = from.get().ownPackages
val statsLineCount = if (ownPackages == null) 1 else 3
val stats = lines.take(statsLineCount).map { it.getStatValue() }.toList()
val total = stats[0]
@@ -129,7 +122,7 @@ abstract class DexMethodCountStats : DefaultTask() {
println("##teamcity[buildStatisticValue key='DexMethodCount_${artifactOrArchiveName}' value='$total']")
}
ownPackages.map { packages ->
ownPackages?.let { packages ->
val totalOwnPackages = stats[1]
val totalOtherPackages = stats[2]
@@ -148,9 +141,7 @@ abstract class DexMethodCountStats : DefaultTask() {
fun Project.printStats(dexMethodCount: TaskProvider<DexMethodCount>) {
val dexMethodCountStats = tasks.register("dexMethodCountStats", DexMethodCountStats::class.java) {
dependsOn(dexMethodCount)
inputFile.set(dexMethodCount.flatMap { objects.fileProperty().apply { set(it.detailOutputFile) } })
artifactOrArchiveName.set(dexMethodCount.map { it.artifactOrArchiveName })
ownPackages.set(dexMethodCount.flatMap { it.ownPackages })
from = dexMethodCount
}
dexMethodCount.configure {

View File

@@ -5,7 +5,6 @@
package plugins
import PublishToMavenLocalSerializable
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.attributes.Usage
@@ -14,10 +13,10 @@ import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import java.util.*
@@ -28,6 +27,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
) : Plugin<Project> {
override fun apply(target: Project): Unit = with(target) {
apply<MavenPublishPlugin>()
apply<SigningPlugin>()
val publishedRuntime = configurations.maybeCreate(RUNTIME_CONFIGURATION).apply {
isCanBeConsumed = false
@@ -68,7 +68,7 @@ class KotlinBuildPublishingPlugin @Inject constructor(
configure<PublishingExtension> {
publications {
create<MavenPublication>(project.mainPublicationName) {
create<MavenPublication>(PUBLICATION_NAME) {
from(kotlinLibraryComponent)
configureKotlinPomAttributes(project)
@@ -79,26 +79,16 @@ class KotlinBuildPublishingPlugin @Inject constructor(
}
companion object {
const val DEFAULT_MAIN_PUBLICATION_NAME = "Main"
const val MAIN_PUBLICATION_NAME_PROPERTY = "MainPublicationName"
const val PUBLICATION_NAME = "Main"
const val REPOSITORY_NAME = "Maven"
const val ADHOC_COMPONENT_NAME = "kotlinLibrary"
const val COMPILE_CONFIGURATION = "publishedCompile"
const val RUNTIME_CONFIGURATION = "publishedRuntime"
}
}
var Project.mainPublicationName: String
get() {
return if (project.extra.has(KotlinBuildPublishingPlugin.MAIN_PUBLICATION_NAME_PROPERTY))
project.extra.get(KotlinBuildPublishingPlugin.MAIN_PUBLICATION_NAME_PROPERTY) as String
else KotlinBuildPublishingPlugin.DEFAULT_MAIN_PUBLICATION_NAME
}
set(value) {
project.extra.set(KotlinBuildPublishingPlugin.MAIN_PUBLICATION_NAME_PROPERTY, value)
}
@OptIn(ExperimentalStdlibApi::class)
private fun humanReadableName(name: String) =
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
@@ -142,49 +132,31 @@ fun Project.configureDefaultPublishing() {
}
}
val signingRequired = project.providers.gradleProperty("signingRequired").forUseAtConfigurationTime().orNull?.toBoolean()
?: project.providers.gradleProperty("isSonatypeRelease").forUseAtConfigurationTime().orNull?.toBoolean() ?: false
if (signingRequired) {
apply<SigningPlugin>()
configureSigning()
}
configureSigning()
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
// workaround for Gradle configuration cache
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
tasks.withType(PublishToMavenLocal::class.java) {
val originalTask = this
val serializablePublishTask =
tasks.register(originalTask.name + "Serializable", PublishToMavenLocalSerializable::class.java) {
publication = originalTask.publication
}
originalTask.onlyIf { false }
originalTask.dependsOn(serializablePublishTask)
}
tasks.withType<PublishToMavenRepository>()
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
.all { configureRepository() }
}
private fun Project.configureSigning() {
configure<SigningExtension> {
sign(extensions.getByType<PublishingExtension>().publications) // all publications
val signingRequired = provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
}
val signKeyId = project.findProperty("signKeyId") as? String
if (!signKeyId.isNullOrBlank()) {
val signKeyPrivate = project.findProperty("signKeyPrivate") as? String
?: error("Parameter `signKeyPrivate` not found")
val signKeyPassphrase = project.findProperty("signKeyPassphrase") as? String
?: error("Parameter `signKeyPassphrase` not found")
useInMemoryPgpKeys(signKeyId, signKeyPrivate, signKeyPassphrase)
} else {
useGpgCmd()
}
configure<SigningExtension> {
setRequired(signingRequired)
sign(extensions.getByType<PublishingExtension>().publications) // all publications
useGpgCmd()
}
tasks.withType<Sign>().configureEach {
setOnlyIf { signingRequired.get() }
}
}
@@ -209,4 +181,4 @@ private fun PublishToMavenRepository.configureRepository() {
}
}
}
}
}

View File

@@ -0,0 +1,173 @@
@file:Suppress("DEPRECATION")
package plugins
import org.codehaus.groovy.runtime.InvokerHelper
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.maven.Conf2ScopeMappingContainer
import org.gradle.api.artifacts.maven.MavenDeployment
import org.gradle.api.artifacts.maven.MavenResolver
import org.gradle.api.plugins.MavenPluginConvention
import org.gradle.api.plugins.MavenRepositoryHandlerConvention
import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
import org.gradle.api.tasks.Upload
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.Sign
import org.gradle.plugins.signing.SigningExtension
import kotlin.properties.Delegates
/**
* Configures a Kotlin module for publication.
*/
open class PublishedKotlinModule : Plugin<Project> {
private fun String.toBooleanOrNull() = listOf(true, false).firstOrNull { it.toString().equals(this, ignoreCase = true) }
override fun apply(project: Project) {
project.run {
plugins.apply("maven")
configurations.maybeCreate("publishedRuntime").apply {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.RUNTIME)
}
configurations.maybeCreate("publishedCompile").apply {
the<MavenPluginConvention>()
.conf2ScopeMappings
.addMapping(0, this, Conf2ScopeMappingContainer.COMPILE)
}
if (!project.hasProperty("prebuiltJar")) {
plugins.apply("signing")
val signingRequired = project.findProperty("signingRequired")?.toString()?.toBooleanOrNull()
?: project.property("isSonatypeRelease") as Boolean
configure<SigningExtension> {
isRequired = signingRequired
sign(configurations["archives"])
useGpgCmd()
}
tasks.named<Sign>("signArchives").configure {
enabled = signingRequired
}
}
fun MavenResolver.configurePom() {
pom.project {
withGroovyBuilder {
"licenses" {
"license" {
"name"("The Apache Software License, Version 2.0")
"url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
"distribution"("repo")
}
}
"name"("${project.group}:${project.name}")
"packaging"("jar")
// optionally artifactId can be defined here
"description"(project.description)
"url"("https://kotlinlang.org/")
"licenses" {
"license" {
"name"("The Apache License, Version 2.0")
"url"("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
"scm" {
"url"("https://github.com/JetBrains/kotlin")
"connection"("scm:git:https://github.com/JetBrains/kotlin.git")
"developerConnection"("scm:git:https://github.com/JetBrains/kotlin.git")
}
"developers" {
"developer" {
"name"("Kotlin Team")
setProperty("organization", "JetBrains")
"organizationUrl"("https://www.jetbrains.com")
}
}
}
}
pom.whenConfigured {
dependencies.removeIf {
InvokerHelper.getMetaClass(it).getProperty(it, "scope") == "test"
}
dependencies
.find {
InvokerHelper.getMetaClass(it).getProperty(it, "groupId") == "org.jetbrains.kotlin"
&& InvokerHelper.getMetaClass(it).getProperty(it, "artifactId") == "kotlin-stdlib"
}
?.also {
InvokerHelper.getMetaClass(it).setProperty(it, "exclusions", emptyList<Any>())
logger.warn("WARNING! Removed exclusions from kotlin-stdlib dependency of ${this.artifactId} artifact's maven metadata, check kotlin-stdlib dependency of ${project.path} project")
}
}
}
tasks.named<Upload>("uploadArchives").configure {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()
dependsOn(preparePublication)
val username: String? by preparePublication.extra
val password: String? by preparePublication.extra
val repoUrl: String by preparePublication.extra
var repository by Delegates.notNull<MavenRemoteRepository>()
repositories {
withConvention(MavenRepositoryHandlerConvention::class) {
mavenDeployer {
withGroovyBuilder {
"beforeDeployment" {
val signing = project.the<SigningExtension>()
if (signing.isRequired)
signing.signPom(delegate as MavenDeployment)
}
"repository"("url" to repoUrl)!!.also { repository = it as MavenRemoteRepository }.withGroovyBuilder {
if (username != null && password != null) {
"authentication"("userName" to username, "password" to password)
}
}
}
configurePom()
}
}
}
doFirst {
repository.url = repoUrl
}
}
val install = if (tasks.names.contains("install")) tasks.getByName("install") as Upload
else tasks.create("install", Upload::class.java)
install.apply {
configuration = project.configurations.getByName(Dependency.ARCHIVES_CONFIGURATION)
description = "Installs the 'archives' artifacts into the local Maven repository."
repositories {
withConvention(MavenRepositoryHandlerConvention::class) {
mavenInstaller {
configurePom()
}
}
}
}
tasks.register("publish") {
dependsOn(tasks.named("uploadArchives"))
}
}
}
}

View File

@@ -7,230 +7,185 @@
// usages in build scripts are not tracked properly
@file:Suppress("unused")
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter
import org.gradle.api.publish.internal.PublishOperation
import org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal
import org.gradle.api.publish.maven.internal.publisher.MavenNormalizedPublication
import org.gradle.api.publish.maven.internal.publisher.MavenPublisher
import org.gradle.api.publish.maven.internal.publisher.ValidatingMavenPublisher
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.testing.Test
import org.gradle.internal.serialization.Cached
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import org.gradle.kotlin.dsl.support.serviceOf
import java.io.File
import java.lang.Character.isLowerCase
import java.lang.Character.isUpperCase
import java.nio.file.Files
import java.nio.file.Path
val kotlinGradlePluginAndItsRequired = arrayOf(
":kotlin-allopen",
":kotlin-noarg",
":kotlin-sam-with-receiver",
":kotlin-android-extensions",
":kotlin-android-extensions-runtime",
":kotlin-parcelize-compiler",
":kotlin-build-common",
":kotlin-compiler-embeddable",
":native:kotlin-native-utils",
":kotlin-util-klib",
":kotlin-util-io",
":kotlin-compiler-runner",
":kotlin-daemon-embeddable",
":kotlin-daemon-client",
":kotlin-project-model",
":kotlin-gradle-plugin-api",
":kotlin-gradle-plugin",
":kotlin-gradle-plugin-model",
":kotlin-tooling-metadata",
":kotlin-reflect",
":kotlin-annotation-processing-gradle",
":kotlin-test",
":kotlin-gradle-subplugin-example",
":kotlin-stdlib-common",
":kotlin-stdlib",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-stdlib-js",
":examples:annotation-processor-example",
":kotlin-script-runtime",
":kotlin-scripting-common",
":kotlin-scripting-jvm",
":kotlin-scripting-compiler-embeddable",
":kotlin-scripting-compiler-impl-embeddable",
":kotlin-serialization",
":kotlin-test-js-runner",
":native:kotlin-klib-commonizer-embeddable",
":native:kotlin-klib-commonizer-api",
":native:kotlin-native-utils"
)
fun Task.dependsOnKotlinGradlePluginInstall() {
kotlinGradlePluginAndItsRequired.forEach {
dependsOn("${it}:install")
}
fun Task.dependsOnKotlinPluginInstall() {
dependsOn(
":kotlin-allopen:install",
":kotlin-noarg:install",
":kotlin-sam-with-receiver:install",
":kotlin-android-extensions:install",
":kotlin-parcelize-compiler:install",
":kotlin-build-common:install",
":kotlin-compiler-embeddable:install",
":native:kotlin-native-utils:install",
":kotlin-util-klib:install",
":kotlin-util-io:install",
":kotlin-compiler-runner:install",
":kotlin-daemon-embeddable:install",
":kotlin-daemon-client:install",
":kotlin-gradle-plugin-api:install",
":kotlin-gradle-plugin:install",
":kotlin-gradle-plugin-model:install",
":kotlin-reflect:install",
":kotlin-annotation-processing-gradle:install",
":kotlin-test:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",
":kotlin-stdlib-jdk8:install",
":kotlin-stdlib-js:install",
":examples:annotation-processor-example:install",
":kotlin-script-runtime:install",
":kotlin-scripting-common:install",
":kotlin-scripting-jvm:install",
":kotlin-scripting-compiler-embeddable:install",
":kotlin-scripting-compiler-impl-embeddable:install",
":kotlin-test-js-runner:install",
":native:kotlin-klib-commonizer-embeddable:install"
)
}
fun Task.dependsOnKotlinGradlePluginPublish() {
kotlinGradlePluginAndItsRequired.forEach {
project.rootProject.tasks.findByPath("${it}:publish")?.let { task ->
dependsOn(task)
}
}
}
/**
* @param parallel is redundant if @param jUnit5Enabled is true, because
* JUnit5 supports parallel test execution by itself, without gradle help
*/
fun Project.projectTest(
taskName: String = "test",
parallel: Boolean = false,
shortenTempRootName: Boolean = false,
jUnit5Enabled: Boolean = false,
body: Test.() -> Unit = {}
): TaskProvider<Test> {
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
.forUseAtConfigurationTime().orNull?.toBoolean() != true
if (shouldInstrument) {
evaluationDependsOn(":test-instrumenter")
}
return getOrCreateTask<Test>(taskName) {
doFirst {
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
val patterns = filter.includePatterns + commandLineIncludePatterns
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
patterns.forEach { pattern ->
var isClassPattern = false
val maybeMethodName = pattern.substringAfterLast('.')
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
pattern.substringBeforeLast('.')
): TaskProvider<Test> = getOrCreateTask(taskName) {
doFirst {
val commandLineIncludePatterns = (filter as? DefaultTestFilter)?.commandLineIncludePatterns ?: mutableSetOf()
val patterns = filter.includePatterns + commandLineIncludePatterns
if (patterns.isEmpty() || patterns.any { '*' in it }) return@doFirst
patterns.forEach { pattern ->
var isClassPattern = false
val maybeMethodName = pattern.substringAfterLast('.')
val maybeClassFqName = if (maybeMethodName.isFirstChar(::isLowerCase)) {
pattern.substringBeforeLast('.')
} else {
isClassPattern = true
pattern
}
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
return@forEach
}
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
val classFileName = "$classFileNameWithoutExtension.class"
if (isClassPattern) {
val innerClassPattern = "$pattern$*"
if (pattern in commandLineIncludePatterns) {
commandLineIncludePatterns.add(innerClassPattern)
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
} else {
isClassPattern = true
pattern
filter.includePatterns.add(innerClassPattern)
}
}
if (!maybeClassFqName.substringAfterLast('.').isFirstChar(::isUpperCase)) {
return@forEach
}
val classFileNameWithoutExtension = maybeClassFqName.replace('.', '/')
val classFileName = "$classFileNameWithoutExtension.class"
if (isClassPattern) {
val innerClassPattern = "$pattern$*"
if (pattern in commandLineIncludePatterns) {
commandLineIncludePatterns.add(innerClassPattern)
(filter as? DefaultTestFilter)?.setCommandLineIncludePatterns(commandLineIncludePatterns)
} else {
filter.includePatterns.add(innerClassPattern)
val parentNames = if (jUnit5Enabled) {
/*
* If we run test from inner test class with junit 5 we need
* to include all containing classes of our class
*/
val nestedNames = classFileNameWithoutExtension.split("$")
mutableListOf(nestedNames.first()).also {
for (s in nestedNames.subList(1, nestedNames.size)) {
it += "${it.last()}\$$s"
}
}
} else emptyList()
val parentNames = if (jUnit5Enabled) {
/*
* If we run test from inner test class with junit 5 we need
* to include all containing classes of our class
*/
val nestedNames = classFileNameWithoutExtension.split("$")
mutableListOf(nestedNames.first()).also {
for (s in nestedNames.subList(1, nestedNames.size)) {
it += "${it.last()}\$$s"
}
}
} else emptyList()
include { treeElement ->
val path = treeElement.path
if (treeElement.isDirectory) {
classFileNameWithoutExtension.startsWith(path)
include { treeElement ->
val path = treeElement.path
if (treeElement.isDirectory) {
classFileNameWithoutExtension.startsWith(path)
} else {
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
if (jUnit5Enabled) {
path == classFileName || (path.endsWith(".class") && parentNames.any { path.startsWith(it) })
} else {
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
path == classFileName || (path.endsWith(".class") && path.startsWith("$classFileNameWithoutExtension$"))
}
}
}
}
}
if (shouldInstrument) {
val instrumentationArgsProperty = project.providers.gradleProperty("kotlin.test.instrumentation.args")
val testInstrumenterOutputs = project.tasks.findByPath(":test-instrumenter:jar")!!.outputs.files
doFirst {
val agent = testInstrumenterOutputs.singleFile
val args = instrumentationArgsProperty.orNull?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
}
jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseCodeCacheFlushing",
"-XX:ReservedCodeCacheSize=256m",
"-Djna.nosys=true"
)
maxHeapSize = "1600m"
systemProperty("idea.is.unit.test", "true")
systemProperty("idea.home.path", project.intellijRootDir().canonicalPath)
systemProperty("java.awt.headless", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
environment("PROJECT_CLASSES_DIRS", project.testSourceSet.output.classesDirs.asPath)
environment("PROJECT_BUILD_DIR", project.buildDir)
systemProperty("jps.kotlin.home", project.rootProject.extra["distKotlinHomeDir"]!!)
systemProperty("kotlin.ni", if (project.rootProject.hasProperty("newInferenceTests")) "true" else "false")
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (project.rootProject.hasProperty("skipMutedTests")) "true" else "false")
systemProperty("idea.ignore.disabled.plugins", "true")
var subProjectTempRoot: Path? = null
val projectName = project.name
val teamcity = project.rootProject.findProperty("teamcity") as? Map<*, *>
if (project.findProperty("kotlin.test.instrumentation.disable")?.toString()?.toBoolean() != true) {
doFirst {
val systemTempRoot =
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
// Should be fixed soon on Teamcity side
(teamcity?.get("teamcity.build.tempDir") as? String)
?: System.getProperty("java.io.tmpdir")
systemTempRoot.let {
val prefix = (projectName + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
val agent = tasks.findByPath(":test-instrumenter:jar")!!.outputs.files.singleFile
val args = project.findProperty("kotlin.test.instrumentation.args")?.let { "=$it" }.orEmpty()
jvmArgs("-javaagent:$agent$args")
}
dependsOn(":test-instrumenter:jar")
}
jvmArgs(
"-ea",
"-XX:+HeapDumpOnOutOfMemoryError",
"-XX:+UseCodeCacheFlushing",
"-XX:ReservedCodeCacheSize=256m",
"-Djna.nosys=true"
)
maxHeapSize = "1600m"
systemProperty("idea.is.unit.test", "true")
systemProperty("idea.home.path", intellijRootDir().canonicalPath)
systemProperty("java.awt.headless", "true")
environment("NO_FS_ROOTS_ACCESS_CHECK", "true")
environment("PROJECT_CLASSES_DIRS", testSourceSet.output.classesDirs.asPath)
environment("PROJECT_BUILD_DIR", buildDir)
systemProperty("jps.kotlin.home", rootProject.extra["distKotlinHomeDir"]!!)
systemProperty("kotlin.ni", if (rootProject.hasProperty("newInferenceTests")) "true" else "false")
systemProperty("org.jetbrains.kotlin.skip.muted.tests", if (rootProject.hasProperty("skipMutedTests")) "true" else "false")
if (Platform[202].orHigher()) {
systemProperty("idea.ignore.disabled.plugins", "true")
}
var subProjectTempRoot: Path? = null
doFirst {
val teamcity = rootProject.findProperty("teamcity") as? Map<*, *>
val systemTempRoot =
// TC by default doesn't switch `teamcity.build.tempDir` to 'java.io.tmpdir' so it could cause to wasted disk space
// Should be fixed soon on Teamcity side
(teamcity?.get("teamcity.build.tempDir") as? String)
?: System.getProperty("java.io.tmpdir")
systemTempRoot.let {
val prefix = (project.name + "Project_" + taskName + "_").takeUnless { shortenTempRootName }
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), prefix)
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
}
}
doLast {
subProjectTempRoot?.let {
try {
delete(it)
} catch (e: Exception) {
project.logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
}
}
}
val fs = project.serviceOf<FileSystemOperations>()
doLast {
subProjectTempRoot?.let {
try {
fs.delete {
delete(it)
}
} catch (e: Exception) {
logger.warn("Can't delete test temp root folder $it", e.printStackTrace())
}
}
}
if (parallel && !jUnit5Enabled) {
maxParallelForks =
project.providers.gradleProperty("kotlin.test.maxParallelForks").forUseAtConfigurationTime().orNull?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (project.kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
}.apply { configure(body) }
if (parallel) {
maxParallelForks =
project.findProperty("kotlin.test.maxParallelForks")?.toString()?.toInt()
?: (Runtime.getRuntime().availableProcessors() / if (kotlinBuildProperties.isTeamcityBuild) 2 else 4).coerceAtLeast(1)
}
body()
}
private inline fun String.isFirstChar(f: (Char) -> Boolean) = isNotEmpty() && f(first())
@@ -257,25 +212,18 @@ private fun Task.useAndroidConfiguration(systemPropertyName: String, configName:
val configuration = with(project) {
configurations.getOrCreate(configName)
.also {
if (it.allDependencies.matching { dep ->
dep is ProjectDependency &&
dep.targetConfiguration == configName &&
dep.dependencyProject.path == ":dependencies:android-sdk"
}.count() == 0) {
dependencies.add(
configName,
dependencies.project(":dependencies:android-sdk", configuration = configName)
)
}
dependencies.add(
configName,
dependencies.project(":dependencies:android-sdk", configuration = configName)
)
}
}
dependsOn(configuration)
if (this is Test) {
val androidFilePath = configuration.singleFile.canonicalPath
doFirst {
systemProperty(systemPropertyName, androidFilePath)
systemProperty(systemPropertyName, configuration.singleFile.canonicalPath)
}
}
}
@@ -287,30 +235,3 @@ fun Task.useAndroidSdk() {
fun Task.useAndroidJar() {
TaskUtils.useAndroidJar(this)
}
// Workaround to make PublishToMavenLocal compatible with Gradle configuration cache
// TODO: remove it when https://github.com/gradle/gradle/pull/16945 merged into used in build Gradle version
abstract class PublishToMavenLocalSerializable : AbstractPublishToMaven() {
private val normalizedPublication = Cached.of { this.computeNormalizedPublication() }
private fun computeNormalizedPublication(): MavenNormalizedPublication {
val publicationInternal: MavenPublicationInternal = publicationInternal
?: throw InvalidUserDataException("The 'publication' property is required")
duplicatePublicationTracker.checkCanPublishToMavenLocal(publicationInternal)
return publicationInternal.asNormalisedPublication()
}
@TaskAction
open fun publish() {
val normalizedPublication = normalizedPublication.get()
object : PublishOperation(normalizedPublication.name, "mavenLocal") {
override fun publish() {
val localPublisher = mavenPublishers.getLocalPublisher(
temporaryDirFactory
)
val validatingPublisher: MavenPublisher = ValidatingMavenPublisher(localPublisher)
validatingPublisher.publish(normalizedPublication, null)
}
}.run()
}
}

View File

@@ -10,8 +10,8 @@ import org.gradle.internal.os.OperatingSystem
fun Test.configureTestDistribution(configure: TestDistributionExtension.() -> Unit = {}) {
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
val testDistributionEnabled =
project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean() ?: false
val testDistributionEnabled = project.findProperty("kotlin.build.test.distribution.enabled")?.toString()?.toBoolean()
?: isTeamcityBuild
useJUnitPlatform()
extensions.configure(TestDistributionExtension::class.java) {

View File

@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:4.1.1'
}
}
apply plugin: 'com.android.application'
@@ -37,6 +37,14 @@ android {
packagingOptions { exclude 'META-INF/build.txt' }
//TODO run under java 6, cause there is error on implicit 'stream' import in 'asWithMutable' test
lintOptions {
abortOnError false
}
compileOptions {
incremental = false
}
dexOptions {
dexInProcess false
@@ -73,19 +81,11 @@ android {
dimension "box"
}
common_ir0 {
jvm80 {
dimension "box"
}
common_ir1 {
dimension "box"
}
common_ir2 {
dimension "box"
}
reflect_ir0 {
reflectjvm80 {
dimension "box"
}
}

View File

@@ -24,18 +24,24 @@ dependencies {
testApi(projectTests(":compiler:tests-compiler-utils"))
testApi(projectTests(":compiler:tests-common-new"))
testCompile(projectTests(":jps-plugin"))
testCompile(commonDep("junit:junit"))
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", rootProject = rootProject) }
testCompile(intellijDep()) { includeJars("groovy", rootProject = rootProject) }
Platform[193].orLower {
testCompile(intellijDep()) { includeJars("openapi", rootProject = rootProject) }
}
testCompile(intellijDep()) { includeJars("util", "idea", "idea_rt", rootProject = rootProject) }
Platform[202].orHigher {
testCompile(intellijDep()) { includeJars("groovy", rootProject = rootProject) }
}
Platform[201].orLower {
testCompile(intellijDep()) { includeJars("groovy-all", rootProject = rootProject) }
}
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
testCompile(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest())
testRuntimeOnly(compile(intellijCoreDep()) { includeJars("intellij-core") })
testRuntimeOnly(compile(intellijDep()) { includeJars("jna", rootProject = rootProject) })
testCompile("org.junit.platform:junit-platform-launcher:${commonVer("org.junit.platform", "")}")
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.android.tests;
import org.jetbrains.kotlin.jps.build.BaseKotlinJpsBuildTestCase;
import org.junit.Ignore;
import java.io.File;
import java.io.IOException;
@Ignore
public class AndroidJpsBuildTestCase extends BaseKotlinJpsBuildTestCase {
private static final String PROJECT_NAME = "android-module";
private static final String SDK_NAME = "Android_SDK";
private final File workDir = new File(AndroidRunner.getPathManager().getTmpFolder());
public void doTest() {
initProject();
rebuildAllModules();
buildAllModules().assertSuccessful();
}
@Override
protected String getProjectName() {
return "android-module";
}
@Override
protected void runTest() {
doTest();
}
@Override
public String getName() {
return "AndroidJpsTest";
}
@Override
protected File doGetProjectDir() throws IOException {
return workDir;
}
private void initProject() {
addJdk(SDK_NAME, AndroidRunner.getPathManager().getPlatformFolderInAndroidSdk() + "/android.jar");
loadProject(workDir.getAbsolutePath() + File.separator + PROJECT_NAME + ".ipr");
}
}

View File

@@ -46,8 +46,12 @@ public class AndroidRunner {
CodegenTestsOnAndroidGenerator.generate(pathManager);
System.out.println("Run tests on Android...");
return CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
System.out.println("Run tests on android...");
TestSuite suite = CodegenTestsOnAndroidRunner.runTestsInEmulator(pathManager);
//AndroidJpsBuildTestCase indirectly depends on UsefulTestCase which compiled against java 8
//TODO: Need add separate run configuration for AndroidJpsBuildTestCase
//suite.addTest(new AndroidJpsBuildTestCase());
return suite;
}
public void tearDown() throws Exception {

View File

@@ -12,6 +12,7 @@ import com.intellij.openapi.util.io.FileUtilRt
import org.jetbrains.kotlin.cli.common.output.writeAllTo
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.CodegenTestCase
import org.jetbrains.kotlin.codegen.CodegenTestFiles
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
@@ -21,6 +22,8 @@ import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.*
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
@@ -54,18 +57,17 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
//keep it globally to avoid test grouping on TC
private val generatedTestNames = hashSetOf<String>()
private val COMMON = FlavorConfig(TargetBackend.ANDROID,"common", 3)
private val REFLECT = FlavorConfig(TargetBackend.ANDROID, "reflect", 1)
private val COMMON = FlavorConfig("common", 3);
private val REFLECT = FlavorConfig("reflect", 1);
private val JVM8 = FlavorConfig("jvm8", 1);
private val JVM8REFLECT = FlavorConfig("reflectjvm8", 1);
private val COMMON_IR = FlavorConfig(TargetBackend.ANDROID_IR, "common_ir", 3)
private val REFLECT_IR = FlavorConfig(TargetBackend.ANDROID_IR,"reflect_ir", 1)
class FlavorConfig(private val backend: TargetBackend, private val prefix: String, val limit: Int) {
class FlavorConfig(private val prefix: String, val limit: Int) {
private var writtenFilesCount = 0
fun printStatistics() {
println("FlavorTestCompiler for $backend: $prefix, generated file count: $writtenFilesCount")
println("FlavorTestCompiler: $prefix, generated file count: $writtenFilesCount")
}
fun getFlavorForNewFiles(newFilesCount: Int): String {
@@ -111,7 +113,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
it.setExecutable(true)
}
}
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"))
File("./gradlew.bat").copyTo(File(projectRoot, "gradlew.bat"));
val file = File(target, "gradle-wrapper.properties")
file.readLines().map {
when {
@@ -148,47 +150,27 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
private fun generateTestsAndFlavourSuites() {
println("Generating test files...")
val folders = arrayOf(
File("compiler/testData/codegen/box"),
File("compiler/testData/codegen/boxInline")
)
generateTestMethodsForDirectories(
TargetBackend.ANDROID,
COMMON,
REFLECT,
*folders
)
generateTestMethodsForDirectories(
TargetBackend.ANDROID_IR,
COMMON_IR,
REFLECT_IR,
*folders
)
generateTestMethodsForDirectories(File("compiler/testData/codegen/box"), File("compiler/testData/codegen/boxInline"))
pendingUnitTestGenerators.values.forEach { it.generate() }
}
private fun generateTestMethodsForDirectories(
backend: TargetBackend,
commonFlavor: FlavorConfig,
reflectionFlavor: FlavorConfig,
vararg dirs: File
) {
private fun generateTestMethodsForDirectories(vararg dirs: File) {
val holders = mutableMapOf<ConfigurationKey, FilesWriter>()
for (dir in dirs) {
val files = dir.listFiles() ?: error("Folder with testData is empty: ${dir.absolutePath}")
processFiles(files, holders, backend, commonFlavor, reflectionFlavor)
processFiles(files, holders)
}
holders.values.forEach {
it.writeFilesOnDisk()
}
commonFlavor.printStatistics()
reflectionFlavor.printStatistics()
COMMON.printStatistics()
REFLECT.printStatistics()
JVM8.printStatistics()
JVM8REFLECT.printStatistics()
}
internal inner class FilesWriter(
@@ -262,7 +244,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
private fun getFlavorUnitTestFolder(flavourName: String): String {
return pathManager.srcFolderInAndroidTmpFolder +
"/androidTest${flavourName.replaceFirstChar(Char::uppercaseChar)}/java/" +
"/androidTest${flavourName.capitalize()}/java/" +
testClassPackage.replace(".", "/") + "/"
}
@@ -276,10 +258,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
@Throws(IOException::class)
private fun processFiles(
files: Array<File>,
holders: MutableMap<ConfigurationKey, FilesWriter>,
backend: TargetBackend,
commmonFlavor: FlavorConfig,
reflectionFlavor: FlavorConfig
holders: MutableMap<ConfigurationKey, FilesWriter>
) {
holders.values.forEach {
it.writeFilesOnDiskIfNeeded()
@@ -289,7 +268,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (file.isDirectory) {
val listFiles = file.listFiles()
if (listFiles != null) {
processFiles(listFiles, holders, backend, commmonFlavor, reflectionFlavor)
processFiles(listFiles, holders)
}
} else if (FileUtilRt.getExtension(file.name) != KotlinFileType.EXTENSION) {
// skip non kotlin files
@@ -298,7 +277,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
continue
}
if (!InTextDirectivesUtils.isPassingTarget(backend.compatibleWith, file) ||
if (!InTextDirectivesUtils.isPassingTarget(TargetBackend.JVM, file) ||
InTextDirectivesUtils.isIgnoredTarget(TargetBackend.ANDROID, file)
) {
continue
@@ -317,19 +296,18 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (fullFileText.contains("// ASSERTIONS_MODE: jvm")) continue
if (fullFileText.contains("// MODULE: ")) continue
val targets = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fullFileText, "// JVM_TARGET:")
.also { it.remove(JvmTarget.JVM_1_6.description) }
val isAtLeastJvm8Target = !targets.contains(JvmTarget.JVM_1_6.description)
if (isAtLeastJvm8Target && fullFileText.contains("@Target(AnnotationTarget.TYPE)")) {
//TODO: type annotations supported on sdk 26 emulator
continue
}
val isJvm8Target =
if (targets.isEmpty()) false
else if (targets.contains(JvmTarget.JVM_1_8.description) && targets.size == 1) true
else continue //TODO: support other targets on Android
// TODO: support SKIP_JDK6 on new platforms
if (fullFileText.contains("// SKIP_JDK6")) continue
if (hasBoxMethod(fullFileText)) {
val testConfiguration = createTestConfiguration(file, backend)
val testConfiguration = createTestConfiguration(file)
val services = testConfiguration.testServices
val moduleStructure = try {
@@ -354,13 +332,15 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
extractor.provideConfigurationKeys()
extractor.configure(keyConfiguration, module.directives)
}
val kind = JvmEnvironmentConfigurator.extractConfigurationKind(module.directives)
val jdkKind = JvmEnvironmentConfigurator.extractJdkKind(module.directives)
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
keyConfiguration.languageVersionSettings = module.languageVersionSettings
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
val compiler = if (kind.withReflection) reflectionFlavor else commmonFlavor
val compiler = if (isJvm8Target) {
if (kind.withReflection) JVM8REFLECT else JVM8
} else if (kind.withReflection) REFLECT else COMMON
val compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
@@ -374,21 +354,21 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
}
}
private fun createTestConfiguration(testDataFile: File, backend: TargetBackend): TestConfiguration {
private fun createTestConfiguration(testDataFile: File): TestConfiguration {
return TestConfigurationBuilder().apply {
configure(backend)
testConfiguration()
testInfo = KotlinTestInfo(
"org.jetbrains.kotlin.android.tests.AndroidRunner",
"test${testDataFile.nameWithoutExtension.replaceFirstChar(Char::uppercaseChar)}",
"test${testDataFile.nameWithoutExtension.capitalize()}",
emptySet()
)
}.build(testDataFile.path)
}
private fun TestConfigurationBuilder.configure(backend: TargetBackend) {
private val testConfiguration: TestConfigurationBuilder.() -> Unit = {
globalDefaults {
frontend = FrontendKinds.ClassicFrontend
targetBackend = backend
targetBackend = TargetBackend.ANDROID
targetPlatform = JvmPlatforms.defaultJvmPlatform
dependencyKind = DependencyKind.Binary
}
@@ -411,6 +391,9 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
}
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)
companion object {
const val GRADLE_VERSION = "6.8.1" // update GRADLE_SHA_256 on change
const val GRADLE_SHA_256 = "fd591a34af7385730970399f473afabdb8b28d57fd97d6625c388d090039d6fd"

View File

@@ -71,20 +71,15 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return rootSuite
}
private fun processReport(rootSuite: TestSuite, resultOutput: String) {
private fun processReport(suite: TestSuite, resultOutput: String) {
val reportFolder = File(flavorFolder())
try {
val folders = reportFolder.listFiles()
assertTrue(folders != null && folders.isNotEmpty(), "No folders in ${reportFolder.path}")
folders.forEach {
assertTrue("${it.path} is not directory") { it.isDirectory }
val isIr = it.name.contains("_ir")
val testCases = parseSingleReportInFolder(it)
testCases.forEach { aCase ->
if (isIr) aCase.name += "_ir"
rootSuite.addTest(aCase)
}
testCases.forEach { aCase -> suite.addTest(aCase) }
Assert.assertNotEquals("There is no test results in report", 0, testCases.size.toLong())
}
} catch (e: Throwable) {
@@ -92,6 +87,10 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
}
}
private fun renameFlavorFolder() {
val reportFolder = File(flavorFolder())
reportFolder.renameTo(File(reportFolder.parentFile, reportFolder.name + "_d8"))
}
private fun flavorFolder() = pathManager.tmpFolder + "/build/test/results/connected/flavors"
@@ -120,7 +119,7 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
private fun cleanAndBuildProject(gradleRunner: GradleRunner) {
gradleRunner.clean()
gradleRunner.assembleAndroidTest()
gradleRunner.build()
}
@Throws(IOException::class, SAXException::class, ParserConfigurationException::class)
@@ -139,14 +138,21 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
return (0 until testCases.length).map { i ->
val item = testCases.item(i) as Element
val failure = item.getElementsByTagName("failure").takeIf { it.length != 0 }?.item(0)
val failure = item.getElementsByTagName("failure")
val name = item.getAttribute("name")
object : TestCase(name) {
@Throws(Throwable::class)
override fun runTest() {
if (failure != null) {
Assert.fail(failure.textContent)
if (failure.length == 0) {
object : TestCase(name) {
@Throws(Throwable::class)
override fun runTest() {
}
}
} else {
object : TestCase(name) {
@Throws(Throwable::class)
override fun runTest() {
Assert.fail(failure.item(0).textContent)
}
}
}

View File

@@ -27,7 +27,7 @@ class UnitTestFileWriter(
}
fun generate() {
FileWriter(File(flavourFolder, flavourName.replaceFirstChar(Char::uppercaseChar) + ".java").also { it.parentFile.mkdirs() }).use { suite ->
FileWriter(File(flavourFolder, flavourName.capitalize() + ".java").also { it.parentFile.mkdirs() }).use { suite ->
val p = Printer(suite)
p.println(
"""package ${CodegenTestsOnAndroidGenerator.testClassPackage};
@@ -35,7 +35,7 @@ class UnitTestFileWriter(
|import ${CodegenTestsOnAndroidGenerator.baseTestClassPackage}.${CodegenTestsOnAndroidGenerator.baseTestClassName};
|
|/* This class is generated by ${CodegenTestsOnAndroidGenerator.generatorName}. DO NOT MODIFY MANUALLY */
|public class ${flavourName.replaceFirstChar(Char::uppercaseChar)} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|public class ${flavourName.capitalize()} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
""".trimMargin()
)

View File

@@ -45,9 +45,9 @@ public class GradleRunner {
OutputUtils.checkResult(result);
}
public void assembleAndroidTest() {
public void build() {
System.out.println("Building gradle project...");
GeneralCommandLine build = generateCommandLine("assembleAndroidTest");
GeneralCommandLine build = generateCommandLine("build");
build.addParameter("--stacktrace");
build.addParameter("--warn");
RunResult result = RunUtils.execute(build);

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor
import org.jetbrains.kotlin.resolve.sam.getAbstractMembers
import org.jetbrains.kotlin.types.KotlinType
class SamType constructor(val type: KotlinType) {
val classDescriptor: ClassDescriptor
get() = type.constructor.declarationDescriptor as? ClassDescriptor ?: error("Sam/Fun interface not a class descriptor: $type")
val kotlinFunctionType: KotlinType
get() = classDescriptor.defaultFunctionTypeForSamInterface!!
val originalAbstractMethod: SimpleFunctionDescriptor
get() = getAbstractMembers(classDescriptor)[0] as SimpleFunctionDescriptor
override fun equals(other: Any?): Boolean {
return other is SamType && type == other.type
}
override fun hashCode(): Int {
return type.hashCode()
}
override fun toString(): String {
return "SamType($type)"
}
}

View File

@@ -1,76 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.backend.common
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.checker.intersectWrappedTypes
import org.jetbrains.kotlin.types.typeUtil.replaceArgumentsWithNothing
class SamTypeApproximator(builtIns: KotlinBuiltIns, languageVersionSettings: LanguageVersionSettings) {
private val typeApproximator = TypeApproximator(builtIns, languageVersionSettings)
fun getSamTypeForValueParameter(valueParameter: ValueParameterDescriptor): KotlinType? {
val singleArgumentType: KotlinType
val originalSingleArgumentType: KotlinType?
val varargElementType = valueParameter.varargElementType
if (varargElementType != null) {
singleArgumentType = varargElementType
originalSingleArgumentType = valueParameter.original.varargElementType
assert(originalSingleArgumentType != null) {
"Value parameter and original value parameter have inconsistent varargs: " +
valueParameter + "; " + valueParameter.original
}
} else {
singleArgumentType = valueParameter.type
originalSingleArgumentType = valueParameter.original.type
}
if (singleArgumentType.isError || originalSingleArgumentType!!.isError) {
return null
}
// This can be true in case when the value parameter is in the method of a generic type with out-projection.
// We approximate Inv<Captured#1> to Nothing, while Inv itself can be a SAM interface safe to call here
// (see testData genericSamProjectedOut.kt for details)
// In such a case we can't have a proper supertype since wildcards are not allowed there,
// so we use Nothing arguments instead that leads to a raw type used for a SAM wrapper.
// See org.jetbrains.kotlin.codegen.state.KotlinTypeMapper#writeGenericType to understand how
// raw types and Nothing arguments relate.
val originalTypeToUse =
if (KotlinBuiltIns.isNothing(singleArgumentType))
originalSingleArgumentType.replaceArgumentsWithNothing()
else
singleArgumentType
val approximatedOriginalTypeToUse =
typeApproximator.approximateToSubType(
originalTypeToUse,
TypeApproximatorConfiguration.UpperBoundAwareIntersectionTypeApproximator
) ?: originalTypeToUse
approximatedOriginalTypeToUse as KotlinType
return approximatedOriginalTypeToUse.removeExternalProjections()
}
private fun KotlinType.removeExternalProjections(): KotlinType {
val newArguments = arguments.map { TypeProjectionImpl(Variance.INVARIANT, it.type) }
return replace(newArguments)
}
}
open class SamTypeFactory {
open fun isSamType(type: KotlinType): Boolean {
val descriptor = type.constructor.declarationDescriptor
return descriptor is ClassDescriptor && descriptor.isFun
}
fun create(originalType: KotlinType): SamType? {
return if (isSamType(originalType)) SamType(originalType) else null
}
}

View File

@@ -18,7 +18,7 @@ fun mangleNameIfNeeded(name: String): String {
if (c.isValidCharacter()) {
append(c)
} else {
val hexString = Integer.toHexString(c.code)
val hexString = Integer.toHexString(c.toInt())
assert(hexString.length <= 4)
append("_u").append(hexString)
}

View File

@@ -0,0 +1,13 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.codegen
import org.jetbrains.org.objectweb.asm.Opcodes
// This object should help compiling against different ASM versions from different bunch versions
object VersionIndependentOpcodes {
const val ACC_RECORD = 0
}

View File

@@ -18,10 +18,7 @@ interface TypeMappingContext<Writer : JvmDescriptorTypeWriter<Type>> {
val typeContext: TypeSystemCommonBackendContextForTypeMapping
fun getClassInternalName(typeConstructor: TypeConstructorMarker): String
fun getScriptInternalName(typeConstructor: TypeConstructorMarker): String
// NB: The counterpart, [KotlinTypeMapper#writeGenericType], doesn't have restriction on [type]
fun Writer.writeGenericType(type: KotlinTypeMarker, asmType: Type, mode: TypeMappingMode)
fun Writer.writeGenericType(type: SimpleTypeMarker, asmType: Type, mode: TypeMappingMode)
}
object AbstractTypeMapper {
@@ -46,7 +43,6 @@ object AbstractTypeMapper {
sw: Writer? = null
): Type = context.typeContext.mapType(context, type, mode, sw)
// NB: The counterpart, [descriptorBasedTypeSignatureMapping#mapType] doesn't have restriction on [type].
@OptIn(ExperimentalStdlibApi::class)
private fun <Writer : JvmDescriptorTypeWriter<Type>> TypeSystemCommonBackendContextForTypeMapping.mapType(
context: TypeMappingContext<Writer>,
@@ -54,7 +50,10 @@ object AbstractTypeMapper {
mode: TypeMappingMode = TypeMappingMode.DEFAULT,
sw: Writer? = null
): Type {
if (type is SimpleTypeMarker && type.isSuspendFunction()) {
if (type !is SimpleTypeMarker) {
error("Unexpected type: $type (original Kotlin type=$type of ${type.let { it::class }})")
}
if (type.isSuspendFunction()) {
val argumentsCount = type.argumentsCount()
val argumentsList = type.asArgumentList()
@@ -79,7 +78,7 @@ object AbstractTypeMapper {
val typeConstructor = type.typeConstructor()
when {
type is SimpleTypeMarker && type.isArrayOrNullableArray() -> {
type.isArrayOrNullableArray() -> {
val typeArgument = type.asArgumentList()[0]
val (variance, memberType) = when {
typeArgument.isStarProjection() -> Variance.OUT_VARIANCE to nullableAnyType()
@@ -99,7 +98,7 @@ object AbstractTypeMapper {
return AsmUtil.getArrayType(arrayElementType)
}
type is SimpleTypeMarker && typeConstructor.isClassTypeConstructor() -> {
typeConstructor.isClassTypeConstructor() -> {
if (typeConstructor.isInlineClass() && !mode.needInlineClassWrapping) {
val expandedType = computeExpandedTypeForInlineClass(type)
require(expandedType is SimpleTypeMarker?)
@@ -118,7 +117,9 @@ object AbstractTypeMapper {
}
typeConstructor.isScript() -> {
return Type.getObjectType(context.getScriptInternalName(typeConstructor))
val asmType = AsmTypes.JAVA_CLASS_TYPE
with(context) { sw?.writeGenericType(type, asmType, mode) }
return asmType
}
typeConstructor.isTypeParameter() -> {

View File

@@ -0,0 +1,158 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.inline.SMAPBuilder;
import org.jetbrains.kotlin.codegen.inline.SourceMapper;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.*;
import java.util.List;
import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.GENERATE_SMAP;
public abstract class AbstractClassBuilder implements ClassBuilder {
protected static final MethodVisitor EMPTY_METHOD_VISITOR = new MethodVisitor(Opcodes.API_VERSION) {};
protected static final FieldVisitor EMPTY_FIELD_VISITOR = new FieldVisitor(Opcodes.API_VERSION) {};
private String thisName;
private final JvmSerializationBindings serializationBindings = new JvmSerializationBindings();
private String sourceName;
private String debugInfo;
public static class Concrete extends AbstractClassBuilder {
private final ClassVisitor v;
public Concrete(@NotNull ClassVisitor v) {
this.v = v;
}
@Override
@NotNull
public ClassVisitor getVisitor() {
return v;
}
}
@Override
@NotNull
public FieldVisitor newField(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable Object value
) {
FieldVisitor visitor = getVisitor().visitField(access, name, desc, signature, value);
if (visitor == null) {
return EMPTY_FIELD_VISITOR;
}
return visitor;
}
@Override
@NotNull
public MethodVisitor newMethod(
@NotNull JvmDeclarationOrigin origin,
int access,
@NotNull String name,
@NotNull String desc,
@Nullable String signature,
@Nullable String[] exceptions
) {
MethodVisitor visitor = getVisitor().visitMethod(access, name, desc, signature, exceptions);
if (visitor == null) {
return EMPTY_METHOD_VISITOR;
}
return visitor;
}
@Override
@NotNull
public JvmSerializationBindings getSerializationBindings() {
return serializationBindings;
}
@Override
@NotNull
public AnnotationVisitor newAnnotation(@NotNull String desc, boolean visible) {
return getVisitor().visitAnnotation(desc, visible);
}
@Override
public void done() {
getVisitor().visitSource(sourceName, debugInfo);
getVisitor().visitEnd();
}
@Override
public void defineClass(
@Nullable PsiElement origin,
int version,
int access,
@NotNull String name,
@Nullable String signature,
@NotNull String superName,
@NotNull String[] interfaces
) {
thisName = name;
getVisitor().visit(version, access, name, signature, superName, interfaces);
}
@Override
public void visitSource(@NotNull String name, @Nullable String debug) {
assert sourceName == null || sourceName.equals(name) : "inconsistent file name: " + sourceName + " vs " + name;
sourceName = name;
debugInfo = debug;
}
@Override
public void visitSMAP(@NotNull SourceMapper smap, boolean backwardsCompatibleSyntax) {
if (!GENERATE_SMAP) return;
List<FileMapping> fileMappings = smap.getResultMappings();
if (fileMappings.isEmpty()) return;
visitSource(fileMappings.get(0).getName(), SMAPBuilder.INSTANCE.build(fileMappings, backwardsCompatibleSyntax));
}
@Override
public void visitOuterClass(@NotNull String owner, @Nullable String name, @Nullable String desc) {
getVisitor().visitOuterClass(owner, name, desc);
}
@Override
public void visitInnerClass(@NotNull String name, @Nullable String outerName, @Nullable String innerName, int access) {
getVisitor().visitInnerClass(name, outerName, innerName, access);
}
@Override
@NotNull
public String getThisName() {
assert thisName != null : "This name isn't set";
return thisName;
}
}

View File

@@ -34,10 +34,10 @@ import org.jetbrains.kotlin.name.Name;
import org.jetbrains.kotlin.resolve.AnnotationChecker;
import org.jetbrains.kotlin.resolve.DescriptorUtils;
import org.jetbrains.kotlin.resolve.InlineClassesUtilsKt;
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker;
import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.jvm.annotations.JvmAnnotationUtilKt;
import org.jetbrains.kotlin.resolve.multiplatform.OptionalAnnotationUtil;
import org.jetbrains.kotlin.types.FlexibleType;
import org.jetbrains.kotlin.types.FlexibleTypesKt;
import org.jetbrains.kotlin.types.KotlinType;
@@ -376,7 +376,7 @@ public abstract class AnnotationCodegen {
// We do not generate annotations whose classes are optional (annotated with `@OptionalExpectation`) because if an annotation entry
// is resolved to the expected declaration, this means that annotation has no actual class, and thus should not be generated.
// (Otherwise we would've resolved the entry to the actual annotation class.)
if (OptionalAnnotationUtil.isOptionalAnnotationClass(classDescriptor)) {
if (ExpectedActualDeclarationChecker.isOptionalAnnotationClass(classDescriptor)) {
return null;
}

View File

@@ -20,12 +20,14 @@ import org.jetbrains.kotlin.codegen.inline.NameGenerator
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner.Companion.putReifiedOperationMarker
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeInliner.OperationKind
import org.jetbrains.kotlin.codegen.inline.ReifiedTypeParametersUsages
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.types.TypeSystemCommonBackendContext
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.kotlin.types.model.TypeParameterMarker
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
interface BaseExpressionCodegen {
val frameMap: FrameMapBase<*>
val visitor: InstructionAdapter
@@ -38,14 +40,24 @@ interface BaseExpressionCodegen {
fun propagateChildReifiedTypeParametersUsages(reifiedTypeParametersUsages: ReifiedTypeParametersUsages)
fun pushClosureOnStack(
classDescriptor: ClassDescriptor,
putThis: Boolean,
callGenerator: CallGenerator,
functionReferenceReceiver: StackValue?
)
fun markLineNumberAfterInlineIfNeeded(registerLineNumberAfterwards: Boolean)
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
}
fun BaseExpressionCodegen.putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind): Boolean {
val (typeParameter, second) = typeSystem.extractReificationArgument(type) ?: return false
consumeReifiedOperationMarker(typeParameter)
putReifiedOperationMarker(operationKind, second, visitor)
return true
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
with(typeSystem) {
val (typeParameter, second) = extractReificationArgument(type) ?: return
if (typeParameter.isReified()) {
consumeReifiedOperationMarker(typeParameter)
putReifiedOperationMarker(operationKind, second, visitor)
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More