Compare commits

..

139 Commits

Author SHA1 Message Date
Stanislav Erokhin
8ad07bb0a0 Fix 1.4-M2 ChangeLog.md 2020-07-02 22:05:37 +03:00
Lilia
e2296a3784 Add changelog for 1.4-M2 2020-06-03 18:05:14 +02:00
Stanislav Erokhin
ea347c8a23 Update kotlin version used in wizard
Unfortunately there is some test data that checks that it was
dev version, not eap version, so I picked an dev version instead.
2020-06-01 19:35:16 +03:00
Stanislav Erokhin
fa19c059b9 Advance kotlin version for wizard testing
Previous version was dropped from bintray
(because it is a kotlin-dev repo).
This is temporary fix for 1.4-M2
2020-06-01 14:59:09 +03:00
Pavel Punegov
acb1da1bb8 Update Kotlin/Native compiler to 1.4-M2 2020-05-29 15:06:12 +00:00
Ilmir Usmanov
45a5d0a01c Fix bugs with capturing rhs into EXACTLY_ONCE lambda
There are multiple ways to declare a named variable-like entity in
Kotlin:
1. val/var variable declaration
2. destructuring declaration
3. parameter of a function
4. parameter of a lambda
5. destructured lambda parameter
6. for-loop's variable declaration
7. catch block exception declaration
8. val in when
9. field declaration

Out of them, only variable and field can be assignable, in other words,
they can be on the left hand side of an assignment.
Val/var variable declarations were already supported.
So, we needed to just support field initialization and tell the backend
that other ways are prohibited. Function and lambda parameters were
already been supported. So, the only thing to explain to the backend are
remaining ways.
 #KT-39113 Fixed
 #KT-34048 Fixed
2020-05-29 15:13:31 +02:00
Vyacheslav Gerasimov
66ec576308 as41: Build against AS 4.1 C10 2020-05-29 13:54:48 +03:00
Vyacheslav Gerasimov
14a15a76cc as41: Setup bunch config and compatibility dsl for AS 4.1
(cherry picked from commit 097b93cb2a)
2020-05-29 09:10:37 +03:00
Vyacheslav Gerasimov
27a237ef5b Build: Remove bunch files with intellijUltimateEnabled=false for AS
(cherry picked from commit d6011103e2)
2020-05-29 09:10:34 +03:00
Dmitry Savvinov
2722cb984d Allow specific native targets to depend on unspecified native target
^KT-38769 Fixed
2020-05-26 10:50:48 +03:00
Dmitriy Dolovov
1bf6a047e7 [Commonizer] Add Gradle property to pass JVM args
^KT-39094
2020-05-22 16:11:52 +07:00
Ilya Goncharov
8abc86a9ba [Gradle, JS] Add isMpp property
#KT-38592 fixed

(cherry picked from commit 22f5d3b134)

[Gradle, JS] Define fake configuration for single js plugin to publish as common

#KT-38592 fixed

(cherry picked from commit 4f747072f4)

[Gradle, JS] Add fake common usage context for single js plugin publish

#KT-38592 fixed

(cherry picked from commit a6812e5d6a)

[Gradle, JS] Add test on hmpp with both js

#KT-38592 fixed

(cherry picked from commit 79984b6e04)

[Gradle, JS] Fix for JsIrTarget in mixed mode

#KT-38592 fixed

(cherry picked from commit d089bbe14a)

[Gradle, JS] Fix naming of test and test data

#KT-38592 fixed

(cherry picked from commit bed7b23d6c)

[Gradle, JS] Fix hmpp on only js

#KT-38592 fixed

(cherry picked from commit 985623eac5)

[Gradle, JS] Add test on local project dependency

#KT-38592 fixed

(cherry picked from commit 3c9207a2cd)
2020-05-22 11:02:45 +03:00
Sergey Igushkin
641b6a5e43 Fix KT-39063 by not adding extendsFrom with metadata configurations
Issue #KT-39063 Fixed

(cherry picked from commit 38fd9c3d1a)
2020-05-20 17:07:35 +03:00
Dmitry Savvinov
3ca79a052e Check for common klibs builtins_platform properly
Actually, common klibs don't have a corresponding record (and abscence
of that record should be treated as platform COMMON).

^KT-38769 Fixed
2020-05-17 19:17:18 +03:00
Ilya Kirillov
1236b9a1e7 Wizard: use correct version of react libraries
#KT-38929 fixed
2020-05-15 16:37:03 +03:00
Dmitriy Dolovov
dae56958e5 [Commonizer] Added README.md 2020-05-14 17:36:18 +07:00
Andrey Uskov
bb2f43945e Fixed import of MPP modules with single artifacts
#KT-38037 Fixed
2020-05-14 00:54:42 +03:00
Mikhael Bogdanov
d755bd9692 Call visit method on ClassWriter in IC caching in proper order
(cherry picked from commit 9fdb1ff4f8)
2020-05-13 18:13:51 +02:00
Mikhail Bogdanov
ba47666dea Call missed visit method on ClassWriter in IC caching
Otherwise ASM fails with error on invalid frames because bytecode version is 0

(cherry picked from commit 3134832396)
2020-05-13 18:13:37 +02:00
Anton Yalyshev
ea8de74cda Bump Gradle (6.3) and Android-build-tools (3.6.3) versions in new project wizards
(cherry picked from commit 37e676a4a6)
2020-05-07 16:28:32 +03:00
Sergey Igushkin
d0b9d48d9b Fix falsely skipped shared-native source sets in HMPP (KT-38746)
Issue #KT-38746 Fixed

(cherry picked from commit 292563451c)
2020-05-07 16:13:12 +03:00
Mikhail Bogdanov
e42d05b40c Postpone JvmDefault deprecation. Revert "Deprecate @JvmDefault"
This reverts commit c11f3868

(cherry picked from commit 4f7599076c)
2020-05-05 13:49:21 +02:00
Dmitry Savvinov
5d2507bf85 Make KotlinNativeTasks.konanTargetsForManifest non-nullable, otherwise Gradle fails 2020-05-03 10:35:02 +03:00
Dmitry Savvinov
f1150101d7 Collect and pass to K2Native actual targets of native-shared compilation
^KT-38658 Fixed
2020-04-30 20:03:16 +03:00
Sergey Igushkin
185f42c953 Kotlin/Native 1.4-M2-eap-49 2020-04-30 01:01:25 +03:00
Dmitriy Dolovov
9e9111a15a HMPP: Backward-compatible Kotlin facet serialization
^KT-38634
2020-04-29 19:49:32 +07:00
Ilya Goncharov
53cbb8e454 [Gradle, JS] No create target on import if no target in DSL
#KT-38469 fixed

(cherry picked from commit 1f40a71cbe)
2020-04-29 13:48:53 +03:00
Andrey Uskov
04475aa7f1 Fixed collecting MPP targets in gradle statistics
(cherry picked from commit 55934ff63a)
2020-04-29 13:42:16 +03:00
Andrey Uskov
8585407da2 Fixed import of JS source sets with Both mode
Added flag indicating that source set naming contract is violated. In this case disambiguition classifier is ignored in IDE.
#KT-37562 Fixed

(cherry picked from commit 96887d6e9f)
2020-04-29 13:42:12 +03:00
Ilya Kirillov
1c92db8f91 Wizard: remove copyrights from iOS template 2020-04-29 12:03:22 +03:00
Ilya Kirillov
6081aa1d3e Wizard: fix not created by default xcode framework in shared module
the runForXcode task is not generating xcode framework
if there is no source files in shared module
2020-04-29 12:03:21 +03:00
Ilya Kirillov
c91ff19fa4 Wizard: fix android project template
It was not able to be built as lint task required com.android.tools.build:gradle
in classpath to work

#KT-38579 fixed
2020-04-29 12:03:20 +03:00
Ilya Kirillov
a5e9bf7c4f Wizard: do not run whole JPS project importing in write action 2020-04-29 12:03:19 +03:00
Ilya Kirillov
c3fce0e3d2 Wizard: always allow user to choose project JDK 2020-04-29 12:03:18 +03:00
Ilya Kirillov
1739a0a397 Wizard: fix kotlin and resources directory names in Android module
#KT-38428 fixed
2020-04-29 12:03:16 +03:00
Ilya Kirillov
0c49cf6c0e Wizard: minor, move message to bundle 2020-04-29 12:03:14 +03:00
Ilya Kirillov
b43e8db2ab Wizard: add common target to FullStackWebApplicationProjectTemplate 2020-04-29 12:03:13 +03:00
Ilya Kirillov
3c51abc9e0 Wizard: validate project path for emptiness
#KT-38567 fixed
2020-04-29 12:03:11 +03:00
Ilya Kirillov
897596b3b5 Wizard: reduce buildsystem buttons sizes 2020-04-29 12:03:04 +03:00
Ilya Kirillov
0ed2dd84cb Wizard: do not create project with snapshot version 2020-04-29 12:03:00 +03:00
Ilya Kirillov
8dc7fa1f2a Wizard: add arrows for module selection popup 2020-04-29 12:02:55 +03:00
Ilya Kirillov
9623102fb9 Wizard: use new api from gradle to import project on >= 193 2020-04-29 12:02:54 +03:00
Ilya Kirillov
2df2f37026 Wizard: run Gradle wrapper task in background
#KT-38225 fixed

(cherry picked from commit 9c156c1a93)
2020-04-29 12:02:30 +03:00
Dmitriy Dolovov
e70663f94b [Commonizer] Capitalize messages to be printed at console 2020-04-29 13:28:37 +07:00
Dmitriy Dolovov
e988a95e93 [Commonizer] Don't fail when one of targets is not supported at the host
^KMM-214
2020-04-29 13:28:31 +07:00
Leonid Startsev
40fc072c22 Use AssociatedObjects on JS too
because JS IR now supports them

(cherry picked from commit 52933e161e)
2020-04-29 01:32:07 +03:00
Anton Bannykh
6e7aef6936 JS IR: fix findAssociatedObjects for primitive type KClass'es
(cherry picked from commit 2992d49a1d)
2020-04-28 19:22:39 +03:00
Anton Bannykh
e4b4d237bc JS IR: hide runtime helpers from users
(cherry picked from commit e8a6ddceaa)
2020-04-28 17:33:06 +03:00
Sergey Igushkin
c07043c166 Kotlin/Native 1.4-M2-eap-31 2020-04-28 14:22:57 +03:00
Sergey Igushkin
b0a7fde66d Drop Gradle < 6.0 support for Kotlin MPP Gradle plugin
This is required due to issues with dependency resolution of the
kotlinx library modules published in a way that their root MPP module
contains the JVM artifacts so that consumers that can't read Gradle
module metadata get the JVM JAR and POM. Gradle 6.0+ fails to resolve
those modules in a variant-aware way, always choosing the JVM artifacts.

To avoid issues on the consumer side when these dependencies are used,
we decided to drop support for Gradle < 6.0 in the MPP plugin.

Issue #KMM-233 Fixed

(cherry picked from commit e3d33cdc10)
2020-04-28 14:21:49 +03:00
Dmitry Savvinov
14d76ddfb1 Fallback to M2-implementation of dependsOn in AS + M3
^KT-33809
2020-04-28 10:43:58 +03:00
Dmitriy Dolovov
3fc3921897 Add test for overloading expect MemberDescriptors discrimination
Issue #KT-38298
2020-04-28 14:24:07 +07:00
Dmitriy Dolovov
483507af58 Discriminate overloading expect MemberDescriptors
Issue #KT-38298
2020-04-28 14:24:01 +07:00
Ilya Goncharov
f86d0aa367 [Gradle, JS] Remove propagation moduleName from legacy to ir target
#KT-38614 fixed

(cherry picked from commit 6b5b23f37b)
2020-04-27 18:48:32 +03:00
Abduqodiri Qurbonzoda
a3c7d9fbe9 Remove String.format with non-null locale
Introducing new overloads with @SinceKotlin(1.4) annotation
and marking the old ones @LowPriorityInOverloadResolution breaks
all code that uses the format(locale, args) overload with
-api-version 1.3. Because the low priority of the non-1.4 version makes
format(args) preferable in all cases.
For example, "%02X".format(Locale.ROOT, 1) throws
IllegalFormatConversionException: x != java.util.Locale.

(cherry picked from commit 2307692064)
2020-04-27 18:38:06 +03:00
Anton Bannykh
f500243930 IR JS: support findAssociatedObject feature (KT-37418 fixed)
(cherry picked from commit 442331acc9)
2020-04-27 17:56:16 +03:00
Konstantin Tskhovrebov
deecbe586a Get first platform from platformCompilations instead host platform.
Fixed #KMM-234

(cherry picked from commit 6d7e428d89)
2020-04-27 17:44:36 +03:00
Vladimir Ilmov
cf99351b9c (CoroutineDebugger) SkipCoroutineStackFrameProxy logic added 2020-04-27 16:13:12 +02:00
Vladimir Ilmov
f077b350cb (CoroutineDebugger) Tests added for no creation stack frame information 2020-04-27 16:13:11 +02:00
Vladimir Ilmov
f4aae0c33f (CoroutineDebugger) Exception if no creationStackTrace available
#KT-38484 Fixed
2020-04-27 16:13:11 +02:00
Vladimir Ilmov
26ccf81b1b (CoroutineDebugger) Minor issued fixed, log level adjusted for missing classes in JVM. 2020-04-27 16:13:10 +02:00
Vladimir Ilmov
46f5ff7ea1 (CoroutineDebugger) Unneccesary log record removed. 2020-04-27 16:13:10 +02:00
Vladimir Ilmov
57611995a5 (CoroutineDebugger) Unstable tests muted 2020-04-27 16:13:09 +02:00
Vladimir Ilmov
26a684c017 (CoroutineDebugger) Minor fixes, kotlinx.coroutines version fix 2020-04-27 16:13:06 +02:00
Vladimir Ilmov
e25c0b75b3 (CoroutineDebugger) negative frames removed from coroutine stack 2020-04-27 16:12:26 +02:00
Vladimir Ilmov
746eb1f064 (CoroutineDebugger) kotlinx.coroutines.core:1.3.5 support / dynamicProxy(interface) classes 2020-04-27 16:12:25 +02:00
Vladimir Ilmov
0c8ea17028 (CoroutineDebugger) kotlinx.coroutines compatibility version fix 2020-04-27 16:12:25 +02:00
Vladimir Ilmov
7d5be60e5e (CoroutineDebugger) Added setting to disable coroutine agent 2020-04-27 16:12:24 +02:00
Vladimir Ilmov
923f34fd73 (CoroutineDebugger) kotlinx-coroutines-core:1.3.5 support 2020-04-27 16:12:24 +02:00
Vladimir Ilmov
5ffdc4b96e (CoroutineDebugger) PreflightFrame support in tests via CoroutineAsync 2020-04-27 16:12:24 +02:00
Vladimir Ilmov
39b16b0dd0 (CoroutineDebugger) Fixed CombinedContext information, default group renamed to empty dispatcher 2020-04-27 16:12:23 +02:00
Vladimir Ilmov
d720d9362e (CoroutineDebugger) unused classes removed / code cleanup 2020-04-27 16:12:23 +02:00
Vladimir Ilmov
59e5052175 (CoroutineDebugger) Stack printing logic extracted to the single place
for DebugMetadata and CoroutinePanel, some corner cases fixed, test
cases added.
Added:
 - external maven dependencies in test scenarios
 - comparing stack traces + variables on breakpoint
2020-04-27 16:12:22 +02:00
Vladimir Ilmov
03cb79d156 (CoroutineDebugger) Added check if agent is not available in target jvm 2020-04-27 16:12:22 +02:00
Vladimir Ilmov
10c2d6f9f2 (CoroutineDebugger) Group coroutines by dispatcher
Kotlin Script support added.

 #KT-37917 fixed
2020-04-27 16:12:21 +02:00
Vladimir Ilmov
bb3aea8026 NPE fix in StackFrameInterceptor 2020-04-27 16:12:21 +02:00
Anton Yalyshev
68fd4cd1b9 Update group id for refactoring fus collector in 201 bunch
(cherry picked from commit f356ff36b4)
2020-04-24 21:22:07 +03:00
Dmitry Gridin
b87ab423ed i18n, MoveKotlinNestedClassesToUpperLevelDialog: add missing bundles for 201
#KT-38527 Fixed

(cherry picked from commit 60dc2f9674)
2020-04-24 17:13:53 +07:00
Dmitry Gridin
633f88c248 i18n, debugger: add missing bundles for 201
#KT-38487 Fixed

(cherry picked from commit 6524e2b764)
2020-04-24 17:13:17 +07:00
Dmitry Savvinov
6beb4e31d4 Allow dependencies to see internals from main module as well
^KT-38338 Fixed

(cherry picked from commit b07f89864e)
2020-04-24 12:57:14 +03:00
Sergey Igushkin
68fabac8eb fix testLanguageSettingsApplied
(cherry picked from commit af09cb0e57)
2020-04-24 12:57:10 +03:00
Sergey Igushkin
29d71087e7 Add Gradle integration tests running the IDE HMPP highlighting tests
(cherry picked from commit 60c49d26e3)
2020-04-24 12:57:08 +03:00
Sergey Igushkin
0ecd3ef070 Fix expect discrimination with actual typealias in deserialization
* For types encountered during deserialization, search for a classifier,
  not necessarily a class, across module dependencies (i.e. accept type
  aliases, returned when actual type alias discriminates an expect
  class).

* When the referenced type is a type alias, expand it, so that when
  the descriptor is compared to the expansion in other places,
  they match.

* Also, when resolving an abbreviation, don't expand the type aliases,
  as there are assumptions in the code base that an abbreviation is a
  type alias.

(cherry picked from commit 4b0da0688a)
2020-04-24 12:57:05 +03:00
Sergey Igushkin
3811b69f0e Support additional module descriptor dependencies in klib descriptors
(cherry picked from commit d4a0844a77)
2020-04-24 12:57:03 +03:00
Sergey Igushkin
9696e9b054 Fix wrong assumption in getHostSpecificSourceSets (KMM-225)
The assumption that each source set is already registered in at least
one compilation would break Android targets which are configured later
on the execution path, and also fail when there are unused source sets.

Issue #KMM-225 Fixed

(cherry picked from commit a9dd194383)
2020-04-24 12:57:00 +03:00
Sergey Igushkin
85f4d1dbb8 Add a dependency from all klib-originated modules to the main module
This is required, for instance, to properly resolve supertypes across
the modules.

Issue #KT-37832 Fixed

(cherry picked from commit 67f4b7e2b0)
2020-04-24 12:56:58 +03:00
Ilya Goncharov
df5356c6d7 [Gradle, JS] Add compiler type values on extension type
#KT-38519 fixed

(cherry picked from commit 9a3bf54d9d)

[Gradle, JS] Test check several ways to configure compiler type

#KT-38519 fixed

(cherry picked from commit f95ff049c6)
2020-04-24 10:54:09 +03:00
Ilya Matveev
5f174bc423 [Gradle] Use : as a separator for group and name in klib unique names 2020-04-24 10:27:48 +07:00
Ilya Matveev
4a88699d71 [Gradle, native] Make tests tolerate to stacktrace format changes
The K/N compiler changed the way in which inline functions are shown
in stacktraces. When an exception is thrown from an inline function,
the stacktrace refers to a line in the body of the inline function
while in 1.3.7x it referred to a line when the inline function is called.

This patch gets rid of inline functions in the corresponding test
to make it independent on such changes in the stacktrace format.
2020-04-24 10:27:47 +07:00
Ilya Matveev
7f1999f99a [Gradle, native] Improve logging in CacheBuilder 2020-04-24 10:27:47 +07:00
Ilya Matveev
dcfe23b2ca [Gradle, Native/JS] Specify FQ module name for klibs
By default, a unique name for a klibrary equals to a klib
file name. In the MPP plugin, the file name equals to a
Gradle project name. But the project name is not unique
enough. E.g. there is a situation when there are several projects
with the same simple name inside a single Gradle build. If
one of these projects depends on another, the compiler
will report a false cyclic dependency error.

This patch partially fixes this problem by specifying a custom
unique name for produced klibs based on project group and name.
We still can get a unique name clash in a case of equal groups
and project names. But in this case the cyclic dependency error
looks much more logical for user.

Also this patch specifies short names for native klibs to avoid
long declaration prefixes in framework headers.

Issue #KT-36721 Fixed
Issue #KT-38220 Fixed
2020-04-24 10:27:47 +07:00
Ilya Matveev
2dc5468b62 [JS IR] Support setting custom module name (= unique name)
Required for #KT-36721.
2020-04-24 10:27:47 +07:00
Ilya Matveev
2a1f3bd671 Update K/N: 1.4-M2-eap-14 2020-04-24 10:27:47 +07:00
Alexey Trilis
40543bc7e5 Introduce MSE and EME APIs to Kotlin/JS stdlib
#KT-37910 Fixed

(cherry picked from commit 3ad597ca5c)
2020-04-23 16:51:54 +03:00
Ilya Chernikov
bcab0d9ee5 Revert "Drop unnecessary dependency from embeddable compiler to daemon"
The commit breaks gradle plugin, because it relies on this dependency.
This reverts commit 2c889c2e
2020-04-23 15:47:50 +02:00
Ilya Goncharov
b53566a1c1 [Gradle, JS] Add string sompiler setting in js plugin
#KT-38485 fixed

(cherry picked from commit c7f7f2bcbb)

[Gradle, JS] Fix test

#KT-38485 fixed

(cherry picked from commit 47c27726b9)

[Gradle, JS] Change byArgument on byArgumentOrNull

#KT-38485 fixed

(cherry picked from commit 8e282e8aad)

[Gradle, JS] Remove copypaste in js compiler argument

#KT-38485 fixed

(cherry picked from commit ac11bc6710)
2020-04-23 15:03:43 +03:00
Abduqodiri Qurbonzoda
ec6bc50e01 Fix CharArray sort in JS IR-backend 2020-04-23 13:43:50 +03:00
Anton Bannykh
a991f7bd8d JS: fix JsName renamer (KT-36484 fixed)
The following code was treated incorrectly:
```
function (_) {

  function foo() {
      try {} catch (_) {}
      try {} catch (_) {}
  }

  // _ is linked to the catch parameter here
}
```

(cherry picked from commit de25d13f1a)
2020-04-22 19:33:15 +03:00
Igor Yakovlev
dde850e663 Fixed possible NPE in LightClasses
Fixed #EA-218014
2020-04-22 14:01:16 +03:00
Igor Yakovlev
00d9da53f5 Fix invalid signature for generic UL method
Fixed #KT-38348
2020-04-22 14:01:13 +03:00
Abduqodiri Qurbonzoda
86016f18ed Reverse range and sortDescending range #KT-36955
(cherry picked from commit d6472aa700)
2020-04-22 13:55:13 +03:00
Ilya Chernikov
2c889c2e75 Drop unnecessary dependency from embeddable compiler to daemon
(cherry picked from commit 86d47b496b)
2020-04-22 08:34:36 +02:00
Ilya Chernikov
a87ec06c6f Fix ThreadDeath exception on stopping daemon thread
#KT-30086 fixed

(cherry picked from commit c2eaa3d955)
2020-04-22 08:34:35 +02:00
Dmitriy Dolovov
c45b2438c4 IDE. Allow expect declarations in completion in shared native modules
Issue #KMM-218
2020-04-22 08:39:51 +07:00
Ilya Kirillov
5c663ba319 Wizard: enable new wizard by default in registry key
It was forgotten in 0e199ae94c

(cherry picked from commit bf97391c51)
2020-04-20 19:00:38 +03:00
Igor Chevdar
ae191da8c8 [box-tests] Turned on some tests on fun interfaces for JS & Native 2020-04-20 19:58:27 +05:00
Dmitry Gridin
0090f1c2ce i18n: fix text in AbstractKotlinInlineDialog
#KT-37822 Fixed

(cherry picked from commit 2d64ded3c7)
2020-04-20 19:16:12 +07:00
Vladimir Dolzhenko
06ffea298e Fix KotlinNativeABICompatibilityChecker.getLibrariesToNotifyAbout freeze
Get rid of O(n^2) in copyProperties
make ModuleProductionSourceInfo.stableName lazy
add checkCanceled in loops in IdeaModelInfosCache

#KT-38318 Fixed

(cherry picked from commit 86a02c07f6)
2020-04-20 11:35:09 +02:00
Vladimir Dolzhenko
f8b4bf1831 Do not search TODOs in non KT and non physical files
#KT-37896 Fixed
#EA-230407 Fixed

(cherry picked from commit 86a02c07f6)
2020-04-20 11:35:09 +02:00
Pavel Kirpichenkov
c54869d113 [NI] Fix expicit super receiver check
^KT-37497 Fixed
2020-04-20 12:12:01 +03:00
Ilya Matveev
6265a94f4d [klibs] Allow resolving klibs which names are not valid file names
Issue #KT-36721

Cherry-picked from 5f53986f47
2020-04-20 15:24:25 +07:00
Dmitriy Dolovov
8b73f939a6 [Commonizer] Generate correct TA types for callable descriptors
Issue #KMM-217
2020-04-20 13:22:08 +07:00
Dmitriy Dolovov
5a8e7d586d Minor. Add comments 2020-04-20 13:18:54 +07:00
Dmitriy Dolovov
b9c3440ea8 HMPP. Avoid leaking platform-specific dependencies into common libraries
Issue #KMM-217
2020-04-20 13:18:44 +07:00
Dmitriy Dolovov
9d8bad3e93 HMPP. Rewrite LibraryDependenciesCache on using LibraryInfo/SdkInfo
... instead of pure IJ Library/SDK.
2020-04-20 13:18:39 +07:00
Dmitriy Dolovov
ec6bc11b1c HMPP: Fix detection of NativePlatform in CompositeResolverForModuleFactory 2020-04-20 13:18:31 +07:00
Dmitriy Dolovov
ae18b563e4 HMPP: Evaluate exact TargetPlatform for each K/N KLIB library 2020-04-20 13:18:23 +07:00
Dmitriy Dolovov
d29c1fdea7 Minor. Specify explicit property types 2020-04-20 13:18:18 +07:00
Dmitriy Dolovov
5451cde862 HMPP: Fix serialization of TargetPlatform in tests 2020-04-20 13:18:12 +07:00
Dmitriy Dolovov
8530541a4d HMPP: Fix serialization of TargetPlatform in Kotlin facet 2020-04-20 13:18:06 +07:00
Dmitriy Dolovov
b161d45d7f Minor. Formatted 2020-04-20 13:18:00 +07:00
Dmitriy Dolovov
42d048e112 HMPP: Fix detection of PlatformDependentAnalyzerServices for TargetPlatform 2020-04-20 13:17:45 +07:00
Dmitriy Dolovov
31a7e3dd78 JVM, JS: Use faster checks in IdePlatformKind.supportsTargetPlatform() 2020-04-20 13:17:36 +07:00
Dmitriy Dolovov
ce5f10c1c1 HMPP: Avoid false positive detection of "common native" as "common" 2020-04-20 13:17:30 +07:00
Dmitriy Dolovov
92d909effa HMPP. Fix tests after parameterization of NativePlatform 2020-04-20 13:17:23 +07:00
Dmitriy Dolovov
dd727404fe HMPP: Parameterize NativePlatform with KonanTarget 2020-04-20 13:17:18 +07:00
Dmitriy Dolovov
35d9655aff HMPP: Propagate K/N flavor into each imported K/N module 2020-04-20 13:17:08 +07:00
Ilya Matveev
22d2adb071 [Gradle, native] Disable platform libraries generation by default
Since there are a lot of changes around klibs in 1.4-M2, it was
decided to postpone enabling user-side platform libraries generation
by default. This patch switches the default distribution type to
prebuilt.

It also slightly refactors the code allowing user to choose the
distribution type. Now, there are only two distribution types
available:

- prebuilt - the default type, contains prebuilt platform libs.
             A distribution archive has the "-prebuilt-" classifier.
- light    - doesn't contain platform libs in an archive and
             generates them at the user side. The archive has no
             classifier to avoid changes in the K/N build logic and
             TC configurations.

The same types are also available for 1.3 but with sightly different
convention:

- prebuilt - the default type, contains prebuilt platform libs.
             A distribution archive has no classifier.
- light    - aka "restricted" distribution, doesn't contain
             platform libs for Apple platforms. The archive has
             the "-restricted-" suffix. Doesn't have a facility
             to build the libraries at the user side.

Issue #KT-38174 Fixed
2020-04-19 12:21:09 +07:00
Ilya Matveev
a54c4b54fa [Gradle, native] Rename native distribution kind: regular -> light 2020-04-19 12:21:08 +07:00
Ilya Gorbunov
793e13c093 Introduce runningFold and runningReduce operations
runningFold is a synonym for scan,
runningReduce replaces scanReduce.

#KT-38060

(cherry picked from commit 893021f22b)
2020-04-16 19:26:11 +03:00
Ilya Gorbunov
abb4ba30fc Delegate properties to property references
#KT-8658

(cherry picked from commit ea1e16e309)
2020-04-16 19:26:09 +03:00
Mikhail Zarechenskiy
bef7e02781 [NI] Properly support UnsafeVariance annotation
#KT-38134 Fixed
 #KT-34433 Fixed
 #KT-31823 Fixed
2020-04-16 14:24:00 +03:00
Anton Bannykh
c1cf23b491 JS: support explicit SAM constructor invocation
(cherry picked from commit 81798282b9)
2020-04-15 21:18:10 +03:00
Mikhail Zarechenskiy
8cd7430cc1 Remove JavaResolverUtils.java as its usages were moved to core 2020-04-15 11:26:01 +03:00
Mikhail Zarechenskiy
7dab4c8bc6 Introduce synthetic scope for constructors of fun interfaces
#KT-37434 Fixed
2020-04-15 11:26:01 +03:00
Mikhail Zarechenskiy
2976a22436 Refactoring: move utils to create & initialize SAM constructors to core 2020-04-15 11:26:00 +03:00
Mikhail Zarechenskiy
20e942e104 Extract Java specific check from common method out
This is needed for further refactoring
2020-04-15 11:25:59 +03:00
Mikhail Zarechenskiy
a581c1c52e Move Sam(TypeAlias)ConstructorDescriptor to core 2020-04-15 11:25:59 +03:00
Mikhail Zarechenskiy
c38413b31f Move SyntheticMemberDescriptor.kt to core
This is a first part of unification SAM constructors for all platforms
2020-04-15 11:25:58 +03:00
39619 changed files with 616105 additions and 1859947 deletions

10
.bunch
View File

@@ -1,2 +1,8 @@
202
as42
193
201
192
191_192
as35_191_192
as36_192
as40
as41_201

2
.gitattributes vendored
View File

@@ -2,7 +2,5 @@
*Generated.java linguist-generated=true
* text=auto
* eol=lf
*.png binary
*.jar binary
compiler/cli/bin/* eol=lf
compiler/cli/bin/*.bat eol=crlf

12
.gitignore vendored
View File

@@ -32,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
@@ -52,18 +50,10 @@ build/
.idea/artifacts/kotlin_main_kts_jar.xml
.idea/artifacts/kotlin_compiler_client_embeddable_jar.xml
.idea/artifacts/kotlin_reflect_jar.xml
.idea/artifacts/kotlin_stdlib_js_ir_*
.idea/artifacts/kotlin_test_js_ir_*
.idea/artifacts/kotlin_stdlib_wasm_*
.idea/jarRepositories.xml
.idea/csv-plugin.xml
kotlin-ultimate/
node_modules/
.rpt2_cache/
libraries/tools/kotlin-test-js-runner/lib/
libraries/tools/kotlin-source-map-loader/lib/
local.properties
buildSrcTmp/
distTmp/
outTmp/
/test.output
/kotlin-native/dist

View File

@@ -1,8 +0,0 @@
<component name="ArtifactManager">
<artifact build-on-make="true" name="dist_root">
<output-path>$PROJECT_DIR$/dist</output-path>
<root id="root">
<element id="artifact" artifact-name="dist" />
</root>
</artifact>
</component>

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" />

View File

@@ -11,7 +11,6 @@
<w>protobuf</w>
<w>redirector</w>
<w>remapper</w>
<w>sonatype</w>
<w>unpresent</w>
</words>
</dictionary>

View File

@@ -1,20 +1,12 @@
<component name="ProjectDictionaryState">
<dictionary name="dmitriy.dolovov">
<words>
<w>cinterop</w>
<w>commonizable</w>
<w>commonization</w>
<w>commonize</w>
<w>commonized</w>
<w>commonizer</w>
<w>commonizers</w>
<w>commonizes</w>
<w>commonizing</w>
<w>interop</w>
<w>jetbrains</w>
<w>konan</w>
<w>kotlinx</w>
<w>macos</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

@@ -1,27 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="svyatoslav.kuzmich">
<words>
<w>anyfunc</w>
<w>copysign</w>
<w>eqref</w>
<w>exnref</w>
<w>externref</w>
<w>funcref</w>
<w>jetbrains</w>
<w>kotlinx</w>
<w>ktor</w>
<w>optref</w>
<w>popcnt</w>
<w>rotl</w>
<w>rotr</w>
<w>simd</w>
<w>sqrt</w>
<w>testsuite</w>
<w>uninstantiable</w>
<w>unlinkable</w>
<w>vtable</w>
<w>wabt</w>
<w>xopt</w>
</words>
</dictionary>
</component>

View File

@@ -10,10 +10,7 @@
<w>kapt</w>
<w>kotlinc</w>
<w>mutators</w>
<w>parcelable</w>
<w>parceler</w>
<w>parcelers</w>
<w>parcelize</w>
<w>repl</w>
<w>testdata</w>
<w>uast</w>

BIN
.idea/icon.png generated

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -453,4 +453,4 @@
<option name="ignoreNonEmtpyLoops" value="false" />
</inspection_tool>
</profile>
</component>
</component>

16
.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>
@@ -28,7 +24,7 @@
<option name="myDefaultNotNull" value="org.jetbrains.annotations.NotNull" />
<option name="myNullables">
<value>
<list size="14">
<list size="11">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
@@ -40,15 +36,12 @@
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="9" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="14">
<list size="11">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="javax.validation.constraints.NotNull" />
@@ -60,9 +53,6 @@
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="9" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
</list>
</value>
</option>
@@ -70,7 +60,7 @@
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="PsiViewerSettings">

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

@@ -10,7 +10,7 @@
</option>
<option name="taskNames">
<list>
<option value=":compiler:tests-for-compiler-generator:generateTests" />
<option value=":compiler:generateTests" />
<option value=":compiler:tests-java8:generateTests" />
<option value=":compiler:tests-against-klib:generateTests" />
<option value=":js:js.tests:generateTests" />
@@ -22,4 +22,4 @@
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<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: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>

View File

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

View File

@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<configuration default="false" name="IDEA Ultimate" 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,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<configuration default="false" name="IDEA Ultimate (No ProcessCanceledException) " 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,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<configuration default="false" name="IDEA (No ProcessCanceledException)" 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,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle" folderName="IDEA">
<configuration default="false" name="IDEA (Not Internal)" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
@@ -16,4 +16,4 @@
<option name="vmOptions" value="" />
</ExternalSystemSettings>
</configuration>
</component>
</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,20 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: KMM" 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="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="kmmTest" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<method v="2" />
</configuration>
</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,22 +0,0 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test: stdlib-js public kotlin api test, overwrite results" type="GradleRunConfiguration" factoryName="Gradle" folderName="Stdlib">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.jetbrains.kotlin.js.test.ApiTest&quot; -Poverwrite.output=true --parallel" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":js:js.tests:cleanTest" />
<option value=":js:js.tests:test" />
</list>
</option>
<option name="vmOptions" value="" />
</ExternalSystemSettings>
<GradleScriptDebugEnabled>false</GradleScriptDebugEnabled>
<method v="2" />
</configuration>
</component>

View File

@@ -1,3 +1,3 @@
<component name="DependencyValidationManager">
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle&amp;&amp;!file[group:kotlin-ultimate]:*/&amp;&amp;!file[kotlin.libraries]:stdlib/api//*" />
<scope name="Apply copyright" pattern="!file[*]:*//testData//*&amp;&amp;!file[*]:testData//*&amp;&amp;!file[*]:*.gradle.kts&amp;&amp;!file[*]:*.gradle" />
</component>

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,11 @@
[![official project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_KotlinPublic_Compiler.svg)](https://teamcity.jetbrains.com/buildConfiguration/Kotlin_KotlinPublic_Compiler?branch=%3Cdefault%3E&buildTypeTab=overview&mode=builds)
[![TeamCity (simple build status)](https://img.shields.io/teamcity/http/teamcity.jetbrains.com/s/Kotlin_dev_Compiler.svg)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=Kotlin_dev_Compiler&branch_Kotlin_dev=%3Cdefault%3E&tab=buildTypeStatusDiv)
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlin/kotlin-maven-plugin.svg)](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jetbrains.kotlin%22)
[![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
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.
Some handy links:
Welcome to [Kotlin](https://kotlinlang.org/)! Some handy links:
* [Kotlin Site](https://kotlinlang.org/)
* [Getting Started Guide](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -18,21 +14,10 @@ Some handy links:
* [Issue Tracker](https://youtrack.jetbrains.com/issues/KT)
* [Forum](https://discuss.kotlinlang.org/)
* [Kotlin Blog](https://blog.jetbrains.com/kotlin/)
* [Subscribe to Kotlin YouTube channel](https://www.youtube.com/channel/UCP7uiEZIqci43m22KDl0sNw)
* [Follow Kotlin on Twitter](https://twitter.com/kotlin)
* [Public Slack channel](https://slack.kotlinlang.org/)
* [TeamCity CI build](https://teamcity.jetbrains.com/project.html?tab=projectOverview&projectId=Kotlin)
## Kotlin Multiplatform capabilities
Support for multiplatform programming is one of Kotlins key benefits. It reduces time spent writing and maintaining the same code for [different platforms](https://kotlinlang.org/docs/reference/mpp-supported-platforms.html) while retaining the flexibility and benefits of native programming.
* [Kotlin Multiplatform Mobile](https://kotlinlang.org/lp/mobile/) for sharing code between Android and iOS
* [Getting Started with Kotlin Multiplatform Mobile Guide](https://kotlinlang.org/docs/mobile/create-first-app.html)
* [Kotlin Multiplatform Benefits](https://kotlinlang.org/docs/reference/multiplatform.html)
* [Share code on all platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-all-platforms)
* [Share code on similar platforms](https://kotlinlang.org/docs/reference/mpp-share-on-platforms.html#share-code-on-similar-platforms)
## Editing Kotlin
* [Kotlin IntelliJ IDEA Plugin](https://kotlinlang.org/docs/tutorials/getting-started.html)
@@ -56,12 +41,7 @@ For local development, if you're not working on bytecode generation or the stand
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
```
> Note: The JDK 6 for MacOS is not available on Oracle's site. You can [download it here](https://support.apple.com/kb/DL1572).
On Windows you might need to add long paths setting to the repo:
@@ -101,23 +81,19 @@ command line parameters on the first run:
- `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
@@ -147,27 +123,28 @@ From this root project there are Run/Debug Configurations for running `IDEA` or
* Run the `IDEA` run configuration in the project
* A child IntelliJ IDEA with the Kotlin plugin will then startup
### Dependency verification
### Including into composite build
We have a [dependencies verification](https://docs.gradle.org/current/userguide/dependency_verification.html) feature enabled in the
repository for all Gradle builds. Gradle will check hashes (md5 and sha256) of used dependencies and will fail builds with
`Dependency verification failed` errors when local artifacts are absent or have different hashes listed in the
[verification-metadata.xml](https://github.com/JetBrains/kotlin/blob/master/gradle/verification-metadata.xml) file.
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`
It's expected that `verification-metadata.xml` should only be updated with the commits that modify the build. There are some tips how
to perform such updates:
```Kotlin
includeBuild("/path/to/kotlin") {
dependencySubstitution {
substitute(module("org.jetbrains.kotlin:kotlin-compiler"))
.with(project(":include:kotlin-compiler"))
}
}
```
- Use auto-generation for getting an initial list of new hashes (verify updates relate to you changes).
or in `settings.gradle`
`./gradlew -M sha256,md5 help`
*(any other task may be used instead of `help`)*
- Consider removing old versions from the file if you are updating dependencies.
- Leave meaningful `origin` attribute (instead of `Generated by Gradle`) if you did some manual verification of the artifact.
- Always do manual verification if several hashes are needed and a new `also-trust` tag has to be added.
- If youre adding a dependency with OS mentioning in an artifact name (`darwin`, `mac`, `osx`, `linux`, `windows`), remember to add
counterparts for other platforms.
```Groovy
includeBuild('/path/to/kotlin') {
dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-compiler') with project(':include:kotlin-compiler')
}
}
```
# License
Kotlin is distributed under the terms of the Apache License (Version 2.0). See [license folder](license/README.md) for details.

View File

@@ -16,24 +16,18 @@
package org.jetbrains.kotlin.ant
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.taskdefs.Execute
import org.apache.tools.ant.taskdefs.Redirector
import org.apache.tools.ant.types.*
import org.apache.tools.ant.types.Path
import org.apache.tools.ant.types.Reference
import java.io.File.pathSeparator
import java.io.File.separator
class Kotlin2JvmTask : KotlinCompilerBaseTask() {
override val compilerFqName = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
var includeRuntime: Boolean = false
var includeRuntime: Boolean = true
var moduleName: String? = null
var noReflect: Boolean = false
private val cmdl = CommandlineJava()
var fork: Boolean = false
private var compileClasspath: Path? = null
fun setClasspath(classpath: Path) {
@@ -79,47 +73,4 @@ class Kotlin2JvmTask : KotlinCompilerBaseTask() {
if (noReflect) args.add("-no-reflect")
if (includeRuntime) args.add("-include-runtime")
}
override fun execute() {
if (!fork)
super.execute()
else {
exec()
}
}
private fun exec() {
val javaHome = System.getProperty("java.home")
val javaBin = javaHome + separator + "bin" + separator + "java"
val redirector = Redirector(this)
fillArguments()
val command = ArrayList<String>()
command.add(javaBin)
command.addAll(cmdl.vmCommand.arguments) // jvm args
command.add("-Dorg.jetbrains.kotlin.cliMessageRenderer=FullPath") // same MessageRenderer as non-forking mode
command.add("-cp")
command.add(KotlinAntTaskUtil.compilerJar.canonicalPath)
command.add(compilerFqName)
command.addAll(args) // compiler args
// streamHandler: used to handle the input and output streams of the subprocess.
// watchdog: a watchdog for the subprocess or <code>null</code> to disable a timeout for the subprocess.
// TODO: support timeout for the subprocess
val exe = Execute(redirector.createHandler(), null)
exe.setAntRun(getProject())
exe.commandline = command.toTypedArray()
log("Executing command: ${command.joinToString(" ")}", LogLevel.DEBUG.level)
log("Compiling ${src!!.list().toList()} => [${output!!.canonicalPath}]")
val exitCode = exe.execute()
redirector.complete()
if (failOnError && exitCode != 0) {
throw BuildException("Compile failed; see the compiler error output for details.")
}
}
fun createJvmarg(): Commandline.Argument {
return cmdl.createVmArgument()
}
}

View File

@@ -80,7 +80,7 @@ abstract class KotlinCompilerBaseTask : Task() {
fillSpecificArguments()
}
override fun execute() {
final override fun execute() {
fillArguments()
val compilerClass = KotlinAntTaskUtil.getOrCreateClassLoader().loadClass(compilerFqName)

View File

@@ -1,23 +1,53 @@
import kotlinx.benchmark.gradle.benchmark
val benchmarks_version = "0.3.0"
val benchmarks_version = "0.2.0-dev-7"
buildscript {
val benchmarks_version = "0.2.0-dev-7"
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
dependencies {
classpath("org.jetbrains.kotlinx:kotlinx.benchmark.gradle:$benchmarks_version")
}
}
apply(plugin = "kotlinx.benchmark")
plugins {
java
kotlin("jvm")
id("org.jetbrains.kotlinx.benchmark") version "0.3.0"
}
repositories {
val cacheRedirectorEnabled = findProperty("cacheRedirectorEnabled")?.toString()?.toBoolean() == true
if (cacheRedirectorEnabled) {
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlinx")
maven("https://cache-redirector.jetbrains.com/dl.bintray.com/kotlin/kotlin-dev")
} else {
maven("https://dl.bintray.com/kotlin/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-dev")
}
}
dependencies {
compile(kotlinStdlib())
compile(project(":compiler:frontend"))
compile(projectTests(":compiler:tests-common"))
compile(project(":compiler:cli"))
compile(intellijCoreDep()) { includeJars("intellij-core") }
compile(jpsStandalone()) { includeJars("jps-model") }
compile(intellijPluginDep("java"))
Platform[192].orHigher {
compile(intellijPluginDep("java"))
}
compile(intellijDep()) { includeIntellijCoreJarDependencies(project) }
compile("org.jetbrains.kotlinx:kotlinx-benchmark-runtime:$benchmarks_version")
compile("org.jetbrains.kotlinx:kotlinx.benchmark.runtime-jvm:$benchmarks_version")
}
sourceSets {
@@ -43,7 +73,6 @@ benchmark {
param("size", 1000)
include("CommonCallsBenchmark")
include("ControlFlowAnalysisBenchmark")
//include("InferenceBaselineCallsBenchmark")
}
@@ -66,50 +95,3 @@ benchmark {
register("main")
}
}
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.register<JavaExec>("runBenchmark") {
// jmhArgs example: -PjmhArgs='CommonCalls -p size=500 -p isIR=true -p useNI=true -f 1'
val jmhArgs = if (project.hasProperty("jmhArgs")) project.property("jmhArgs").toString() else ""
val resultFilePath = "$buildDir/benchmarks/jmh-result.json"
val ideaHome = intellijRootDir().canonicalPath
val benchmarkJarPath = "$buildDir/benchmarks/main/jars/benchmarks.jar"
args = mutableListOf("-Didea.home.path=$ideaHome", benchmarkJarPath, "-rf", "json", "-rff", resultFilePath) + jmhArgs.split("\\s".toRegex())
main = "-jar"
doLast {
if (project.kotlinBuildProperties.isTeamcityBuild) {
val jsonArray = com.google.gson.JsonParser.parseString(File(resultFilePath).readText()).asJsonArray
jsonArray.forEach {
val benchmark = it.asJsonObject
// remove unnecessary name parts from string like this "org.jetbrains.kotlin.benchmarks.CommonCallsBenchmark.benchmark"
val name = benchmark["benchmark"].asString.removeSuffix(".benchmark").let {
val indexOfLastDot = it.indexOfLast { it == '.' }
it.removeRange(0..indexOfLastDot)
}
val params = benchmark["params"].asJsonObject
val isIR = if (params.has("isIR")) params["isIR"].asString else "false"
val useNI = if (params.has("useNI")) params["useNI"].asString else "false"
val size = params["size"].asString
val score = "%.3f".format(benchmark["primaryMetric"].asJsonObject["score"].asString.toFloat())
val irPostfix = if (isIR.toBoolean()) " isIR=true" else ""
val niPostfix = if (useNI.toBoolean() && !isIR.toBoolean()) " isNI=true" else ""
println("""##teamcity[buildStatisticValue key='$name size=$size${irPostfix}$niPostfix' value='$score']""")
}
}
}
}

View File

@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.benchmarks
import com.intellij.openapi.Disposable
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.CharsetToolkit
import com.intellij.psi.PsiElementFinder
@@ -12,6 +13,7 @@ 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.analyzer.ModuleInfo
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.builtins.jvm.JvmBuiltIns
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
@@ -24,15 +26,21 @@ 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.FirSession
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
import org.jetbrains.kotlin.fir.createSessionForTests
import org.jetbrains.kotlin.fir.java.FirJavaElementFinder
import org.jetbrains.kotlin.fir.java.FirJavaModuleBasedSession
import org.jetbrains.kotlin.fir.java.FirLibrarySession
import org.jetbrains.kotlin.fir.java.FirProjectSessionProvider
import org.jetbrains.kotlin.fir.resolve.firProvider
import org.jetbrains.kotlin.fir.resolve.providers.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveProcessor
import org.jetbrains.kotlin.fir.resolve.impl.FirProviderImpl
import org.jetbrains.kotlin.fir.resolve.transformers.FirTotalResolveTransformer
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.resolve.jvm.platform.JvmPlatformAnalyzerServices
import org.jetbrains.kotlin.storage.ExceptionTracker
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.storage.StorageManager
@@ -58,10 +66,10 @@ private val JDK_PATH = File("${System.getProperty("java.home")!!}/lib/rt.jar")
private val RUNTIME_JAR = File(System.getProperty("kotlin.runtime.path") ?: "dist/kotlinc/lib/kotlin-runtime.jar")
private val LANGUAGE_FEATURE_SETTINGS =
LanguageVersionSettingsImpl(
LanguageVersion.KOTLIN_1_3, ApiVersion.KOTLIN_1_3,
specificFeatures = mapOf(LanguageFeature.NewInference to LanguageFeature.State.ENABLED)
)
LanguageVersionSettingsImpl(
LanguageVersion.KOTLIN_1_3, ApiVersion.KOTLIN_1_3,
specificFeatures = mapOf(LanguageFeature.NewInference to LanguageFeature.State.ENABLED)
)
private fun newConfiguration(useNewInference: Boolean): CompilerConfiguration {
val configuration = CompilerConfiguration()
@@ -73,10 +81,10 @@ private fun newConfiguration(useNewInference: Boolean): CompilerConfiguration {
val newInferenceState = if (useNewInference) LanguageFeature.State.ENABLED else LanguageFeature.State.DISABLED
configuration.languageVersionSettings = LanguageVersionSettingsImpl(
LanguageVersion.KOTLIN_1_3, ApiVersion.KOTLIN_1_3,
specificFeatures = mapOf(
LanguageFeature.NewInference to newInferenceState
)
LanguageVersion.KOTLIN_1_3, ApiVersion.KOTLIN_1_3,
specificFeatures = mapOf(
LanguageFeature.NewInference to newInferenceState
)
)
return configuration
}
@@ -97,19 +105,21 @@ abstract class AbstractSimpleFileBenchmark {
fun setUp() {
if (isIR && !useNewInference) error("Invalid configuration")
env = KotlinCoreEnvironment.createForTests(
myDisposable,
newConfiguration(useNewInference),
EnvironmentConfigFiles.JVM_CONFIG_FILES
myDisposable,
newConfiguration(useNewInference),
EnvironmentConfigFiles.JVM_CONFIG_FILES
)
if (isIR) {
PsiElementFinder.EP.getPoint(env.project).unregisterExtension(JavaElementFinder::class.java)
Extensions.getArea(env.project)
.getExtensionPoint(PsiElementFinder.EP_NAME)
.unregisterExtension(JavaElementFinder::class.java)
}
file = createFile(
"test.kt",
buildText(),
env.project
"test.kt",
buildText(),
env.project
)
}
@@ -124,22 +134,22 @@ abstract class AbstractSimpleFileBenchmark {
private fun analyzeGreenFileFrontend(bh: Blackhole) {
val tracker = ExceptionTracker()
val storageManager: StorageManager =
LockBasedStorageManager.createWithExceptionHandling("benchmarks", tracker)
LockBasedStorageManager.createWithExceptionHandling("benchmarks", tracker)
val context = SimpleGlobalContext(storageManager, tracker)
val module =
ModuleDescriptorImpl(
Name.special("<benchmark>"), storageManager,
JvmBuiltIns(storageManager, JvmBuiltIns.Kind.FROM_DEPENDENCIES)
)
ModuleDescriptorImpl(
Name.special("<benchmark>"), storageManager,
JvmBuiltIns(storageManager, JvmBuiltIns.Kind.FROM_DEPENDENCIES)
)
val moduleContext = context.withProject(env.project).withModule(module)
val result = TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
moduleContext.project,
listOf(file),
NoScopeRecordCliBindingTrace(),
env.configuration,
{ scope -> JvmPackagePartProvider(LANGUAGE_FEATURE_SETTINGS, scope) }
moduleContext.project,
listOf(file),
NoScopeRecordCliBindingTrace(),
env.configuration,
{ scope -> JvmPackagePartProvider(LANGUAGE_FEATURE_SETTINGS, scope) }
)
assert(result.bindingContext.diagnostics.none { it.severity == Severity.ERROR })
@@ -149,21 +159,56 @@ abstract class AbstractSimpleFileBenchmark {
private fun analyzeGreenFileIr(bh: Blackhole) {
val scope = GlobalSearchScope.filesScope(env.project, listOf(file.virtualFile))
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSessionForTests(env, scope)
.uniteWith(TopDownAnalyzerFacadeForJVM.AllJavaSourcesInProjectScope(env.project))
val session = createSession(env, scope)
val firProvider = session.firProvider as FirProviderImpl
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider)
val builder = RawFirBuilder(session, firProvider.kotlinScopeProvider, stubMode = false)
val totalTransformer = FirTotalResolveProcessor(session)
val totalTransformer = FirTotalResolveTransformer()
val firFile = builder.buildFirFile(file).also(firProvider::recordFile)
totalTransformer.process(listOf(firFile))
for (transformer in totalTransformer.transformers) {
transformer.transformFile(firFile, null)
}
bh.consume(firFile.hashCode())
env.project.extensionArea
.getExtensionPoint<PsiElementFinder>(PsiElementFinder.EP.name)
.unregisterExtension(FirJavaElementFinder::class.java)
}
protected abstract fun buildText(): String
}
fun createSession(
environment: KotlinCoreEnvironment,
sourceScope: GlobalSearchScope,
librariesScope: GlobalSearchScope = GlobalSearchScope.notScope(sourceScope)
): FirSession {
val moduleInfo = FirTestModuleInfo()
val project = environment.project
val provider = FirProjectSessionProvider(project)
return FirJavaModuleBasedSession(moduleInfo, provider, sourceScope).also {
createSessionForDependencies(provider, moduleInfo, librariesScope, environment)
}
}
private fun createSessionForDependencies(
provider: FirProjectSessionProvider,
moduleInfo: FirTestModuleInfo,
librariesScope: GlobalSearchScope,
environment: KotlinCoreEnvironment
) {
val dependenciesInfo = FirTestModuleInfo()
moduleInfo.dependencies.add(dependenciesInfo)
FirLibrarySession.create(
dependenciesInfo, provider, librariesScope, environment.project,
environment.createPackagePartProvider(librariesScope)
)
}
class FirTestModuleInfo(
override val name: Name = Name.identifier("TestModule"),
val dependencies: MutableList<ModuleInfo> = mutableListOf(),
override val platform: TargetPlatform = JvmPlatforms.unspecifiedJvmPlatform,
override val analyzerServices: PlatformDependentAnalyzerServices = JvmPlatformAnalyzerServices
) : ModuleInfo {
override fun dependencies(): List<ModuleInfo> = dependencies
}

View File

@@ -1,35 +0,0 @@
/*
* 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.benchmarks
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.Blackhole
import java.util.concurrent.TimeUnit
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
open class ControlFlowAnalysisBenchmark : AbstractSimpleFileBenchmark() {
@Param("1000")
private var size: Int = 0
@Benchmark
fun benchmark(bh: Blackhole) {
analyzeGreenFile(bh)
}
override fun buildText() =
buildString {
appendLine("fun test() {")
for (i in 0 until size) {
appendLine("for (i$i in 0..10) { ")
}
for (i in 0 until size) {
appendLine("}")
}
appendLine("}")
}
}

View File

@@ -23,28 +23,28 @@ open class ManyImplicitReceiversBenchmark : AbstractSimpleFileBenchmark() {
override fun buildText(): String {
return buildString {
appendLine("inline fun <T, R> with(receiver: T, block: T.() -> R): R = block()")
appendln("inline fun <T, R> with(receiver: T, block: T.() -> R): R = block()")
for (i in 1..size) {
appendLine("interface A$i {")
appendLine(" fun foo$i()")
appendLine("}")
appendLine()
appendln("interface A$i {")
appendln(" fun foo$i()")
appendln("}")
appendln()
}
appendLine()
appendln()
append("fun test(")
append((1..size).joinToString(", ") { "a$it: A$it" })
appendLine(" {")
appendln(" {")
for (i in 1..size) {
appendLine("with(a$i) {")
appendln("with(a$i) {")
}
for (i in 1..size) {
appendLine("foo$i()")
appendln("foo$i()")
}
for (i in 1..size) {
appendLine("}")
appendln("}")
}
appendLine("}")
appendln("}")
}
}
}

View File

@@ -22,7 +22,7 @@ open class PlusAssignOperatorDesugaringBenchmark : AbstractInferenceBenchmark()
}
override fun buildText(): String = buildString {
appendLine(
appendln(
"""
class A {
operator fun <T : Number> plus(other: (Int) -> T): A = this
@@ -30,20 +30,19 @@ open class PlusAssignOperatorDesugaringBenchmark : AbstractInferenceBenchmark()
}
""".trimIndent()
)
appendLine("fun test() {")
appendLine("var a = A()")
appendln("fun test() {")
appendln("var a = A()")
for (i in 1..size) {
appendLine("a += {")
appendln("a += {")
}
for (i in 1..size) {
appendLine(
appendln(
"""
it.inc()
1
}
""".trimIndent()
)
""".trimIndent())
}
appendLine()
appendln()
}
}

View File

@@ -7,7 +7,6 @@ plugins {
dependencies {
compileOnly(project(":core:util.runtime"))
compileOnly(project(":compiler:backend.common.jvm"))
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:cli-common"))
compileOnly(project(":compiler:frontend.java"))

File diff suppressed because it is too large Load Diff

View File

@@ -17,6 +17,9 @@ interface BuildMetaInfo {
val compilerBuildVersion: String
val languageVersionString: String
val apiVersionString: String
val coroutinesEnable: Boolean
val coroutinesWarn: Boolean
val coroutinesError: Boolean
val multiplatformEnable: Boolean
val metadataVersionMajor: Int
val metadataVersionMinor: Int
@@ -32,6 +35,9 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -47,6 +53,9 @@ abstract class BuildMetaInfoFactory<T : BuildMetaInfo>(private val metaInfoClass
compilerBuildVersion = KotlinCompilerVersion.VERSION,
languageVersionString = languageVersion.versionString,
apiVersionString = args.apiVersion ?: languageVersion.versionString,
coroutinesEnable = args.coroutinesState == CommonCompilerArguments.ENABLE,
coroutinesWarn = args.coroutinesState == CommonCompilerArguments.WARN,
coroutinesError = args.coroutinesState == CommonCompilerArguments.ERROR,
multiplatformEnable = args.multiPlatform,
ownVersion = OWN_VERSION,
coroutinesVersion = COROUTINES_VERSION,

View File

@@ -15,6 +15,9 @@ data class CommonBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -29,6 +32,9 @@ data class CommonBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -41,6 +47,9 @@ data class CommonBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -1,12 +0,0 @@
/*
* 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.build
import java.io.Serializable
enum class ExecutionStrategy : Serializable {
DAEMON, IN_PROCESS, OUT_OF_PROCESS
}

View File

@@ -15,6 +15,9 @@ data class JsBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -29,6 +32,9 @@ data class JsBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -41,6 +47,9 @@ data class JsBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**
@@ -27,6 +27,9 @@ data class JvmBuildMetaInfo(
override val compilerBuildVersion: String,
override val languageVersionString: String,
override val apiVersionString: String,
override val coroutinesEnable: Boolean,
override val coroutinesWarn: Boolean,
override val coroutinesError: Boolean,
override val multiplatformEnable: Boolean,
override val metadataVersionMajor: Int,
override val metadataVersionMinor: Int,
@@ -44,6 +47,9 @@ data class JvmBuildMetaInfo(
compilerBuildVersion: String,
languageVersionString: String,
apiVersionString: String,
coroutinesEnable: Boolean,
coroutinesWarn: Boolean,
coroutinesError: Boolean,
multiplatformEnable: Boolean,
ownVersion: Int,
coroutinesVersion: Int,
@@ -56,6 +62,9 @@ data class JvmBuildMetaInfo(
compilerBuildVersion = compilerBuildVersion,
languageVersionString = languageVersionString,
apiVersionString = apiVersionString,
coroutinesEnable = coroutinesEnable,
coroutinesWarn = coroutinesWarn,
coroutinesError = coroutinesError,
multiplatformEnable = multiplatformEnable,
metadataVersionMajor = metadataVersion.major,
metadataVersionMinor = metadataVersion.minor,

View File

@@ -26,13 +26,11 @@ 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"

View File

@@ -1,24 +0,0 @@
/*
* 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.build.report
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
import org.jetbrains.kotlin.build.report.metrics.RemoteBuildMetricsReporter
open class BuildReporter(
protected open val icReporter: ICReporter,
protected open val buildMetricsReporter: BuildMetricsReporter
) : ICReporter by icReporter, BuildMetricsReporter by buildMetricsReporter
class RemoteBuildReporter(
override val icReporter: RemoteICReporter,
override val buildMetricsReporter: RemoteBuildMetricsReporter
) : BuildReporter(icReporter, buildMetricsReporter), RemoteReporter {
override fun flush() {
icReporter.flush()
buildMetricsReporter.flush()
}
}

View File

@@ -1,9 +0,0 @@
/*
* 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.build.report
interface RemoteICReporter : ICReporter,
RemoteReporter

View File

@@ -1,11 +0,0 @@
/*
* 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.build.report
interface RemoteReporter {
fun flush()
}

View File

@@ -1,37 +0,0 @@
/*
* 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.build.report.metrics
import java.io.Serializable
enum class BuildAttributeKind : Serializable {
REBUILD_REASON;
companion object {
const val serialVersionUID = 0L
}
}
enum class BuildAttribute(val kind: BuildAttributeKind) : Serializable {
NO_BUILD_HISTORY(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),
JAVA_CHANGE_UNEXPECTED_PSI(BuildAttributeKind.REBUILD_REASON),
JAVA_CHANGE_UNKNOWN_QUALIFIER(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_REMOVED_ENTRY(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_IS_NOT_FOUND(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_CANNOT_BE_READ(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_HISTORY_NO_KNOWN_BUILDS(BuildAttributeKind.REBUILD_REASON),
DEP_CHANGE_NON_INCREMENTAL_BUILD_IN_DEP(BuildAttributeKind.REBUILD_REASON),
IN_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
OUT_OF_PROCESS_EXECUTION(BuildAttributeKind.REBUILD_REASON),
IC_IS_NOT_ENABLED(BuildAttributeKind.REBUILD_REASON);
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,30 +0,0 @@
/*
* 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.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildAttributes : Serializable {
private val myAttributes =
EnumMap<BuildAttribute, Int>(
BuildAttribute::class.java
)
fun add(attr: BuildAttribute, count: Int = 1) {
myAttributes[attr] = myAttributes.getOrDefault(attr, 0) + count
}
fun addAll(other: BuildAttributes) {
other.myAttributes.forEach { (attr, n) -> add(attr, n) }
}
fun asMap(): Map<BuildAttribute, Int> = myAttributes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,22 +0,0 @@
/*
* 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.build.report.metrics
import java.io.Serializable
data class BuildMetrics(
val buildTimes: BuildTimes = BuildTimes(),
val buildAttributes: BuildAttributes = BuildAttributes()
) : Serializable {
fun addAll(other: BuildMetrics) {
buildTimes.addAll(other.buildTimes)
buildAttributes.addAll(other.buildAttributes)
}
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,28 +0,0 @@
/*
* 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.build.report.metrics
interface BuildMetricsReporter {
fun startMeasure(metric: BuildTime, startNs: Long)
fun endMeasure(metric: BuildTime, endNs: Long)
fun addAttribute(attribute: BuildAttribute)
fun getMetrics(): BuildMetrics
fun addMetrics(metrics: BuildMetrics?)
}
inline fun <T> BuildMetricsReporter.measure(metric: BuildTime, fn: () -> T): T {
val start = System.nanoTime()
startMeasure(metric, start)
try {
return fn()
} finally {
val end = System.nanoTime()
endMeasure(metric, end)
}
}

View File

@@ -1,47 +0,0 @@
/*
* 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.build.report.metrics
import java.util.*
class BuildMetricsReporterImpl : BuildMetricsReporter {
private val myBuildTimeStartNs: EnumMap<BuildTime, Long> =
EnumMap(
BuildTime::class.java
)
private val myBuildTimes = BuildTimes()
private val myBuildAttributes = BuildAttributes()
override fun startMeasure(metric: BuildTime, startNs: Long) {
if (metric in myBuildTimeStartNs) {
error("$metric was restarted before it finished")
}
myBuildTimeStartNs[metric] = startNs
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
val startNs = myBuildTimeStartNs.remove(metric) ?: error("$metric finished before it started")
val durationNs = endNs - startNs
myBuildTimes.add(metric, durationNs)
}
override fun addAttribute(attribute: BuildAttribute) {
myBuildAttributes.add(attribute)
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
buildTimes = myBuildTimes,
buildAttributes = myBuildAttributes
)
override fun addMetrics(metrics: BuildMetrics?) {
if (metrics == null) return
myBuildAttributes.addAll(metrics.buildAttributes)
myBuildTimes.addAll(metrics.buildTimes)
}
}

View File

@@ -1,43 +0,0 @@
/*
* 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.build.report.metrics
import java.io.Serializable
@Suppress("Reformat")
enum class BuildTime(val parent: BuildTime? = null) : Serializable {
GRADLE_TASK,
CLEAR_OUTPUT(GRADLE_TASK),
BACKUP_OUTPUT(GRADLE_TASK),
RESTORE_OUTPUT_FROM_BACKUP(GRADLE_TASK),
CONNECT_TO_DAEMON(GRADLE_TASK),
CLEAR_JAR_CACHE(GRADLE_TASK),
RUN_COMPILER(GRADLE_TASK),
NON_INCREMENTAL_COMPILATION_IN_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_OUT_OF_PROCESS(RUN_COMPILER),
NON_INCREMENTAL_COMPILATION_DAEMON(RUN_COMPILER),
INCREMENTAL_COMPILATION(RUN_COMPILER),
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),
IC_ANALYZE_HISTORY_FILES(IC_ANALYZE_CHANGES_IN_DEPENDENCIES),
IC_ANALYZE_CHANGES_IN_JAVA_SOURCES(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_ANALYZE_CHANGES_IN_ANDROID_LAYOUTS(IC_CALCULATE_INITIAL_DIRTY_SET),
IC_DETECT_REMOVED_CLASSES(IC_CALCULATE_INITIAL_DIRTY_SET),
CLEAR_OUTPUT_ON_REBUILD(INCREMENTAL_COMPILATION),
IC_UPDATE_CACHES(INCREMENTAL_COMPILATION),
INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
NON_INCREMENTAL_ITERATION(INCREMENTAL_COMPILATION),
IC_WRITE_HISTORY_FILE(INCREMENTAL_COMPILATION);
companion object {
const val serialVersionUID = 0L
val children by lazy {
values().filter { it.parent != null }.groupBy { it.parent }
}
}
}

View File

@@ -1,29 +0,0 @@
/*
* 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.build.report.metrics
import java.io.Serializable
import java.util.*
class BuildTimes : Serializable {
private val myBuildTimes = EnumMap<BuildTime, Long>(BuildTime::class.java)
fun addAll(other: BuildTimes) {
for ((bt, timeNs) in other.myBuildTimes) {
add(bt, timeNs)
}
}
fun add(buildTime: BuildTime, timeNs: Long) {
myBuildTimes[buildTime] = myBuildTimes.getOrDefault(buildTime, 0) + timeNs
}
fun asMap(): Map<BuildTime, Long> = myBuildTimes
companion object {
const val serialVersionUID = 0L
}
}

View File

@@ -1,25 +0,0 @@
/*
* 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.build.report.metrics
object DoNothingBuildMetricsReporter : BuildMetricsReporter {
override fun startMeasure(metric: BuildTime, startNs: Long) {
}
override fun endMeasure(metric: BuildTime, endNs: Long) {
}
override fun addAttribute(attribute: BuildAttribute) {
}
override fun getMetrics(): BuildMetrics =
BuildMetrics(
BuildTimes(),
BuildAttributes()
)
override fun addMetrics(metrics: BuildMetrics?) {}
}

View File

@@ -1,11 +0,0 @@
/*
* 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.build.report.metrics
import org.jetbrains.kotlin.build.report.RemoteReporter
interface RemoteBuildMetricsReporter : BuildMetricsReporter,
RemoteReporter

View File

@@ -29,43 +29,21 @@ import org.jetbrains.kotlin.cli.common.arguments.Argument;
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments;
import org.jetbrains.kotlin.cli.common.arguments.InternalArgument;
import org.jetbrains.kotlin.cli.common.arguments.ParseCommandLineArgumentsKt;
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutor;
import org.jetbrains.kotlin.idea.ExplicitDefaultSubstitutorsKt;
import org.jetbrains.kotlin.utils.StringsKt;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
public class ArgumentUtils {
private ArgumentUtils() {
}
private ArgumentUtils() {}
@NotNull
public static List<String> convertArgumentsToStringList(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<String> convertedArguments = convertArgumentsToStringListInternal(arguments);
Map<KClass<? extends CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> defaultSubstitutorsMap =
ExplicitDefaultSubstitutorsKt.getDefaultSubstitutors();
KClass<? extends CommonToolArguments> argumentsKClass = JvmClassMappingKt.getKotlinClass(arguments.getClass());
Collection<ExplicitDefaultSubstitutor> defaultSubstitutors = defaultSubstitutorsMap.get(argumentsKClass);
if (defaultSubstitutors != null) {
for (ExplicitDefaultSubstitutor substitutor : defaultSubstitutors) {
if (substitutor.isSubstitutable(convertedArguments)) convertedArguments.addAll(substitutor.getNewSubstitution());
}
}
return convertedArguments;
}
@NotNull
public static List<String> convertArgumentsToStringListNoDefaults(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
return convertArgumentsToStringListInternal(arguments);
}
private static List<String> convertArgumentsToStringListInternal(@NotNull CommonToolArguments arguments)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<String> result = new ArrayList<>();
Class<? extends CommonToolArguments> argumentsClass = arguments.getClass();
convertArgumentsToStringList(arguments, argumentsClass.newInstance(), JvmClassMappingKt.getKotlinClass(argumentsClass), result);

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.compilerRunner
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSourceLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.common.messages.OutputMessageUtil
@@ -25,7 +25,7 @@ class MessageCollectorToOutputItemsCollectorAdapter(
private val delegate: MessageCollector,
private val outputCollector: OutputItemsCollector
) : MessageCollector by delegate {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageLocation?) {
// TODO: consider adding some other way of passing input -> output mapping from compiler, e.g. dedicated service
OutputMessageUtil.parseOutputMessage(message)?.let {
outputCollector.add(it.sourceFiles, it.outputFile)

View File

@@ -1,46 +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.idea
import org.jetbrains.kotlin.cli.common.arguments.Argument
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.config.JvmTarget
import kotlin.reflect.KClass
import kotlin.reflect.KProperty1
import kotlin.reflect.full.findAnnotation
val defaultSubstitutors: Map<KClass<out CommonToolArguments>, Collection<ExplicitDefaultSubstitutor>> =
mapOf(K2JVMCompilerArguments::class to listOf(JvmTargetDefaultSubstitutor))
sealed class ExplicitDefaultSubstitutor {
abstract val substitutedProperty: KProperty1<out CommonToolArguments, String?>
abstract val oldSubstitution: List<String>
abstract val newSubstitution: List<String>
abstract fun isSubstitutable(args: List<String>): Boolean
protected val argument: Argument by lazy {
substitutedProperty.findAnnotation() ?: error("Property \"${substitutedProperty.name}\" has no Argument annotation")
}
}
object JvmTargetDefaultSubstitutor : ExplicitDefaultSubstitutor() {
override val substitutedProperty
get() = K2JVMCompilerArguments::jvmTarget
private val oldDefault: String
get() = JvmTarget.JVM_1_6.description
private val newDefault: String
get() = JvmTarget.JVM_1_8.description
private fun prepareSubstitution(default: String): List<String> = listOf(argument.value, default)
override val oldSubstitution: List<String>
get() = prepareSubstitution(oldDefault)
override val newSubstitution: List<String>
get() = prepareSubstitution(newDefault)
override fun isSubstitutable(args: List<String>): Boolean = argument.value !in args
}

View File

@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.incremental
import com.intellij.util.io.EnumeratorStringDescriptor
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.TypeTable
import org.jetbrains.kotlin.metadata.deserialization.supertypes
@@ -35,15 +34,12 @@ interface IncrementalCacheCommon {
val thisWithDependentCaches: Iterable<AbstractIncrementalCache<*>>
fun classesFqNamesBySources(files: Iterable<File>): Collection<FqName>
fun getSubtypesOf(className: FqName): Sequence<FqName>
fun getSupertypesOf(className: FqName): Sequence<FqName>
fun getSourceFileIfClass(fqName: FqName): File?
fun markDirty(removedAndCompiledSources: Collection<File>)
fun clearCacheForRemovedClasses(changesCollector: ChangesCollector)
fun getComplementaryFilesRecursive(dirtyFiles: Collection<File>): Collection<File>
fun updateComplementaryFiles(dirtyFiles: Collection<File>, expectActualTracker: ExpectActualTrackerImpl)
fun dump(): String
fun isSealed(className: FqName): Boolean?
}
/**
@@ -54,7 +50,6 @@ abstract class AbstractIncrementalCache<ClassName>(
protected val pathConverter: FileToPathConverter
) : BasicMapsOwner(workingDir), IncrementalCacheCommon {
companion object {
private val CLASS_ATTRIBUTES = "class-attributes"
private val SUBTYPES = "subtypes"
private val SUPERTYPES = "supertypes"
private val CLASS_FQ_NAME_TO_SOURCE = "class-fq-name-to-source"
@@ -76,7 +71,6 @@ abstract class AbstractIncrementalCache<ClassName>(
result
}
internal val classAttributesMap = registerMap(ClassAttributesMap(CLASS_ATTRIBUTES.storageFile))
private val subtypesMap = registerMap(SubtypesMap(SUBTYPES.storageFile))
private val supertypesMap = registerMap(SupertypesMap(SUPERTYPES.storageFile))
protected val classFqNameToSourceMap = registerMap(ClassFqNameToSourceMap(CLASS_FQ_NAME_TO_SOURCE.storageFile, pathConverter))
@@ -96,14 +90,6 @@ abstract class AbstractIncrementalCache<ClassName>(
override fun getSubtypesOf(className: FqName): Sequence<FqName> =
subtypesMap[className].asSequence()
override fun getSupertypesOf(className: FqName): Sequence<FqName> {
return supertypesMap[className].asSequence()
}
override fun isSealed(className: FqName): Boolean? {
return classAttributesMap[className]?.isSealed
}
override fun getSourceFileIfClass(fqName: FqName): File? =
classFqNameToSourceMap[fqName]
@@ -132,7 +118,6 @@ abstract class AbstractIncrementalCache<ClassName>(
supertypesMap[child] = parents
classFqNameToSourceMap[child] = srcFile
classAttributesMap[child] = ICClassesAttributes(ProtoBuf.Modality.SEALED == Flags.MODALITY.get(proto.flags))
}
protected fun removeAllFromClassStorage(removedClasses: Collection<FqName>, changesCollector: ChangesCollector) {
@@ -167,17 +152,14 @@ abstract class AbstractIncrementalCache<ClassName>(
}
}
removedFqNames.forEach {
classFqNameToSourceMap.remove(it)
classAttributesMap.remove(it)
}
removedFqNames.forEach { classFqNameToSourceMap.remove(it) }
}
protected class ClassFqNameToSourceMap(
storageFile: File,
private val pathConverter: FileToPathConverter
) : BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor(), PathStringDescriptor) {
operator fun set(fqName: FqName, sourceFile: File) {
storage[fqName.asString()] = pathConverter.toPath(sourceFile)
}

View File

@@ -19,14 +19,12 @@ package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.Flags
import org.jetbrains.kotlin.metadata.deserialization.NameResolver
import org.jetbrains.kotlin.metadata.deserialization.supertypes
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.getClassId
class ChangesCollector {
private val removedMembers = hashMapOf<FqName, MutableSet<String>>()
private val changedParents = hashMapOf<FqName, MutableSet<FqName>>()
private val changedMembers = hashMapOf<FqName, MutableSet<String>>()
private val areSubclassesAffected = hashMapOf<FqName, Boolean>()
@@ -49,10 +47,6 @@ class ChangesCollector {
changes.add(ChangeInfo.SignatureChanged(fqName, areSubclassesAffected))
}
for ((fqName, changedParents) in changedParents) {
changes.add(ChangeInfo.ParentsChanged(fqName, changedParents))
}
return changes
}
@@ -85,12 +79,12 @@ class ChangesCollector {
}
if (oldData == null) {
newData!!.collectAll(isRemoved = false, isAdded = true, collectAllMembersForNewClass = collectAllMembersForNewClass)
newData!!.collectAll(isRemoved = false, collectAllMembersForNewClass = collectAllMembersForNewClass)
return
}
if (newData == null) {
oldData.collectAll(isRemoved = true, isAdded = false)
oldData.collectAll(isRemoved = true)
return
}
@@ -104,7 +98,6 @@ class ChangesCollector {
collectSignature(oldData, diff.areSubclassesAffected)
}
collectChangedMembers(fqName, diff.changedMembersNames)
addChangedParents(fqName, diff.changedSupertypes)
}
is PackagePartProtoData -> {
collectSignature(oldData, areSubclassesAffected = true)
@@ -128,11 +121,10 @@ class ChangesCollector {
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) =
private fun ProtoData.collectAll(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) =
when (this) {
is PackagePartProtoData -> collectAllFromPackage(isRemoved)
is ClassProtoData -> collectAllFromClass(isRemoved, isAdded, collectAllMembersForNewClass)
is ClassProtoData -> collectAllFromClass(isRemoved, collectAllMembersForNewClass)
}
private fun PackagePartProtoData.collectAllFromPackage(isRemoved: Boolean) {
@@ -151,7 +143,7 @@ class ChangesCollector {
}
}
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, isAdded: Boolean, collectAllMembersForNewClass: Boolean = false) {
private fun ClassProtoData.collectAllFromClass(isRemoved: Boolean, collectAllMembersForNewClass: Boolean = false) {
val classFqName = nameResolver.getClassId(proto.fqName).asSingleFqName()
val kind = Flags.CLASS_KIND.get(proto.flags)
@@ -170,23 +162,6 @@ class ChangesCollector {
collectSignature(classFqName, areSubclassesAffected = true)
}
if (isRemoved || isAdded) {
collectChangedParents(classFqName, proto.supertypeList)
}
}
private fun addChangedParents(fqName: FqName, parents: Collection<FqName>) {
if (parents.isNotEmpty()) {
changedParents.getOrPut(fqName) { HashSet() }.addAll(parents)
}
}
private fun ClassProtoData.collectChangedParents(fqName: FqName, parents: Collection<ProtoBuf.Type>) {
val changedParentsFqNames = parents.map { type ->
nameResolver.getClassId(type.className).asSingleFqName()
}
addChangedParents(fqName, changedParentsFqNames)
}
private fun ClassProtoData.getNonPrivateMemberNames(): Set<String> {

View File

@@ -3,7 +3,7 @@
* 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.build.report
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.cli.common.ExitCode
import java.io.File
@@ -17,5 +17,3 @@ interface ICReporter {
fun reportMarkDirtyMember(affectedFiles: Iterable<File>, scope: String, name: String)
fun reportMarkDirty(affectedFiles: Iterable<File>, reason: String)
}

View File

@@ -1,9 +1,9 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2019 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.build.report
package org.jetbrains.kotlin.incremental
import java.io.File

View File

@@ -32,7 +32,6 @@ import org.jetbrains.kotlin.name.parentOrNull
import org.jetbrains.kotlin.serialization.SerializerExtensionProtocol
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import org.jetbrains.kotlin.serialization.js.JsSerializerProtocol
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
import java.io.DataInput
import java.io.DataOutput
import java.io.File
@@ -76,7 +75,7 @@ open class IncrementalJsCache(
override fun markDirty(removedAndCompiledSources: Collection<File>) {
removedAndCompiledSources.forEach { sourceFile ->
// The common prefix of all FQN parents has to be the file package
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minByOrNull { it.length }?.let {
sourceToClassesMap[sourceFile].map { it.parentOrNull()?.asString() ?: "" }.minBy { it.length }?.let {
packageMetadata.remove(it)
}
}
@@ -327,7 +326,7 @@ private class ProtoDataProvider(private val serializerProtocol: SerializerExtens
proto.`package`.apply {
val packageNameId = getExtensionOrNull(serializerProtocol.packageFqName)
val packageFqName = packageNameId?.let { FqName(nameResolver.getPackageFqName(it)) } ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -348,7 +347,7 @@ fun getProtoData(sourceFile: File, metadata: ByteArray): Map<ClassId, ProtoData>
proto.`package`.apply {
val packageFqName = getExtensionOrNull(JsProtoBuf.packageFqName)?.let(nameResolver::getPackageFqName)?.let(::FqName) ?: FqName.ROOT
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalizeAsciiOnly() + "Kt"))
val packagePartClassId = ClassId(packageFqName, Name.identifier(sourceFile.nameWithoutExtension.capitalize() + "Kt"))
classes[packagePartClassId] = PackagePartProtoData(this, nameResolver, packageFqName)
}
@@ -413,4 +412,4 @@ private class PackageMetadataMap(storageFile: File) : BasicStringMap<ByteArray>(
operator fun get(packageName: String) = storage[packageName]
override fun dumpValue(value: ByteArray): String = "Package metadata: ${value.md5()}"
}
}

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.*
@@ -95,10 +94,6 @@ open class IncrementalJvmCache(
fun sourcesByInternalName(internalName: String): Collection<File> =
internalNameToSource[internalName]
fun getAllPartsOfMultifileFacade(facade: JvmClassName): Collection<String>? {
return multifileFacadeToParts[facade]
}
fun isMultifileFacade(className: JvmClassName): Boolean =
className in multifileFacadeToParts
@@ -150,7 +145,6 @@ open class IncrementalJvmCache(
}
protoMap.remove(className, changesCollector)
classFqNameToSourceMap.remove(className.fqNameForClassNameWithoutDollars)
classAttributesMap.remove(className.fqNameForClassNameWithoutDollars)
internalNameToSource.remove(className.internalName)
// TODO NO_CHANGES? (delegates only)
@@ -174,8 +168,6 @@ open class IncrementalJvmCache(
constantsMap.process(kotlinClass, changesCollector)
inlineFunctionsMap.process(kotlinClass, changesCollector)
}
KotlinClassHeader.Kind.UNKNOWN, KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
}
}
}
@@ -277,7 +269,6 @@ open class IncrementalJvmCache(
private inner class ProtoMap(storageFile: File) : BasicStringMap<ProtoMapValue>(storageFile, ProtoMapValueExternalizer) {
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
return put(kotlinClass, changesCollector)
}
@@ -289,12 +280,10 @@ open class IncrementalJvmCache(
// from files compiled during last round.
// However there is no need to compare old and new data in this case
// (also that would fail with exception).
@Synchronized
fun storeModuleMapping(className: JvmClassName, bytes: ByteArray) {
storage[className.internalName] = ProtoMapValue(isPackageFacade = false, bytes = bytes, strings = emptyArray())
}
@Synchronized
private fun put(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val header = kotlinClass.classHeader
@@ -317,7 +306,6 @@ open class IncrementalJvmCache(
operator fun get(className: JvmClassName): ProtoMapValue? =
storage[className.internalName]
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -334,8 +322,6 @@ open class IncrementalJvmCache(
private inner class JavaSourcesProtoMap(storageFile: File) :
BasicStringMap<SerializedJavaClass>(storageFile, JavaClassProtoMapValueExternalizer) {
@Synchronized
fun process(jvmClassName: JvmClassName, newData: SerializedJavaClass, changesCollector: ChangesCollector) {
val key = jvmClassName.internalName
val oldData = storage[key]
@@ -347,7 +333,6 @@ open class IncrementalJvmCache(
)
}
@Synchronized
fun remove(className: JvmClassName, changesCollector: ChangesCollector) {
val key = className.internalName
val oldValue = storage[key] ?: return
@@ -387,7 +372,6 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -400,13 +384,10 @@ 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])
}
}
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -432,8 +413,6 @@ open class IncrementalJvmCache(
private inner class MultifileClassFacadeMap(storageFile: File) :
BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
@Synchronized
operator fun set(className: JvmClassName, partNames: Collection<String>) {
storage[className.internalName] = partNames
}
@@ -444,7 +423,6 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -454,8 +432,6 @@ open class IncrementalJvmCache(
private inner class MultifileClassPartMap(storageFile: File) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
@Synchronized
fun set(partName: String, facadeName: String) {
storage[partName] = facadeName
}
@@ -463,7 +439,6 @@ open class IncrementalJvmCache(
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -545,7 +520,6 @@ open class IncrementalJvmCache(
return result
}
@Synchronized
fun process(kotlinClass: LocalFileKotlinClass, changesCollector: ChangesCollector) {
val key = kotlinClass.className.internalName
val oldMap = storage[key] ?: emptyMap()
@@ -571,7 +545,6 @@ open class IncrementalJvmCache(
private fun functionNameBySignature(signature: String): String =
signature.substringBefore("(")
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -593,7 +566,6 @@ sealed class ChangeInfo(val fqName: FqName) {
class SignatureChanged(fqName: FqName, val areSubclassesAffected: Boolean) : ChangeInfo(fqName)
class ParentsChanged(fqName: FqName, val parentsChanged: Collection<FqName>) : ChangeInfo(fqName)
protected open fun toStringProperties(): String = "fqName = $fqName"
@@ -602,12 +574,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

@@ -21,7 +21,6 @@ data class IncrementalModuleEntry(
class IncrementalModuleInfo(
val projectRoot: File,
val rootProjectBuildDir: File,
val dirToModule: Map<File, IncrementalModuleEntry>,
val nameToModules: Map<String, Set<IncrementalModuleEntry>>,
val jarToClassListFile: Map<File, File>,
@@ -29,6 +28,6 @@ class IncrementalModuleInfo(
val jarToModule: Map<File, IncrementalModuleEntry>
) : Serializable {
companion object {
private const val serialVersionUID = 1L
private const val serialVersionUID = 0L
}
}

View File

@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.java.JavaDescriptorVisibilities
import org.jetbrains.kotlin.load.java.JavaVisibilities
import org.jetbrains.kotlin.metadata.ProtoBuf
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
import org.jetbrains.kotlin.metadata.java.JavaClassProtoBuf
@@ -41,7 +41,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeClass(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateClass, true)
}
}
@@ -50,7 +50,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
proto: ProtoBuf.Constructor.Builder,
childSerializer: DescriptorSerializer) {
super.serializeConstructor(descriptor, proto, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateConstructor, true)
}
}
@@ -62,7 +62,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeFunction(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateMethod, true)
}
@@ -78,7 +78,7 @@ class JavaClassesSerializerExtension : KotlinSerializerExtensionBase(BuiltInSeri
childSerializer: DescriptorSerializer
) {
super.serializeProperty(descriptor, proto, versionRequirementTable, childSerializer)
if (descriptor.visibility == JavaDescriptorVisibilities.PACKAGE_VISIBILITY) {
if (descriptor.visibility == JavaVisibilities.PACKAGE_VISIBILITY) {
proto.setExtension(JavaClassProtoBuf.isPackagePrivateField, true)
}

View File

@@ -1,6 +1,17 @@
/*
* 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.
* Copyright 2010-2017 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.incremental

View File

@@ -23,12 +23,12 @@ import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
class LocalFileKotlinClass private constructor(
private val file: File,
private val fileContents: ByteArray,
className: ClassId,
classVersion: Int,
classHeader: KotlinClassHeader,
innerClasses: InnerClassesInfo
private val file: File,
private val fileContents: ByteArray,
className: ClassId,
classVersion: Int,
classHeader: KotlinClassHeader,
innerClasses: InnerClassesInfo
) : FileBasedKotlinClass(className, classVersion, classHeader, innerClasses) {
companion object {

View File

@@ -17,18 +17,19 @@
package org.jetbrains.kotlin.incremental
import com.intellij.util.containers.MultiMap
import com.intellij.util.containers.StringInterner
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.incremental.storage.*
import org.jetbrains.kotlin.utils.Printer
import org.jetbrains.kotlin.utils.createStringInterner
import org.jetbrains.kotlin.utils.keysToMap
import java.io.File
import java.io.IOException
import java.util.*
open class LookupStorage(
targetDataDir: File,
pathConverter: FileToPathConverter
@@ -79,7 +80,7 @@ open class LookupStorage(
for (lookupSymbol in lookups.keySet().sorted()) {
val key = LookupSymbolKey(lookupSymbol.name, lookupSymbol.scope)
val paths = lookups[lookupSymbol]
val paths = lookups[lookupSymbol]!!
val fileIds = paths.mapTo(TreeSet()) { pathToId[it]!! }
fileIds.addAll(lookupMap[key] ?: emptySet())
lookupMap[key] = fileIds
@@ -211,8 +212,8 @@ open class LookupStorage(
class LookupTrackerImpl(private val delegate: LookupTracker) : LookupTracker {
val lookups = MultiMap.createSet<LookupSymbol, String>()
val pathInterner = createStringInterner()
private val interner = createStringInterner()
val pathInterner = StringInterner()
private val interner = StringInterner()
override val requiresPosition: Boolean
get() = delegate.requiresPosition

View File

@@ -14,8 +14,6 @@
* limitations under the License.
*/
@file:Suppress("UNUSED_PARAMETER")
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.library.metadata.KlibMetadataProtoBuf
@@ -182,21 +180,6 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) return false
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) return false
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) return false
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) return false
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) return false
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) return false
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) return false
}
if (!checkEqualsClassVersionRequirement(old, new)) return false
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) return false
@@ -281,9 +264,6 @@ open class ProtoCompareGenerated(
TYPE_ALIAS_LIST,
ENUM_ENTRY_LIST,
SEALED_SUBCLASS_FQ_NAME_LIST,
INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
INLINE_CLASS_UNDERLYING_TYPE,
INLINE_CLASS_UNDERLYING_TYPE_ID,
VERSION_REQUIREMENT_LIST,
VERSION_REQUIREMENT_TABLE,
JVM_EXT_CLASS_MODULE_NAME,
@@ -332,21 +312,6 @@ open class ProtoCompareGenerated(
if (!checkEqualsClassSealedSubclassFqName(old, new)) result.add(ProtoBufClassKind.SEALED_SUBCLASS_FQ_NAME_LIST)
if (old.hasInlineClassUnderlyingPropertyName() != new.hasInlineClassUnderlyingPropertyName()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
if (old.hasInlineClassUnderlyingPropertyName()) {
if (!checkStringEquals(old.inlineClassUnderlyingPropertyName, new.inlineClassUnderlyingPropertyName)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME)
}
if (old.hasInlineClassUnderlyingType() != new.hasInlineClassUnderlyingType()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
if (old.hasInlineClassUnderlyingType()) {
if (!checkEquals(old.inlineClassUnderlyingType, new.inlineClassUnderlyingType)) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE)
}
if (old.hasInlineClassUnderlyingTypeId() != new.hasInlineClassUnderlyingTypeId()) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
if (old.hasInlineClassUnderlyingTypeId()) {
if (!checkEquals(oldTypeTable.getType(old.inlineClassUnderlyingTypeId), newTypeTable.getType(new.inlineClassUnderlyingTypeId))) result.add(ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID)
}
if (!checkEqualsClassVersionRequirement(old, new)) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_LIST)
if (old.hasVersionRequirementTable() != new.hasVersionRequirementTable()) result.add(ProtoBufClassKind.VERSION_REQUIREMENT_TABLE)
@@ -1761,18 +1726,6 @@ fun ProtoBuf.Class.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) ->
hashCode = 31 * hashCode + fqNameIndexes(getSealedSubclassFqName(i))
}
if (hasInlineClassUnderlyingPropertyName()) {
hashCode = 31 * hashCode + stringIndexes(inlineClassUnderlyingPropertyName)
}
if (hasInlineClassUnderlyingType()) {
hashCode = 31 * hashCode + inlineClassUnderlyingType.hashCode(stringIndexes, fqNameIndexes, typeById)
}
if (hasInlineClassUnderlyingTypeId()) {
hashCode = 31 * hashCode + typeById(inlineClassUnderlyingTypeId).hashCode(stringIndexes, fqNameIndexes, typeById)
}
for(i in 0..versionRequirementCount - 1) {
hashCode = 31 * hashCode + getVersionRequirement(i)
}

View File

@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.build.GeneratedFile
import org.jetbrains.kotlin.build.GeneratedJvmClass
import org.jetbrains.kotlin.build.JvmSourceRoot
import org.jetbrains.kotlin.build.isModuleMappingFile
import org.jetbrains.kotlin.build.report.ICReporter
import org.jetbrains.kotlin.config.Services
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.load.kotlin.incremental.components.IncrementalCache
@@ -32,43 +31,41 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus
import org.jetbrains.kotlin.resolve.sam.SAM_LOOKUP_NAME
import org.jetbrains.kotlin.utils.addToStdlib.flattenTo
import java.io.File
import java.nio.file.Files
import java.util.*
import kotlin.collections.HashSet
import kotlin.collections.LinkedHashSet
const val DELETE_MODULE_FILE_PROPERTY = "kotlin.delete.module.file.after.build"
fun makeModuleFile(
name: String,
isTest: Boolean,
outputDir: File,
sourcesToCompile: Iterable<File>,
commonSources: Iterable<File>,
javaSourceRoots: Iterable<JvmSourceRoot>,
classpath: Iterable<File>,
friendDirs: Iterable<File>
name: String,
isTest: Boolean,
outputDir: File,
sourcesToCompile: Iterable<File>,
commonSources: Iterable<File>,
javaSourceRoots: Iterable<JvmSourceRoot>,
classpath: Iterable<File>,
friendDirs: Iterable<File>
): File {
val builder = KotlinModuleXmlBuilder()
builder.addModule(
name,
outputDir.absolutePath,
// important to transform file to absolute paths,
// otherwise compiler will use module file's parent as base path (a temporary file; see below)
// (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths)
sourcesToCompile.map { it.absoluteFile },
javaSourceRoots,
classpath,
commonSources.map { it.absoluteFile },
null,
"java-production",
isTest,
// this excludes the output directories from the class path, to be removed for true incremental compilation
setOf(outputDir),
friendDirs
name,
outputDir.absolutePath,
// important to transform file to absolute paths,
// otherwise compiler will use module file's parent as base path (a temporary file; see below)
// (see org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.getAbsolutePaths)
sourcesToCompile.map { it.absoluteFile },
javaSourceRoots,
classpath,
commonSources.map { it.absoluteFile },
null,
"java-production",
isTest,
// this excludes the output directories from the class path, to be removed for true incremental compilation
setOf(outputDir),
friendDirs
)
val scriptFile = Files.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml").toFile()
val scriptFile = File.createTempFile("kjps", sanitizeJavaIdentifier(name) + ".script.xml")
scriptFile.writeText(builder.asText().toString())
return scriptFile
}
@@ -86,9 +83,9 @@ private fun sanitizeJavaIdentifier(string: String) =
}
fun makeCompileServices(
incrementalCaches: Map<TargetId, IncrementalCache>,
lookupTracker: LookupTracker,
compilationCanceledStatus: CompilationCanceledStatus?
incrementalCaches: Map<TargetId, IncrementalCache>,
lookupTracker: LookupTracker,
compilationCanceledStatus: CompilationCanceledStatus?
): Services =
with(Services.Builder()) {
register(LookupTracker::class.java, lookupTracker)
@@ -108,14 +105,12 @@ fun updateIncrementalCache(
for (generatedFile in generatedFiles) {
when {
generatedFile is GeneratedJvmClass -> cache.saveFileToCache(generatedFile, changesCollector)
generatedFile.outputFile.isModuleMappingFile() -> cache.saveModuleMappingToCache(
generatedFile.sourceFiles,
generatedFile.outputFile
)
generatedFile.outputFile.isModuleMappingFile() -> cache.saveModuleMappingToCache(generatedFile.sourceFiles, generatedFile.outputFile)
}
}
javaChangesTracker?.javaClassesUpdates?.forEach { (source, serializedJavaClass) ->
javaChangesTracker?.javaClassesUpdates?.forEach {
(source, serializedJavaClass) ->
cache.saveJavaClassProto(source, serializedJavaClass, changesCollector)
}
@@ -123,9 +118,9 @@ fun updateIncrementalCache(
}
fun LookupStorage.update(
lookupTracker: LookupTracker,
filesToCompile: Iterable<File>,
removedFiles: Iterable<File>
lookupTracker: LookupTracker,
filesToCompile: Iterable<File>,
removedFiles: Iterable<File>
) {
if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker::class.java}")
@@ -135,9 +130,8 @@ fun LookupStorage.update(
}
data class DirtyData(
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
val dirtyClassesFqNames: Collection<FqName> = emptyList(),
val dirtyClassesFqNamesForceRecompile: Collection<FqName> = emptyList()
val dirtyLookupSymbols: Collection<LookupSymbol> = emptyList(),
val dirtyClassesFqNames: Collection<FqName> = emptyList()
)
fun ChangesCollector.getDirtyData(
@@ -147,9 +141,6 @@ fun ChangesCollector.getDirtyData(
val dirtyLookupSymbols = HashSet<LookupSymbol>()
val dirtyClassesFqNames = HashSet<FqName>()
val sealedParents = HashMap<FqName, MutableSet<FqName>>()
val notSealedParents = HashSet<FqName>()
for (change in changes()) {
reporter.reportVerbose { "Process $change" }
@@ -174,35 +165,10 @@ fun ChangesCollector.getDirtyData(
}
fqNames.mapTo(dirtyLookupSymbols) { LookupSymbol(SAM_LOOKUP_NAME.asString(), it.asString()) }
} else if (change is ChangeInfo.ParentsChanged) {
fun FqName.isSealed(): Boolean {
if (notSealedParents.contains(this)) return false
if (sealedParents.containsKey(this)) return true
return isSealed(this, caches).also { sealed ->
if (sealed) {
sealedParents[this] = HashSet()
} else {
notSealedParents.add(this)
}
}
}
change.parentsChanged.forEach { parent ->
if (parent.isSealed()) {
sealedParents.getOrPut(parent) { HashSet() }.add(change.fqName)
}
}
}
}
val forceRecompile = HashSet<FqName>().apply {
addAll(sealedParents.keys)
//we should recompile all inheritors with parent sealed class: add known subtypes
addAll(sealedParents.keys.flatMap { withSubtypes(it, caches) })
//we should recompile all inheritors with parent sealed class: add new subtypes
addAll(sealedParents.values.flatten())
}
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames, forceRecompile)
return DirtyData(dirtyLookupSymbols, dirtyClassesFqNames)
}
fun mapLookupSymbolsToFiles(
@@ -246,27 +212,20 @@ fun mapClassesFqNamesToFiles(
return fqNameToAffectedFiles.values.flattenTo(HashSet())
}
fun isSealed(
fqName: FqName,
caches: Iterable<IncrementalCacheCommon>
): Boolean = caches.any { it.isSealed(fqName) ?: false }
fun withSubtypes(
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon>
typeFqName: FqName,
caches: Iterable<IncrementalCacheCommon>
): Set<FqName> {
val types = LinkedHashSet(listOf(typeFqName))
val types = LinkedList(listOf(typeFqName))
val subtypes = hashSetOf<FqName>()
while (types.isNotEmpty()) {
val iterator = types.iterator()
val unprocessedType = iterator.next()
iterator.remove()
val unprocessedType = types.pollFirst()
caches.asSequence()
.flatMap { it.getSubtypesOf(unprocessedType) }
.filter { it !in subtypes }
.forEach { types.add(it) }
.flatMap { it.getSubtypesOf(unprocessedType) }
.filter { it !in subtypes }
.forEach { types.addLast(it) }
subtypes.add(unprocessedType)
}

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufClassKind
import org.jetbrains.kotlin.incremental.ProtoCompareGenerated.ProtoBufPackageKind
import org.jetbrains.kotlin.incremental.storage.ProtoMapValue
@@ -27,15 +27,12 @@ import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmProtoBufUtil
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.protobuf.MessageLite
import org.jetbrains.kotlin.serialization.deserialization.ProtoEnumFlags
import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
import org.jetbrains.kotlin.serialization.deserialization.getClassId
import java.util.*
data class Difference(
val isClassAffected: Boolean = false,
val areSubclassesAffected: Boolean = false,
val changedMembersNames: Set<String> = emptySet(),
val changedSupertypes: Set<FqName> = emptySet()
val changedMembersNames: Set<String> = emptySet()
)
sealed class ProtoData
@@ -52,8 +49,8 @@ fun ProtoMapValue.toProtoData(packageFqName: FqName): ProtoData =
}
internal val MessageLite.isPrivate: Boolean
get() = DescriptorVisibilities.isPrivate(
ProtoEnumFlags.descriptorVisibility(
get() = Visibilities.isPrivate(
ProtoEnumFlags.visibility(
when (this) {
is ProtoBuf.Constructor -> Flags.VISIBILITY.get(flags)
is ProtoBuf.Function -> Flags.VISIBILITY.get(flags)
@@ -189,7 +186,6 @@ class DifferenceCalculatorForClass(
var isClassAffected = false
var areSubclassesAffected = false
val changedSupertypes = HashSet<FqName>()
val names = hashSetOf<String>()
val classIsSealed = newProto.isSealed && oldProto.isSealed
@@ -250,21 +246,12 @@ class DifferenceCalculatorForClass(
ProtoBufClassKind.FLAGS,
ProtoBufClassKind.FQ_NAME,
ProtoBufClassKind.TYPE_PARAMETER_LIST,
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST,
ProtoBufClassKind.JS_EXT_CLASS_ANNOTATION_LIST -> {
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST -> {
isClassAffected = true
areSubclassesAffected = true
val oldSupertypes = oldProto.supertypeList.map { oldNameResolver.getClassId(it.className).asSingleFqName() }
val newSupertypes = newProto.supertypeList.map { newNameResolver.getClassId(it.className).asSingleFqName() }
val changed = (oldSupertypes union newSupertypes) subtract (oldSupertypes intersect newSupertypes)
changedSupertypes.addAll(changed)
}
ProtoBufClassKind.JVM_EXT_CLASS_MODULE_NAME,
ProtoBufClassKind.JS_EXT_CLASS_CONTAINING_FILE_ID -> {
// TODO
@@ -290,15 +277,10 @@ class DifferenceCalculatorForClass(
isClassAffected = true
areSubclassesAffected = true
}
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_PROPERTY_NAME,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE,
ProtoBufClassKind.INLINE_CLASS_UNDERLYING_TYPE_ID -> {
isClassAffected = true
}
}
}
return Difference(isClassAffected, areSubclassesAffected, names, changedSupertypes)
return Difference(isClassAffected, areSubclassesAffected, names)
}
}
@@ -364,4 +346,4 @@ val ProtoBuf.Class.typeTableOrNull: ProtoBuf.TypeTable?
get() = if (hasTypeTable()) typeTable else null
val ProtoBuf.Package.typeTableOrNull: ProtoBuf.TypeTable?
get() = if (hasTypeTable()) typeTable else null
get() = if (hasTypeTable()) typeTable else null

View File

@@ -0,0 +1,81 @@
/*
* 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.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.EnumeratorStringDescriptor
import com.intellij.util.io.KeyDescriptor
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.utils.Printer
import java.io.File
abstract class BasicMap<K : Comparable<K>, V>(
internal val storageFile: File,
keyDescriptor: KeyDescriptor<K>,
valueExternalizer: DataExternalizer<V>
) {
protected val storage = LazyStorage(storageFile, keyDescriptor, valueExternalizer)
fun clean() {
storage.clean()
}
fun flush(memoryCachesOnly: Boolean) {
storage.flush(memoryCachesOnly)
}
fun close() {
storage.close()
}
@TestOnly
fun dump(): String {
return with(StringBuilder()) {
with(Printer(this)) {
println(this@BasicMap::class.java.simpleName)
pushIndent()
for (key in storage.keys.sorted()) {
println("${dumpKey(key)} -> ${dumpValue(storage[key]!!)}")
}
popIndent()
}
this
}.toString()
}
@TestOnly
protected abstract fun dumpKey(key: K): String
@TestOnly
protected abstract fun dumpValue(value: V): String
}
abstract class BasicStringMap<V>(
storageFile: File,
keyDescriptor: KeyDescriptor<String>,
valueExternalizer: DataExternalizer<V>
) : BasicMap<String, V>(storageFile, keyDescriptor, valueExternalizer) {
constructor(
storageFile: File,
valueExternalizer: DataExternalizer<V>
) : this(storageFile, EnumeratorStringDescriptor.INSTANCE, valueExternalizer)
override fun dumpKey(key: String): String = key
}

View File

@@ -30,7 +30,6 @@ open class BasicMapsOwner(val cachesDir: File) {
protected val String.storageFile: File
get() = File(cachesDir, this + "." + CACHE_EXTENSION)
@Synchronized
protected fun <K, V, M : BasicMap<K, V>> registerMap(map: M): M {
maps.add(map)
return map
@@ -48,7 +47,6 @@ open class BasicMapsOwner(val cachesDir: File) {
forEachMapSafe("flush") { it.flush(memoryCachesOnly) }
}
@Synchronized
private fun forEachMapSafe(actionName: String, action: (BasicMap<*, *>) -> Unit) {
val actionExceptions = LinkedHashMap<String, Exception>()
maps.forEach {
@@ -68,6 +66,5 @@ open class BasicMapsOwner(val cachesDir: File) {
}
@TestOnly
@Synchronized
fun dump(): String = maps.joinToString("\n\n") { it.dump() }
}

View File

@@ -17,11 +17,9 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
import java.io.IOException
/**
@@ -32,6 +30,7 @@ class CachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
@@ -81,10 +80,8 @@ class CachingLazyStorage<K, V>(
try {
storage?.close()
} finally {
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
}
}

View File

@@ -1,51 +0,0 @@
/*
* 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.incremental.storage
import com.intellij.util.io.DataExternalizer
import org.jetbrains.kotlin.name.FqName
import java.io.DataInput
import java.io.DataOutput
import java.io.File
internal data class ICClassesAttributes(val isSealed: Boolean)
internal object ICClassesAttributesExternalizer : DataExternalizer<ICClassesAttributes> {
override fun read(input: DataInput): ICClassesAttributes {
return ICClassesAttributes(input.readBoolean())
}
override fun save(output: DataOutput, value: ICClassesAttributes) {
output.writeBoolean(value.isSealed)
}
}
internal open class ClassAttributesMap(
storageFile: File
) : BasicStringMap<ICClassesAttributes>(storageFile, ICClassesAttributesExternalizer) {
override fun dumpValue(value: ICClassesAttributes): String = value.toString()
operator fun set(key: FqName, value: ICClassesAttributes) {
storage[key.asString()] = value
}
operator fun get(key: FqName): ICClassesAttributes? = storage[key.asString()]
fun remove(key: FqName) {
storage.remove(key.asString())
}
}

View File

@@ -20,18 +20,18 @@ import org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import java.io.File
internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
internal open class ClassOneToManyMap(
storageFile: File
) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
@Synchronized
fun add(key: FqName, value: FqName) {
storage.append(key.asString(), listOf(value.asString()))
}
operator fun get(key: FqName): Collection<FqName> =
storage[key.asString()]?.map(::FqName) ?: setOf()
storage[key.asString()]?.map(::FqName) ?: setOf()
@Synchronized
operator fun set(key: FqName, values: Collection<FqName>) {
if (values.isEmpty()) {
remove(key)
@@ -41,14 +41,10 @@ internal open class ClassOneToManyMap(storageFile: File) : BasicStringMap<Collec
storage[key.asString()] = values.map(FqName::asString)
}
@Synchronized
fun remove(key: FqName) {
storage.remove(key.asString())
}
// Access to caches could be done from multiple threads (e.g. JPS worker and RMI). The underlying collection is already synchronized,
// thus we need synchronization of this method and all modification methods.
@Synchronized
fun removeValues(key: FqName, removed: Set<FqName>) {
val notRemoved = this[key].filter { it !in removed }
this[key] = notRemoved

View File

@@ -0,0 +1,55 @@
/*
* 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.incremental.storage
import org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import java.io.File
internal open class ClassOneToManyMap(
storageFile: File
) : BasicStringMap<Collection<String>>(storageFile, StringCollectionExternalizer) {
override fun dumpValue(value: Collection<String>): String = value.dumpCollection()
fun add(key: FqName, value: FqName) {
storage.append(key.asString(), value.asString())
}
operator fun get(key: FqName): Collection<FqName> =
storage[key.asString()]?.map(::FqName) ?: setOf()
operator fun set(key: FqName, values: Collection<FqName>) {
if (values.isEmpty()) {
remove(key)
return
}
storage[key.asString()] = values.map(FqName::asString)
}
fun remove(key: FqName) {
storage.remove(key.asString())
}
fun removeValues(key: FqName, removed: Set<FqName>) {
val notRemoved = this[key].filter { it !in removed }
this[key] = notRemoved
}
}
internal class SubtypesMap(storageFile: File) : ClassOneToManyMap(storageFile)
internal class SupertypesMap(storageFile: File) : ClassOneToManyMap(storageFile)

View File

@@ -25,7 +25,8 @@ internal class DirtyClassesJvmNameMap(storageFile: File) : AbstractDirtyClassesM
internal class DirtyClassesFqNameMap(storageFile: File) : AbstractDirtyClassesMap<FqName>(FqNameTransformer, storageFile)
internal abstract class AbstractDirtyClassesMap<Name>(
private val nameTransformer: NameTransformer<Name>, storageFile: File
private val nameTransformer: NameTransformer<Name>,
storageFile: File
) : BasicStringMap<Boolean>(storageFile, BooleanDataDescriptor.INSTANCE) {
fun markDirty(className: Name) {
storage[nameTransformer.asString(className)] = true
@@ -36,10 +37,10 @@ internal abstract class AbstractDirtyClassesMap<Name>(
}
fun getDirtyOutputClasses(): Collection<Name> =
storage.keys.map { nameTransformer.asName(it) }
storage.keys.map { nameTransformer.asName(it) }
fun isDirty(className: Name): Boolean =
storage.contains(nameTransformer.asString(className))
storage.contains(nameTransformer.asString(className))
override fun dumpValue(value: Boolean) = ""
}

View File

@@ -1,34 +0,0 @@
/*
* 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.incremental.storage
import java.io.File
open class IncrementalFileToPathConverter(val rootProjectDir: File?) : FileToPathConverter {
//project root dir
private val projectDirPath = rootProjectDir?.normalize()?.absolutePath
override fun toPath(file: File): String {
val path = file.normalize().absolutePath
return when {
projectDirPath == null || !path.startsWith(projectDirPath) -> path
else -> PROJECT_DIR_PLACEHOLDER + path.substring(projectDirPath.length)
}
}
override fun toFile(path: String): File =
when {
rootProjectDir != null && path.startsWith(PROJECT_DIR_PLACEHOLDER) -> rootProjectDir.resolve(path.substring(PATH_PREFIX.length))
else -> File(path)
}
private companion object {
private const val PROJECT_DIR_PLACEHOLDER = "${'$'}PROJECT_DIR$"
//use only for prefix length because it OS dependent
private const val PATH_PREFIX = "$PROJECT_DIR_PLACEHOLDER/"
}
}

View File

@@ -0,0 +1,122 @@
/*
* 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.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.DataOutput
import java.io.File
import java.io.IOException
/**
* It's lazy in a sense that PersistentHashMap is created only on write
*/
class LazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
fun append(key: K, value: String) {
append(key) { out -> IOUtil.writeUTF(out, value) }
}
fun append(key: K, value: Int) {
append(key) { out -> out.writeInt(value) }
}
@Synchronized
fun clean() {
try {
storage?.close()
}
catch (ignored: Throwable) {
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
}
else {
existingStorage.force()
}
}
@Synchronized
fun close() {
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
private fun append(key: K, append: (DataOutput)->Unit) {
getStorageOrCreateNew().appendData(key, append)
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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.incremental.storage
import java.io.File
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()
fun add(name: String, scope: String, fileId: Int) {
storage.append(LookupSymbolKey(name, scope), fileId)
}
operator fun get(key: LookupSymbolKey): Collection<Int>? = storage[key]
operator fun set(key: LookupSymbolKey, fileIds: Set<Int>) {
storage[key] = fileIds
}
fun remove(key: LookupSymbolKey) {
storage.remove(key)
}
val keys: Collection<LookupSymbolKey>
get() = storage.keys
}

View File

@@ -17,11 +17,9 @@
package org.jetbrains.kotlin.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.IOUtil
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import com.intellij.util.io.JpsPersistentHashMap
import java.io.File
import java.io.IOException
class NonCachingLazyStorage<K, V>(
@@ -29,10 +27,11 @@ class NonCachingLazyStorage<K, V>(
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
private var storage: PersistentHashMap<K, V>? = null
@Volatile
private var storage: JpsPersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
private fun getStorageIfExists(): JpsPersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
@@ -44,7 +43,7 @@ class NonCachingLazyStorage<K, V>(
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
private fun getStorageOrCreateNew(): JpsPersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
@@ -70,19 +69,18 @@ class NonCachingLazyStorage<K, V>(
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
getStorageOrCreateNew().appendDataWithoutCache(key, value)
}
@Synchronized
override fun clean() {
try {
storage?.close()
} finally {
storage = null
if (!IOUtil.deleteAllFilesStartingWith(storageFile)) {
throw IOException("Could not delete internal storage: ${storageFile.absolutePath}")
}
} catch (ignored: Throwable) {
}
JpsPersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
@@ -103,6 +101,6 @@ class NonCachingLazyStorage<K, V>(
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
private fun createMap(): JpsPersistentHashMap<K, V> =
JpsPersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -0,0 +1,106 @@
/*
* 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.incremental.storage
import com.intellij.util.io.DataExternalizer
import com.intellij.util.io.KeyDescriptor
import com.intellij.util.io.PersistentHashMap
import java.io.File
class NonCachingLazyStorage<K, V>(
private val storageFile: File,
private val keyDescriptor: KeyDescriptor<K>,
private val valueExternalizer: DataExternalizer<V>
) : LazyStorage<K, V> {
@Volatile
private var storage: PersistentHashMap<K, V>? = null
@Synchronized
private fun getStorageIfExists(): PersistentHashMap<K, V>? {
if (storage != null) return storage
if (storageFile.exists()) {
storage = createMap()
return storage
}
return null
}
@Synchronized
private fun getStorageOrCreateNew(): PersistentHashMap<K, V> {
if (storage == null) {
storage = createMap()
}
return storage!!
}
override val keys: Collection<K>
get() = getStorageIfExists()?.allKeysWithExistingMapping ?: listOf()
override operator fun contains(key: K): Boolean =
getStorageIfExists()?.containsMapping(key) ?: false
override operator fun get(key: K): V? =
getStorageIfExists()?.get(key)
override operator fun set(key: K, value: V) {
getStorageOrCreateNew().put(key, value)
}
override fun remove(key: K) {
getStorageIfExists()?.remove(key)
}
override fun append(key: K, value: V) {
getStorageOrCreateNew().appendData(key) { dataOutput -> valueExternalizer.save(dataOutput, value) }
}
@Synchronized
override fun clean() {
try {
storage?.close()
} catch (ignored: Throwable) {
}
PersistentHashMap.deleteFilesStartingWith(storageFile)
storage = null
}
@Synchronized
override fun flush(memoryCachesOnly: Boolean) {
val existingStorage = storage ?: return
if (memoryCachesOnly) {
if (existingStorage.isDirty) {
existingStorage.dropMemoryCaches()
}
} else {
existingStorage.force()
}
}
@Synchronized
override fun close() {
storage?.close()
}
private fun createMap(): PersistentHashMap<K, V> =
PersistentHashMap(storageFile, keyDescriptor, valueExternalizer)
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright 2010-2017 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.incremental.storage
import org.jetbrains.kotlin.incremental.dumpCollection
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import java.io.File
internal class SourceToJvmNameMap(
storageFile: File,
pathConverter: FileToPathConverter
) : AbstractSourceToOutputMap<JvmClassName>(JvmClassNameTransformer, storageFile, pathConverter)
internal class SourceToFqNameMap(
storageFile: File,
pathConverter: FileToPathConverter
) : AbstractSourceToOutputMap<FqName>(FqNameTransformer, storageFile, pathConverter)
internal abstract class AbstractSourceToOutputMap<Name>(
private val nameTransformer: NameTransformer<Name>,
storageFile: File,
private val pathConverter: FileToPathConverter
) : BasicStringMap<Collection<String>>(storageFile, PathStringDescriptor, StringCollectionExternalizer) {
fun clearOutputsForSource(sourceFile: File) {
remove(pathConverter.toPath(sourceFile))
}
fun add(sourceFile: File, className: Name) {
storage.append(pathConverter.toPath(sourceFile), nameTransformer.asString(className))
}
fun contains(sourceFile: File): Boolean =
pathConverter.toPath(sourceFile) in storage
operator fun get(sourceFile: File): Collection<Name> =
storage[pathConverter.toPath(sourceFile)].orEmpty().map(nameTransformer::asName)
fun getFqNames(sourceFile: File): Collection<FqName> =
storage[pathConverter.toPath(sourceFile)].orEmpty().map(nameTransformer::asFqName)
override fun dumpValue(value: Collection<String>) =
value.dumpCollection()
private fun remove(path: String) {
storage.remove(path)
}
}

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
@@ -33,7 +34,10 @@ class BuildMetaInfoTest : TestCase() {
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesEnable",
"coroutinesError",
"coroutinesVersion",
"coroutinesWarn",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
@@ -67,12 +71,14 @@ class BuildMetaInfoTest : TestCase() {
@Test
fun testJvmEquals() {
val args1 = K2JVMCompilerArguments()
args1.coroutinesState = CommonCompilerArguments.ENABLE
val info1 = JvmBuildMetaInfo.create(args1)
val args2 = K2JVMCompilerArguments()
args2.coroutinesState = CommonCompilerArguments.WARN
val info2 = JvmBuildMetaInfo.create(args2)
assertEquals(info1, info2)
assertEquals(info1, info2.copy())
assertNotEquals(info1, info2)
assertEquals(info1, info2.copy(coroutinesEnable = true, coroutinesWarn = false))
}
}

View File

@@ -1,62 +0,0 @@
/*
* 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.incremental.storage
import org.jetbrains.kotlin.TestWithWorkingDir
import org.junit.Test
import java.io.File
internal class IncrementalFileToPathConverterTest : TestWithWorkingDir() {
val separator: String = File.separator
@Test
fun testPathTransform() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testComplicatedProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("first$separator..${separator}testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testInccorectProjectRootPath() {
val relativeFilePath = "testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir$separator"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}$separator$relativeFilePath", transformedPath)
}
@Test
fun testFileOutOfProject() {
val relativeFilePath = "..${separator}testFile.txt"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${workingDir.absolutePath}${separator}testFile.txt", transformedPath)
}
@Test
fun testFileWithExtraSlash() {
val relativeFilePath = "testFile.txt$separator"
val transformedPath = testPathTransformation(workingDir.resolve("testDir"), relativeFilePath)
assertEquals("${'$'}PROJECT_DIR${'$'}${separator}testFile.txt", transformedPath)
}
private fun testPathTransformation(projectRoot: File, relativeFilePath: String): String {
val pathConverter = IncrementalFileToPathConverter(projectRoot)
val testFile = projectRoot.resolve(relativeFilePath)
val transformedPath = pathConverter.toPath(testFile)
assertEquals(testFile.normalize().absolutePath, pathConverter.toFile(transformedPath).normalize().absolutePath)
return transformedPath
}
}

View File

@@ -22,19 +22,16 @@ data class BuildLogFinder(
private val isDataContainerBuildLogEnabled: Boolean = false,
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 isJsIrEnabled: Boolean = false, // TODO rename as it is used for metadata-only test
private val isScopeExpansionEnabled: Boolean = false
) {
companion object {
private const val JS_LOG = "js-build.log"
private const val KLIB_LOG = "klib-build.log"
private const val JS_IR_LOG = "js-ir-build.log"
private const val SCOPE_EXPANDING_LOG = "build-with-scope-expansion.log"
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 =
@@ -46,10 +43,8 @@ data class BuildLogFinder(
val files = names.filter { File(dir, it).isFile }.toSet()
val matchedName = when {
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
isJsIrEnabled && JS_IR_LOG in files -> JS_IR_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

@@ -151,35 +151,29 @@ private fun classFileToString(classFile: File): String {
val traceVisitor = TraceClassVisitor(PrintWriter(out))
ClassReader(classFile.readBytes()).accept(traceVisitor, 0)
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader ?: return ""
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
val classHeader = LocalFileKotlinClass.create(classFile)?.classHeader
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.CLASS, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> {
ByteArrayInputStream(BitEncoding.decodeBytes(classHeader.data!!)).use { input ->
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
val annotationDataEncoded = classHeader?.data
if (annotationDataEncoded != null) {
ByteArrayInputStream(BitEncoding.decodeBytes(annotationDataEncoded)).use {
input ->
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> error(classHeader.kind)
}
out.write("\n------ string table types proto -----\n${DebugJvmProtoBuf.StringTableTypes.parseDelimitedFrom(input)}")
if (!classHeader.metadataVersion.isCompatible()) {
error("Incompatible class ($classHeader): $classFile")
}
when (classHeader.kind) {
KotlinClassHeader.Kind.FILE_FACADE ->
out.write("\n------ file facade proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.CLASS ->
out.write("\n------ class proto -----\n${DebugProtoBuf.Class.parseFrom(input, getExtensionRegistry())}")
KotlinClassHeader.Kind.MULTIFILE_CLASS_PART ->
out.write("\n------ multi-file part proto -----\n${DebugProtoBuf.Package.parseFrom(input, getExtensionRegistry())}")
else -> throw IllegalStateException()
}
}
KotlinClassHeader.Kind.MULTIFILE_CLASS -> {
out.write("\n------ multi-file facade data -----\n")
out.write(classHeader.data!!.joinToString("\n"))
}
KotlinClassHeader.Kind.SYNTHETIC_CLASS -> {
// Synthetic class has no metadata, thus there can be no differences in it.
}
KotlinClassHeader.Kind.UNKNOWN -> error("Should not meet unknown classes here: $classFile")
}
return out.toString()

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

@@ -208,65 +208,6 @@ public final class DebugJvmModuleProtoBuf {
*/
org.jetbrains.kotlin.metadata.DebugProtoBuf.AnnotationOrBuilder getAnnotationOrBuilder(
int index);
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class>
getOptionalAnnotationClassList();
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class getOptionalAnnotationClass(int index);
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
int getOptionalAnnotationClassCount();
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
java.util.List<? extends org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder>
getOptionalAnnotationClassOrBuilderList();
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder getOptionalAnnotationClassOrBuilder(
int index);
}
/**
* Protobuf type {@code org.jetbrains.kotlin.metadata.jvm.Module}
@@ -379,14 +320,6 @@ public final class DebugJvmModuleProtoBuf {
annotation_.add(input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.Annotation.PARSER, extensionRegistry));
break;
}
case 130: {
if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
optionalAnnotationClass_ = new java.util.ArrayList<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class>();
mutable_bitField0_ |= 0x00000040;
}
optionalAnnotationClass_.add(input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.PARSER, extensionRegistry));
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -407,9 +340,6 @@ public final class DebugJvmModuleProtoBuf {
if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
annotation_ = java.util.Collections.unmodifiableList(annotation_);
}
if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) {
optionalAnnotationClass_ = java.util.Collections.unmodifiableList(optionalAnnotationClass_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
@@ -698,76 +628,6 @@ public final class DebugJvmModuleProtoBuf {
return annotation_.get(index);
}
public static final int OPTIONAL_ANNOTATION_CLASS_FIELD_NUMBER = 16;
private java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class> optionalAnnotationClass_;
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class> getOptionalAnnotationClassList() {
return optionalAnnotationClass_;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public java.util.List<? extends org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder>
getOptionalAnnotationClassOrBuilderList() {
return optionalAnnotationClass_;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public int getOptionalAnnotationClassCount() {
return optionalAnnotationClass_.size();
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Class getOptionalAnnotationClass(int index) {
return optionalAnnotationClass_.get(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder getOptionalAnnotationClassOrBuilder(
int index) {
return optionalAnnotationClass_.get(index);
}
private void initFields() {
packageParts_ = java.util.Collections.emptyList();
metadataParts_ = java.util.Collections.emptyList();
@@ -775,7 +635,6 @@ public final class DebugJvmModuleProtoBuf {
stringTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.StringTable.getDefaultInstance();
qualifiedNameTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.QualifiedNameTable.getDefaultInstance();
annotation_ = java.util.Collections.emptyList();
optionalAnnotationClass_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -807,12 +666,6 @@ public final class DebugJvmModuleProtoBuf {
return false;
}
}
for (int i = 0; i < getOptionalAnnotationClassCount(); i++) {
if (!getOptionalAnnotationClass(i).isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
memoizedIsInitialized = 1;
return true;
}
@@ -838,9 +691,6 @@ public final class DebugJvmModuleProtoBuf {
for (int i = 0; i < annotation_.size(); i++) {
output.writeMessage(6, annotation_.get(i));
}
for (int i = 0; i < optionalAnnotationClass_.size(); i++) {
output.writeMessage(16, optionalAnnotationClass_.get(i));
}
getUnknownFields().writeTo(output);
}
@@ -879,10 +729,6 @@ public final class DebugJvmModuleProtoBuf {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(6, annotation_.get(i));
}
for (int i = 0; i < optionalAnnotationClass_.size(); i++) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(16, optionalAnnotationClass_.get(i));
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -997,7 +843,6 @@ public final class DebugJvmModuleProtoBuf {
getStringTableFieldBuilder();
getQualifiedNameTableFieldBuilder();
getAnnotationFieldBuilder();
getOptionalAnnotationClassFieldBuilder();
}
}
private static Builder create() {
@@ -1038,12 +883,6 @@ public final class DebugJvmModuleProtoBuf {
} else {
annotationBuilder_.clear();
}
if (optionalAnnotationClassBuilder_ == null) {
optionalAnnotationClass_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000040);
} else {
optionalAnnotationClassBuilder_.clear();
}
return this;
}
@@ -1120,15 +959,6 @@ public final class DebugJvmModuleProtoBuf {
} else {
result.annotation_ = annotationBuilder_.build();
}
if (optionalAnnotationClassBuilder_ == null) {
if (((bitField0_ & 0x00000040) == 0x00000040)) {
optionalAnnotationClass_ = java.util.Collections.unmodifiableList(optionalAnnotationClass_);
bitField0_ = (bitField0_ & ~0x00000040);
}
result.optionalAnnotationClass_ = optionalAnnotationClass_;
} else {
result.optionalAnnotationClass_ = optionalAnnotationClassBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -1239,32 +1069,6 @@ public final class DebugJvmModuleProtoBuf {
}
}
}
if (optionalAnnotationClassBuilder_ == null) {
if (!other.optionalAnnotationClass_.isEmpty()) {
if (optionalAnnotationClass_.isEmpty()) {
optionalAnnotationClass_ = other.optionalAnnotationClass_;
bitField0_ = (bitField0_ & ~0x00000040);
} else {
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.addAll(other.optionalAnnotationClass_);
}
onChanged();
}
} else {
if (!other.optionalAnnotationClass_.isEmpty()) {
if (optionalAnnotationClassBuilder_.isEmpty()) {
optionalAnnotationClassBuilder_.dispose();
optionalAnnotationClassBuilder_ = null;
optionalAnnotationClass_ = other.optionalAnnotationClass_;
bitField0_ = (bitField0_ & ~0x00000040);
optionalAnnotationClassBuilder_ =
org.jetbrains.kotlin.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getOptionalAnnotationClassFieldBuilder() : null;
} else {
optionalAnnotationClassBuilder_.addAllMessages(other.optionalAnnotationClass_);
}
}
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -1294,12 +1098,6 @@ public final class DebugJvmModuleProtoBuf {
return false;
}
}
for (int i = 0; i < getOptionalAnnotationClassCount(); i++) {
if (!getOptionalAnnotationClass(i).isInitialized()) {
return false;
}
}
return true;
}
@@ -2628,372 +2426,6 @@ public final class DebugJvmModuleProtoBuf {
return annotationBuilder_;
}
private java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class> optionalAnnotationClass_ =
java.util.Collections.emptyList();
private void ensureOptionalAnnotationClassIsMutable() {
if (!((bitField0_ & 0x00000040) == 0x00000040)) {
optionalAnnotationClass_ = new java.util.ArrayList<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class>(optionalAnnotationClass_);
bitField0_ |= 0x00000040;
}
}
private org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder> optionalAnnotationClassBuilder_;
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class> getOptionalAnnotationClassList() {
if (optionalAnnotationClassBuilder_ == null) {
return java.util.Collections.unmodifiableList(optionalAnnotationClass_);
} else {
return optionalAnnotationClassBuilder_.getMessageList();
}
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public int getOptionalAnnotationClassCount() {
if (optionalAnnotationClassBuilder_ == null) {
return optionalAnnotationClass_.size();
} else {
return optionalAnnotationClassBuilder_.getCount();
}
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Class getOptionalAnnotationClass(int index) {
if (optionalAnnotationClassBuilder_ == null) {
return optionalAnnotationClass_.get(index);
} else {
return optionalAnnotationClassBuilder_.getMessage(index);
}
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder setOptionalAnnotationClass(
int index, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class value) {
if (optionalAnnotationClassBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.set(index, value);
onChanged();
} else {
optionalAnnotationClassBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder setOptionalAnnotationClass(
int index, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder builderForValue) {
if (optionalAnnotationClassBuilder_ == null) {
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.set(index, builderForValue.build());
onChanged();
} else {
optionalAnnotationClassBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder addOptionalAnnotationClass(org.jetbrains.kotlin.metadata.DebugProtoBuf.Class value) {
if (optionalAnnotationClassBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.add(value);
onChanged();
} else {
optionalAnnotationClassBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder addOptionalAnnotationClass(
int index, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class value) {
if (optionalAnnotationClassBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.add(index, value);
onChanged();
} else {
optionalAnnotationClassBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder addOptionalAnnotationClass(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder builderForValue) {
if (optionalAnnotationClassBuilder_ == null) {
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.add(builderForValue.build());
onChanged();
} else {
optionalAnnotationClassBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder addOptionalAnnotationClass(
int index, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder builderForValue) {
if (optionalAnnotationClassBuilder_ == null) {
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.add(index, builderForValue.build());
onChanged();
} else {
optionalAnnotationClassBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder addAllOptionalAnnotationClass(
java.lang.Iterable<? extends org.jetbrains.kotlin.metadata.DebugProtoBuf.Class> values) {
if (optionalAnnotationClassBuilder_ == null) {
ensureOptionalAnnotationClassIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, optionalAnnotationClass_);
onChanged();
} else {
optionalAnnotationClassBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder clearOptionalAnnotationClass() {
if (optionalAnnotationClassBuilder_ == null) {
optionalAnnotationClass_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000040);
onChanged();
} else {
optionalAnnotationClassBuilder_.clear();
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public Builder removeOptionalAnnotationClass(int index) {
if (optionalAnnotationClassBuilder_ == null) {
ensureOptionalAnnotationClassIsMutable();
optionalAnnotationClass_.remove(index);
onChanged();
} else {
optionalAnnotationClassBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder getOptionalAnnotationClassBuilder(
int index) {
return getOptionalAnnotationClassFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder getOptionalAnnotationClassOrBuilder(
int index) {
if (optionalAnnotationClassBuilder_ == null) {
return optionalAnnotationClass_.get(index); } else {
return optionalAnnotationClassBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public java.util.List<? extends org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder>
getOptionalAnnotationClassOrBuilderList() {
if (optionalAnnotationClassBuilder_ != null) {
return optionalAnnotationClassBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(optionalAnnotationClass_);
}
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder addOptionalAnnotationClassBuilder() {
return getOptionalAnnotationClassFieldBuilder().addBuilder(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.getDefaultInstance());
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder addOptionalAnnotationClassBuilder(
int index) {
return getOptionalAnnotationClassFieldBuilder().addBuilder(
index, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.getDefaultInstance());
}
/**
* <code>repeated .org.jetbrains.kotlin.metadata.Class optional_annotation_class = 16;</code>
*
* <pre>
* &#64;OptionalExpectation-annotated annotation classes in this module. This list is only used in the compiler frontend when compiling
* a second-tier multiplatform module against a multiplatform module which uses optional annotations, not actualized on the JVM.
* This is not needed in the IDE because optional annotations can only be used in common modules, where the IDE plugin resolves
* it to the corresponding class with the resolution capabilities of common modules.
* </pre>
*/
public java.util.List<org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder>
getOptionalAnnotationClassBuilderList() {
return getOptionalAnnotationClassFieldBuilder().getBuilderList();
}
private org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder>
getOptionalAnnotationClassFieldBuilder() {
if (optionalAnnotationClassBuilder_ == null) {
optionalAnnotationClassBuilder_ = new org.jetbrains.kotlin.protobuf.RepeatedFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Class, org.jetbrains.kotlin.metadata.DebugProtoBuf.Class.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.ClassOrBuilder>(
optionalAnnotationClass_,
((bitField0_ & 0x00000040) == 0x00000040),
getParentForChildren(),
isClean());
optionalAnnotationClass_ = null;
}
return optionalAnnotationClassBuilder_;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.metadata.jvm.Module)
}
@@ -5212,7 +4644,7 @@ public final class DebugJvmModuleProtoBuf {
"\n,core/metadata.jvm/src/jvm_module.debug" +
".proto\022!org.jetbrains.kotlin.metadata.jv" +
"m\032&core/metadata/src/metadata.debug.prot" +
"o\"\316\003\n\006Module\022F\n\rpackage_parts\030\001 \003(\0132/.or" +
"o\"\205\003\n\006Module\022F\n\rpackage_parts\030\001 \003(\0132/.or" +
"g.jetbrains.kotlin.metadata.jvm.PackageP" +
"arts\022G\n\016metadata_parts\030\002 \003(\0132/.org.jetbr" +
"ains.kotlin.metadata.jvm.PackageParts\022\030\n" +
@@ -5221,18 +4653,16 @@ public final class DebugJvmModuleProtoBuf {
"ringTable\022O\n\024qualified_name_table\030\005 \001(\0132",
"1.org.jetbrains.kotlin.metadata.Qualifie" +
"dNameTable\022=\n\nannotation\030\006 \003(\0132).org.jet" +
"brains.kotlin.metadata.Annotation\022G\n\031opt" +
"ional_annotation_class\030\020 \003(\0132$.org.jetbr" +
"ains.kotlin.metadata.Class\"\276\002\n\014PackagePa" +
"rts\022\027\n\017package_fq_name\030\001 \002(\t\022\030\n\020short_cl" +
"ass_name\030\002 \003(\t\022*\n\036multifile_facade_short" +
"_name_id\030\003 \003(\005B\002\020\001\022#\n\033multifile_facade_s" +
"hort_name\030\004 \003(\t\022.\n&class_with_jvm_packag" +
"e_name_short_name\030\005 \003(\t\022F\n:class_with_jv",
"m_package_name_multifile_facade_short_na" +
"me_id\030\007 \003(\005B\002\020\001\0222\n&class_with_jvm_packag" +
"e_name_package_id\030\006 \003(\005B\002\020\001B\030B\026DebugJvmM" +
"oduleProtoBuf"
"brains.kotlin.metadata.Annotation\"\276\002\n\014Pa" +
"ckageParts\022\027\n\017package_fq_name\030\001 \002(\t\022\030\n\020s" +
"hort_class_name\030\002 \003(\t\022*\n\036multifile_facad" +
"e_short_name_id\030\003 \003(\005B\002\020\001\022#\n\033multifile_f" +
"acade_short_name\030\004 \003(\t\022.\n&class_with_jvm" +
"_package_name_short_name\030\005 \003(\t\022F\n:class_" +
"with_jvm_package_name_multifile_facade_s" +
"hort_name_id\030\007 \003(\005B\002\020\001\0222\n&class_with_jvm",
"_package_name_package_id\030\006 \003(\005B\002\020\001B\030B\026De" +
"bugJvmModuleProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -5252,7 +4682,7 @@ public final class DebugJvmModuleProtoBuf {
internal_static_org_jetbrains_kotlin_metadata_jvm_Module_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_metadata_jvm_Module_descriptor,
new java.lang.String[] { "PackageParts", "MetadataParts", "JvmPackageName", "StringTable", "QualifiedNameTable", "Annotation", "OptionalAnnotationClass", });
new java.lang.String[] { "PackageParts", "MetadataParts", "JvmPackageName", "StringTable", "QualifiedNameTable", "Annotation", });
internal_static_org_jetbrains_kotlin_metadata_jvm_PackageParts_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_org_jetbrains_kotlin_metadata_jvm_PackageParts_fieldAccessorTable = new

View File

@@ -4656,8 +4656,7 @@ public final class DebugJvmProtoBuf {
* <code>extend .org.jetbrains.kotlin.metadata.Class { ... }</code>
*
* <pre>
* first bit: isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* second bit: is all-compatibility mode or not, 1 - yes, 0 - no
* isFunctionBodyInInterface: 0 if actual body generated in DefaultImpl, 1 - otherwise (in interface default method)
* </pre>
*/
public static final

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