Compare commits

...

578 Commits

Author SHA1 Message Date
Victor Petukhov
4e9f28f96a 1 2021-04-08 17:04:58 +03:00
Victor Petukhov
582d41623a 1 2021-04-08 17:04:38 +03:00
Victor Petukhov
f933345540 Support type enhancement on freshly supported module level annotations 2021-04-08 10:10:43 +03:00
Victor Petukhov
37410d188b 1 2021-04-08 10:10:15 +03:00
Victor Petukhov
a2f41ff1c8 1 2021-04-07 17:13:45 +03:00
Victor Petukhov
8bfcd054a2 Support reading annotations on java 9 module on sources and binaries 2021-04-07 17:09:29 +03:00
Victor Petukhov
9e068cdcbe Add binary java 9 modules properly in the tests 2021-04-07 17:06:13 +03:00
Victor Petukhov
56618ecf88 Add directive ALL_JAVA_AS_BINARIES and use it explicitly for foreign annotations tests with compiled java 2021-04-06 17:45:08 +03:00
Victor Petukhov
e6f481fed6 Add extraModulepath 2021-04-06 17:42:20 +03:00
Victor Petukhov
cbff9a92a2 Revert abstract 2021-04-06 17:37:14 +03:00
Victor Petukhov
29f22c4a27 Move jspecify tests 2021-04-06 17:30:41 +03:00
Victor Petukhov
78b97916d8 Revert abstract 2021-04-06 17:30:25 +03:00
Victor Petukhov
8eadffa152 Update some third-party annotations 2021-04-06 16:28:25 +03:00
Victor Petukhov
ec7590cd27 Add basic diagnostic tests for java 9 modules 2021-04-06 16:27:39 +03:00
Victor Petukhov
3f5e45eb4b Support java 9 modules in the diagnostic tests both in sources and binaries 2021-04-06 16:25:16 +03:00
Victor Petukhov
7f3cd73e0d Revert tests 2021-04-06 16:21:17 +03:00
Victor Petukhov
3ef7efb9d4 Revert abstract 2021-04-06 16:17:52 +03:00
Victor Petukhov
476fb80c53 Introduce special common directives for tests based on foreign annotation tests 2021-04-05 18:08:01 +03:00
Victor Petukhov
1f0f3bc112 1 2021-04-05 18:04:38 +03:00
Victor Petukhov
f5d4a64fb2 [Jspecify] Move diagnostic tests against compiled java under the new tests infrastructure 2021-04-05 18:04:27 +03:00
Victor Petukhov
ff750b3c52 [Jspecify] Move jspecify test runner under the new tests infrastructure 2021-04-05 17:59:03 +03:00
Victor Petukhov
f4b8207eb1 Move foreign annotation tests into diagnostics folder 2021-04-05 17:23:01 +03:00
Victor Petukhov
f0ebf38fc9 [Jspecify] Remove Kotlin use sites generator: consider manually picking changes from the jspecify repo 2021-04-05 17:08:53 +03:00
Victor Petukhov
5b9a581094 1 2021-04-03 09:54:10 +03:00
Victor Petukhov
f99d87b8c2 Clean-up JavaModuleInfo.kt 2021-04-03 09:53:40 +03:00
Victor Petukhov
f45a471457 Assert that the separation of two annotations on function type during rendering it, is any whitespace-like symbol, not only whitespace itself
E.g. in quick doc mode (HTML), it may be line break

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

 #KT-44658 Fixed

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

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

 #KT-12063 Fixed

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

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

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

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

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

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

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

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

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

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

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

^KT-42042 Fixed

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

 #KT-44624 Fixed

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

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

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

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

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

^KT-45621 fixed

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

^KT-45621 fixed

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

^KT-45621 fixed

[Gradle, JS] Use patch only for webpack 5

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

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

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

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

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

 #KT-45504 Fixed

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

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

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

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

[Gradle, JS] Adopt Gradle plugin to webpack 5

^KT-42921 fixed

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

^KT-42921 fixed

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

^KT-42921 fixed

[Gradle, JS] Fix of using format-util

^KT-42921 fixed

[Gradle, JS] Use compatible node version

^KT-42921 fixed

[Gradle, JS] Add compatibility with webpack 4

^KT-42921 fixed

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

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

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

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

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

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

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

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

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

 #KT-45100 Fixed

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

 #KT-45486 Fixed

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

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

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

^KT-37127 Fixed

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

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

The rest is trivial code moving/methods introduction

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

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

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

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

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

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

Lets consider two possible cases:

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

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

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

^KT-44756 Fixed

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

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

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

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

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

 #KT-45292 Fixed

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

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

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

Fixes KT-44412

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

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

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

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

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

KT-44717

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

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

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

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

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

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

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

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

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

 #KT-44827 Fixed

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

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

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

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

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

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

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

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

 #KT-44496

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

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

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

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

 #KT-45323

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 KT-26234

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

- mod return type: same as divisor for integer types

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

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

Fixes KT-45298

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

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

 #KT-45007

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

 #KT-45007 Fixed

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

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

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

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

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

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

KT-45107

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 #KT-41758

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

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

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

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

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

 #KT-44726 Fixed

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

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

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

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

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

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

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

[JS IR] Fix description of dce mode argument

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

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

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

[JS IR] Extract JsError

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

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed

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

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

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

Original commit: bd222a5255c2fd6f4abfce3115f81733ef9a39f3

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

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

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

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

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

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

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

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

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

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

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

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

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

 #KT-44850 Fixed

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

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

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

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

Original commit: 12d8e88b846f29598ca3904b49996bd6a9891ccd

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

Original commit: 1d63a1b48d480b958ff44676c42b698a8ca5f64a

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Issue #KT-44845

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

^KT-44616 fixed

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

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

^KT-44433 fixed

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

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

 #KT-44594 Fixed

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

->

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

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

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

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

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

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

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

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

Update integration tests to use kotlin-test common dependency.

KT-40225

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

KT-40225

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

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

KT-40225

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

KT-40225

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

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

 #KT-31027

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

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

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

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

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

For some reason, using

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

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

 #KT-43704

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

 #KT-43704 Fixed

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

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

View File

@@ -1,6 +1,826 @@
# CHANGELOG
## 1.5-M1
### Backend. Native
- [`KT-43690`](https://youtrack.jetbrains.com/issue/KT-43690) Support compiler caches for ios_arm64
### Compiler
#### New Features
- [`KT-42522`](https://youtrack.jetbrains.com/issue/KT-42522) Enable string concatenation via invokedynamic by default for JVM target 9 and above
- [`KT-43677`](https://youtrack.jetbrains.com/issue/KT-43677) Support for Java records
- [`KT-44650`](https://youtrack.jetbrains.com/issue/KT-44650) Deprecate JVM target version 1.6
- [`KT-44787`](https://youtrack.jetbrains.com/issue/KT-44787) Suspend functions in fun interfaces
- [`KT-44865`](https://youtrack.jetbrains.com/issue/KT-44865) Allow to declare protected constructors in sealed classes
- [`KT-44869`](https://youtrack.jetbrains.com/issue/KT-44869) Compiling sealed interface with version less than 1.5: error message from future could be provided
#### Performance Improvements
- [`KT-6336`](https://youtrack.jetbrains.com/issue/KT-6336) Optimize generation of local functions
- [`KT-7307`](https://youtrack.jetbrains.com/issue/KT-7307) Optimize infix call of String.plus
- [`KT-18692`](https://youtrack.jetbrains.com/issue/KT-18692) Optimize '<optimizable_range> step x' for-in loop
- [`KT-19978`](https://youtrack.jetbrains.com/issue/KT-19978) Inefficient bytecode generated for function references undergoing Java SAM conversion
- [`KT-23565`](https://youtrack.jetbrains.com/issue/KT-23565) OperationsMapGenerated.kt generates unreasonable amount of bytecode
- [`KT-23825`](https://youtrack.jetbrains.com/issue/KT-23825) Tail suspend call utilizing elvis operator does not take advantage of suspend tail call optimization
- [`KT-23826`](https://youtrack.jetbrains.com/issue/KT-23826) A suspend function on the right side of a returned || condition is not tail call optimized
- [`KT-25348`](https://youtrack.jetbrains.com/issue/KT-25348) No compile time unsigned integer conversion when using hex literal
- [`KT-26590`](https://youtrack.jetbrains.com/issue/KT-26590) Do not generate create method for suspend lambdas if its arity >= 2
- [`KT-27427`](https://youtrack.jetbrains.com/issue/KT-27427) Optimize nullable check introduced with 'as' cast
- [`KT-28246`](https://youtrack.jetbrains.com/issue/KT-28246) Redundant boxing/unboxing isn't eliminated by the compiler in case of inline classes and javaClass intrinsic
- [`KT-30605`](https://youtrack.jetbrains.com/issue/KT-30605) Constant folding doesn't evaluate inv() function
- [`KT-36845`](https://youtrack.jetbrains.com/issue/KT-36845) Generate enum-based TABLESWITCH/LOOKUPSWITCH on a value with smart cast to enum in JVM_IR
- [`KT-39585`](https://youtrack.jetbrains.com/issue/KT-39585) JVM BE generates redundant accessor calls when accessing static final field lifted from companion
- [`KT-40886`](https://youtrack.jetbrains.com/issue/KT-40886) Old JVM BE unspills ACONST_NULL from continuation
#### Fixes
- [`KT-6007`](https://youtrack.jetbrains.com/issue/KT-6007) Support changed return type of inlined generic function when lambda returns anonymous object
- [`KT-6055`](https://youtrack.jetbrains.com/issue/KT-6055) Failed invoke plus assign on array element accessed via several args through local get/set convention extensions
- [`KT-6879`](https://youtrack.jetbrains.com/issue/KT-6879) CompilationException when local classes hierarchy is placed within other local or inner declaration
- [`KT-8120`](https://youtrack.jetbrains.com/issue/KT-8120) NoSuchMethodError on local class constructor call inside a local class
- [`KT-8199`](https://youtrack.jetbrains.com/issue/KT-8199) "Cannot pop operand off an empty stack" for local class using a captured variable as default value for constructor parameter
- [`KT-10835`](https://youtrack.jetbrains.com/issue/KT-10835) "AssertionError: Non-outer parameter incorrectly mapped to outer" when inlining object literal extending inner class
- [`KT-12790`](https://youtrack.jetbrains.com/issue/KT-12790) Don't generate synthetic accessors for private inline function/properties
- [`KT-13213`](https://youtrack.jetbrains.com/issue/KT-13213) IllegalArgumentException in ByteVector.putUTF8 on attempt to compile file with moderately long string literal
- [`KT-14628`](https://youtrack.jetbrains.com/issue/KT-14628) "UnsupportedOperationException: Don't know how to generate outer expression" for nested class inheriting from inner class with a companion object
- [`KT-14833`](https://youtrack.jetbrains.com/issue/KT-14833) JVM internal error: Augment assignment and increment are not supported for local delegated properties and inline properties
- [`KT-15403`](https://youtrack.jetbrains.com/issue/KT-15403) Suspend operator get wrong code generated by BE (NoSuchMethodError)
- [`KT-15404`](https://youtrack.jetbrains.com/issue/KT-15404) Suspend operator set wrong code generated
- [`KT-16084`](https://youtrack.jetbrains.com/issue/KT-16084) Proguard can't find enclosing class of let closure inside apply closure
- [`KT-16151`](https://youtrack.jetbrains.com/issue/KT-16151) Internal compiler error when using plusAssign operator with mutable map
- [`KT-16221`](https://youtrack.jetbrains.com/issue/KT-16221) Support in/!in suspend operators
- [`KT-16282`](https://youtrack.jetbrains.com/issue/KT-16282) "Cannot pop operand off an empty stack" for plusAssign with default parameters in setter operator
- [`KT-16445`](https://youtrack.jetbrains.com/issue/KT-16445) `java.lang.VerifyError: Bad type on operand stack` when delegating an interface through a private reified function inside an object
- [`KT-16520`](https://youtrack.jetbrains.com/issue/KT-16520) Invalid bytecode semantics for set call by convention with default parameters
- [`KT-16567`](https://youtrack.jetbrains.com/issue/KT-16567) Inliner creates redundant objects on source inlining
- [`KT-16752`](https://youtrack.jetbrains.com/issue/KT-16752) Delegating function interface to function reference does not work
- [`KT-17554`](https://youtrack.jetbrains.com/issue/KT-17554) Incorrect cast to Unit generated on annotated when-expression with a single-branch if inside
- [`KT-17738`](https://youtrack.jetbrains.com/issue/KT-17738) Java cannot extend class implementing kotlin.collections.Map
- [`KT-17753`](https://youtrack.jetbrains.com/issue/KT-17753) Strange behavior of if and return statements
- [`KT-18583`](https://youtrack.jetbrains.com/issue/KT-18583) "ISE: Recursive call in a lazy value" for generic sealed class with nested subclass in a `when(this)` with inferred return type
- [`KT-19861`](https://youtrack.jetbrains.com/issue/KT-19861) "IllegalStateException: Label wasn't found during iterating through instructions" for `plusAssign` with safe call
- [`KT-20996`](https://youtrack.jetbrains.com/issue/KT-20996) IllegalStateException: Cannot get FQ name of local class: class <no name provided> in metadata serialization for common code
- [`KT-21014`](https://youtrack.jetbrains.com/issue/KT-21014) Incorrect bytecode generated for 'PrimitiveArray::size'
- [`KT-21092`](https://youtrack.jetbrains.com/issue/KT-21092) Reference `javaClass` for generic property: "couldn't transform method node: get()"
- [`KT-21778`](https://youtrack.jetbrains.com/issue/KT-21778) "IllegalStateException: Couldn't build context" for inline function inside an anonymous object
- [`KT-21900`](https://youtrack.jetbrains.com/issue/KT-21900) VerifyError on equals on generic primitive type
- [`KT-22098`](https://youtrack.jetbrains.com/issue/KT-22098) "UnsupportedOperationException: Don't know how to generate outer expression" on extension function call inside lambda in anonymous object super constructor call
- [`KT-22488`](https://youtrack.jetbrains.com/issue/KT-22488) Bad line numbers generated for '&&' expression
- [`KT-22972`](https://youtrack.jetbrains.com/issue/KT-22972) A compiler bug(?) in Number class descendants
- [`KT-23619`](https://youtrack.jetbrains.com/issue/KT-23619) Transform stateless singleton lambda during inline
- [`KT-23881`](https://youtrack.jetbrains.com/issue/KT-23881) Declaration of lambda in inlined apply block holds reference to superfluous references causing leak
- [`KT-24135`](https://youtrack.jetbrains.com/issue/KT-24135) Calling invoke on crossinline suspend lambda leads to no state-machine
- [`KT-24193`](https://youtrack.jetbrains.com/issue/KT-24193) NoClassDefFoundError: java/lang/Cloneable$DefaultImpls on inheritance from Cloneable through an interface
- [`KT-24305`](https://youtrack.jetbrains.com/issue/KT-24305) ClassNotFoundException when using Java reflection on local class in an inlined lambda
- [`KT-24564`](https://youtrack.jetbrains.com/issue/KT-24564) Custom operator fun set on ByteArray resolves properly but is miscompiled
- [`KT-25400`](https://youtrack.jetbrains.com/issue/KT-25400) "NoClassDefFoundError: kotlin/KotlinPackage" with Turkish system locale on macOS
- [`KT-26130`](https://youtrack.jetbrains.com/issue/KT-26130) Incorrect method signature for a generic function with inline class as a type parameter upper bound
- [`KT-26360`](https://youtrack.jetbrains.com/issue/KT-26360) "Method from super interface has a different signature" for Interface that extends both interfaces with and without @JvmDefault
- [`KT-26473`](https://youtrack.jetbrains.com/issue/KT-26473) Error on compiling inline class with calls of super methods equals(), hashCode(), toString()
- [`KT-26474`](https://youtrack.jetbrains.com/issue/KT-26474) VE “Bad type on operand stack” at runtime on calling toString() method of inline class with calls of super methods (toString(), equals(), hashCode()) inside
- [`KT-27449`](https://youtrack.jetbrains.com/issue/KT-27449) NoSuchMethodError for local suspend function with suspend lambda parameter with default value
- [`KT-27469`](https://youtrack.jetbrains.com/issue/KT-27469) "Cannot pop operand off an empty stack" for compound assignment (plusAssign) with a `vararg` operator get
- [`KT-27825`](https://youtrack.jetbrains.com/issue/KT-27825) Gradually prohibit non-abstract classes containing abstract members invisible from that classes (internal/package-private)
- [`KT-27830`](https://youtrack.jetbrains.com/issue/KT-27830) "Incompatible stack heights" with suspend inline function in do while loop that executes suspend lambda
- [`KT-28042`](https://youtrack.jetbrains.com/issue/KT-28042) "Cannot pop operand off an empty stack" for a bound callable reference of lambda inside inline function
- [`KT-28166`](https://youtrack.jetbrains.com/issue/KT-28166) "Argument 1: expected I, but found R" for generic method with generic parameter or receiver with inline class upper bound
- [`KT-28331`](https://youtrack.jetbrains.com/issue/KT-28331) Consider generating accessors for lateinit properties to avoid assertion on each call
- [`KT-28573`](https://youtrack.jetbrains.com/issue/KT-28573) Inliner does not update references to transformed object
- [`KT-29331`](https://youtrack.jetbrains.com/issue/KT-29331) "AnalyzerException: Argument 1: expected R, but found I" with local generic extension property called on `Int` receiver
- [`KT-29595`](https://youtrack.jetbrains.com/issue/KT-29595) NoClassDefFoundError with inline reified function with lambda argument returning anonymous object
- [`KT-29802`](https://youtrack.jetbrains.com/issue/KT-29802) Incorrect reification when the same type parameter name is used for different reified types
- [`KT-30041`](https://youtrack.jetbrains.com/issue/KT-30041) "AnalyzerException: Expected an object reference, but found ." on nested suspend function calls outer suspend function
- [`KT-30066`](https://youtrack.jetbrains.com/issue/KT-30066) Consider adding annotations to ConeKotlinType
- [`KT-30280`](https://youtrack.jetbrains.com/issue/KT-30280) Inline class class literal gets unwrapped in annotation arguments
- [`KT-30402`](https://youtrack.jetbrains.com/issue/KT-30402) Constant folding works incorrectly with unsigned arithmetics
- [`KT-30548`](https://youtrack.jetbrains.com/issue/KT-30548) "java.lang.IndexOutOfBoundsException: Cannot pop operand off an empty stack" while compiling access to a private lateinit companion field
- [`KT-30629`](https://youtrack.jetbrains.com/issue/KT-30629) `java.lang.VerifyError: Bad type on operand stack` when using a function reference to a generic property
- [`KT-30933`](https://youtrack.jetbrains.com/issue/KT-30933) Inline function produces IllegalAccessError on property reference from different package
- [`KT-31136`](https://youtrack.jetbrains.com/issue/KT-31136) "AnalyzerException: Argument 1: expected R, but found I" on x::javaClass when x is inline class object built around primitive type
- [`KT-31227`](https://youtrack.jetbrains.com/issue/KT-31227) Prohibit using array based on non-reified type parameters as reified type arguments on JVM
- [`KT-31592`](https://youtrack.jetbrains.com/issue/KT-31592) NoSuchMethodException when inlining public function accessing a protected static Java class member
- [`KT-31727`](https://youtrack.jetbrains.com/issue/KT-31727) Object expression captures all variables used in constructor
- [`KT-32023`](https://youtrack.jetbrains.com/issue/KT-32023) "AnalyzerException: Expected I, but found R" with inline suspend function used with callable reference
- [`KT-32115`](https://youtrack.jetbrains.com/issue/KT-32115) NPE during initialization of enum class with delegated property
- [`KT-32153`](https://youtrack.jetbrains.com/issue/KT-32153) "AnalyzerException: Expected an object reference, but found ." with recursive suspend local function
- [`KT-32351`](https://youtrack.jetbrains.com/issue/KT-32351) ClassNotFoundException for anonymous object implementing interface inside a lambda with data class and inline methods
- [`KT-32384`](https://youtrack.jetbrains.com/issue/KT-32384) Safe cast to generic type argument with inline class upper-bound throws NPE instead of ClassCastException
- [`KT-32579`](https://youtrack.jetbrains.com/issue/KT-32579) java.lang.VerifyError: Bad type on operand stack on calling inner class of inherited class in super class when casting to inherited class
- [`KT-32749`](https://youtrack.jetbrains.com/issue/KT-32749) "VerifyError: Call to wrong <init> method" with inline function and accessing class field from anonymous object
- [`KT-32793`](https://youtrack.jetbrains.com/issue/KT-32793) Generated code crashes by ClassCastException with local suspend function and inline class
- [`KT-32812`](https://youtrack.jetbrains.com/issue/KT-32812) "AnalyzerException: Argument 1: expected R, but found I" invoking function with default parameter inherited by inline class
- [`KT-32821`](https://youtrack.jetbrains.com/issue/KT-32821) Missing unboxing of inline class for complex hierarchy of suspend calls
- [`KT-33155`](https://youtrack.jetbrains.com/issue/KT-33155) ClassNotFoundException for qualified this in anonymous object and as a result of inline function call
- [`KT-33173`](https://youtrack.jetbrains.com/issue/KT-33173) Internal error: "AnalyzerException: Expected I, but found R" for supercall inside inline lambda from HashSet.remove implementation
- [`KT-33577`](https://youtrack.jetbrains.com/issue/KT-33577) NoSuchFieldError with nested anonymous objects accessing outer instance property
- [`KT-33836`](https://youtrack.jetbrains.com/issue/KT-33836) Wrong code generated for a local tailrec suspend function.
- [`KT-33873`](https://youtrack.jetbrains.com/issue/KT-33873) ClassCastException invoking UByte setter function via reflection
- [`KT-34018`](https://youtrack.jetbrains.com/issue/KT-34018) "Cannot pop operand off an empty stack" with inline lambda with callable reference
- [`KT-34186`](https://youtrack.jetbrains.com/issue/KT-34186) JDK11: class file contains malformed variable arity method for vararg sealed class constructor
- [`KT-34202`](https://youtrack.jetbrains.com/issue/KT-34202) IllegalAccessError on callable reference of function from multifile facade from standard library
- [`KT-34255`](https://youtrack.jetbrains.com/issue/KT-34255) @JvmStatic tailrec function: "Cannot pop operand off an empty stack"
- [`KT-34507`](https://youtrack.jetbrains.com/issue/KT-34507) Incorrect generated code for mutable collection stub methods in case of presence of functions with similar signature
- [`KT-34665`](https://youtrack.jetbrains.com/issue/KT-34665) Possible index overflow in optimized "for" loop over withIndex()
- [`KT-34754`](https://youtrack.jetbrains.com/issue/KT-34754) Flow builder: "AnalyzerException: Expected an object reference, but found ." with recursive suspend local function
- [`KT-34816`](https://youtrack.jetbrains.com/issue/KT-34816) "AnalyzerException: Expected an object reference, but found I" on "this" in inline class member extension suspend function
- [`KT-34841`](https://youtrack.jetbrains.com/issue/KT-34841) ClassNotFoundException when invoke param function inside anonymous object method
- [`KT-35008`](https://youtrack.jetbrains.com/issue/KT-35008) "AnalyzerException: Expected an object reference, but found I" in inline class companion calling private constructor
- [`KT-35166`](https://youtrack.jetbrains.com/issue/KT-35166) `NoSuchMethodError` at runtime with local property delegate on anonymous object referencing another anonymous object
- [`KT-35301`](https://youtrack.jetbrains.com/issue/KT-35301) MethodInliner fails with "AssertionError: <init> call doesn't correspond to object transformation info" for qualified this in SAM constructor used as parameter of anonymous object inside inline lambda
- [`KT-35419`](https://youtrack.jetbrains.com/issue/KT-35419) `Failed to generate expression: KtNamedFunction` for local suspend tailrec function with receiver
- [`KT-35511`](https://youtrack.jetbrains.com/issue/KT-35511) VerifyError: "Bad type on operand stack" after reification
- [`KT-35553`](https://youtrack.jetbrains.com/issue/KT-35553) Kotlin compiler generates methods that always have line number 1 for Inline Classes
- [`KT-35725`](https://youtrack.jetbrains.com/issue/KT-35725) "AssertionError: Couldn't find a context for a super-call" for `super` member call in property initializer of companion object
- [`KT-36420`](https://youtrack.jetbrains.com/issue/KT-36420) ClassCastException with inline class Foo extending generic Comparable<Foo>
- [`KT-36713`](https://youtrack.jetbrains.com/issue/KT-36713) AnalyzerException: "Incompatible stack heights" with suspend and inline suspend functions
- [`KT-36794`](https://youtrack.jetbrains.com/issue/KT-36794) Move $assertionsDisabled field to the top-level class
- [`KT-36875`](https://youtrack.jetbrains.com/issue/KT-36875) "RuntimeException: Trying to access skipped parameter" on synthetic local variable access from inline function
- [`KT-36916`](https://youtrack.jetbrains.com/issue/KT-36916) AnalyzerException: Argument 1: expected I, but found R when using inline class with rxjava
- [`KT-36957`](https://youtrack.jetbrains.com/issue/KT-36957) Exception during codegen: cannot pop operand off an empty stack (Nothing variable in string interpolation)
- [`KT-36984`](https://youtrack.jetbrains.com/issue/KT-36984) SAM adapter classes should be generated as anonymous inner classes in JVM_IR
- [`KT-37704`](https://youtrack.jetbrains.com/issue/KT-37704) Incorrect SMAP syntax
- [`KT-37716`](https://youtrack.jetbrains.com/issue/KT-37716) "AssertionError: <init> call doesn't correspond to object transformation info" with inline reified type parameter, anonymous object and lambda in constructor call
- [`KT-37972`](https://youtrack.jetbrains.com/issue/KT-37972) IllegalAccessError on initializing property reference for a property declared in JvmMultifileClass with -Xmultifile-parts-inherit
- [`KT-38833`](https://youtrack.jetbrains.com/issue/KT-38833) JVM: java.lang.ClassCastException when loop variable is nullable in for loop over unsigned progression
- [`KT-38849`](https://youtrack.jetbrains.com/issue/KT-38849) Read-only variable initialized in non-inline lambda using contract callsInPlace EXACTLY_ONCE is not captured correctly in nested lambdas
- [`KT-38869`](https://youtrack.jetbrains.com/issue/KT-38869) JVM BE produces invalid bytecode when inheriting from AbstractList and declaring methods that look like MutableList implementors (but they aren't)
- [`KT-38965`](https://youtrack.jetbrains.com/issue/KT-38965) "UnsupportedOperationException: Don't know how to generate outer expression: Closure" with reference to local variable in block argument of anonymous object `by` delegation
- [`KT-39289`](https://youtrack.jetbrains.com/issue/KT-39289) CCE in if-else inside annotated 'if' statement
- [`KT-39425`](https://youtrack.jetbrains.com/issue/KT-39425) AbstractMethodError: "Receiver class does not define or inherit an implementation of the resolved method" using classes with complex Java and Kotlin inheritance hierarchies.
- [`KT-39434`](https://youtrack.jetbrains.com/issue/KT-39434) IllegalAccessError with local delegated property in lambda in inlined function
- [`KT-39687`](https://youtrack.jetbrains.com/issue/KT-39687) "Couldn't find captured this" when more than 3 inline functions are nested
- [`KT-39784`](https://youtrack.jetbrains.com/issue/KT-39784) "IndexOutOfBoundsException: Cannot pop operand off an empty stack" caused by JvmOverloads annotation inside an inline class
- [`KT-40165`](https://youtrack.jetbrains.com/issue/KT-40165) ClassCastException caused by SAM conversion used on a functional interface with suspended function
- [`KT-40179`](https://youtrack.jetbrains.com/issue/KT-40179) "VerifyError: Bad type on operand stack" with parent class `get` extension function and child class `set` extension function which used inside child class `plusAssign` extension function
- [`KT-40277`](https://youtrack.jetbrains.com/issue/KT-40277) Fix generic types in special bridge methods
- [`KT-40308`](https://youtrack.jetbrains.com/issue/KT-40308) NoSuchFieldError for multiple delegated extension properties with the same name in a companion object
- [`KT-40338`](https://youtrack.jetbrains.com/issue/KT-40338) NoSuchFieldError on property without backing field that is called as function reference
- [`KT-40396`](https://youtrack.jetbrains.com/issue/KT-40396) NI: Exceptions when ambiguous type argument and generic invoke
- [`KT-40510`](https://youtrack.jetbrains.com/issue/KT-40510) "AssertionError: DELEGATION slice must override something" for ByteBuffer delegation
- [`KT-40601`](https://youtrack.jetbrains.com/issue/KT-40601) VerifyError: "interface method reference is in an indirect superinterface" when calling @JvmDefault suspend method
- [`KT-40809`](https://youtrack.jetbrains.com/issue/KT-40809) "Couldn't find captured field" compiler error with local function with recursive call through method reference
- [`KT-41105`](https://youtrack.jetbrains.com/issue/KT-41105) IllegalStateException: 'Couldn't find declaration file <class name>' with inline delegate declared in another file
- [`KT-41165`](https://youtrack.jetbrains.com/issue/KT-41165) "IllegalStateException: Concrete fake override public final fun" when an enum class inherits an interface with a variable 'name' or 'ordinal'
- [`KT-41222`](https://youtrack.jetbrains.com/issue/KT-41222) "IllegalStateException: Concrete fake override public final fun" when a class property is inherited as merged 'var' from 'val' and 'var' from parent abstract class and interface properties
- [`KT-41255`](https://youtrack.jetbrains.com/issue/KT-41255) JDK 11: "VerifyError: Bad type on operand stack" with long function body with annotated `when` expression
- [`KT-41427`](https://youtrack.jetbrains.com/issue/KT-41427) NoSuchMethodError caused by implementation by delegation to function reference
- [`KT-41508`](https://youtrack.jetbrains.com/issue/KT-41508) ClassNotFoundException caused by object with overridden function inside a lambda with safe cast receiver
- [`KT-41750`](https://youtrack.jetbrains.com/issue/KT-41750) Inline classes: ClassCastExceptionError when calling .withIndex() on Iterator over Array
- [`KT-41770`](https://youtrack.jetbrains.com/issue/KT-41770) AssertionError: "Asm parameter types should be the same length as Kotlin parameter types" cause by fun interface
- [`KT-41874`](https://youtrack.jetbrains.com/issue/KT-41874) "IllegalStateException: Couldn't obtain compiled function body" on extension delegated property with inline operator getValue in a different file
- [`KT-41917`](https://youtrack.jetbrains.com/issue/KT-41917) [FIR] Incorrect calculating property type for override from intersection scope
- [`KT-42012`](https://youtrack.jetbrains.com/issue/KT-42012) IllegalAccess to protected field instead of getter
- [`KT-42017`](https://youtrack.jetbrains.com/issue/KT-42017) "AssertionError: Unsigned type expected: UInt?" during codegen when a variable of nullable unsigned type is checking for presence in the range
- [`KT-42032`](https://youtrack.jetbrains.com/issue/KT-42032) "AnalyzerException: Expected I, but found R" while using Flow.reduce() with suspend function reference
- [`KT-42034`](https://youtrack.jetbrains.com/issue/KT-42034) ArrayIndexOutOfBoundsException in PopBackwardPropagationTransformer on external override of function in inline class
- [`KT-42064`](https://youtrack.jetbrains.com/issue/KT-42064) "Parameter specified as non-null is null" with default value of the parameter in operator fun
- [`KT-42069`](https://youtrack.jetbrains.com/issue/KT-42069) JVM IR: -Xreport-output-files doesn't report any source files for META-INF/*.kotlin_module files
- [`KT-42083`](https://youtrack.jetbrains.com/issue/KT-42083) AbstractMethodError when 'remove' with irrelevant generic parameter but matching JVM signature is present in Kotlin collection class
- [`KT-42175`](https://youtrack.jetbrains.com/issue/KT-42175) Psi2ir: "AssertionError: Undefined parameter referenced: <this>" on augmented assignment on this in a BuilderInference lambda
- [`KT-42179`](https://youtrack.jetbrains.com/issue/KT-42179) Platform declaration clash when extending abstract Java class implementing 'java.util.Collection' by abstract Kotlin class implementing Kotlin Set or List
- [`KT-42337`](https://youtrack.jetbrains.com/issue/KT-42337) NoSuchMethodError in JVM backend with inheritance of private functions in the interface
- [`KT-42487`](https://youtrack.jetbrains.com/issue/KT-42487) "IndexOutOfBoundsException: Cannot pop operand off an empty stack" caused by USELESS_IS_CHECK of Double type
- [`KT-42533`](https://youtrack.jetbrains.com/issue/KT-42533) `(N until MIN_VALUE).reversed()` should be an empty progression in for loops
- [`KT-42588`](https://youtrack.jetbrains.com/issue/KT-42588) "IllegalStateException: Concrete fake override public open fun" caused by `val` override with `var` with delegation.
- [`KT-42634`](https://youtrack.jetbrains.com/issue/KT-42634) Different bridges and abstract stubs behavior in abstract class implementing Map<K, String> in JVM and JVM_IR
- [`KT-42635`](https://youtrack.jetbrains.com/issue/KT-42635) ClassCastException with inline class in for loop
- [`KT-42662`](https://youtrack.jetbrains.com/issue/KT-42662) AbstractMethodError when using partially specialized generic Map class
- [`KT-42694`](https://youtrack.jetbrains.com/issue/KT-42694) @get:Synchronized causes the JVM getter method not to be generated
- [`KT-42753`](https://youtrack.jetbrains.com/issue/KT-42753) "VerifyError: Bad invokespecial instruction: interface method reference is in an indirect superinterface" with `jvm-default=all`
- [`KT-42879`](https://youtrack.jetbrains.com/issue/KT-42879) JVM: Declaration clash in fun interface implementation returning an inline class
- [`KT-42900`](https://youtrack.jetbrains.com/issue/KT-42900) "VerifyError: Bad return type" incorrect bytecode when a property and an extension property in inline class have the same names
- [`KT-42946`](https://youtrack.jetbrains.com/issue/KT-42946) FIR2IR: Fix super-calls to Java overrides of special built-in
- [`KT-42971`](https://youtrack.jetbrains.com/issue/KT-42971) JVM: "AssertionError: Unsigned type expected: T" with UInt loop range
- [`KT-42990`](https://youtrack.jetbrains.com/issue/KT-42990) "AssertionError: Next value after NEW should be one generated by DUP" caused by extension properties with accessors annotataed as @JvmStatic
- [`KT-43034`](https://youtrack.jetbrains.com/issue/KT-43034) AssertionError: Compiler fails with complicated tailrec + inline case
- [`KT-43048`](https://youtrack.jetbrains.com/issue/KT-43048) JVM_IR: Implement coroutines state clearing
- [`KT-43050`](https://youtrack.jetbrains.com/issue/KT-43050) JVM IR: incorrect mangling for method with type parameter with inline class bound in the signature
- [`KT-43059`](https://youtrack.jetbrains.com/issue/KT-43059) Different bridges behavior in class implementing Map<String, String> in JVM and JVM_IR
- [`KT-43063`](https://youtrack.jetbrains.com/issue/KT-43063) Redundant DefaultImpls delegate is generated in old JVM backend on explicit "duplicate" inheritance from interface
- [`KT-43069`](https://youtrack.jetbrains.com/issue/KT-43069) JVM: incorrect generic signature for method with implicit return type Nothing overriding a method from Collection
- [`KT-43099`](https://youtrack.jetbrains.com/issue/KT-43099) Tailrec call in not tail-call position leads to internal compiler error
- [`KT-43106`](https://youtrack.jetbrains.com/issue/KT-43106) JVM: custom `remove` in Iterator subclass results in a synthetic bridge
- [`KT-43120`](https://youtrack.jetbrains.com/issue/KT-43120) JVM: "Expected an object reference, but found ." caused by function which is passed as reference to suspend parameter
- [`KT-43255`](https://youtrack.jetbrains.com/issue/KT-43255) Verify error when inheriting from an abstract class implementing Collection with stub-like method in superclass
- [`KT-43333`](https://youtrack.jetbrains.com/issue/KT-43333) AbstractMethodError when calling 'toArray' from Java on a Kotlin Collection with custom internal 'toArray'
- [`KT-43334`](https://youtrack.jetbrains.com/issue/KT-43334) AbstractMethodError when calling 'remove' from Java on a Kotlin Collection with custom internal 'remove'
- [`KT-43342`](https://youtrack.jetbrains.com/issue/KT-43342) [FIR2IR] No getter or backing field found for delegated member call
- [`KT-43347`](https://youtrack.jetbrains.com/issue/KT-43347) [FIR] Synthetic setter with unmatched parameter type isn't found
- [`KT-43401`](https://youtrack.jetbrains.com/issue/KT-43401) JVM_IR. Additional `synchronized` flag on JvmOverloads-generated adapter for Synchronized function
- [`KT-43405`](https://youtrack.jetbrains.com/issue/KT-43405) Turkish locale, Linux Mint: "NoSuchMethodError: 'int[] kotlin.jvm.internal.Intrinsics$Kotlin.intArrayOf(int[])'" with `intArrayOf` function call
- [`KT-43460`](https://youtrack.jetbrains.com/issue/KT-43460) JVM: redundant private setter is generated in case of multifile facade
- [`KT-43473`](https://youtrack.jetbrains.com/issue/KT-43473) "VerifyError: Bad type on operand stack" caused by operator `get` with optional argument in superclass when called via square brackets on subclass
- [`KT-43518`](https://youtrack.jetbrains.com/issue/KT-43518) JVM_IR. Additional `strictfp` flag on JvmOverloads-generated adapter for Strictfp function
- [`KT-43569`](https://youtrack.jetbrains.com/issue/KT-43569) FIR: inapplicable candidate(s): kotlin/collections/set
- [`KT-43616`](https://youtrack.jetbrains.com/issue/KT-43616) [FIR] Nullable type parameter-based type after merge in if
- [`KT-43669`](https://youtrack.jetbrains.com/issue/KT-43669) FIR: No real overrides for FUN IR_EXTERNAL_DECLARATION_STUB
- [`KT-43682`](https://youtrack.jetbrains.com/issue/KT-43682) Inline extension method of a multifile library inline class not found
- [`KT-43687`](https://youtrack.jetbrains.com/issue/KT-43687) FIR: UnusedChecker does not take annotation arguments into account
- [`KT-43688`](https://youtrack.jetbrains.com/issue/KT-43688) FIR: unused checker doesn't handle invokes properly
- [`KT-43749`](https://youtrack.jetbrains.com/issue/KT-43749) "UnsupportedOperationException: Don't know how to generate outer expression: Closure" caused by Flow and collect method with function reference as a parameter
- [`KT-43812`](https://youtrack.jetbrains.com/issue/KT-43812) JVM IR: SAM wrapper class with generic supertype mentions missing type parameter in the signature
- [`KT-43832`](https://youtrack.jetbrains.com/issue/KT-43832) JVM IR: missing bridges for inheritance of class from interface in a complex generic diamond hierarchy
- [`KT-43851`](https://youtrack.jetbrains.com/issue/KT-43851) JVM IR: function call returning object instance is removed during constant propagation
- [`KT-43864`](https://youtrack.jetbrains.com/issue/KT-43864) JVM: "Assertion error after mandatory stack transformations: incorrect bytecode" with lateinit property of type T, which has a primitive type upperbound
- [`KT-43912`](https://youtrack.jetbrains.com/issue/KT-43912) JVM internal error: Augment assignment and increment are not supported for local delegated properties and inline properties
- [`KT-43915`](https://youtrack.jetbrains.com/issue/KT-43915) Back-end (JVM) Internal error: wrong bytecode generated for default method
- [`KT-43938`](https://youtrack.jetbrains.com/issue/KT-43938) NSME when calling 'kotlin.Number' methods on instance of Java class extending Kolin abstract class extending 'kotlin.Number'
- [`KT-43942`](https://youtrack.jetbrains.com/issue/KT-43942) org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate function
- [`KT-43949`](https://youtrack.jetbrains.com/issue/KT-43949) FIR: unresolved callable reference as lambda return
- [`KT-43983`](https://youtrack.jetbrains.com/issue/KT-43983) IllegalStateException: "Couldn't obtain compiled function body for public final suspend inline fun" after moving inline extension function to library
- [`KT-43984`](https://youtrack.jetbrains.com/issue/KT-43984) FIR: recursion in overridden symbols
- [`KT-44010`](https://youtrack.jetbrains.com/issue/KT-44010) FIR: Inapplicable constructor due to an unresolved reference
- [`KT-44030`](https://youtrack.jetbrains.com/issue/KT-44030) FIR2IR: uncached type parameters in delegated property
- [`KT-44032`](https://youtrack.jetbrains.com/issue/KT-44032) FIR2IR: uncached type parameters in Java field
- [`KT-44050`](https://youtrack.jetbrains.com/issue/KT-44050) FIR: anonymous object as IR parent
- [`KT-44054`](https://youtrack.jetbrains.com/issue/KT-44054) FIR2IR: incorrect IR origin for substituted override function
- [`KT-44058`](https://youtrack.jetbrains.com/issue/KT-44058) CompilationException: open suspend fun with @JvmStatic in open class companion
- [`KT-44069`](https://youtrack.jetbrains.com/issue/KT-44069) please remove deprecated usages
- [`KT-44066`](https://youtrack.jetbrains.com/issue/KT-44066) FIR Java: override ambiguity with vararg value type
- [`KT-44114`](https://youtrack.jetbrains.com/issue/KT-44114) CompilationException when inlining a extension suspend function declared in interface companion with 'this' reference to extension receiver
- [`KT-44131`](https://youtrack.jetbrains.com/issue/KT-44131) "UnsupportedOperationException: Don't know how to generate outer expression: Closure" when using suspend lambda and a function reference
- [`KT-44140`](https://youtrack.jetbrains.com/issue/KT-44140) JVM IR: compilation of kotlin.Result crashes with IOOBE while generating toString-impl
- [`KT-44141`](https://youtrack.jetbrains.com/issue/KT-44141) JVM IR: "ISE: There should be underlying type for inline class type" on usage of type parameter with Result upper bound inside a lambda
- [`KT-44192`](https://youtrack.jetbrains.com/issue/KT-44192) Allow a greater number of constants in an enum class
- [`KT-44202`](https://youtrack.jetbrains.com/issue/KT-44202) "ClassCastException" when getting delegated property with inline class and Any/Any? type
- [`KT-44233`](https://youtrack.jetbrains.com/issue/KT-44233) [IR] Collection Stub generation not correctly considering java.util Collection iterators
- [`KT-44234`](https://youtrack.jetbrains.com/issue/KT-44234) Private companion property with explicit setter generates invalid bytecode
- [`KT-44269`](https://youtrack.jetbrains.com/issue/KT-44269) "[TAILREC_ON_VIRTUAL_MEMBER_ERROR] Tailrec is not allowed on open members" with Spring annotation and private tailrec function
- [`KT-44284`](https://youtrack.jetbrains.com/issue/KT-44284) Make Kotlin binaries publicly unavailable (set KotlinCompilerVersion.IS_PRE_RELEASE = true)
- [`KT-44316`](https://youtrack.jetbrains.com/issue/KT-44316) ReenteringLazyValueComputationException when analyzing complex lazy delegate
- [`KT-44347`](https://youtrack.jetbrains.com/issue/KT-44347) Back-end (JVM) Internal error: Couldn't transform method node for suspend function with wrong local for Continuation
- [`KT-44420`](https://youtrack.jetbrains.com/issue/KT-44420) False NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATION with 1.4.30-RC
- [`KT-44429`](https://youtrack.jetbrains.com/issue/KT-44429) JVM IR: unnecessary integer unboxing leads to NPE when using mockito-kotlin
- [`KT-44439`](https://youtrack.jetbrains.com/issue/KT-44439) Type inference of generic types failing java interop
- [`KT-44440`](https://youtrack.jetbrains.com/issue/KT-44440) Too many Nothings in inferred type
- [`KT-44527`](https://youtrack.jetbrains.com/issue/KT-44527) Suspend function with kotlin.Result: ClassCastException class kotlin.Result cannot be cast to class ...
- [`KT-44529`](https://youtrack.jetbrains.com/issue/KT-44529) Inline class calls wrong iterator method in for loop
- [`KT-44533`](https://youtrack.jetbrains.com/issue/KT-44533) JVM IR: ClassFormatError on synthetic $suspendImpl method generated in interface for a @JvmDefault function
- [`KT-44540`](https://youtrack.jetbrains.com/issue/KT-44540) Regression in 1.4.30 in intellij-community: type mismatch for generic function call with generic Java class
- [`KT-44563`](https://youtrack.jetbrains.com/issue/KT-44563) Type Inference loosing type annotations in lambda type expectation for function calls with block parameters
- [`KT-44631`](https://youtrack.jetbrains.com/issue/KT-44631) "IndexOutOfBoundsException: Cannot pop operand off an empty stack" caused by a default param in inner class constructor which uses method or field from receiver
- [`KT-44647`](https://youtrack.jetbrains.com/issue/KT-44647) "IllegalAccessError: class TestKt tried to access private method" with String Builder `get` and `inc` operator
- [`KT-44651`](https://youtrack.jetbrains.com/issue/KT-44651) JVM / IR: "IllegalStateException: Illegal type substitutor" with if-else inside class constructor argument inside another if-else
- [`KT-44660`](https://youtrack.jetbrains.com/issue/KT-44660) Internal inline functions in companion object with inline class return type fails compilation
- [`KT-44671`](https://youtrack.jetbrains.com/issue/KT-44671) JVM_IR: ClassCastException: Result$Failure cannot be cast to Result with multithreaded coroutines
- [`KT-44712`](https://youtrack.jetbrains.com/issue/KT-44712) JVM / IR: Behavior change after enabling with Mockito
- [`KT-44781`](https://youtrack.jetbrains.com/issue/KT-44781) JVM IR: java.lang.NoSuchFieldError: $noName_0 when calling a crossinline lambda within a suspending lambda
- [`KT-44837`](https://youtrack.jetbrains.com/issue/KT-44837) JVM / IR: ClassCastException with Result object when it is used by a generic method in a suspend call
- [`KT-44875`](https://youtrack.jetbrains.com/issue/KT-44875) JVM_IR. `hashCode` call is generated on interface target in fun interface equality
- [`KT-45067`](https://youtrack.jetbrains.com/issue/KT-45067) "IllegalArgumentException: Wildcard mast have a bound for annotation of WILDCARD_BOUND position" with BEAM SDK 2.27
### IDE
- [`KT-33233`](https://youtrack.jetbrains.com/issue/KT-33233) Use dependency of library to build built-ins in IDE, instead of loading them from the current classloader
- [`KT-34023`](https://youtrack.jetbrains.com/issue/KT-34023) kotlin.KotlinNullPointerException at org.jetbrains.kotlin.backend.common.FunctionsFromAnyGenerator.getPrimaryConstructorProperties(FunctionsFromAnyGenerator.kt:66)
- [`KT-35947`](https://youtrack.jetbrains.com/issue/KT-35947) KFunctionN.call is unresolved in IDE in Kotlin/JVM project
- [`KT-37702`](https://youtrack.jetbrains.com/issue/KT-37702) Code analysis speed: on-the-fly analysis diagnostics reporting
- [`KT-41048`](https://youtrack.jetbrains.com/issue/KT-41048) [FIR-IDE] Properly implement methods in KtFirPackageScope
- [`KT-43824`](https://youtrack.jetbrains.com/issue/KT-43824) KtLightClassForSourceDeclaration#isInheritor works in a different way than java implementation
- [`KT-44128`](https://youtrack.jetbrains.com/issue/KT-44128) IDE: Kotlin JVM record has incorrect property accessors as seen from Java
### IDE. Gradle Integration
- [`KT-42048`](https://youtrack.jetbrains.com/issue/KT-42048) KJS / Gradle integration: Could not determine the dependencies of task ':webApp:testPackageJson' in Android Studio 4.2 Canary 11
### IDE. Inspections and Intentions
- [`KT-23824`](https://youtrack.jetbrains.com/issue/KT-23824) Return lifted out of if condition causes suspend tail call optimization to no longer apply
- [`KT-44821`](https://youtrack.jetbrains.com/issue/KT-44821) IDE: False positive NO_ELSE_IN_WHEN caused by sealed class and when in another module
### IDE. Refactorings
- [`KT-44079`](https://youtrack.jetbrains.com/issue/KT-44079) Sealed Interfaces: Move refactoring should warn about violation of hierarchy restrictions
### JavaScript
- [`KT-42176`](https://youtrack.jetbrains.com/issue/KT-42176) KJS / IR: Interface default method in sub-interface not resolved correctly from extension on super-interface
- [`KT-44103`](https://youtrack.jetbrains.com/issue/KT-44103) [JSIR] TypeError when bumping from 1.4.20 to 1.4.30-M1
- [`KT-44180`](https://youtrack.jetbrains.com/issue/KT-44180) KJS / IR: NPE in ConstTransformer of compileDevelopmentExecutableKotlinJs/compileProductionExecutableKotlinJs tasks
- [`KT-44415`](https://youtrack.jetbrains.com/issue/KT-44415) Kotlin/JS with IR and kotlin-react: "too much recursion" error in runtime in browser
- [`KT-44469`](https://youtrack.jetbrains.com/issue/KT-44469) KJS / IR: Incorrect export functions with bridges
- [`KT-44718`](https://youtrack.jetbrains.com/issue/KT-44718) MPP/ KJS: "IllegalStateException: Unsupported operation" with serialization plugin and incremental compilation
### Libraries
- [`KT-25571`](https://youtrack.jetbrains.com/issue/KT-25571) Make random implementations serializable
- [`KT-40225`](https://youtrack.jetbrains.com/issue/KT-40225) Support adding kotlin-test as a single dependency, as it should be with a multiplatform library
- [`KT-44168`](https://youtrack.jetbrains.com/issue/KT-44168) Prevent storing NaN and negative zero in kotlin.time.Duration
### Middle-end. IR
- [`KT-43831`](https://youtrack.jetbrains.com/issue/KT-43831) Compilation failed, IrSimpleFunctionPublicSymbolImpl is already bound
- [`KT-44100`](https://youtrack.jetbrains.com/issue/KT-44100) KJS / IR: Top level declarations added in IR plugin are not referenceable from other modules
### Tools. Ant
- [`KT-16227`](https://youtrack.jetbrains.com/issue/KT-16227) Ant task: do not include runtime by default if destination is a jar
- [`KT-44293`](https://youtrack.jetbrains.com/issue/KT-44293) Support fork mode in kotlinc Ant task
### Tools. CLI
- [`KT-17344`](https://youtrack.jetbrains.com/issue/KT-17344) Include kotlin-reflect to resulting jar if "-include-runtime" is specified
- [`KT-43220`](https://youtrack.jetbrains.com/issue/KT-43220) -include-runtime should add .kotlin_builtins to the output
- [`KT-43704`](https://youtrack.jetbrains.com/issue/KT-43704) Illegal reflective access by com.intellij.util.ReflectionUtil to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
- [`KT-44078`](https://youtrack.jetbrains.com/issue/KT-44078) Do not include module-info.class of kotlin-stdlib.jar to the resulting jar with -include-runtime
- [`KT-44232`](https://youtrack.jetbrains.com/issue/KT-44232) CLI: do not pass -noverify to java process starting from JDK 13
### Tools. CLI. Native
- [`KT-43874`](https://youtrack.jetbrains.com/issue/KT-43874) Native / CLI: provide a way to show difference between Jvm and Native compilers
### Tools. Gradle
- [`KT-31027`](https://youtrack.jetbrains.com/issue/KT-31027) java.lang.NoSuchMethodError: No static method hashCode(Z)I in class Ljava/lang/Boolean; or its super classes (declaration of 'java.lang.Boolean' appears in /system/framework/core-libart.jar)
- [`KT-44204`](https://youtrack.jetbrains.com/issue/KT-44204) Kotlin Gradle Plugin 1.4.21 makes impossible to use ANTLR in other plugins
### Tools. Gradle. JS
- [`KT-43237`](https://youtrack.jetbrains.com/issue/KT-43237) KJS: `-jsLegacy` Naming Convention is incompatible with NPM
- [`KT-43869`](https://youtrack.jetbrains.com/issue/KT-43869) Error in webpack configuration not displayed
- [`KT-44614`](https://youtrack.jetbrains.com/issue/KT-44614) Update Node.JS and Yarn versions
- [`KT-44616`](https://youtrack.jetbrains.com/issue/KT-44616) Kotlin/JS: IR backend with React: "Uncaught TypeError: _this__0 is undefined" runtime error in browser
### Tools. Gradle. Multiplatform
- [`KT-42098`](https://youtrack.jetbrains.com/issue/KT-42098) Commonizer is re-launched for every included Gradle build
- [`KT-43116`](https://youtrack.jetbrains.com/issue/KT-43116) Merge together MultiplatformHighlightingTest and MultiplatformAnalysisTest
- [`KT-44322`](https://youtrack.jetbrains.com/issue/KT-44322) KotlinTargetComponent maintenance for -sources.jar
### Tools. JPS
- [`KT-13631`](https://youtrack.jetbrains.com/issue/KT-13631) Compilation fails on Turkish locale because of locale-sensitive uppercasing
### Tools. kapt
- [`KT-44909`](https://youtrack.jetbrains.com/issue/KT-44909) Kapt: ReenteringLazyValueComputationException without stacktrace caused by `when` expression with sealed class function without explicit return type
## 1.4.31
### Compiler
- [`KT-39776`](https://youtrack.jetbrains.com/issue/KT-39776) 2020.3+: Unresolved reference to Kotlin stdlib function
### IDE. Gradle Integration
- [`KT-44845`](https://youtrack.jetbrains.com/issue/KT-44845) After update to Kotlin 1.4.30 all external dependencies is unresolved in IDE with kotlin.mpp.enableGranularSourceSetsMetadata=true
### IDE. Gradle. Script
- [`KTIJ-11137`](https://youtrack.jetbrains.com/issue/KTIJ-1137) build.gradle.kts: Fatal error during save/load standalone scripts settings
- [`KTIJ-898`](https://youtrack.jetbrains.com/issue/KTIJ-898) Unable to import with Kotlin DSL buildscript - NullPointerException in KotlinDslScriptModelProcessorKt.toListOfScriptModels
### IDE. Multiplatform
- [`KTIJ-1200`](https://youtrack.jetbrains.com/issue/KTIJ-1200) KotlinIconProviderKt.addExpectActualMarker takes up to 180+ seconds
### IDE
#### Fixes
- [`KT-44697`](https://youtrack.jetbrains.com/issue/KT-44697) New JVM IR backend notification - narrow its triggering to Kotlin projects
- [`KT-44523`](https://youtrack.jetbrains.com/issue/KT-44523) IDE notification for trying new JVM backend
- [`KTIJ-696`](https://youtrack.jetbrains.com/issue/KTIJ-696) Freeze during startup of IDEA with intellij project with Kotlin (211-1.4.10-release-IJ1440)
## 1.4.30
### Android
- [`KT-42383`](https://youtrack.jetbrains.com/issue/KT-42383) HMPP: Bad IDEA dependencies: Missing dependency from p1:jvmAndAndroid to p2:jvmAndAndroid
### Backend. Native
- [`KT-38772`](https://youtrack.jetbrains.com/issue/KT-38772) Native: support non-reified type parameters in typeOf
- [`KT-42234`](https://youtrack.jetbrains.com/issue/KT-42234) Move LLVM optimization parameters into konan.properties
- [`KT-42649`](https://youtrack.jetbrains.com/issue/KT-42649) IndexOutOfBoundsException during InlineClassTransformer lowering
- [`KT-42942`](https://youtrack.jetbrains.com/issue/KT-42942) Native: optimize peak backend memory by clearing BindingContext after psi2ir
- [`KT-43198`](https://youtrack.jetbrains.com/issue/KT-43198) Native: support `init` blocks inside inline classes
### Compiler
#### New Features
- [`KT-28055`](https://youtrack.jetbrains.com/issue/KT-28055) Support `init` blocks inside inline classes
- [`KT-28056`](https://youtrack.jetbrains.com/issue/KT-28056) Consider supporting non-public primary constructors for inline classes
- [`KT-41265`](https://youtrack.jetbrains.com/issue/KT-41265) Support noarg compiler plugin for JVM IR
- [`KT-42094`](https://youtrack.jetbrains.com/issue/KT-42094) Allow open callable members in expect interfaces
- [`KT-43129`](https://youtrack.jetbrains.com/issue/KT-43129) FIR: Support OverloadResolutionByLambdaReturnType
- [`KT-43592`](https://youtrack.jetbrains.com/issue/KT-43592) Promote JVM IR compiler backend to Beta
- [`KT-43919`](https://youtrack.jetbrains.com/issue/KT-43919) Support loading Java annotations on base classes and implementing interfaces' type arguments
- [`KT-44021`](https://youtrack.jetbrains.com/issue/KT-44021) Enable JVM IR backend by default in 1.5
#### Performance Improvements
- [`KT-41352`](https://youtrack.jetbrains.com/issue/KT-41352) JVM IR: reduce bytecode size in for loops and range checks with 'until' by not using inclusive end
- [`KT-41644`](https://youtrack.jetbrains.com/issue/KT-41644) NI: Infinite compilation
- [`KT-42791`](https://youtrack.jetbrains.com/issue/KT-42791) OutOfMemoryError on compilation using kotlin 1.4 on a class with a lot of type inference
- [`KT-42920`](https://youtrack.jetbrains.com/issue/KT-42920) NI: Improve performance around adding constraints
#### Fixes
- [`KT-11454`](https://youtrack.jetbrains.com/issue/KT-11454) Load annotations on TYPE_USE/TYPE_PARAMETER positions from Java class-files
- [`KT-11732`](https://youtrack.jetbrains.com/issue/KT-11732) Verify error for generic interface method invocation with default parameters
- [`KT-14612`](https://youtrack.jetbrains.com/issue/KT-14612) "ISE: Recursive call in a lazy value" during processing of a (weakly) recursive type alias
- [`KT-18344`](https://youtrack.jetbrains.com/issue/KT-18344) Upper bound of a typealias type parameter is not reported correctly if it contains the typealias itself
- [`KT-18768`](https://youtrack.jetbrains.com/issue/KT-18768) @Notnull annotation from Java does not work with varargs
- [`KT-20548`](https://youtrack.jetbrains.com/issue/KT-20548) java.lang.IllegalStateException: Illegal class container on simple Java code parsing
- [`KT-22465`](https://youtrack.jetbrains.com/issue/KT-22465) Excessive synthetic method for private setter from superclass
- [`KT-23816`](https://youtrack.jetbrains.com/issue/KT-23816) Inline classes: constants and annotations
- [`KT-24158`](https://youtrack.jetbrains.com/issue/KT-24158) AE: No receiver found on incomplete code with $-signs
- [`KT-24392`](https://youtrack.jetbrains.com/issue/KT-24392) Nullability of Java arrays is read incorrectly if @Nullable annotation has both targets TYPE_USE and VALUE_PARAMETER
- [`KT-26229`](https://youtrack.jetbrains.com/issue/KT-26229) Lambda/anonymous function argument in parentheses is not supported for callsInPlace effect
- [`KT-29735`](https://youtrack.jetbrains.com/issue/KT-29735) KNPE at `KtEnumEntrySuperclassReferenceExpression.getReferencedElement` with explicit type argument inside enum member constructor
- [`KT-31389`](https://youtrack.jetbrains.com/issue/KT-31389) ClassFormatError with companion object in annotation with @JvmStatic
- [`KT-31907`](https://youtrack.jetbrains.com/issue/KT-31907) ISE: UNIT_EXPECTED_TYPE on parsing array literal inside lambda with Unit return type
- [`KT-32228`](https://youtrack.jetbrains.com/issue/KT-32228) Inconsistent boxing/unboxing for inline classes when interface is specialized by object expression
- [`KT-32450`](https://youtrack.jetbrains.com/issue/KT-32450) Inline class incorrectly gets re-wrapped when provided to a function
- [`KT-35849`](https://youtrack.jetbrains.com/issue/KT-35849) Missing nullability assertion on lambda return value if expected type has generic return value type
- [`KT-35902`](https://youtrack.jetbrains.com/issue/KT-35902) Kotlin generates a private parameterless constructor for constructors taking inline class arguments with default values
- [`KT-36399`](https://youtrack.jetbrains.com/issue/KT-36399) Gradually support TYPE_USE nullability annotations read from class-files
- [`KT-36769`](https://youtrack.jetbrains.com/issue/KT-36769) JVM IR: Missing LVT entries for inline function (default) parameters at call site
- [`KT-36982`](https://youtrack.jetbrains.com/issue/KT-36982) JVM IR: SAM adapter classes are generated as synthetic
- [`KT-37007`](https://youtrack.jetbrains.com/issue/KT-37007) JVM IR: extraneous property accessors are generated in multifile facade for InlineOnly property
- [`KT-37317`](https://youtrack.jetbrains.com/issue/KT-37317) [FIR] Add support of extension functions in postponed lambda completion
- [`KT-38400`](https://youtrack.jetbrains.com/issue/KT-38400) FIR: interface abstract is preferred to Any method in super resolve
- [`KT-38536`](https://youtrack.jetbrains.com/issue/KT-38536) JVM IR: bound adapted function references are not inlined
- [`KT-38656`](https://youtrack.jetbrains.com/issue/KT-38656) FIR: determine overridden member visibility properly
- [`KT-38901`](https://youtrack.jetbrains.com/issue/KT-38901) FIR: Make behavior of integer literals overflow consistent with FE 1.0
- [`KT-39709`](https://youtrack.jetbrains.com/issue/KT-39709) [FIR] False positive UNINITIALIZED_VARIABLE in presence of complex graph with jumps
- [`KT-39923`](https://youtrack.jetbrains.com/issue/KT-39923) Result.Failure will get wrapped with Success when using with RxJava
- [`KT-40198`](https://youtrack.jetbrains.com/issue/KT-40198) '$default' methods in 'kotlin/test/AssertionsKt' generated as non-synthetic by JVM_IR
- [`KT-40200`](https://youtrack.jetbrains.com/issue/KT-40200) IDE: Multiple top-level main functions in different files: broken highlighting, "No descriptor resolved for FUN"
- [`KT-40262`](https://youtrack.jetbrains.com/issue/KT-40262) ACC_DEPRECATED flag not generated for property getter delegate in multifile class facade in JVM_IR
- [`KT-40282`](https://youtrack.jetbrains.com/issue/KT-40282) Inline class wrapping Any gets double boxed
- [`KT-40464`](https://youtrack.jetbrains.com/issue/KT-40464) JVM_IR does not generate LINENUMBER at closing brace of (suspend) lambda
- [`KT-40500`](https://youtrack.jetbrains.com/issue/KT-40500) Warnings reporting by Java nullability annotations doesn't work for not top-level types
- [`KT-40926`](https://youtrack.jetbrains.com/issue/KT-40926) IDE import actions do not add required import for convention `invoke()` extension call
- [`KT-40948`](https://youtrack.jetbrains.com/issue/KT-40948) IllegalAccessError while initializing val property in EXACTLY_ONCE lambda that is passed to another function
- [`KT-40991`](https://youtrack.jetbrains.com/issue/KT-40991) NI: UNRESOLVED_REFERENCE_WRONG_RECEIVER instead of FUNCTION_EXPECTED with convention `invoke` call
- [`KT-41163`](https://youtrack.jetbrains.com/issue/KT-41163) Double wrapped value in Result class after map operation
- [`KT-41284`](https://youtrack.jetbrains.com/issue/KT-41284) Spring CGLIB proxies break auto-generated data class componentN and copy methods when using JVM IR
- [`KT-41468`](https://youtrack.jetbrains.com/issue/KT-41468) JVM IR: IllegalAccessError on access to abstract base member from another package, from anonymous object inside abstract class
- [`KT-41491`](https://youtrack.jetbrains.com/issue/KT-41491) UNRESOLVED_REFERENCE_WRONG_RECEIVER instead of FUNCTION_EXPECTED when invoking non-functional value as a function
- [`KT-41493`](https://youtrack.jetbrains.com/issue/KT-41493) JVM IR: names of classes for local delegated variables contain the variable name twice
- [`KT-41792`](https://youtrack.jetbrains.com/issue/KT-41792) [FIR] Introduce & use ConeAttribute.UnsafeVariance
- [`KT-41793`](https://youtrack.jetbrains.com/issue/KT-41793) [FIR] Make captured types accessible at the end of resolve
- [`KT-41809`](https://youtrack.jetbrains.com/issue/KT-41809) JVM IR: name for internal $default method doesn't include module name
- [`KT-41810`](https://youtrack.jetbrains.com/issue/KT-41810) JVM IR: Deprecated(HIDDEN) class is incorrectly generated as synthetic
- [`KT-41841`](https://youtrack.jetbrains.com/issue/KT-41841) JVM IR: delegates for private functions with default arguments are generated in multifile classes
- [`KT-41857`](https://youtrack.jetbrains.com/issue/KT-41857) Flaky 'ConcurrentModificationException' through `kotlin.serialization.DescriptorSerializer`
- [`KT-41903`](https://youtrack.jetbrains.com/issue/KT-41903) JVM IR: do not generate LineNumberTable in auto-generated members of data classes
- [`KT-41911`](https://youtrack.jetbrains.com/issue/KT-41911) JVM IR: nested big-arity function calls are not lowered
- [`KT-41957`](https://youtrack.jetbrains.com/issue/KT-41957) JVM IR: step into suspend function goes to the first line of the file
- [`KT-41960`](https://youtrack.jetbrains.com/issue/KT-41960) JVM IR: smart step into members implemented with delegation to interface doesn't work
- [`KT-41961`](https://youtrack.jetbrains.com/issue/KT-41961) JVM IR: line numbers are not generated in JvmMultifileClass facade declarations
- [`KT-41962`](https://youtrack.jetbrains.com/issue/KT-41962) JVM IR: intermittent -1 line numbers in the state machine cause double stepping in the debugger
- [`KT-42001`](https://youtrack.jetbrains.com/issue/KT-42001) Cannot resolve symbol: AssertionError: Module <sdk 1.8> is not contained in his own dependencies
- [`KT-42002`](https://youtrack.jetbrains.com/issue/KT-42002) JVM / IR: IllegalStateException: "No mapping for symbol: VAR IR_TEMPORARY_VARIABLE" caused by named arguments
- [`KT-42021`](https://youtrack.jetbrains.com/issue/KT-42021) JVM / IR: "IndexOutOfBoundsException: Index 0 out of bounds for length 0" during IR lowering with suspend conversion
- [`KT-42033`](https://youtrack.jetbrains.com/issue/KT-42033) JVM IR: accidental override in Map subclass with custom implementations of some members
- [`KT-42036`](https://youtrack.jetbrains.com/issue/KT-42036) IR: "AssertionError: TypeAliasDescriptor expected: deserialized class Nothing" when referencing typealias with @UnsafeVariance
- [`KT-42043`](https://youtrack.jetbrains.com/issue/KT-42043) JVM IR: Don't generate collection stubs when implementing methods with more specific return types
- [`KT-42044`](https://youtrack.jetbrains.com/issue/KT-42044) Compiler error when lambda with contract surrounded with parentheses
- [`KT-42114`](https://youtrack.jetbrains.com/issue/KT-42114) JVM_IR generates stub for 'removeIf' in abstract classes implementing 'List' and 'Set'
- [`KT-42115`](https://youtrack.jetbrains.com/issue/KT-42115) JVM_IR doesn't generate 'next' and 'hasNext' method in an abstract class implementing 'ListIterator'
- [`KT-42116`](https://youtrack.jetbrains.com/issue/KT-42116) FIR: Java accessor function should not exist in scope together with relevant property
- [`KT-42117`](https://youtrack.jetbrains.com/issue/KT-42117) IR-based evaluator cannot handle Java static final fields
- [`KT-42118`](https://youtrack.jetbrains.com/issue/KT-42118) FIR2IR: field-targeted annotation is placed on a property, not on a field
- [`KT-42130`](https://youtrack.jetbrains.com/issue/KT-42130) FIR: type variable is observed after when condition analysis
- [`KT-42132`](https://youtrack.jetbrains.com/issue/KT-42132) FIR2IR: companion function reference has no dispatch receiver
- [`KT-42137`](https://youtrack.jetbrains.com/issue/KT-42137) JVM IR: AbstractMethodError on complex hierarchy where implementation comes from another supertype and has a more specific type
- [`KT-42186`](https://youtrack.jetbrains.com/issue/KT-42186) JVM / IR: Infinite cycle in for expression when unsigned bytes are used in decreasing loop range
- [`KT-42251`](https://youtrack.jetbrains.com/issue/KT-42251) JVM / IR: "IllegalStateException: Descriptor can be left only if it is last" when comparing the i-th element of the container of Int? and `i` with change
- [`KT-42253`](https://youtrack.jetbrains.com/issue/KT-42253) JVM IR: NoSuchFieldError on local delegated property in inline function whose call site happens before declaration in the source
- [`KT-42281`](https://youtrack.jetbrains.com/issue/KT-42281) JVM / IR: AnalyzerException when comparing Int and array that cast to Any in if condition
- [`KT-42340`](https://youtrack.jetbrains.com/issue/KT-42340) FIR2IR: duplicating fake overrides
- [`KT-42344`](https://youtrack.jetbrains.com/issue/KT-42344) IR-based evaluator doesn't support "annotation in annotation"
- [`KT-42346`](https://youtrack.jetbrains.com/issue/KT-42346) FIR: double-vararg in IR while resolving collection literal as Java annotation argument
- [`KT-42348`](https://youtrack.jetbrains.com/issue/KT-42348) FIR: false UNINITIALIZED_VARIABLE in local class
- [`KT-42350`](https://youtrack.jetbrains.com/issue/KT-42350) FIR: false UNINITIALIZED_VARIABLE after initialization in try block
- [`KT-42351`](https://youtrack.jetbrains.com/issue/KT-42351) FIR: false HIDDEN in enum entry member call
- [`KT-42354`](https://youtrack.jetbrains.com/issue/KT-42354) JVM / IR: "AssertionError: Unexpected IR element found during code generation" with KProperty `get` invocation
- [`KT-42359`](https://youtrack.jetbrains.com/issue/KT-42359) FIR2IR: cannot mangle type parameter
- [`KT-42373`](https://youtrack.jetbrains.com/issue/KT-42373) FIR2IR: local object nested class has no parent if forward-referenced by nested class supertype
- [`KT-42384`](https://youtrack.jetbrains.com/issue/KT-42384) FIR (BE): top-level field has no parent class in BE
- [`KT-42496`](https://youtrack.jetbrains.com/issue/KT-42496) FIR resolve: synthetic property is written but has no setter
- [`KT-42517`](https://youtrack.jetbrains.com/issue/KT-42517) FIR: exception in BE for recursive inline call
- [`KT-42530`](https://youtrack.jetbrains.com/issue/KT-42530) "AssertionError: No type for resolved lambda argument" on attempting to assign a Pair to a couple of values in a scratch file
- [`KT-42601`](https://youtrack.jetbrains.com/issue/KT-42601) [FIR] Inherited declaration clash for stdlib inheritors
- [`KT-42622`](https://youtrack.jetbrains.com/issue/KT-42622) NI: IllegalStateException for if expression with method reference inside flow
- [`KT-42642`](https://youtrack.jetbrains.com/issue/KT-42642) ISE: No `getProgressionLastElement` for progression type IntProgressionType
- [`KT-42650`](https://youtrack.jetbrains.com/issue/KT-42650) JVM IR: extraneous nullability annotation on a generic function of a flexible type
- [`KT-42656`](https://youtrack.jetbrains.com/issue/KT-42656) FIR2IR: unsupported callable reference for Java field
- [`KT-42725`](https://youtrack.jetbrains.com/issue/KT-42725) Debugger steps into core library inline functions in chained calls
- [`KT-42758`](https://youtrack.jetbrains.com/issue/KT-42758) JVM / IR: Deserialized object that overrides readResolve() is not reference equal to the singleton instance
- [`KT-42770`](https://youtrack.jetbrains.com/issue/KT-42770) FIR: duplicating signatures in mangler (typealias for functional type)
- [`KT-42771`](https://youtrack.jetbrains.com/issue/KT-42771) FIR: duplicating signature in mangler (data class with delegate)
- [`KT-42814`](https://youtrack.jetbrains.com/issue/KT-42814) FIR: false UNINITIALIZED_VARIABLE in local function after if...else
- [`KT-42844`](https://youtrack.jetbrains.com/issue/KT-42844) FIR: Property write in init block resolved to parameter write
- [`KT-42846`](https://youtrack.jetbrains.com/issue/KT-42846) JVM_IR: NPE on function reference to @JvmStatic method in a different file
- [`KT-42933`](https://youtrack.jetbrains.com/issue/KT-42933) JVM / IR: "AnalyzerException: Expected an object reference, but found I" with local delegate in inline class
- [`KT-43006`](https://youtrack.jetbrains.com/issue/KT-43006) JVM/JVM_IR: do not generate no-arg constructor for constructor with default arguments if there are inline class types in the signature
- [`KT-43017`](https://youtrack.jetbrains.com/issue/KT-43017) JVM / IR: AssertionError when callable reference passed into a function requiring a suspendable function
- [`KT-43051`](https://youtrack.jetbrains.com/issue/KT-43051) JVM IR: extraneous methods overridding default (Java 8) collection methods in inline class that extends MutableList
- [`KT-43067`](https://youtrack.jetbrains.com/issue/KT-43067) Inner class declaration inside inline class should be prohibited
- [`KT-43068`](https://youtrack.jetbrains.com/issue/KT-43068) JVM IR: no generic signatures for explicitly written methods in a List subclass, whose signature coincides with MutableList methods
- [`KT-43132`](https://youtrack.jetbrains.com/issue/KT-43132) JVM / IR: Method name '<get-...>' in class '...$screenTexts$1$1' cannot be represented in dex format.
- [`KT-43145`](https://youtrack.jetbrains.com/issue/KT-43145) JVM IR: $default methods in multi-file facades are generated as non-synthetic final
- [`KT-43156`](https://youtrack.jetbrains.com/issue/KT-43156) FIR: false UNINITIALIZED_VARIABLE after initialization in `synchronized` block
- [`KT-43196`](https://youtrack.jetbrains.com/issue/KT-43196) JVM: extra non-static member is generated for extension property in inline class
- [`KT-43199`](https://youtrack.jetbrains.com/issue/KT-43199) JVM IR: synthetic flag for deprecated-hidden is not generated for DeprecatedSinceKotlin and deprecation from override
- [`KT-43207`](https://youtrack.jetbrains.com/issue/KT-43207) JVM IR: no collection stub for `iterator` is generated on extending AbstractCollection
- [`KT-43217`](https://youtrack.jetbrains.com/issue/KT-43217) JVM_IR: Multiple FAKE_OVERRIDES for java methods using @NonNull Double and java double
- [`KT-43225`](https://youtrack.jetbrains.com/issue/KT-43225) Confusing message of warning NULLABLE_TYPE_PARAMETER_AGAINST_NOT_NULL_TYPE_PARAMETER
- [`KT-43226`](https://youtrack.jetbrains.com/issue/KT-43226) "Incompatible stack heights" with non-local return to outer lambda inside suspend lambda
- [`KT-43242`](https://youtrack.jetbrains.com/issue/KT-43242) JVM / IR: "AnalyzerException: Expected I, but found R" caused by `when` inside object with @Nullable Integer subject
- [`KT-43249`](https://youtrack.jetbrains.com/issue/KT-43249) Wrong code generated for suspend lambdas with inline class parameters
- [`KT-43286`](https://youtrack.jetbrains.com/issue/KT-43286) JVM IR: IAE "Inline class types should have the same representation: Lkotlin/UInt; != I" on smart cast of unsigned type value with JVM target 1.8
- [`KT-43326`](https://youtrack.jetbrains.com/issue/KT-43326) JVM_IR: No deprecated flag for getter of deprecated interface property copied to DefaultImpls
- [`KT-43327`](https://youtrack.jetbrains.com/issue/KT-43327) JVM_IR: No deprecated or synthetic flag for accessors of deprecated-hidden property of unsigned type
- [`KT-43332`](https://youtrack.jetbrains.com/issue/KT-43332) FIR: Smart casts lead to false-positive ambiguity
- [`KT-43370`](https://youtrack.jetbrains.com/issue/KT-43370) JVM IR: No deprecated flag for getter of deprecated property copied via delegation by interface
- [`KT-43459`](https://youtrack.jetbrains.com/issue/KT-43459) JVM_IR. Wrong signature for synthetic $annotations method for extension property on nullable primitive
- [`KT-43478`](https://youtrack.jetbrains.com/issue/KT-43478) NI: "IndexOutOfBoundsException: Index: 3, Size: 3" caused by `is` check with raw type inside `if` condition with `when` inside
- [`KT-43519`](https://youtrack.jetbrains.com/issue/KT-43519) JVM_IR. External functions generated differently in multi file facades
- [`KT-43524`](https://youtrack.jetbrains.com/issue/KT-43524) JVM_IR. Missed deprecation flag on companion @JvmStatic property accessor
- [`KT-43525`](https://youtrack.jetbrains.com/issue/KT-43525) Prohibit JvmOverloads on declarations with inline class types in parameters
- [`KT-43536`](https://youtrack.jetbrains.com/issue/KT-43536) JVM IR: IllegalStateException is not caught by runCatching under Deferred.await() with kotlinx.coroutines
- [`KT-43562`](https://youtrack.jetbrains.com/issue/KT-43562) JVM IR: incorrect mangling for Collection.size in unsigned arrays
- [`KT-43584`](https://youtrack.jetbrains.com/issue/KT-43584) [FIR] Java annotations with named arguments aren't loaded correctly
- [`KT-43587`](https://youtrack.jetbrains.com/issue/KT-43587) Invalid default parameter value in expect actual declaration on jvm
- [`KT-43630`](https://youtrack.jetbrains.com/issue/KT-43630) "AssertionError: Number of arguments should not be less than number of parameters" during capturing intersection raw type with star projection
- [`KT-43698`](https://youtrack.jetbrains.com/issue/KT-43698) NoSuchMethodError for inline class implementing interface with @JvmDefault methods, -Xjvm-default=enable
- [`KT-43741`](https://youtrack.jetbrains.com/issue/KT-43741) Report error on inline class implementing 'kotlin.Cloneable'
- [`KT-43845`](https://youtrack.jetbrains.com/issue/KT-43845) org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate expression: KtBlockExpression
- [`KT-43956`](https://youtrack.jetbrains.com/issue/KT-43956) NI: "Error type encountered UninferredParameterTypeConstructor" on "try" and other constructs with code block as a value
- [`KT-44055`](https://youtrack.jetbrains.com/issue/KT-44055) Left uninferred type parameter for callable references inside special calls
- [`KT-44113`](https://youtrack.jetbrains.com/issue/KT-44113) Compiler frontend exception: Number of arguments should not be less than number of parameters, but: parameters=2, args=1
- [`KT-44145`](https://youtrack.jetbrains.com/issue/KT-44145) No highlighting for not initialized base constructor and NoSuchMethodError in Android plugin
### IDE
#### New Features
- [`KT-44075`](https://youtrack.jetbrains.com/issue/KT-44075) Sealed interfaces: New Kotlin Class/File menu update
#### Fixes
- [`KT-29454`](https://youtrack.jetbrains.com/issue/KT-29454) Light class with unexpected name when using obfuscated library
- [`KT-31553`](https://youtrack.jetbrains.com/issue/KT-31553) Complete Statement: Wrong auto-insertion of closing curly brace for a code block
- [`KT-33466`](https://youtrack.jetbrains.com/issue/KT-33466) IDE generates incorrect `external override` with body for overriding `open external` method
- [`KT-39458`](https://youtrack.jetbrains.com/issue/KT-39458) Add CLI support for UL classes
- [`KT-40403`](https://youtrack.jetbrains.com/issue/KT-40403) UAST: PsiMethod for invoked extension function/property misses `@receiver:` annotations
- [`KT-41406`](https://youtrack.jetbrains.com/issue/KT-41406) Kotlin doesn't report annotations for type arguments (no way to add `@Nls`, `@NonNls` annotations to String collections in Kotlin)
- [`KT-41420`](https://youtrack.jetbrains.com/issue/KT-41420) UAST does not return information about type annotations
- [`KT-42194`](https://youtrack.jetbrains.com/issue/KT-42194) OOME: Java heap space from incremental compilation
- [`KT-42754`](https://youtrack.jetbrains.com/issue/KT-42754) MPP: no smart cast for Common nullable property used in platform module
- [`KT-42821`](https://youtrack.jetbrains.com/issue/KT-42821) MPP, IDE: Platform-specific errors are reported even when build doesn't target that platform
- [`KT-44116`](https://youtrack.jetbrains.com/issue/KT-44116) Add language version 1.5 to the compiler configuration preferences
- [`KT-44523`](https://youtrack.jetbrains.com/issue/KT-44523) IDE notification for trying new JVM backend
- [`KT-44543`](https://youtrack.jetbrains.com/issue/KT-44543) Kotlin's LowMemoryWatcher leaks on Kotlin plugin unload
### IDE. Android
- [`KT-42381`](https://youtrack.jetbrains.com/issue/KT-42381) MPP: Bad IDEA dependencies: JVM module depending on built artifact instead of sources of module with Android Plugin applied
### IDE. Completion
- [`KT-44016`](https://youtrack.jetbrains.com/issue/KT-44016) Code completion: support for "sealed interface"
- [`KT-44250`](https://youtrack.jetbrains.com/issue/KT-44250) Code completion does not work in when expression with sealed type argument
### IDE. Gradle. Script
- [`KT-39105`](https://youtrack.jetbrains.com/issue/KT-39105) AE “JvmBuiltins has not been initialized properly” after creating new Gradle/Kotlin-based project via old Project Wizard
### IDE. Inspections and Intentions
#### New Features
- [`KT-22666`](https://youtrack.jetbrains.com/issue/KT-22666) "Create enum constant" quick fix could be provided
- [`KT-24556`](https://youtrack.jetbrains.com/issue/KT-24556) Add Remove quick fix for "Expression under 'when' is never equal to null"
- [`KT-34121`](https://youtrack.jetbrains.com/issue/KT-34121) Report unused result of data class `copy` method
- [`KT-34533`](https://youtrack.jetbrains.com/issue/KT-34533) INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER: Add quickfix "Add val to parameter"
- [`KT-35215`](https://youtrack.jetbrains.com/issue/KT-35215) Quickfix for CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT to remove `const` modifier
- [`KT-40251`](https://youtrack.jetbrains.com/issue/KT-40251) Intention action to evaluate compile time expression
- [`KT-44017`](https://youtrack.jetbrains.com/issue/KT-44017) Sealed interfaces: Java side Inspection "implementation of Kotlin sealed interface is forbidden"
- [`KT-43941`](https://youtrack.jetbrains.com/issue/KT-43941) Sealed interfaces: intention to extend class/interface
- [`KT-44043`](https://youtrack.jetbrains.com/issue/KT-44043) Sealed interfaces: quickfix to move class/interface to proper location
#### Fixes
- [`KT-20420`](https://youtrack.jetbrains.com/issue/KT-20420) Intention "Put arguments/parameters on separate lines" doesn't respect the "Place ')' on new line" Kotlin code style setting
- [`KT-21799`](https://youtrack.jetbrains.com/issue/KT-21799) Quickfix "Change function signature" for receiver type doesn't change it
- [`KT-22665`](https://youtrack.jetbrains.com/issue/KT-22665) "Create object" quick fix produce wrong code for enum
- [`KT-23934`](https://youtrack.jetbrains.com/issue/KT-23934) IntelliJ suggest "merge map to joinToString" even when such action is impossible due to suspending actions in map
- [`KT-30894`](https://youtrack.jetbrains.com/issue/KT-30894) Wrong results of intention "Add names to call arguments" when backticked argument starts from digit
- [`KT-31523`](https://youtrack.jetbrains.com/issue/KT-31523) ReplaceWith introduces additional argument name for lambda when named argument is used on call-site
- [`KT-31833`](https://youtrack.jetbrains.com/issue/KT-31833) JavaMapForEachInspection should report for expression with implicit receiver
- [`KT-33096`](https://youtrack.jetbrains.com/issue/KT-33096) Turn 'MapGetWithNotNullAssertionOperator' into an intention
- [`KT-33212`](https://youtrack.jetbrains.com/issue/KT-33212) False positive "map.put() should be converted to assignment" inspection when class inherited from MutableMap has "set" method
- [`KT-34270`](https://youtrack.jetbrains.com/issue/KT-34270) False negative "Join declaration and assignment" with constructor call
- [`KT-34859`](https://youtrack.jetbrains.com/issue/KT-34859) False positive "Should be replaced with Kotlin function" inspection for Character.toString(int) function
- [`KT-34959`](https://youtrack.jetbrains.com/issue/KT-34959) False positive "Redundant overriding method" with different implemented/overridden signatures
- [`KT-35051`](https://youtrack.jetbrains.com/issue/KT-35051) False positive "Remove redundant backticks" if variable inside the string and isn't followed by space
- [`KT-35097`](https://youtrack.jetbrains.com/issue/KT-35097) False positive "Call replaceable with binary operator" on explicit 'equals' call on a platform type value
- [`KT-35165`](https://youtrack.jetbrains.com/issue/KT-35165) "Replace 'if' with elvis operator": don't suggest if val initializer is a complex expression
- [`KT-35346`](https://youtrack.jetbrains.com/issue/KT-35346) False positive 'Make internal' suggestion for function inside interface
- [`KT-35357`](https://youtrack.jetbrains.com/issue/KT-35357) "Move lambda argument out of parentheses" does not preserve block comments
- [`KT-38349`](https://youtrack.jetbrains.com/issue/KT-38349) Invalid suggestion to fold to elvis when having a var-variable
- [`KT-40704`](https://youtrack.jetbrains.com/issue/KT-40704) False negative "Redundant semicolon" at start of line
- [`KT-40861`](https://youtrack.jetbrains.com/issue/KT-40861) "Convert to secondary constructor" intention expected on class name
- [`KT-40879`](https://youtrack.jetbrains.com/issue/KT-40879) False positive "Redundant 'inner' modifier" when calling another inner class with empty constructor
- [`KT-40985`](https://youtrack.jetbrains.com/issue/KT-40985) "Remove explicit type arguments" is suggested when type has an annotation
- [`KT-41223`](https://youtrack.jetbrains.com/issue/KT-41223) False positive "Redundant inner modifier" inspection ignores constructor arguments of object expressions
- [`KT-41246`](https://youtrack.jetbrains.com/issue/KT-41246) False positive "Receiver parameter is never used" with anonymous function expression
- [`KT-41298`](https://youtrack.jetbrains.com/issue/KT-41298) "Remove redundant 'with' call" intention works incorrectly with non-local returns and single-expression functions
- [`KT-41311`](https://youtrack.jetbrains.com/issue/KT-41311) False positive "Redundant inner modifier" when deriving from a nested Java class
- [`KT-41499`](https://youtrack.jetbrains.com/issue/KT-41499) "Convert receiver to parameter" produces code with incorrect order of generic type and function invocation in case of generic function with lambda as a parameter
- [`KT-41680`](https://youtrack.jetbrains.com/issue/KT-41680) False positive "Redundant inner modifier" when deriving from class with non-empty constructor and value passed to it from enclosing class
- [`KT-42201`](https://youtrack.jetbrains.com/issue/KT-42201) Add Opt-In action doesn't work if there is already OptIn annotation
- [`KT-42255`](https://youtrack.jetbrains.com/issue/KT-42255) "Replace elvis expression with 'if' expression" intention shouldn't introduce unnecessary variable if 'error' expression is used
### IDE. JS
- [`KT-43760`](https://youtrack.jetbrains.com/issue/KT-43760) KJS: Debugging Kotlin code for Node.js runtime doesn't work
### IDE. Misc
- [`KT-44018`](https://youtrack.jetbrains.com/issue/KT-44018) Sealed interfaces: IDE side implementation for hierarchy provider
### IDE. Multiplatform
- [`KT-40814`](https://youtrack.jetbrains.com/issue/KT-40814) MISSING_DEPENDENCY_CLASS when consuming native-shared library in a source-set with fewer targets than library has
### IDE. Run Configurations
- [`KT-34535`](https://youtrack.jetbrains.com/issue/KT-34535) Unable to run common tests on Android via gutter icon in a multiplatform project
### IDE. Scratch
- [`KT-25038`](https://youtrack.jetbrains.com/issue/KT-25038) Scratch: Destructuring declaration produces an unresolved reference
- [`KT-43415`](https://youtrack.jetbrains.com/issue/KT-43415) Kotlin scratch file could not be run and could lead to dead lock
### IDE. Script
- [`KT-44117`](https://youtrack.jetbrains.com/issue/KT-44117) IDE / Scripts: custom kotlin script definitions aren't loaded
### JavaScript
#### Fixes
- [`KT-31072`](https://youtrack.jetbrains.com/issue/KT-31072) Don't use non-reified arguments to specialize type operations in IR inliner
- [`KT-39964`](https://youtrack.jetbrains.com/issue/KT-39964) Throwable incorrectly implements constructor for (null, cause) args in K/JS-IR
- [`KT-40090`](https://youtrack.jetbrains.com/issue/KT-40090) KJS: IR. Invalid behaviour for optional parameters (redundant tail undefined parameters)
- [`KT-40686`](https://youtrack.jetbrains.com/issue/KT-40686) KJS: Uncaught ReferenceError caused by external class as type inside eventListener in init block
- [`KT-40771`](https://youtrack.jetbrains.com/issue/KT-40771) KJS / IR: "ReferenceError: Metadata is not defined" caused by default parameter value in inner class constructor
- [`KT-41032`](https://youtrack.jetbrains.com/issue/KT-41032) KJS / IR: "AssertionError: Assertion failed" caused by class that is delegated to inherited interface
- [`KT-41076`](https://youtrack.jetbrains.com/issue/KT-41076) KJS / IR: "AssertionError: Assertion failed" caused by overridden extensiion function in child class
- [`KT-41771`](https://youtrack.jetbrains.com/issue/KT-41771) KJS / IR: IndexOutOfBoundsException "Index 0 out of bounds for length 0" caused by inline class with List in primary constructor and vararg in secondary
- [`KT-42025`](https://youtrack.jetbrains.com/issue/KT-42025) KJS / IR: IrConstructorCallImpl: No such type argument slot: 0
- [`KT-42112`](https://youtrack.jetbrains.com/issue/KT-42112) KJS: StackOverflowError on @JsExport in case of name clash with function with Enum parameter with star-projection
- [`KT-42262`](https://youtrack.jetbrains.com/issue/KT-42262) KJS: `break`-statements without label are ignored in a `when`
- [`KT-42357`](https://youtrack.jetbrains.com/issue/KT-42357) KotlinJS - external class constructor with vararg does not correctly handle spread operator.
- [`KT-42364`](https://youtrack.jetbrains.com/issue/KT-42364) KJS: Properties of interface delegate are non-configurable
- [`KT-43212`](https://youtrack.jetbrains.com/issue/KT-43212) JS IR: support `init` blocks inside inline classes
- [`KT-43222`](https://youtrack.jetbrains.com/issue/KT-43222) KJS IR: prototype lazy initialization for top-level properties like in JVM
- [`KT-43313`](https://youtrack.jetbrains.com/issue/KT-43313) KJS / IR: "Can't find name for declaration FUN" for secondary constructor
- [`KT-43901`](https://youtrack.jetbrains.com/issue/KT-43901) Call to enum values() method from enum companion object leads to non-initialized enum instances
### KMM Plugin
- [`KT-41677`](https://youtrack.jetbrains.com/issue/KT-41677) Could not launch iOS project with custom display name
- [`KT-42463`](https://youtrack.jetbrains.com/issue/KT-42463) Launch common tests for Android on local JVM via run gutter
- [`KT-43188`](https://youtrack.jetbrains.com/issue/KT-43188) NoSuchMethodError in New Module Wizard of KMM Project
### Libraries
- [`KT-41112`](https://youtrack.jetbrains.com/issue/KT-41112) Docs: add more details about bit shift operations
- [`KT-41278`](https://youtrack.jetbrains.com/issue/KT-41278) map.entries.contains can return false if the argument is not MutableEntry
- [`KT-41356`](https://youtrack.jetbrains.com/issue/KT-41356) Incorrect documentation for `rangeTo` function
- [`KT-44456`](https://youtrack.jetbrains.com/issue/KT-44456) Introduce locale-agnostic API for case conversions
- [`KT-44458`](https://youtrack.jetbrains.com/issue/KT-44458) Introduce new Char-to-code and Char-to-digit conversions
### Middle-end. IR
- [`KT-41765`](https://youtrack.jetbrains.com/issue/KT-41765) [Native/IR] Could not resolveFakeOverride()
- [`KT-42054`](https://youtrack.jetbrains.com/issue/KT-42054) Psi2ir: "RuntimeException: IrSimpleFunctionSymbolImpl is already bound" when using result of function with overload resolution by lambda return type
### Native. C and ObjC Import
- [`KT-42412`](https://youtrack.jetbrains.com/issue/KT-42412) [C-interop] Modality of generated property accessors is always FINAL
### Native. ObjC Export
- [`KT-38530`](https://youtrack.jetbrains.com/issue/KT-38530) Native: values() method of enum classes is not exposed to Objective-C/Swift
- [`KT-43599`](https://youtrack.jetbrains.com/issue/KT-43599) K/N: Unbound symbols not allowed
### Native. Platform libraries
- [`KT-43597`](https://youtrack.jetbrains.com/issue/KT-43597) Support for Xcode 12.2 SDK
### Native. Platforms
- [`KT-43276`](https://youtrack.jetbrains.com/issue/KT-43276) Support watchos_x64 target
### Native. Runtime
- [`KT-42822`](https://youtrack.jetbrains.com/issue/KT-42822) Kotlin/Native Worker leaks ObjC/Swift autorelease references (and indirectly bridged K/N references) on Darwin targets
### Native. Stdlib
- [`KT-42172`](https://youtrack.jetbrains.com/issue/KT-42172) Kotlin/Native: StableRef.dispose race condition on Kotlin deinitRuntime
- [`KT-42428`](https://youtrack.jetbrains.com/issue/KT-42428) Inconsistent behavior of map.entries on Kotlin.Native
### Reflection
- [`KT-34024`](https://youtrack.jetbrains.com/issue/KT-34024) "KotlinReflectionInternalError: Inconsistent number of parameters" with `javaMethod` on suspending functions with inline class in function signature or inside the function
### Tools. CLI
- [`KT-43294`](https://youtrack.jetbrains.com/issue/KT-43294) Support `-no-stdlib` option for the `kotlin` runner
- [`KT-43406`](https://youtrack.jetbrains.com/issue/KT-43406) JVM: produce deterministic jar files if -d option value is a .jar file
### Tools. CLI. Native
- [`KT-40670`](https://youtrack.jetbrains.com/issue/KT-40670) Allow to override konan.properties via CLI
### Tools. Compiler Plugins
- [`KT-41764`](https://youtrack.jetbrains.com/issue/KT-41764) KJS /IR IllegalStateException: "Symbol for public kotlin/arrayOf is unbound" with serialization plugin
- [`KT-42976`](https://youtrack.jetbrains.com/issue/KT-42976) kotlinx.serialization + JVM IR: NPE on annotation with @SerialInfo
- [`KT-43725`](https://youtrack.jetbrains.com/issue/KT-43725) Prohibit inner and local classes in kotlin-noarg
### Tools. Gradle
- [`KT-38692`](https://youtrack.jetbrains.com/issue/KT-38692) KaptGenerateStubs Gradle task will not clean up outputs when sources are empty and not an incremental build
- [`KT-40140`](https://youtrack.jetbrains.com/issue/KT-40140) kotlin-android plugin eagerly creates several Gradle tasks
- [`KT-41295`](https://youtrack.jetbrains.com/issue/KT-41295) Kotlin Gradle Plugin 1.4.20 Configuration Caching bug due to friendPath provider
- [`KT-42058`](https://youtrack.jetbrains.com/issue/KT-42058) Support moduleName option in Kotlin Gradle plugin for JVM
- [`KT-43054`](https://youtrack.jetbrains.com/issue/KT-43054) Implementation of `AbstractKotlinTarget#buildAdhocComponentsFromKotlinVariants` breaks configuration caching
- [`KT-43489`](https://youtrack.jetbrains.com/issue/KT-43489) Incremental compilation - unable to find history files causing full recompilation
- [`KT-43740`](https://youtrack.jetbrains.com/issue/KT-43740) Gradle out-of-process runner fails with unclear diagnostics if build directory does not exist
- [`KT-43895`](https://youtrack.jetbrains.com/issue/KT-43895) Fix cacheability warnings for the Kotlin plugins
### Tools. Gradle. JS
- [`KT-42400`](https://youtrack.jetbrains.com/issue/KT-42400) Kotlin/JS: Gradle DSL: customField() is rejected in Groovy build.gradle
- [`KT-42462`](https://youtrack.jetbrains.com/issue/KT-42462) NPM dependency declaration with Groovy interpolated string
- [`KT-42954`](https://youtrack.jetbrains.com/issue/KT-42954) Kotlin/JS: IDE import after changing `kotlin.js.externals.output.format` does not re-generate externals
- [`KT-43535`](https://youtrack.jetbrains.com/issue/KT-43535) Common webpack configuration breaks on lambda serialization in some cases
- [`KT-43668`](https://youtrack.jetbrains.com/issue/KT-43668) PackageJson task use file dependencies as is (files and directories), but only files necessary
- [`KT-43793`](https://youtrack.jetbrains.com/issue/KT-43793) nodeArgs in NodeJsExec task
- [`KT-43842`](https://youtrack.jetbrains.com/issue/KT-43842) KJS: Invalid `output.library` support for `null` value
- [`KT-44104`](https://youtrack.jetbrains.com/issue/KT-44104) KJS / Gradle: An ability to pass jvm args to K2JSDce process
### Tools. Gradle. Multiplatform
- [`KT-42269`](https://youtrack.jetbrains.com/issue/KT-42269) Setup default dependsOn edges for Android source sets
- [`KT-42413`](https://youtrack.jetbrains.com/issue/KT-42413) [MPP/gradle] `withJava` breaks build on 1.4.20-M1
- [`KT-43141`](https://youtrack.jetbrains.com/issue/KT-43141) Gradle / Configuration cache: NPE from org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon.getKotlinOptions() on reusing configuration cache for task compileCommonMainKotlinMetadata
- [`KT-43329`](https://youtrack.jetbrains.com/issue/KT-43329) Gradle / Configuration cache: IAE “Parameter specified as non-null is null: method KotlinMetadataTargetConfiguratorKt.isCompatibilityMetadataVariantEnabled, parameter $this$isCompatibilityMetadataVariantEnabled” on reusing configuration cache for task compileKotlinMetadata
- [`KT-44298`](https://youtrack.jetbrains.com/issue/KT-44298) Kotlin 1.4.20+ MPP "root" module publication does not include the source JAR that used to be published in the -metadata modules
### Tools. Gradle. Native
- [`KT-39564`](https://youtrack.jetbrains.com/issue/KT-39564) Make kotlin-native Gradle tasks Cacheable
- [`KT-42485`](https://youtrack.jetbrains.com/issue/KT-42485) Fail on cinterop: clang_indexTranslationUnit returned 1
- [`KT-42550`](https://youtrack.jetbrains.com/issue/KT-42550) Adding subspec dependency with git location failed
- [`KT-42849`](https://youtrack.jetbrains.com/issue/KT-42849) Gradle / Configuration cache: tasks nativeMetadataJar, runReleaseExecutableNative, runDebugExecutableNative are unsupported and fails on reusing configuration cache
- [`KT-42938`](https://youtrack.jetbrains.com/issue/KT-42938) CocoaPods Gradle plugin: podBuildDependencies doesn't properly report xcodebuild failures
- [`KT-43151`](https://youtrack.jetbrains.com/issue/KT-43151) Gradle / Configuration cache: UPAE “lateinit property binary has not been initialized” on reusing configuration cache for linkDebugExecutableNative, linkDebugTestNative, linkReleaseExecutableNative tasks
- [`KT-43516`](https://youtrack.jetbrains.com/issue/KT-43516) Failed to resolve Kotin library [Multiple Multiplatform modules]
### Tools. Incremental Compile
- [`KT-42937`](https://youtrack.jetbrains.com/issue/KT-42937) another compilation fail (problem with compilation caches?)
### Tools. JPS
- [`KT-39536`](https://youtrack.jetbrains.com/issue/KT-39536) JPS compilation fails with IOException "storage is already closed"
### Tools. Parcelize
- [`KT-41553`](https://youtrack.jetbrains.com/issue/KT-41553) JVM IR, Parcelize: IrStarProjectionImpl cannot be cast to class IrTypeProjection
### Tools. Scripts
- [`KT-43534`](https://youtrack.jetbrains.com/issue/KT-43534) Allow running "main.kts" script that does not end in a "main.kts" filename (would allow kotlin scripting on GitHub Actions)
### Tools. kapt
- [`KT-34340`](https://youtrack.jetbrains.com/issue/KT-34340) Incremental annotation processor recompile all files (only if KAPT enabled).
- [`KT-36667`](https://youtrack.jetbrains.com/issue/KT-36667) Kapt: Add a flag to strip kotlin.Metadata() annotations from stubs
- [`KT-40493`](https://youtrack.jetbrains.com/issue/KT-40493) KAPT does not support aggregating annotations processors in incremental mode
- [`KT-40882`](https://youtrack.jetbrains.com/issue/KT-40882) Kapt stub generation is non-deterministic for incremental compilation
- [`KT-41788`](https://youtrack.jetbrains.com/issue/KT-41788) NullPointerException: Random crashes of build using gradle and kapt because of not calling Processor.init()
- [`KT-42182`](https://youtrack.jetbrains.com/issue/KT-42182) KAPT: Does not consider generated sources for incremental compilation.
## 1.4.30-M1
### Android

View File

@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.build
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmMetadataVersion
/**

View File

@@ -29,21 +29,43 @@ 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.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.*;
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

@@ -0,0 +1,46 @@
/*
* 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

@@ -94,6 +94,10 @@ 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
@@ -425,6 +429,8 @@ 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
}
@@ -435,6 +441,7 @@ open class IncrementalJvmCache(
operator fun contains(className: JvmClassName): Boolean =
className.internalName in storage
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}
@@ -444,6 +451,8 @@ open class IncrementalJvmCache(
private inner class MultifileClassPartMap(storageFile: File) :
BasicStringMap<String>(storageFile, EnumeratorStringDescriptor.INSTANCE) {
@Synchronized
fun set(partName: String, facadeName: String) {
storage[partName] = facadeName
}
@@ -451,6 +460,7 @@ open class IncrementalJvmCache(
fun get(partName: JvmClassName): String? =
storage[partName.internalName]
@Synchronized
fun remove(className: JvmClassName) {
storage.remove(className.internalName)
}

View File

@@ -21,6 +21,7 @@ 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>,
@@ -28,6 +29,6 @@ class IncrementalModuleInfo(
val jarToModule: Map<File, IncrementalModuleEntry>
) : Serializable {
companion object {
private const val serialVersionUID = 0L
private const val serialVersionUID = 1L
}
}

View File

@@ -182,6 +182,21 @@ 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
@@ -266,6 +281,9 @@ 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,
@@ -314,6 +332,21 @@ 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)
@@ -1728,6 +1761,18 @@ 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

@@ -290,6 +290,11 @@ 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
}
}
}

View File

@@ -10347,6 +10347,37 @@ public final class DebugProtoBuf {
*/
int getSealedSubclassFqName(int index);
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
boolean hasInlineClassUnderlyingPropertyName();
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
int getInlineClassUnderlyingPropertyName();
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
boolean hasInlineClassUnderlyingType();
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType();
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder();
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
boolean hasInlineClassUnderlyingTypeId();
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
int getInlineClassUnderlyingTypeId();
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
@@ -10585,9 +10616,32 @@ public final class DebugProtoBuf {
input.popLimit(limit);
break;
}
case 136: {
bitField0_ |= 0x00000008;
inlineClassUnderlyingPropertyName_ = input.readInt32();
break;
}
case 146: {
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
subBuilder = inlineClassUnderlyingType_.toBuilder();
}
inlineClassUnderlyingType_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.PARSER, extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(inlineClassUnderlyingType_);
inlineClassUnderlyingType_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
break;
}
case 152: {
bitField0_ |= 0x00000020;
inlineClassUnderlyingTypeId_ = input.readInt32();
break;
}
case 242: {
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder subBuilder = null;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
if (((bitField0_ & 0x00000040) == 0x00000040)) {
subBuilder = typeTable_.toBuilder();
}
typeTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.PARSER, extensionRegistry);
@@ -10595,13 +10649,13 @@ public final class DebugProtoBuf {
subBuilder.mergeFrom(typeTable_);
typeTable_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000008;
bitField0_ |= 0x00000040;
break;
}
case 248: {
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00004000;
mutable_bitField0_ |= 0x00020000;
}
versionRequirement_.add(input.readInt32());
break;
@@ -10609,9 +10663,9 @@ public final class DebugProtoBuf {
case 250: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00004000) == 0x00004000) && input.getBytesUntilLimit() > 0) {
if (!((mutable_bitField0_ & 0x00020000) == 0x00020000) && input.getBytesUntilLimit() > 0) {
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00004000;
mutable_bitField0_ |= 0x00020000;
}
while (input.getBytesUntilLimit() > 0) {
versionRequirement_.add(input.readInt32());
@@ -10621,7 +10675,7 @@ public final class DebugProtoBuf {
}
case 258: {
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder subBuilder = null;
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
subBuilder = versionRequirementTable_.toBuilder();
}
versionRequirementTable_ = input.readMessage(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.PARSER, extensionRegistry);
@@ -10629,7 +10683,7 @@ public final class DebugProtoBuf {
subBuilder.mergeFrom(versionRequirementTable_);
versionRequirementTable_ = subBuilder.buildPartial();
}
bitField0_ |= 0x00000010;
bitField0_ |= 0x00000080;
break;
}
}
@@ -10670,7 +10724,7 @@ public final class DebugProtoBuf {
if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) {
sealedSubclassFqName_ = java.util.Collections.unmodifiableList(sealedSubclassFqName_);
}
if (((mutable_bitField0_ & 0x00004000) == 0x00004000)) {
if (((mutable_bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
}
this.unknownFields = unknownFields.build();
@@ -11225,13 +11279,64 @@ public final class DebugProtoBuf {
}
private int sealedSubclassFqNameMemoizedSerializedSize = -1;
public static final int INLINE_CLASS_UNDERLYING_PROPERTY_NAME_FIELD_NUMBER = 17;
private int inlineClassUnderlyingPropertyName_;
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public boolean hasInlineClassUnderlyingPropertyName() {
return ((bitField0_ & 0x00000008) == 0x00000008);
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public int getInlineClassUnderlyingPropertyName() {
return inlineClassUnderlyingPropertyName_;
}
public static final int INLINE_CLASS_UNDERLYING_TYPE_FIELD_NUMBER = 18;
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public boolean hasInlineClassUnderlyingType() {
return ((bitField0_ & 0x00000010) == 0x00000010);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
return inlineClassUnderlyingType_;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
return inlineClassUnderlyingType_;
}
public static final int INLINE_CLASS_UNDERLYING_TYPE_ID_FIELD_NUMBER = 19;
private int inlineClassUnderlyingTypeId_;
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public boolean hasInlineClassUnderlyingTypeId() {
return ((bitField0_ & 0x00000020) == 0x00000020);
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public int getInlineClassUnderlyingTypeId() {
return inlineClassUnderlyingTypeId_;
}
public static final int TYPE_TABLE_FIELD_NUMBER = 30;
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
public boolean hasTypeTable() {
return ((bitField0_ & 0x00000008) == 0x00000008);
return ((bitField0_ & 0x00000040) == 0x00000040);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
@@ -11286,7 +11391,7 @@ public final class DebugProtoBuf {
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
*/
public boolean hasVersionRequirementTable() {
return ((bitField0_ & 0x00000010) == 0x00000010);
return ((bitField0_ & 0x00000080) == 0x00000080);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
@@ -11315,6 +11420,9 @@ public final class DebugProtoBuf {
typeAlias_ = java.util.Collections.emptyList();
enumEntry_ = java.util.Collections.emptyList();
sealedSubclassFqName_ = java.util.Collections.emptyList();
inlineClassUnderlyingPropertyName_ = 0;
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
inlineClassUnderlyingTypeId_ = 0;
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
versionRequirement_ = java.util.Collections.emptyList();
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
@@ -11371,6 +11479,12 @@ public final class DebugProtoBuf {
return false;
}
}
if (hasInlineClassUnderlyingType()) {
if (!getInlineClassUnderlyingType().isInitialized()) {
memoizedIsInitialized = 0;
return false;
}
}
if (hasTypeTable()) {
if (!getTypeTable().isInitialized()) {
memoizedIsInitialized = 0;
@@ -11443,12 +11557,21 @@ public final class DebugProtoBuf {
output.writeInt32NoTag(sealedSubclassFqName_.get(i));
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
output.writeInt32(17, inlineClassUnderlyingPropertyName_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
output.writeMessage(18, inlineClassUnderlyingType_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
output.writeInt32(19, inlineClassUnderlyingTypeId_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
output.writeMessage(30, typeTable_);
}
for (int i = 0; i < versionRequirement_.size(); i++) {
output.writeInt32(31, versionRequirement_.get(i));
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
output.writeMessage(32, versionRequirementTable_);
}
extensionWriter.writeUntil(19000, output);
@@ -11544,6 +11667,18 @@ public final class DebugProtoBuf {
sealedSubclassFqNameMemoizedSerializedSize = dataSize;
}
if (((bitField0_ & 0x00000008) == 0x00000008)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(17, inlineClassUnderlyingPropertyName_);
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(18, inlineClassUnderlyingType_);
}
if (((bitField0_ & 0x00000020) == 0x00000020)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32Size(19, inlineClassUnderlyingTypeId_);
}
if (((bitField0_ & 0x00000040) == 0x00000040)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(30, typeTable_);
}
@@ -11556,7 +11691,7 @@ public final class DebugProtoBuf {
size += dataSize;
size += 2 * getVersionRequirementList().size();
}
if (((bitField0_ & 0x00000010) == 0x00000010)) {
if (((bitField0_ & 0x00000080) == 0x00000080)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeMessageSize(32, versionRequirementTable_);
}
@@ -11678,6 +11813,7 @@ public final class DebugProtoBuf {
getPropertyFieldBuilder();
getTypeAliasFieldBuilder();
getEnumEntryFieldBuilder();
getInlineClassUnderlyingTypeFieldBuilder();
getTypeTableFieldBuilder();
getVersionRequirementTableFieldBuilder();
}
@@ -11742,20 +11878,30 @@ public final class DebugProtoBuf {
}
sealedSubclassFqName_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00001000);
inlineClassUnderlyingPropertyName_ = 0;
bitField0_ = (bitField0_ & ~0x00002000);
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
} else {
inlineClassUnderlyingTypeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00004000);
inlineClassUnderlyingTypeId_ = 0;
bitField0_ = (bitField0_ & ~0x00008000);
if (typeTableBuilder_ == null) {
typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
} else {
typeTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00002000);
bitField0_ = (bitField0_ & ~0x00010000);
versionRequirement_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
if (versionRequirementTableBuilder_ == null) {
versionRequirementTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance();
} else {
versionRequirementTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00008000);
bitField0_ = (bitField0_ & ~0x00040000);
return this;
}
@@ -11877,18 +12023,34 @@ public final class DebugProtoBuf {
if (((from_bitField0_ & 0x00002000) == 0x00002000)) {
to_bitField0_ |= 0x00000008;
}
result.inlineClassUnderlyingPropertyName_ = inlineClassUnderlyingPropertyName_;
if (((from_bitField0_ & 0x00004000) == 0x00004000)) {
to_bitField0_ |= 0x00000010;
}
if (inlineClassUnderlyingTypeBuilder_ == null) {
result.inlineClassUnderlyingType_ = inlineClassUnderlyingType_;
} else {
result.inlineClassUnderlyingType_ = inlineClassUnderlyingTypeBuilder_.build();
}
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
to_bitField0_ |= 0x00000020;
}
result.inlineClassUnderlyingTypeId_ = inlineClassUnderlyingTypeId_;
if (((from_bitField0_ & 0x00010000) == 0x00010000)) {
to_bitField0_ |= 0x00000040;
}
if (typeTableBuilder_ == null) {
result.typeTable_ = typeTable_;
} else {
result.typeTable_ = typeTableBuilder_.build();
}
if (((bitField0_ & 0x00004000) == 0x00004000)) {
if (((bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = java.util.Collections.unmodifiableList(versionRequirement_);
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
}
result.versionRequirement_ = versionRequirement_;
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
to_bitField0_ |= 0x00000010;
if (((from_bitField0_ & 0x00040000) == 0x00040000)) {
to_bitField0_ |= 0x00000080;
}
if (versionRequirementTableBuilder_ == null) {
result.versionRequirementTable_ = versionRequirementTable_;
@@ -12132,13 +12294,22 @@ public final class DebugProtoBuf {
}
onChanged();
}
if (other.hasInlineClassUnderlyingPropertyName()) {
setInlineClassUnderlyingPropertyName(other.getInlineClassUnderlyingPropertyName());
}
if (other.hasInlineClassUnderlyingType()) {
mergeInlineClassUnderlyingType(other.getInlineClassUnderlyingType());
}
if (other.hasInlineClassUnderlyingTypeId()) {
setInlineClassUnderlyingTypeId(other.getInlineClassUnderlyingTypeId());
}
if (other.hasTypeTable()) {
mergeTypeTable(other.getTypeTable());
}
if (!other.versionRequirement_.isEmpty()) {
if (versionRequirement_.isEmpty()) {
versionRequirement_ = other.versionRequirement_;
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
} else {
ensureVersionRequirementIsMutable();
versionRequirement_.addAll(other.versionRequirement_);
@@ -12200,6 +12371,12 @@ public final class DebugProtoBuf {
return false;
}
}
if (hasInlineClassUnderlyingType()) {
if (!getInlineClassUnderlyingType().isInitialized()) {
return false;
}
}
if (hasTypeTable()) {
if (!getTypeTable().isInitialized()) {
@@ -14258,6 +14435,186 @@ public final class DebugProtoBuf {
return this;
}
private int inlineClassUnderlyingPropertyName_ ;
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public boolean hasInlineClassUnderlyingPropertyName() {
return ((bitField0_ & 0x00002000) == 0x00002000);
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public int getInlineClassUnderlyingPropertyName() {
return inlineClassUnderlyingPropertyName_;
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public Builder setInlineClassUnderlyingPropertyName(int value) {
bitField0_ |= 0x00002000;
inlineClassUnderlyingPropertyName_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 inline_class_underlying_property_name = 17;</code>
*/
public Builder clearInlineClassUnderlyingPropertyName() {
bitField0_ = (bitField0_ & ~0x00002000);
inlineClassUnderlyingPropertyName_ = 0;
onChanged();
return this;
}
private org.jetbrains.kotlin.metadata.DebugProtoBuf.Type inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder> inlineClassUnderlyingTypeBuilder_;
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public boolean hasInlineClassUnderlyingType() {
return ((bitField0_ & 0x00004000) == 0x00004000);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type getInlineClassUnderlyingType() {
if (inlineClassUnderlyingTypeBuilder_ == null) {
return inlineClassUnderlyingType_;
} else {
return inlineClassUnderlyingTypeBuilder_.getMessage();
}
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder setInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
if (inlineClassUnderlyingTypeBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
inlineClassUnderlyingType_ = value;
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.setMessage(value);
}
bitField0_ |= 0x00004000;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder setInlineClassUnderlyingType(
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder builderForValue) {
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingType_ = builderForValue.build();
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00004000;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder mergeInlineClassUnderlyingType(org.jetbrains.kotlin.metadata.DebugProtoBuf.Type value) {
if (inlineClassUnderlyingTypeBuilder_ == null) {
if (((bitField0_ & 0x00004000) == 0x00004000) &&
inlineClassUnderlyingType_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance()) {
inlineClassUnderlyingType_ =
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.newBuilder(inlineClassUnderlyingType_).mergeFrom(value).buildPartial();
} else {
inlineClassUnderlyingType_ = value;
}
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00004000;
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public Builder clearInlineClassUnderlyingType() {
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingType_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.getDefaultInstance();
onChanged();
} else {
inlineClassUnderlyingTypeBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00004000);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder getInlineClassUnderlyingTypeBuilder() {
bitField0_ |= 0x00004000;
onChanged();
return getInlineClassUnderlyingTypeFieldBuilder().getBuilder();
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder getInlineClassUnderlyingTypeOrBuilder() {
if (inlineClassUnderlyingTypeBuilder_ != null) {
return inlineClassUnderlyingTypeBuilder_.getMessageOrBuilder();
} else {
return inlineClassUnderlyingType_;
}
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.Type inline_class_underlying_type = 18;</code>
*/
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>
getInlineClassUnderlyingTypeFieldBuilder() {
if (inlineClassUnderlyingTypeBuilder_ == null) {
inlineClassUnderlyingTypeBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.Type, org.jetbrains.kotlin.metadata.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeOrBuilder>(
getInlineClassUnderlyingType(),
getParentForChildren(),
isClean());
inlineClassUnderlyingType_ = null;
}
return inlineClassUnderlyingTypeBuilder_;
}
private int inlineClassUnderlyingTypeId_ ;
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public boolean hasInlineClassUnderlyingTypeId() {
return ((bitField0_ & 0x00008000) == 0x00008000);
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public int getInlineClassUnderlyingTypeId() {
return inlineClassUnderlyingTypeId_;
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public Builder setInlineClassUnderlyingTypeId(int value) {
bitField0_ |= 0x00008000;
inlineClassUnderlyingTypeId_ = value;
onChanged();
return this;
}
/**
* <code>optional int32 inline_class_underlying_type_id = 19;</code>
*/
public Builder clearInlineClassUnderlyingTypeId() {
bitField0_ = (bitField0_ & ~0x00008000);
inlineClassUnderlyingTypeId_ = 0;
onChanged();
return this;
}
private org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable typeTable_ = org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance();
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder, org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTableOrBuilder> typeTableBuilder_;
@@ -14265,7 +14622,7 @@ public final class DebugProtoBuf {
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
public boolean hasTypeTable() {
return ((bitField0_ & 0x00002000) == 0x00002000);
return ((bitField0_ & 0x00010000) == 0x00010000);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
@@ -14290,7 +14647,7 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.setMessage(value);
}
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
return this;
}
/**
@@ -14304,7 +14661,7 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
return this;
}
/**
@@ -14312,7 +14669,7 @@ public final class DebugProtoBuf {
*/
public Builder mergeTypeTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable value) {
if (typeTableBuilder_ == null) {
if (((bitField0_ & 0x00002000) == 0x00002000) &&
if (((bitField0_ & 0x00010000) == 0x00010000) &&
typeTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.getDefaultInstance()) {
typeTable_ =
org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.newBuilder(typeTable_).mergeFrom(value).buildPartial();
@@ -14323,7 +14680,7 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
return this;
}
/**
@@ -14336,14 +14693,14 @@ public final class DebugProtoBuf {
} else {
typeTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00002000);
bitField0_ = (bitField0_ & ~0x00010000);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.TypeTable type_table = 30;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.TypeTable.Builder getTypeTableBuilder() {
bitField0_ |= 0x00002000;
bitField0_ |= 0x00010000;
onChanged();
return getTypeTableFieldBuilder().getBuilder();
}
@@ -14376,9 +14733,9 @@ public final class DebugProtoBuf {
private java.util.List<java.lang.Integer> versionRequirement_ = java.util.Collections.emptyList();
private void ensureVersionRequirementIsMutable() {
if (!((bitField0_ & 0x00004000) == 0x00004000)) {
if (!((bitField0_ & 0x00020000) == 0x00020000)) {
versionRequirement_ = new java.util.ArrayList<java.lang.Integer>(versionRequirement_);
bitField0_ |= 0x00004000;
bitField0_ |= 0x00020000;
}
}
/**
@@ -14463,7 +14820,7 @@ public final class DebugProtoBuf {
*/
public Builder clearVersionRequirement() {
versionRequirement_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00004000);
bitField0_ = (bitField0_ & ~0x00020000);
onChanged();
return this;
}
@@ -14475,7 +14832,7 @@ public final class DebugProtoBuf {
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
*/
public boolean hasVersionRequirementTable() {
return ((bitField0_ & 0x00008000) == 0x00008000);
return ((bitField0_ & 0x00040000) == 0x00040000);
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
@@ -14500,7 +14857,7 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.setMessage(value);
}
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
return this;
}
/**
@@ -14514,7 +14871,7 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.setMessage(builderForValue.build());
}
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
return this;
}
/**
@@ -14522,7 +14879,7 @@ public final class DebugProtoBuf {
*/
public Builder mergeVersionRequirementTable(org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable value) {
if (versionRequirementTableBuilder_ == null) {
if (((bitField0_ & 0x00008000) == 0x00008000) &&
if (((bitField0_ & 0x00040000) == 0x00040000) &&
versionRequirementTable_ != org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.getDefaultInstance()) {
versionRequirementTable_ =
org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.newBuilder(versionRequirementTable_).mergeFrom(value).buildPartial();
@@ -14533,7 +14890,7 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.mergeFrom(value);
}
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
return this;
}
/**
@@ -14546,14 +14903,14 @@ public final class DebugProtoBuf {
} else {
versionRequirementTableBuilder_.clear();
}
bitField0_ = (bitField0_ & ~0x00008000);
bitField0_ = (bitField0_ & ~0x00040000);
return this;
}
/**
* <code>optional .org.jetbrains.kotlin.metadata.VersionRequirementTable version_requirement_table = 32;</code>
*/
public org.jetbrains.kotlin.metadata.DebugProtoBuf.VersionRequirementTable.Builder getVersionRequirementTableBuilder() {
bitField0_ |= 0x00008000;
bitField0_ |= 0x00040000;
onChanged();
return getVersionRequirementTableFieldBuilder().getBuilder();
}
@@ -34382,7 +34739,7 @@ public final class DebugProtoBuf {
"Variance:\003INV\0228\n\013upper_bound\030\005 \003(\0132#.org" +
".jetbrains.kotlin.metadata.Type\022\036\n\016upper" +
"_bound_id\030\006 \003(\005B\006\020\001\240\265\030\001\"$\n\010Variance\022\006\n\002I" +
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\250\007\n\005Class\022\020" +
"N\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002*\005\010d\020\350\007\"\327\010\n\005Class\022\020" +
"\n\005flags\030\001 \001(\005:\0016\022\025\n\007fq_name\030\003 \002(\005B\004\220\265\030\001\022",
"#\n\025companion_object_name\030\004 \001(\005B\004\210\265\030\001\022D\n\016" +
"type_parameter\030\005 \003(\0132,.org.jetbrains.kot" +
@@ -34398,122 +34755,127 @@ public final class DebugProtoBuf {
"brains.kotlin.metadata.TypeAlias\022<\n\nenum" +
"_entry\030\r \003(\0132(.org.jetbrains.kotlin.meta" +
"data.EnumEntry\022\'\n\027sealed_subclass_fq_nam" +
"e\030\020 \003(\005B\006\020\001\220\265\030\001\022<\n\ntype_table\030\036 \001(\0132(.or" +
"g.jetbrains.kotlin.metadata.TypeTable\022\033\n" +
"\023version_requirement\030\037 \003(\005\022Y\n\031version_re" +
"quirement_table\030 \001(\01326.org.jetbrains.ko" +
"tlin.metadata.VersionRequirementTable\"x\n" +
"\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTERFACE\020\001\022\016\n\nENUM_",
"CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CL" +
"ASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMPANION_OBJECT\020\006*" +
"\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010function\030\003 \003(\0132\'." +
"org.jetbrains.kotlin.metadata.Function\0229" +
"\n\010property\030\004 \003(\0132\'.org.jetbrains.kotlin." +
"metadata.Property\022<\n\ntype_alias\030\005 \003(\0132(." +
"org.jetbrains.kotlin.metadata.TypeAlias\022" +
"<\n\ntype_table\030\036 \001(\0132(.org.jetbrains.kotl" +
"in.metadata.TypeTable\022Y\n\031version_require" +
"ment_table\030 \001(\01326.org.jetbrains.kotlin.",
"metadata.VersionRequirementTable*\005\010d\020\310\001\"" +
"`\n\tTypeTable\0221\n\004type\030\001 \003(\0132#.org.jetbrai" +
"ns.kotlin.metadata.Type\022\032\n\016first_nullabl" +
"e\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Constructor\022\020\n\005fla" +
"gs\030\001 \001(\005:\0016\022F\n\017value_parameter\030\002 \003(\0132-.o" +
"rg.jetbrains.kotlin.metadata.ValueParame" +
"ter\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224\001" +
"\"\246\004\n\010Function\022\020\n\005flags\030\t \001(\005:\0016\022\024\n\told_f" +
"lags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013ret" +
"urn_type\030\003 \001(\0132#.org.jetbrains.kotlin.me",
"tadata.Type\022\034\n\016return_type_id\030\007 \001(\005B\004\240\265\030" +
"\001\022D\n\016type_parameter\030\004 \003(\0132,.org.jetbrain" +
"s.kotlin.metadata.TypeParameter\022:\n\rrecei" +
"ver_type\030\005 \001(\0132#.org.jetbrains.kotlin.me" +
"tadata.Type\022\036\n\020receiver_type_id\030\010 \001(\005B\004\240" +
"\265\030\001\022F\n\017value_parameter\030\006 \003(\0132-.org.jetbr" +
"ains.kotlin.metadata.ValueParameter\022<\n\nt" +
"ype_table\030\036 \001(\0132(.org.jetbrains.kotlin.m" +
"etadata.TypeTable\022\033\n\023version_requirement" +
"\030\037 \003(\005\0229\n\010contract\030 \001(\0132\'.org.jetbrains",
".kotlin.metadata.Contract*\006\010d\020\270\224\001\"\345\003\n\010Pr" +
"operty\022\022\n\005flags\030\013 \001(\005:\003518\022\027\n\told_flags\030" +
"\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0228\n\013retur" +
"n_type\030\003 \001(\0132#.org.jetbrains.kotlin.meta" +
"data.Type\022\034\n\016return_type_id\030\t \001(\005B\004\240\265\030\001\022" +
"D\n\016type_parameter\030\004 \003(\0132,.org.jetbrains." +
"kotlin.metadata.TypeParameter\022:\n\rreceive" +
"r_type\030\005 \001(\0132#.org.jetbrains.kotlin.meta" +
"data.Type\022\036\n\020receiver_type_id\030\n \001(\005B\004\240\265\030" +
"\001\022M\n\026setter_value_parameter\030\006 \001(\0132-.org.",
"jetbrains.kotlin.metadata.ValueParameter" +
"\022\024\n\014getter_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010" +
" \001(\005\022\033\n\023version_requirement\030\037 \003(\005*\006\010d\020\270\224" +
"\001\"\357\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022\022" +
"\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004type\030\003 \001(\0132#.org.j" +
"etbrains.kotlin.metadata.Type\022\025\n\007type_id" +
"\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_element_type\030\004 \001(" +
"\0132#.org.jetbrains.kotlin.metadata.Type\022$" +
"\n\026vararg_element_type_id\030\006 \001(\005B\004\240\265\030\001*\005\010d" +
"\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flags\030\001 \001(\005:\0016\022\022\n\004n",
"ame\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_parameter\030\003 \003(\0132" +
",.org.jetbrains.kotlin.metadata.TypePara" +
"meter\022<\n\017underlying_type\030\004 \001(\0132#.org.jet" +
"brains.kotlin.metadata.Type\022 \n\022underlyin" +
"g_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\rexpanded_type\030\006" +
" \001(\0132#.org.jetbrains.kotlin.metadata.Typ" +
"e\022\036\n\020expanded_type_id\030\007 \001(\005B\004\240\265\030\001\022=\n\nann" +
"otation\030\010 \003(\0132).org.jetbrains.kotlin.met" +
"adata.Annotation\022\033\n\023version_requirement\030" +
"\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B",
"\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionRequirement\022\017\n\007v" +
"ersion\030\001 \001(\005\022\024\n\014version_full\030\002 \001(\005\022M\n\005le" +
"vel\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
"a.VersionRequirement.Level:\005ERROR\022\022\n\nerr" +
"or_code\030\004 \001(\005\022\025\n\007message\030\005 \001(\005B\004\230\265\030\001\022e\n\014" +
"version_kind\030\006 \001(\0162=.org.jetbrains.kotli" +
"n.metadata.VersionRequirement.VersionKin" +
"d:\020LANGUAGE_VERSION\"+\n\005Level\022\013\n\007WARNING\020" +
"\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"J\n\013VersionKind\022" +
"\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020COMPILER_VERSIO",
"N\020\001\022\017\n\013API_VERSION\020\002\"a\n\027VersionRequireme" +
"ntTable\022F\n\013requirement\030\001 \003(\01321.org.jetbr" +
"ains.kotlin.metadata.VersionRequirement\"" +
"\217\002\n\017PackageFragment\022;\n\007strings\030\001 \001(\0132*.o" +
"rg.jetbrains.kotlin.metadata.StringTable" +
"\022J\n\017qualified_names\030\002 \001(\01321.org.jetbrain" +
"s.kotlin.metadata.QualifiedNameTable\0227\n\007" +
"package\030\003 \001(\0132&.org.jetbrains.kotlin.met" +
"adata.Package\0223\n\005class\030\004 \003(\0132$.org.jetbr" +
"ains.kotlin.metadata.Class*\005\010d\020\310\001\"A\n\010Con",
"tract\0225\n\006effect\030\001 \003(\0132%.org.jetbrains.ko" +
"tlin.metadata.Effect\"\306\003\n\006Effect\022E\n\013effec" +
"t_type\030\001 \001(\01620.org.jetbrains.kotlin.meta" +
"data.Effect.EffectType\022N\n\033effect_constru" +
"ctor_argument\030\002 \003(\0132).org.jetbrains.kotl" +
"in.metadata.Expression\022S\n conclusion_of_" +
"conditional_effect\030\003 \001(\0132).org.jetbrains" +
".kotlin.metadata.Expression\022B\n\004kind\030\004 \001(" +
"\01624.org.jetbrains.kotlin.metadata.Effect" +
".InvocationKind\"C\n\nEffectType\022\024\n\020RETURNS",
"_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n\020RETURNS_NOT_NU" +
"LL\020\002\"G\n\016InvocationKind\022\020\n\014AT_MOST_ONCE\020\000" +
"\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_LEAST_ONCE\020\002\"\245\003" +
"\n\nExpression\022\020\n\005flags\030\001 \001(\005:\0010\022!\n\031value_" +
"parameter_reference\030\002 \001(\005\022O\n\016constant_va" +
"lue\030\003 \001(\01627.org.jetbrains.kotlin.metadat" +
"a.Expression.ConstantValue\022=\n\020is_instanc" +
"e_type\030\004 \001(\0132#.org.jetbrains.kotlin.meta" +
"data.Type\022!\n\023is_instance_type_id\030\005 \001(\005B\004" +
"\240\265\030\001\022?\n\014and_argument\030\006 \003(\0132).org.jetbrai",
"ns.kotlin.metadata.Expression\022>\n\013or_argu" +
"ment\030\007 \003(\0132).org.jetbrains.kotlin.metada" +
"ta.Expression\".\n\rConstantValue\022\010\n\004TRUE\020\000" +
"\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010Modality\022\t\n\005FIN" +
"AL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002\022\n\n\006SEALED\020\003" +
"*b\n\nVisibility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020" +
"\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_" +
"TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nMemberKind\022\017\n\013DE" +
"CLARATION\020\000\022\021\n\rFAKE_OVERRIDE\020\001\022\016\n\nDELEGA" +
"TION\020\002\022\017\n\013SYNTHESIZED\020\003B\017B\rDebugProtoBuf"
"e\030\020 \003(\005B\006\020\001\220\265\030\001\0223\n%inline_class_underlyi" +
"ng_property_name\030\021 \001(\005B\004\210\265\030\001\022I\n\034inline_c" +
"lass_underlying_type\030\022 \001(\0132#.org.jetbrai" +
"ns.kotlin.metadata.Type\022-\n\037inline_class_" +
"underlying_type_id\030\023 \001(\005B\004\240\265\030\001\022<\n\ntype_t" +
"able\030\036 \001(\0132(.org.jetbrains.kotlin.metada",
"ta.TypeTable\022\033\n\023version_requirement\030\037 \003(" +
"\005\022Y\n\031version_requirement_table\030 \001(\01326.o" +
"rg.jetbrains.kotlin.metadata.VersionRequ" +
"irementTable\"x\n\004Kind\022\t\n\005CLASS\020\000\022\r\n\tINTER" +
"FACE\020\001\022\016\n\nENUM_CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024" +
"\n\020ANNOTATION_CLASS\020\004\022\n\n\006OBJECT\020\005\022\024\n\020COMP" +
"ANION_OBJECT\020\006*\006\010d\020\270\224\001\"\335\002\n\007Package\0229\n\010fu" +
"nction\030\003 \003(\0132\'.org.jetbrains.kotlin.meta" +
"data.Function\0229\n\010property\030\004 \003(\0132\'.org.je" +
"tbrains.kotlin.metadata.Property\022<\n\ntype",
"_alias\030\005 \003(\0132(.org.jetbrains.kotlin.meta" +
"data.TypeAlias\022<\n\ntype_table\030\036 \001(\0132(.org" +
".jetbrains.kotlin.metadata.TypeTable\022Y\n\031" +
"version_requirement_table\030 \001(\01326.org.je" +
"tbrains.kotlin.metadata.VersionRequireme" +
"ntTable*\005\010d\020\310\001\"`\n\tTypeTable\0221\n\004type\030\001 \003(" +
"\0132#.org.jetbrains.kotlin.metadata.Type\022\032" +
"\n\016first_nullable\030\002 \001(\005:\002-1:\004\240\273\030\001\"\214\001\n\013Con" +
"structor\022\020\n\005flags\030\001 \001(\005:\0016\022F\n\017value_para" +
"meter\030\002 \003(\0132-.org.jetbrains.kotlin.metad",
"ata.ValueParameter\022\033\n\023version_requiremen" +
"t\030\037 \003(\005*\006\010d\020\270\224\001\"\246\004\n\010Function\022\020\n\005flags\030\t " +
"\001(\005:\0016\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002" +
"(\005B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetb" +
"rains.kotlin.metadata.Type\022\034\n\016return_typ" +
"e_id\030\007 \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\013" +
"2,.org.jetbrains.kotlin.metadata.TypePar" +
"ameter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetb" +
"rains.kotlin.metadata.Type\022\036\n\020receiver_t" +
"ype_id\030\010 \001(\005B\004\240\265\030\001\022F\n\017value_parameter\030\006 ",
"\003(\0132-.org.jetbrains.kotlin.metadata.Valu" +
"eParameter\022<\n\ntype_table\030\036 \001(\0132(.org.jet" +
"brains.kotlin.metadata.TypeTable\022\033\n\023vers" +
"ion_requirement\030\037 \003(\005\0229\n\010contract\030 \001(\0132" +
"\'.org.jetbrains.kotlin.metadata.Contract" +
"*\006\010d\020\270\224\001\"\345\003\n\010Property\022\022\n\005flags\030\013 \001(\005:\00351" +
"8\022\027\n\told_flags\030\001 \001(\005:\0042054\022\022\n\004name\030\002 \002(\005" +
"B\004\210\265\030\001\0228\n\013return_type\030\003 \001(\0132#.org.jetbra" +
"ins.kotlin.metadata.Type\022\034\n\016return_type_" +
"id\030\t \001(\005B\004\240\265\030\001\022D\n\016type_parameter\030\004 \003(\0132,",
".org.jetbrains.kotlin.metadata.TypeParam" +
"eter\022:\n\rreceiver_type\030\005 \001(\0132#.org.jetbra" +
"ins.kotlin.metadata.Type\022\036\n\020receiver_typ" +
"e_id\030\n \001(\005B\004\240\265\030\001\022M\n\026setter_value_paramet" +
"er\030\006 \001(\0132-.org.jetbrains.kotlin.metadata" +
".ValueParameter\022\024\n\014getter_flags\030\007 \001(\005\022\024\n" +
"\014setter_flags\030\010 \001(\005\022\033\n\023version_requireme" +
"nt\030\037 \003(\005*\006\010d\020\270\224\001\"\357\001\n\016ValueParameter\022\020\n\005f" +
"lags\030\001 \001(\005:\0010\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0221\n\004typ" +
"e\030\003 \001(\0132#.org.jetbrains.kotlin.metadata.",
"Type\022\025\n\007type_id\030\005 \001(\005B\004\240\265\030\001\022@\n\023vararg_el" +
"ement_type\030\004 \001(\0132#.org.jetbrains.kotlin." +
"metadata.Type\022$\n\026vararg_element_type_id\030" +
"\006 \001(\005B\004\240\265\030\001*\005\010d\020\310\001\"\226\003\n\tTypeAlias\022\020\n\005flag" +
"s\030\001 \001(\005:\0016\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\022D\n\016type_p" +
"arameter\030\003 \003(\0132,.org.jetbrains.kotlin.me" +
"tadata.TypeParameter\022<\n\017underlying_type\030" +
"\004 \001(\0132#.org.jetbrains.kotlin.metadata.Ty" +
"pe\022 \n\022underlying_type_id\030\005 \001(\005B\004\240\265\030\001\022:\n\r" +
"expanded_type\030\006 \001(\0132#.org.jetbrains.kotl",
"in.metadata.Type\022\036\n\020expanded_type_id\030\007 \001" +
"(\005B\004\240\265\030\001\022=\n\nannotation\030\010 \003(\0132).org.jetbr" +
"ains.kotlin.metadata.Annotation\022\033\n\023versi" +
"on_requirement\030\037 \003(\005*\005\010d\020\310\001\"&\n\tEnumEntry" +
"\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020\310\001\"\225\003\n\022VersionR" +
"equirement\022\017\n\007version\030\001 \001(\005\022\024\n\014version_f" +
"ull\030\002 \001(\005\022M\n\005level\030\003 \001(\01627.org.jetbrains" +
".kotlin.metadata.VersionRequirement.Leve" +
"l:\005ERROR\022\022\n\nerror_code\030\004 \001(\005\022\025\n\007message\030" +
"\005 \001(\005B\004\230\265\030\001\022e\n\014version_kind\030\006 \001(\0162=.org.",
"jetbrains.kotlin.metadata.VersionRequire" +
"ment.VersionKind:\020LANGUAGE_VERSION\"+\n\005Le" +
"vel\022\013\n\007WARNING\020\000\022\t\n\005ERROR\020\001\022\n\n\006HIDDEN\020\002\"" +
"J\n\013VersionKind\022\024\n\020LANGUAGE_VERSION\020\000\022\024\n\020" +
"COMPILER_VERSION\020\001\022\017\n\013API_VERSION\020\002\"a\n\027V" +
"ersionRequirementTable\022F\n\013requirement\030\001 " +
"\003(\01321.org.jetbrains.kotlin.metadata.Vers" +
"ionRequirement\"\217\002\n\017PackageFragment\022;\n\007st" +
"rings\030\001 \001(\0132*.org.jetbrains.kotlin.metad" +
"ata.StringTable\022J\n\017qualified_names\030\002 \001(\013",
"21.org.jetbrains.kotlin.metadata.Qualifi" +
"edNameTable\0227\n\007package\030\003 \001(\0132&.org.jetbr" +
"ains.kotlin.metadata.Package\0223\n\005class\030\004 " +
"\003(\0132$.org.jetbrains.kotlin.metadata.Clas" +
"s*\005\010d\020\310\001\"A\n\010Contract\0225\n\006effect\030\001 \003(\0132%.o" +
"rg.jetbrains.kotlin.metadata.Effect\"\306\003\n\006" +
"Effect\022E\n\013effect_type\030\001 \001(\01620.org.jetbra" +
"ins.kotlin.metadata.Effect.EffectType\022N\n" +
"\033effect_constructor_argument\030\002 \003(\0132).org" +
".jetbrains.kotlin.metadata.Expression\022S\n",
" conclusion_of_conditional_effect\030\003 \001(\0132" +
").org.jetbrains.kotlin.metadata.Expressi" +
"on\022B\n\004kind\030\004 \001(\01624.org.jetbrains.kotlin." +
"metadata.Effect.InvocationKind\"C\n\nEffect" +
"Type\022\024\n\020RETURNS_CONSTANT\020\000\022\t\n\005CALLS\020\001\022\024\n" +
"\020RETURNS_NOT_NULL\020\002\"G\n\016InvocationKind\022\020\n" +
"\014AT_MOST_ONCE\020\000\022\020\n\014EXACTLY_ONCE\020\001\022\021\n\rAT_" +
"LEAST_ONCE\020\002\"\245\003\n\nExpression\022\020\n\005flags\030\001 \001" +
"(\005:\0010\022!\n\031value_parameter_reference\030\002 \001(\005" +
"\022O\n\016constant_value\030\003 \001(\01627.org.jetbrains",
".kotlin.metadata.Expression.ConstantValu" +
"e\022=\n\020is_instance_type\030\004 \001(\0132#.org.jetbra" +
"ins.kotlin.metadata.Type\022!\n\023is_instance_" +
"type_id\030\005 \001(\005B\004\240\265\030\001\022?\n\014and_argument\030\006 \003(" +
"\0132).org.jetbrains.kotlin.metadata.Expres" +
"sion\022>\n\013or_argument\030\007 \003(\0132).org.jetbrain" +
"s.kotlin.metadata.Expression\".\n\rConstant" +
"Value\022\010\n\004TRUE\020\000\022\t\n\005FALSE\020\001\022\010\n\004NULL\020\002*9\n\010" +
"Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRAC" +
"T\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010INTERNA",
"L\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n\006PUBLI" +
"C\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020\005*Q\n\nM" +
"emberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERR" +
"IDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003B\017" +
"B\rDebugProtoBuf"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -34587,7 +34949,7 @@ public final class DebugProtoBuf {
internal_static_org_jetbrains_kotlin_metadata_Class_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_metadata_Class_descriptor,
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
new java.lang.String[] { "Flags", "FqName", "CompanionObjectName", "TypeParameter", "Supertype", "SupertypeId", "NestedClassName", "Constructor", "Function", "Property", "TypeAlias", "EnumEntry", "SealedSubclassFqName", "InlineClassUnderlyingPropertyName", "InlineClassUnderlyingType", "InlineClassUnderlyingTypeId", "TypeTable", "VersionRequirement", "VersionRequirementTable", });
internal_static_org_jetbrains_kotlin_metadata_Package_descriptor =
getDescriptor().getMessageTypes().get(6);
internal_static_org_jetbrains_kotlin_metadata_Package_fieldAccessorTable = new
@@ -34696,6 +35058,8 @@ public final class DebugProtoBuf {
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.fqNameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.skipMessageInComparison);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.nameIdInTable);
registry.add(org.jetbrains.kotlin.metadata.DebugExtOptionsProtoBuf.typeIdInTable);

View File

@@ -178,7 +178,7 @@ extra["versions.jflex"] = "1.7.0"
extra["versions.markdown"] = "0.1.25"
extra["versions.trove4j"] = "1.0.20181211"
extra["versions.completion-ranking-kotlin"] = "0.1.3"
extra["versions.r8"] = "2.0.88"
extra["versions.r8"] = "2.1.75"
val immutablesVersion = "0.3.1"
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
@@ -187,7 +187,7 @@ extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
extra["versions.ktor-network"] = "1.0.1"
if (!project.hasProperty("versions.kotlin-native")) {
extra["versions.kotlin-native"] = "1.5-dev-17775"
extra["versions.kotlin-native"] = "1.5-eap-4"
}
val intellijUltimateEnabled by extra(project.kotlinBuildProperties.intellijUltimateEnabled)
@@ -345,6 +345,7 @@ val coreLibProjects = listOfNotNull(
":kotlin-stdlib-js",
":kotlin-stdlib-jdk7",
":kotlin-stdlib-jdk8",
":kotlin-test",
":kotlin-test:kotlin-test-annotations-common",
":kotlin-test:kotlin-test-common",
":kotlin-test:kotlin-test-jvm",
@@ -637,7 +638,10 @@ tasks {
listOf("clean", "assemble", "install").forEach { taskName ->
register("coreLibs${taskName.capitalize()}") {
coreLibProjects.forEach { projectName -> dependsOn("$projectName:$taskName") }
for (projectName in coreLibProjects) {
if (projectName.startsWith(":kotlin-test:") && taskName == "install") continue
dependsOn("$projectName:$taskName")
}
}
}
@@ -728,10 +732,12 @@ tasks {
register("scriptingTest") {
dependsOn("dist")
dependsOn(":kotlin-script-util:test")
dependsOn(":kotlin-scripting-compiler-embeddable:test")
dependsOn(":kotlin-scripting-compiler:test")
dependsOn(":kotlin-scripting-compiler:testWithIr")
dependsOn(":kotlin-scripting-common:test")
dependsOn(":kotlin-scripting-jvm:test")
dependsOn(":kotlin-scripting-jvm-host-test:test")
dependsOn(":kotlin-scripting-jvm-host-test:testWithIr")
dependsOn(":kotlin-scripting-dependencies:test")
dependsOn(":kotlin-scripting-dependencies-maven:test")
dependsOn(":kotlin-scripting-jsr223-test:test")
@@ -739,6 +745,7 @@ tasks {
// dependsOn(":kotlin-scripting-jvm-host-test:embeddableTest")
dependsOn(":kotlin-scripting-jsr223-test:embeddableTest")
dependsOn(":kotlin-main-kts-test:test")
dependsOn(":kotlin-main-kts-test:testWithIr")
dependsOn(":kotlin-scripting-ide-services-test:test")
dependsOn(":kotlin-scripting-ide-services-test:embeddableTest")
dependsOn(":kotlin-scripting-js-test:test")
@@ -752,7 +759,6 @@ tasks {
register("miscCompilerTest") {
dependsOn("nativeCompilerTest")
dependsOn("firCompilerTest")
dependsOn(":kotlin-daemon-tests:test")
dependsOn("scriptingTest")
@@ -953,7 +959,6 @@ tasks {
dependsOn(
":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-for-ide:publish",
":prepare:ide-plugin-dependencies:allopen-compiler-plugin-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:incremental-compilation-impl-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-build-common-tests-for-ide:publish",
":prepare:ide-plugin-dependencies:kotlin-compiler-for-ide:publish",
@@ -975,9 +980,7 @@ tasks {
":kotlin-stdlib-jdk7:publish",
":kotlin-stdlib-jdk8:publish",
":kotlin-reflect:publish",
":kotlin-main-kts:publish",
":kotlin-stdlib-js:publish",
":kotlin-test:kotlin-test-js:publish"
":kotlin-main-kts:publish"
)
}
}

View File

@@ -9,10 +9,13 @@
import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ExternalModuleDependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.FileCollection
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.project
import java.io.File
@@ -112,6 +115,50 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
fun Project.testApiJUnit5(
vintageEngine: Boolean = false,
runner: Boolean = false,
suiteApi: Boolean = false
) {
with(dependencies) {
val platformVersion = commonVer("org.junit", "junit-bom")
testApi(platform("org.junit:junit-bom:$platformVersion"))
testApi("org.junit.jupiter:junit-jupiter")
if (vintageEngine) {
testApi("org.junit.vintage:junit-vintage-engine:$platformVersion")
}
val componentsVersion = commonVer("org.junit.platform", "")
val components = mutableListOf(
"org.junit.platform:junit-platform-commons",
"org.junit.platform:junit-platform-launcher"
)
if (runner) {
components += "org.junit.platform:junit-platform-runner"
}
if (suiteApi) {
components += "org.junit.platform:junit-platform-suite-api"
}
for (component in components) {
testApi("$component:$componentsVersion")
}
addDependencyTo<ExternalModuleDependency>(this, "testImplementation", intellijDep()) {
// This dependency is needed only for FileComparisonFailure
includeJars("idea_rt", rootProject = rootProject)
isTransitive = false
}
// This is needed only for using FileComparisonFailure, which relies on JUnit 3 classes
add("testRuntimeOnly", commonDep("junit:junit"))
}
}
private fun DependencyHandler.testApi(dependencyNotation: Any) {
add("testApi", dependencyNotation)
}
val Project.protobufVersion: String get() = findProperty("versions.protobuf") as String
val Project.protobufRepo: String

View File

@@ -25,6 +25,7 @@ val packagesToRelocate =
"org.fusesource",
"net.jpountz",
"one.util.streamex",
"it.unimi.dsi.fastutil",
"kotlinx.collections.immutable"
)

View File

@@ -41,7 +41,7 @@ open class DexMethodCount : DefaultTask() {
dependsOn(jar)
}
@Internal // plain output properties are not supported, mark as internal to suppress warning from validateTaskProperties
@Internal // plain output properties are not supported, mark as internal to suppress warning from validatePlugins
lateinit var counts: Counts
@get:OutputFile

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* 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.
*/
@@ -71,62 +71,11 @@ class KotlinBuildPublishingPlugin @Inject constructor(
create<MavenPublication>(PUBLICATION_NAME) {
from(kotlinLibraryComponent)
pom {
packaging = "jar"
name.set(humanReadableName(project))
description.set(project.description ?: humanReadableName(project))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
}
repositories {
maven {
name = REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
configureKotlinPomAttributes(project)
}
}
}
val signingRequired = provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
}
configure<SigningExtension> {
setRequired(signingRequired)
sign(extensions.getByType<PublishingExtension>().publications[PUBLICATION_NAME])
useGpgCmd()
}
tasks.withType<Sign>().configureEach {
setOnlyIf { signingRequired.get() }
}
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.named<PublishToMavenRepository>("publish${PUBLICATION_NAME}PublicationTo${REPOSITORY_NAME}Repository")
.configureRepository()
configureDefaultPublishing()
}
companion object {
@@ -137,13 +86,84 @@ class KotlinBuildPublishingPlugin @Inject constructor(
const val COMPILE_CONFIGURATION = "publishedCompile"
const val RUNTIME_CONFIGURATION = "publishedRuntime"
@OptIn(ExperimentalStdlibApi::class)
fun humanReadableName(project: Project) =
project.name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() = configure {
@OptIn(ExperimentalStdlibApi::class)
private fun humanReadableName(name: String) =
name.split("-").joinToString(separator = " ") { it.capitalize(Locale.ROOT) }
fun MavenPublication.configureKotlinPomAttributes(project: Project, explicitDescription: String? = null) {
val publication = this
pom {
packaging = "jar"
name.set(humanReadableName(publication.artifactId))
description.set(explicitDescription ?: project.description ?: humanReadableName(publication.artifactId))
url.set("https://kotlinlang.org/")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
url.set("https://github.com/JetBrains/kotlin")
connection.set("scm:git:https://github.com/JetBrains/kotlin.git")
developerConnection.set("scm:git:https://github.com/JetBrains/kotlin.git")
}
developers {
developer {
name.set("Kotlin Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
}
}
fun Project.configureDefaultPublishing() {
configure<PublishingExtension> {
repositories {
maven {
name = KotlinBuildPublishingPlugin.REPOSITORY_NAME
url = file("${project.rootDir}/build/repo").toURI()
}
}
}
configureSigning()
tasks.register("install") {
dependsOn(tasks.named("publishToMavenLocal"))
}
tasks.withType<PublishToMavenRepository>()
.matching { it.name.endsWith("PublicationTo${KotlinBuildPublishingPlugin.REPOSITORY_NAME}Repository") }
.all { configureRepository() }
}
private fun Project.configureSigning() {
val signingRequired = provider {
project.findProperty("signingRequired")?.toString()?.toBoolean()
?: project.property("isSonatypeRelease") as Boolean
}
configure<SigningExtension> {
setRequired(signingRequired)
sign(extensions.getByType<PublishingExtension>().publications) // all publications
useGpgCmd()
}
tasks.withType<Sign>().configureEach {
setOnlyIf { signingRequired.get() }
}
}
fun TaskProvider<PublishToMavenRepository>.configureRepository() =
configure { configureRepository() }
private fun PublishToMavenRepository.configureRepository() {
dependsOn(project.rootProject.tasks.named("preparePublication"))
doFirst {
val preparePublication = project.rootProject.tasks.named("preparePublication").get()

View File

@@ -1,17 +1,6 @@
/*
* 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.
* 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.
*/
@@ -51,11 +40,7 @@ fun Task.dependsOnKotlinPluginInstall() {
":kotlin-gradle-plugin-model:install",
":kotlin-reflect:install",
":kotlin-annotation-processing-gradle:install",
":kotlin-test:kotlin-test-common:install",
":kotlin-test:kotlin-test-annotations-common:install",
":kotlin-test:kotlin-test-jvm:install",
":kotlin-test:kotlin-test-js:install",
":kotlin-test:kotlin-test-junit:install",
":kotlin-test:install",
":kotlin-gradle-subplugin-example:install",
":kotlin-stdlib-common:install",
":kotlin-stdlib:install",

View File

@@ -19,6 +19,10 @@ dependencies {
testCompile(project(":kotlin-reflect"))
testCompile(projectTests(":compiler:tests-common"))
testCompile(commonDep("junit:junit"))
testApi(projectTests(":compiler:test-infrastructure"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
testApi(projectTests(":compiler:tests-compiler-utils"))
testApi(projectTests(":compiler:tests-common-new"))
testCompile(projectTests(":jps-plugin"))
testCompile(commonDep("junit:junit"))
@@ -37,6 +41,8 @@ dependencies {
testCompile(intellijPluginDep("java")) { includeJars("jps-builders") }
testCompile(jpsStandalone()) { includeJars("jps-model") }
testCompile(jpsBuildTest())
testCompile("org.junit.platform:junit-platform-launcher:${commonVer("org.junit.platform", "")}")
}
sourceSets {

View File

@@ -20,7 +20,9 @@ import com.intellij.openapi.util.Ref
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.test.KotlinBaseTest
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.sourceFileProvider
import java.io.File
import java.util.regex.Pattern
@@ -34,28 +36,24 @@ private data class OldPackageAndNew(val oldFqName: FqName, val newFqName: FqName
internal fun patchFilesAndAddTest(
testFile: File,
testFiles: List<KotlinBaseTest.TestFile>,
module: TestModule,
services: TestServices,
filesHolder: CodegenTestsOnAndroidGenerator.FilesWriter
): FqName? {
if (testFiles.any { it.name.endsWith(".java") }) {
//TODO support java files
return null
}
val ktFiles = testFiles.filter { it.name.endsWith(".kt") }
if (ktFiles.isEmpty()) return null
): FqName {
val newPackagePrefix = testFile.path.replace("\\\\|-|\\.|/".toRegex(), "_")
val oldPackage = Ref<FqName>()
val isJvmName = Ref<Boolean>(false)
val testFiles = module.files
val isSingle = testFiles.size == 1
val resultFiles = testFiles.map {
val fileName = if (isSingle) it.name else testFile.name.substringBeforeLast(".kt") + "/" + it.name
val content = services.sourceFileProvider.getContentOfSourceFile(it)
TestClassInfo(
fileName,
changePackage(newPackagePrefix, it.content, oldPackage, isJvmName),
changePackage(newPackagePrefix, content, oldPackage, isJvmName),
oldPackage.get(),
isJvmName.get(),
getGeneratedClassName(File(fileName), it.content, newPackagePrefix, oldPackage.get())
getGeneratedClassName(File(fileName), content, newPackagePrefix, oldPackage.get())
)
}
val packages =

View File

@@ -16,12 +16,25 @@ import org.jetbrains.kotlin.codegen.CodegenTestCase
import org.jetbrains.kotlin.codegen.CodegenTestFiles
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.*
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
import org.jetbrains.kotlin.test.directives.model.singleOrZeroValue
import org.jetbrains.kotlin.test.model.DependencyKind
import org.jetbrains.kotlin.test.model.FrontendKinds
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
import org.jetbrains.kotlin.test.services.*
import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
import org.jetbrains.kotlin.test.services.impl.BackendKindExtractorImpl
import org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl
import org.jetbrains.kotlin.test.services.sourceProviders.AdditionalDiagnosticsSourceFilesProvider
import org.jetbrains.kotlin.test.services.sourceProviders.CodegenHelpersSourceFilesProvider
import org.jetbrains.kotlin.test.services.sourceProviders.CoroutineHelpersSourceFilesProvider
import org.jetbrains.kotlin.test.util.KtTestUtil
import org.junit.Assert
import java.io.File
@@ -241,6 +254,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
}
}
@OptIn(TestInfrastructureInternals::class)
@Throws(IOException::class)
private fun processFiles(
files: Array<File>,
@@ -279,7 +293,8 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
//TODO support JvmPackageName
if (fullFileText.contains("@file:JvmPackageName(")) continue
// TODO: Support jvm assertions
if (fullFileText.contains("// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm")) continue
if (fullFileText.contains("// ASSERTIONS_MODE: jvm")) continue
if (fullFileText.contains("// MODULE: ")) continue
val targets = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fullFileText, "// JVM_TARGET:")
.also { it.remove(JvmTarget.JVM_1_6.description) }
@@ -292,31 +307,90 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
if (fullFileText.contains("// SKIP_JDK6")) continue
if (hasBoxMethod(fullFileText)) {
val testFiles = createTestFiles(file, fullFileText)
val kind = KotlinBaseTest.extractConfigurationKind(testFiles)
val jdkKind = KotlinBaseTest.getTestJdkKind(testFiles)
val testConfiguration = createTestConfiguration(file)
val services = testConfiguration.testServices
val moduleStructure = try {
testConfiguration.moduleStructureExtractor.splitTestDataByModules(
file.path,
testConfiguration.directives,
).also {
services.register(TestModuleStructure::class, it)
}
} catch (e: ExceptionFromModuleStructureTransformer) {
continue
}
val module = moduleStructure.modules.singleOrNull() ?: continue
if (module.files.any { it.isJavaFile || it.isKtsFile }) continue
if (module.files.isEmpty()) continue
services.registerDependencyProvider(DependencyProviderImpl(services, moduleStructure.modules))
val keyConfiguration = CompilerConfiguration()
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, keyConfiguration)
val configuratorForFlags = JvmEnvironmentConfigurator(services)
with(configuratorForFlags) {
val extractor = DirectiveToConfigurationKeyExtractor()
extractor.provideConfigurationKeys()
extractor.configure(keyConfiguration, module.directives)
}
val kind = configuratorForFlags.extractConfigurationKind(module.directives)
val jdkKind = configuratorForFlags.extractJdkKind(module.directives)
keyConfiguration.languageVersionSettings = module.languageVersionSettings
val key = ConfigurationKey(kind, jdkKind, keyConfiguration.toString())
val compiler = if (isJvm8Target) {
if (kind.withReflection) JVM8REFLECT else JVM8
} else if (kind.withReflection) REFLECT else COMMON
val compilerConfigurationProvider = services.compilerConfigurationProvider as CompilerConfigurationProviderImpl
val filesHolder = holders.getOrPut(key) {
FilesWriter(compiler, KotlinTestUtils.newConfiguration(kind, jdkKind,
KtTestUtil.getAnnotationsJar()
).apply {
FilesWriter(compiler, compilerConfigurationProvider.createCompilerConfiguration(module)).also {
println("Creating new configuration by $key")
KotlinBaseTest.updateConfigurationByDirectivesInTestFiles(testFiles, this)
})
}
}
patchFilesAndAddTest(file, testFiles, filesHolder)
patchFilesAndAddTest(file, module, services, filesHolder)
}
}
}
}
private fun createTestConfiguration(testDataFile: File): TestConfiguration {
return TestConfigurationBuilder().apply {
testConfiguration()
testInfo = KotlinTestInfo(
"org.jetbrains.kotlin.android.tests.AndroidRunner",
"test${testDataFile.nameWithoutExtension.capitalize()}",
emptySet()
)
}.build(testDataFile.path)
}
private val testConfiguration: TestConfigurationBuilder.() -> Unit = {
globalDefaults {
frontend = FrontendKinds.ClassicFrontend
targetBackend = TargetBackend.ANDROID
targetPlatform = JvmPlatforms.defaultJvmPlatform
dependencyKind = DependencyKind.Binary
}
useConfigurators(
::CommonEnvironmentConfigurator,
::JvmEnvironmentConfigurator
)
useAdditionalSourceProviders(
::AdditionalDiagnosticsSourceFilesProvider,
::CoroutineHelpersSourceFilesProvider,
::CodegenHelpersSourceFilesProvider,
)
assertions = JUnit5Assertions
useAdditionalService<TemporaryDirectoryManager>(::TemporaryDirectoryManagerImpl)
useAdditionalService<BackendKindExtractor>(::BackendKindExtractorImpl)
useSourcePreprocessor(*AbstractKotlinCompilerTest.defaultPreprocessors.toTypedArray())
useDirectives(*AbstractKotlinCompilerTest.defaultDirectiveContainers.toTypedArray())
}
private fun createTestFiles(file: File, expectedText: String): List<KotlinBaseTest.TestFile> =
CodegenTestCase.createTestFilesFromFile(file, expectedText, false, TargetBackend.JVM)

View File

@@ -14,7 +14,6 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
public class AsmTypes {
private static final Map<Class<?>, Type> TYPES_MAP = new HashMap<>();

View File

@@ -116,6 +116,12 @@ object AbstractTypeMapper {
return asmType
}
typeConstructor.isScript() -> {
val asmType = AsmTypes.JAVA_CLASS_TYPE
with(context) { sw?.writeGenericType(type, asmType, mode) }
return asmType
}
typeConstructor.isTypeParameter() -> {
val typeParameter = typeConstructor as TypeParameterMarker
return mapType(context, typeParameter.representativeUpperBound(), mode, null).also { asmType ->

View File

@@ -50,7 +50,7 @@ class AccessorForFunctionDescriptor(
if (calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION) != null) {
userDataMap = LinkedHashMap<CallableDescriptor.UserDataKey<*>, Any>()
userDataMap[INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION] =
calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION)
calleeDescriptor.getUserData(INITIAL_DESCRIPTOR_FOR_SUSPEND_FUNCTION)
}
}

View File

@@ -20,11 +20,9 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor
import org.jetbrains.kotlin.resolve.calls.components.hasDefaultValue
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.descriptorUtil.overriddenTreeUniqueAsSequence
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.kotlin.utils.mapToIndex
class ArgumentAndDeclIndex(val arg: ResolvedValueArgument, val declIndex: Int)
@@ -70,12 +68,8 @@ abstract class ArgumentGenerator {
generateExpression(declIndex, argument)
}
is DefaultValueArgument -> {
if (calleeDescriptor?.defaultValueFromJava(declIndex) == true) {
generateDefaultJava(declIndex, argument)
} else {
defaultArgs.mark(declIndex)
generateDefault(declIndex, argument)
}
defaultArgs.mark(declIndex)
generateDefault(declIndex, argument)
}
is VarargValueArgument -> {
generateVararg(declIndex, argument)
@@ -103,10 +97,6 @@ abstract class ArgumentGenerator {
throw UnsupportedOperationException("Unsupported vararg value argument #$i: $argument")
}
protected open fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
throw UnsupportedOperationException("Unsupported default java argument #$i: $argument")
}
protected open fun generateOther(i: Int, argument: ResolvedValueArgument) {
throw UnsupportedOperationException("Unsupported value argument #$i: $argument")
}
@@ -116,28 +106,6 @@ abstract class ArgumentGenerator {
}
}
private fun CallableDescriptor.defaultValueFromJava(index: Int): Boolean = DFS.ifAny(
listOf(this),
{ current -> current.original.overriddenDescriptors.map { it.original } },
{ descriptor ->
descriptor.original.overriddenDescriptors.isEmpty() &&
descriptor is JavaCallableMemberDescriptor &&
descriptor.valueParameters[index].declaresDefaultValue()
}
)
fun shouldInvokeDefaultArgumentsStub(resolvedCall: ResolvedCall<*>): Boolean {
val descriptor = resolvedCall.resultingDescriptor
val valueArgumentsByIndex = resolvedCall.valueArgumentsByIndex ?: return false
for (index in valueArgumentsByIndex.indices) {
val resolvedValueArgument = valueArgumentsByIndex[index]
if (resolvedValueArgument is DefaultValueArgument && !descriptor.defaultValueFromJava(index)) {
return true
}
}
return false
}
fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): FunctionDescriptor {
if (functionDescriptor.containingDeclaration !is ClassDescriptor) return functionDescriptor
if (functionDescriptor.overriddenDescriptors.isEmpty()) return functionDescriptor
@@ -155,4 +123,4 @@ fun getFunctionWithDefaultArguments(functionDescriptor: FunctionDescriptor): Fun
function.valueParameters.any { valueParameter -> valueParameter.hasDefaultValue() }
}
?: functionDescriptor
}
}

View File

@@ -51,7 +51,6 @@ interface BaseExpressionCodegen {
fun consumeReifiedOperationMarker(typeParameter: TypeParameterMarker)
@JvmDefault
fun putReifiedOperationMarkerIfTypeIsReifiedParameter(type: KotlinTypeMarker, operationKind: OperationKind) {
with(typeSystem) {
val (typeParameter, second) = extractReificationArgument(type) ?: return

View File

@@ -72,12 +72,6 @@ class CallBasedArgumentGenerator(
callGenerator.putValueIfNeeded(getJvmKotlinType(i), lazyVararg, ValueKind.GENERAL_VARARG, i)
}
override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
val argumentValue = valueParameters[i].findJavaDefaultArgumentValue(valueParameterTypes[i], codegen.typeMapper)
callGenerator.putValueIfNeeded(getJvmKotlinType(i), argumentValue)
}
override fun reorderArgumentsIfNeeded(args: List<ArgumentAndDeclIndex>) {
callGenerator.reorderArgumentsIfNeeded(args, valueParameterTypes)
}

View File

@@ -232,9 +232,7 @@ public class DescriptorAsmUtil {
int flags = getVisibilityAccessFlag(functionDescriptor, kind);
flags |= getVarargsFlag(functionDescriptor);
flags |= getDeprecatedAccessFlag(functionDescriptor);
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) ||
isInlineWithReified(functionDescriptor) ||
functionDescriptor.isSuspend() && functionDescriptor.getVisibility().equals(DescriptorVisibilities.PRIVATE)) {
if (deprecationResolver.isDeprecatedHidden(functionDescriptor) || isInlineWithReified(functionDescriptor)) {
flags |= ACC_SYNTHETIC;
}
return flags;
@@ -427,10 +425,6 @@ public class DescriptorAsmUtil {
return null;
}
if (memberDescriptor instanceof FunctionDescriptor && ((FunctionDescriptor) memberDescriptor).isSuspend()) {
return NO_FLAG_PACKAGE_PRIVATE;
}
if (memberDescriptor instanceof AccessorForCompanionObjectInstanceFieldDescriptor) {
return NO_FLAG_PACKAGE_PRIVATE;
}

View File

@@ -74,7 +74,10 @@ import org.jetbrains.kotlin.resolve.constants.*;
import org.jetbrains.kotlin.resolve.constants.evaluate.ConstantExpressionEvaluatorKt;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.inline.InlineUtil;
import org.jetbrains.kotlin.resolve.jvm.*;
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices;
import org.jetbrains.kotlin.resolve.jvm.JvmConstantsKt;
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionInfo;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOriginKt;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
@@ -85,6 +88,7 @@ import org.jetbrains.kotlin.synthetic.SyntheticJavaPropertyDescriptor;
import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.checker.ClassicTypeSystemContextImpl;
import org.jetbrains.kotlin.types.expressions.DoubleColonLHS;
import org.jetbrains.kotlin.types.model.KotlinTypeMarker;
import org.jetbrains.kotlin.types.model.TypeParameterMarker;
import org.jetbrains.kotlin.types.typesApproximation.CapturedTypeApproximationKt;
import org.jetbrains.kotlin.util.OperatorNameConventions;
@@ -2690,7 +2694,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
}
@NotNull
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall resolvedCall) {
Callable resolveToCallable(@NotNull FunctionDescriptor fd, boolean superCall, @NotNull ResolvedCall<?> resolvedCall) {
IntrinsicMethod intrinsic = state.getIntrinsics().getIntrinsic(fd);
if (intrinsic != null) {
return intrinsic.toCallable(fd, superCall, resolvedCall, this);
@@ -2698,7 +2702,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
fd = SamCodegenUtil.resolveSamAdapter(fd);
if (ArgumentGeneratorKt.shouldInvokeDefaultArgumentsStub(resolvedCall)) {
List<ResolvedValueArgument> valueArguments = resolvedCall.getValueArgumentsByIndex();
if (valueArguments != null && valueArguments.stream().anyMatch(it -> it instanceof DefaultValueArgument)) {
// When we invoke a function with some arguments mapped as defaults,
// we later reroute this call to an overridden function in a base class that processes the default arguments.
// If the base class is generic, this overridden function can have a different Kotlin signature
@@ -5528,4 +5533,11 @@ The "returned" value of try expression with no finally is either the last expres
parentCodegen.getReifiedTypeParametersUsages().addUsedReifiedParameter(typeParameterDescriptor.getName().asString());
}
}
@Override
public void putReifiedOperationMarkerIfTypeIsReifiedParameter(
@NotNull KotlinTypeMarker type, @NotNull ReifiedTypeInliner.OperationKind operationKind
) {
BaseExpressionCodegen.DefaultImpls.putReifiedOperationMarkerIfTypeIsReifiedParameter(this, type, operationKind);
}
}

View File

@@ -1152,8 +1152,10 @@ public class FunctionCodegen {
// $default methods are never private to be accessible from other class files (e.g. inner) without the need of synthetic accessors
// $default methods are never protected to be accessible from subclass nested classes
// TODO: maybe best to generate private default in interface as private
int visibilityFlag =
DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor)
(!isInterface(functionDescriptor.getContainingDeclaration()) || kind == OwnerKind.DEFAULT_IMPLS) &&
(DescriptorVisibilities.isPrivate(functionDescriptor.getVisibility()) || isInlineOnlyPrivateInBytecode(functionDescriptor))
? AsmUtil.NO_FLAG_PACKAGE_PRIVATE : Opcodes.ACC_PUBLIC;
int flags = visibilityFlag | getDeprecatedAccessFlag(functionDescriptor) | ACC_SYNTHETIC;
if (!(functionDescriptor instanceof ConstructorDescriptor &&
@@ -1685,10 +1687,11 @@ public class FunctionCodegen {
// Fake overrides in interfaces should be expanded to implementation to make proper default check
if (JvmAnnotationUtilKt.checkIsImplementationCompiledToJvmDefault(memberDescriptor, mode)) {
return (kind != OwnerKind.DEFAULT_IMPLS && !isSynthetic) ||
boolean isSyntheticInCompatibilityOrJvmDefault = isSynthetic && (mode.isCompatibility() || mode == JvmDefaultMode.ENABLE);
return (kind != OwnerKind.DEFAULT_IMPLS && !isSyntheticInCompatibilityOrJvmDefault) ||
(kind == OwnerKind.DEFAULT_IMPLS &&
(isSynthetic || //TODO: move synthetic method generation into interface
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))));
(isSyntheticInCompatibilityOrJvmDefault ||
(mode.isCompatibility() && !JvmAnnotationUtilKt.hasJvmDefaultNoCompatibilityAnnotation(containingDeclaration))) && !DescriptorVisibilities.isPrivate(memberDescriptor.getVisibility()));
} else {
switch (kind) {
case DEFAULT_IMPLS: return true;

View File

@@ -660,7 +660,8 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
List<VariableDescriptorWithAccessors> delegatedProperties = bindingContext.get(CodegenBinding.DELEGATED_PROPERTIES_WITH_METADATA, thisAsmType);
if (delegatedProperties == null || delegatedProperties.isEmpty()) return;
v.newField(NO_ORIGIN, ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
int additionalFlags = context.getContextKind() != OwnerKind.DEFAULT_IMPLS && isInterface(context.getContextDescriptor()) ? ACC_PUBLIC : 0;
v.newField(NO_ORIGIN, ACC_STATIC | ACC_FINAL | ACC_SYNTHETIC | additionalFlags, JvmAbi.DELEGATED_PROPERTIES_ARRAY_NAME,
"[" + K_PROPERTY_TYPE, null, null);
if (!state.getClassBuilderMode().generateBodies) return;

View File

@@ -34,9 +34,13 @@ import org.jetbrains.kotlin.psi.KtClassOrObject
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtTypeAlias
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.MemberComparator
import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass
import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.resolve.jvm.annotations.JVM_SYNTHETIC_ANNOTATION_FQ_NAME
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
@@ -125,8 +129,19 @@ class MultifileClassCodegenImpl(
val superClassForFacade = if (shouldGeneratePartHierarchy) partInternalNamesSorted.last() else J_L_OBJECT
state.factory.newVisitor(MultifileClass(files.firstOrNull(), actualPackageFragment), facadeClassType, files).apply {
var attributes = FACADE_CLASS_ATTRIBUTES
val nonJvmSyntheticParts = files.filterNot { it.isJvmSynthetic() }
if (nonJvmSyntheticParts.isEmpty()) {
attributes = attributes or Opcodes.ACC_SYNTHETIC
} else if (nonJvmSyntheticParts.size < files.size) {
for (part in nonJvmSyntheticParts) {
state.diagnostics.report(ErrorsJvm.NOT_ALL_MULTIFILE_CLASS_PARTS_ARE_JVM_SYNTHETIC.on(part.packageDirective ?: part))
}
}
defineClass(
singleSourceFile, state.classFileVersion, FACADE_CLASS_ATTRIBUTES,
singleSourceFile, state.classFileVersion, attributes,
facadeClassType.internalName, null, superClassForFacade, emptyArray()
)
if (singleSourceFile != null) {
@@ -146,6 +161,13 @@ class MultifileClassCodegenImpl(
}
}
private fun KtFile.isJvmSynthetic(): Boolean {
return annotationEntries.any { entry ->
val descriptor = state.bindingContext[BindingContext.ANNOTATION, entry]
descriptor?.annotationClass?.let(DescriptorUtils::getFqNameSafe) == JVM_SYNTHETIC_ANNOTATION_FQ_NAME
}
}
override fun generate() {
assert(delegateGenerationTasks.isEmpty()) { "generate() is called twice for facade class $facadeFqName" }

View File

@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.resolve.calls.model.*
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
internal class ObjectSuperCallArgumentGenerator(
@@ -65,12 +64,6 @@ internal class ObjectSuperCallArgumentGenerator(
pushDefaultValueOnStack(type, iv)
}
public override fun generateDefaultJava(i: Int, argument: DefaultValueArgument) {
val type = parameters[i].asmType
val value = superValueParameters[i].findJavaDefaultArgumentValue(type, typeMapper)
value.put(type, iv)
}
public override fun generateVararg(i: Int, argument: VarargValueArgument) {
generateSuperCallArgument(i)
}

View File

@@ -58,7 +58,7 @@ class OriginCollectingClassBuilderFactory(private val builderMode: ClassBuilderM
}
override fun asBytes(builder: ClassBuilder): ByteArray {
val classWriter = ClassWriter(0)
val classWriter = ClassWriter(ClassWriter.COMPUTE_FRAMES or ClassWriter.COMPUTE_MAXS)
(builder as OriginCollectingClassBuilder).classNode.accept(classWriter)
return classWriter.toByteArray()
}
@@ -66,4 +66,4 @@ class OriginCollectingClassBuilderFactory(private val builderMode: ClassBuilderM
override fun asText(builder: ClassBuilder) = throw UnsupportedOperationException()
override fun close() {}
}
}

View File

@@ -36,14 +36,16 @@ class SamWrapperClasses(private val state: GenerationState) {
expressionCodegen: ExpressionCodegen,
contextDescriptor: CallableMemberDescriptor
): Type {
val isInsideInline = InlineUtil.isInlineOrContainingInline(expressionCodegen.context.contextDescriptor) ||
isInsideInlineLambdaContext(expressionCodegen.context, state)
val parentContext = expressionCodegen.context
val isInsideInline = InlineUtil.isInlineOrContainingInline(parentContext.contextDescriptor) ||
isInsideInlineLambdaContext(parentContext, state)
return samInterfaceToWrapperClass.getOrPut(WrapperKey(samType, file, isInsideInline)) {
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, isInsideInline).genWrapper(file, contextDescriptor)
SamWrapperCodegen(state, samType, expressionCodegen.parentCodegen, parentContext, isInsideInline)
.genWrapper(file, contextDescriptor)
}
}
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState):Boolean {
private fun isInsideInlineLambdaContext(context: CodegenContext<*>, state: GenerationState): Boolean {
var parent: CodegenContext<*>? = context
while (parent != null && parent != state.rootContext) {
if (parent is InlineLambdaContext) return true

View File

@@ -21,9 +21,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.backend.common.CodegenUtil;
import org.jetbrains.kotlin.codegen.context.ClassContext;
import org.jetbrains.kotlin.codegen.context.CodegenContext;
import org.jetbrains.kotlin.codegen.context.FieldOwnerContext;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.impl.ClassDescriptorImpl;
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil;
@@ -63,6 +63,7 @@ public class SamWrapperCodegen {
private final KotlinTypeMapper typeMapper;
private final SamType samType;
private final MemberCodegen<?> parentCodegen;
private final CodegenContext<?> parentContext;
private final int visibility;
private final int classFlags;
public static final String SAM_WRAPPER_SUFFIX = "$0";
@@ -71,6 +72,7 @@ public class SamWrapperCodegen {
@NotNull GenerationState state,
@NotNull SamType samType,
@NotNull MemberCodegen<?> parentCodegen,
@NotNull CodegenContext<?> parentContext,
boolean isInsideInline
) {
this.state = state;
@@ -78,8 +80,10 @@ public class SamWrapperCodegen {
this.typeMapper = state.getTypeMapper();
this.samType = samType;
this.parentCodegen = parentCodegen;
this.parentContext = parentContext;
visibility = isInsideInline ? ACC_PUBLIC : NO_FLAG_PACKAGE_PRIVATE;
classFlags = visibility | ACC_FINAL | ACC_SUPER;
int synth = state.getLanguageVersionSettings().supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic) ? ACC_SYNTHETIC : 0;
classFlags = visibility | ACC_FINAL | ACC_SUPER | synth;
}
@NotNull
@@ -168,7 +172,6 @@ public class SamWrapperCodegen {
private void generateInnerClassInformation(@NotNull KtFile file, Type asmType, ClassBuilder cv) {
parentCodegen.addSyntheticAnonymousInnerClass(new SyntheticInnerClassInfo(asmType.getInternalName(), classFlags));
FieldOwnerContext<?> parentContext = parentCodegen.context;
CodegenContext<?> outerContext = MemberCodegen.getNonInlineOuterContext(parentContext);
assert outerContext != null :
"Outer context for SAM wrapper " + asmType.getInternalName() + " is null, parentContext:" + parentContext;

View File

@@ -629,7 +629,11 @@ public abstract class StackValue {
}
public static void coerce(@NotNull Type fromType, @NotNull Type toType, @NotNull InstructionAdapter v) {
if (toType.equals(fromType)) return;
coerce(fromType, toType, v, false);
}
public static void coerce(@NotNull Type fromType, @NotNull Type toType, @NotNull InstructionAdapter v, boolean forceSelfCast) {
if (toType.equals(fromType) && !forceSelfCast) return;
if (toType.getSort() == Type.VOID) {
pop(v, fromType);

View File

@@ -5,18 +5,7 @@
package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.codegen.AsmUtil.unboxPrimitiveTypeOrNull
import org.jetbrains.kotlin.codegen.StackValue.*
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.load.java.Constant
import org.jetbrains.kotlin.load.java.EnumEntry
import org.jetbrains.kotlin.load.java.descriptors.NullDefaultValue
import org.jetbrains.kotlin.load.java.descriptors.StringDefaultValue
import org.jetbrains.kotlin.load.java.descriptors.getDefaultValueFromAnnotation
import org.jetbrains.kotlin.load.java.lexicalCastFrom
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.DFS
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
@@ -86,40 +75,3 @@ class FunctionCallStackValue(
resultKotlinType: KotlinType?,
lambda: (v: InstructionAdapter) -> Unit
) : OperationStackValue(resultType, resultKotlinType, lambda)
fun ValueParameterDescriptor.findJavaDefaultArgumentValue(targetType: Type, typeMapper: KotlinTypeMapper): StackValue {
val descriptorWithDefaultValue = DFS.dfs(
listOf(this.original),
{ it.original.overriddenDescriptors.map(ValueParameterDescriptor::getOriginal) },
object : DFS.AbstractNodeHandler<ValueParameterDescriptor, ValueParameterDescriptor?>() {
var result: ValueParameterDescriptor? = null
override fun beforeChildren(current: ValueParameterDescriptor?): Boolean {
if (current?.declaresDefaultValue() == true && current.getDefaultValueFromAnnotation() != null) {
result = current
return false
}
return true
}
override fun result(): ValueParameterDescriptor? = result
}
) ?: error("Should be at least one descriptor with default value: $this")
val defaultValue = descriptorWithDefaultValue.getDefaultValueFromAnnotation()
if (defaultValue is NullDefaultValue) {
return constant(null, targetType)
}
val value = (defaultValue as StringDefaultValue).value
val castResult = type.lexicalCastFrom(value) ?: error("Should be checked in frontend")
return when (castResult) {
is EnumEntry -> enumEntry(castResult.descriptor, typeMapper)
is Constant -> {
val unboxedType = unboxPrimitiveTypeOrNull(targetType) ?: targetType
return coercion(constant(castResult.value, unboxedType), targetType, null)
}
}
}

View File

@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.codegen.coroutines.CoroutineCodegenUtilKt;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.when.SwitchCodegenProvider;
import org.jetbrains.kotlin.codegen.when.WhenByEnumsMapping;
import org.jetbrains.kotlin.config.JvmDefaultMode;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.config.LanguageVersionSettings;
import org.jetbrains.kotlin.coroutines.CoroutineUtilKt;
@@ -87,6 +88,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
private final LanguageVersionSettings languageVersionSettings;
private final ClassBuilderMode classBuilderMode;
private final DelegatedPropertiesCodegenHelper delegatedPropertiesCodegenHelper;
private final JvmDefaultMode jvmDefaultMode;
public CodegenAnnotatingVisitor(@NotNull GenerationState state) {
this.bindingTrace = state.getBindingTrace();
@@ -97,6 +99,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
this.languageVersionSettings = state.getLanguageVersionSettings();
this.classBuilderMode = state.getClassBuilderMode();
this.delegatedPropertiesCodegenHelper = new DelegatedPropertiesCodegenHelper(state);
jvmDefaultMode = state.getJvmDefaultMode();
}
@NotNull
@@ -585,7 +588,7 @@ class CodegenAnnotatingVisitor extends KtVisitorVoid {
}
return AsmUtil.asmTypeByClassId(
DescriptorUtils.isInterface(descriptor)
DescriptorUtils.isInterface(descriptor) && !jvmDefaultMode.getForAllMethodsWithBody()
? classId.createNestedClassId(Name.identifier(JvmAbi.DEFAULT_IMPLS_CLASS_NAME))
: classId
);

View File

@@ -721,9 +721,16 @@ class CoroutineCodegenForNamedFunction private constructor(
}
val isInterfaceMethod = DescriptorUtils.isInterface(suspendFunctionJvmView.containingDeclaration)
val callableAccessorMethod =
typeMapper.mapToCallableMethod(
context.accessibleDescriptor(suspendFunctionJvmView.unwrapFrontendVersion(), null),
// Obtain default impls method for interfaces
isInterfaceMethod
)
val callableMethod =
typeMapper.mapToCallableMethod(
suspendFunctionJvmView,
suspendFunctionJvmView.unwrapFrontendVersion(),
// Obtain default impls method for interfaces
isInterfaceMethod
)
@@ -736,10 +743,10 @@ class CoroutineCodegenForNamedFunction private constructor(
if (suspendFunctionJvmView.isOverridable && !isInterfaceMethod && captureThisType != null) {
val owner = captureThisType.internalName
val impl = callableMethod.getAsmMethod().getImplForOpenMethod(owner)
val impl = callableAccessorMethod.getAsmMethod().getImplForOpenMethod(owner)
codegen.v.invokestatic(owner, impl.name, impl.descriptor, false)
} else {
callableMethod.genInvokeInstruction(codegen.v)
callableAccessorMethod.genInvokeInstruction(codegen.v)
}
if (inlineClassToBoxInInvokeSuspend != null) {

View File

@@ -1217,6 +1217,27 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
fun isAlive(insnIndex: Int, variableIndex: Int): Boolean =
liveness[insnIndex].isAlive(variableIndex)
fun nextSuspensionPointEndLabel(insn: AbstractInsnNode): LabelNode {
val suspensionPoint =
InsnSequence(insn, method.instructions.last).firstOrNull { isAfterSuspendMarker(it) } ?: method.instructions.last
return suspensionPoint as? LabelNode ?: suspensionPoint.findNextOrNull { it is LabelNode } as LabelNode
}
fun nextSuspensionPointStartLabel(insn: AbstractInsnNode): LabelNode {
val suspensionPoint =
InsnSequence(insn, method.instructions.last).firstOrNull { isBeforeSuspendMarker(it) } ?: method.instructions.last
return suspensionPoint as? LabelNode ?: suspensionPoint.findPreviousOrNull { it is LabelNode } as LabelNode
}
fun min(a: LabelNode, b: LabelNode): LabelNode =
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) a else b
fun max(a: LabelNode, b: LabelNode): LabelNode =
if (method.instructions.indexOf(a) < method.instructions.indexOf(b)) b else a
fun containsSuspensionPoint(a: LabelNode, b: LabelNode): Boolean =
InsnSequence(min(a, b), max(a, b)).none { isBeforeSuspendMarker(it) }
val oldLvt = arrayListOf<LocalVariableNode>()
for (record in method.localVariables) {
oldLvt += record
@@ -1237,23 +1258,35 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
// No variable in LVT -> do not add one
val lvtRecord = oldLvt.findRecord(insnIndex, variableIndex) ?: continue
if (lvtRecord.name == CONTINUATION_VARIABLE_NAME) continue
val endLabel = insn as? LabelNode ?: insn.findNextOrNull { it is LabelNode } as? LabelNode ?: continue
// Extend lvt record to the next suspension point
val endLabel = min(lvtRecord.end, nextSuspensionPointEndLabel(insn))
// startLabel can be null in case of parameters
@Suppress("NAME_SHADOWING") val startLabel = startLabel ?: lvtRecord.start
// Attempt to extend existing local variable node corresponding to the record in
// the original local variable table.
var recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
if (recordToExtend != null && InsnSequence(recordToExtend.end, startLabel).none { isBeforeSuspendMarker(it) }) {
val recordToExtend: LocalVariableNode? = oldLvtNodeToLatestNewLvtNode[lvtRecord]
if (recordToExtend != null && containsSuspensionPoint(recordToExtend.end, startLabel)) {
recordToExtend.end = endLabel
} else {
val node = LocalVariableNode(lvtRecord.name, lvtRecord.desc, lvtRecord.signature, startLabel, endLabel, lvtRecord.index)
method.localVariables.add(node)
if (lvtRecord !in oldLvtNodeToLatestNewLvtNode) {
method.localVariables.add(node)
}
oldLvtNodeToLatestNewLvtNode[lvtRecord] = node
}
}
}
}
val deadVariables = arrayListOf<Int>()
outer@for (variableIndex in start until method.maxLocals) {
if (oldLvt.none { it.index == variableIndex }) continue
for (insnIndex in 0 until (method.instructions.size() - 1)) {
if (isAlive(insnIndex, variableIndex)) continue@outer
}
deadVariables += variableIndex
}
for (variable in oldLvt) {
// $continuation and $result are dead, but they are used by debugger, as well as fake inliner variables
// For example, $continuation is used to create async stack trace
@@ -1262,10 +1295,26 @@ private fun updateLvtAccordingToLiveness(method: MethodNode, isForNamedFunction:
isFakeLocalVariableForInline(variable.name)
) {
method.localVariables.add(variable)
continue
}
// this acts like $continuation for lambdas. For example, it is used by debugger to create async stack trace. Keep it.
if (variable.name == "this" && !isForNamedFunction) {
method.localVariables.add(variable)
continue
}
// Shrink LVT records of dead variables to the next suspension point
if (variable.index in deadVariables) {
method.localVariables.add(
LocalVariableNode(
variable.name,
variable.desc,
variable.signature,
variable.start,
nextSuspensionPointStartLabel(variable.start),
variable.index
)
)
}
}
}

View File

@@ -90,7 +90,10 @@ class AnonymousObjectTransformer(
val node = MethodNode(access, name, desc, signature, exceptions)
if (name == "<init>") {
if (constructor != null) {
throw RuntimeException("Lambda, SAM or anonymous object should have only one constructor")
throw RuntimeException(
"Lambda, SAM or anonymous object should have only one constructor.\n" +
"First:\n${constructor.nodeText}\n\nSecond:\n${node.nodeText}\n"
)
}
constructor = node
} else {
@@ -319,7 +322,7 @@ class AnonymousObjectTransformer(
), null
)
val result = inliner.doInline(deferringVisitor, LocalVarRemapper(parameters, 0), false, ReturnLabelOwner.NOT_APPLICABLE)
val result = inliner.doInline(deferringVisitor, LocalVarRemapper(parameters, 0), false, mapOf())
result.reifiedTypeParametersUsages.mergeAll(typeParametersToReify)
deferringVisitor.visitMaxs(-1, -1)
return result
@@ -462,6 +465,29 @@ class AnonymousObjectTransformer(
val indexToFunctionalArgument = transformationInfo.functionalArguments
val capturedParams = HashSet<Int>()
// Possible cases where we need to add each lambda's captures separately:
//
// 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
// have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
// (already have the fields) or contains the parent lambda object (captures used to be read from it, but
// the object will be removed and its contents inlined).
//
// 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
// `capturedLambdas` contains all lambdas used by this object and nested objects.
//
// 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
// * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
// we *could* group them into `this$0` now, but choose not to. Lambdas are replaced by their captures to match.
// * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
// inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
// empty anyway.
//
// The only remaining case is a top-level object inside a (crossinline) lambda that is inlined into another object.
// Then, the reference to the soon-to-be-removed lambda class containing the captures (and it exists, or else the object
// would not have needed regeneration in the first place) is simply replaced with a reference to the outer object, and
// that object will contain loose fields for everything we need to capture.
val topLevelInCrossinlineLambda = parentFieldRemapper is InlinedLambdaRemapper && !parentFieldRemapper.parent!!.isRoot
//load captured parameters and patch instruction list
// NB: there is also could be object fields
val toDelete = arrayListOf<AbstractInsnNode>()
@@ -470,10 +496,12 @@ class AnonymousObjectTransformer(
val parameterAload = fieldNode.previous as VarInsnNode
val varIndex = parameterAload.`var`
val functionalArgument = indexToFunctionalArgument[varIndex]
val newFieldName = if (isThis0(fieldName) && shouldRenameThis0(parentFieldRemapper, indexToFunctionalArgument.values))
getNewFieldName(fieldName, true)
else
fieldName
// If an outer `this` is already captured by this object, rename it if any inline lambda will capture
// one of the same type, causing the code below to create a clash. Note that the values can be different.
// TODO: this is only really necessary if there will be a name *and* type clash.
val shouldRename = !topLevelInCrossinlineLambda && isThis0(fieldName) &&
indexToFunctionalArgument.values.any { it is LambdaInfo && it.capturedVars.any { it.fieldName == fieldName } }
val newFieldName = if (shouldRename) addUniqueField(fieldName + INLINE_FUN_THIS_0_SUFFIX) else fieldName
val info = capturedParamBuilder.addCapturedParam(
Type.getObjectType(transformationInfo.oldClassName), fieldName, newFieldName,
Type.getType(fieldNode.desc), functionalArgument is LambdaInfo, null
@@ -508,35 +536,17 @@ class AnonymousObjectTransformer(
//For all inlined lambdas add their captured parameters
//TODO: some of such parameters could be skipped - we should perform additional analysis
val allRecapturedParameters = ArrayList<CapturedParamDesc>()
if (parentFieldRemapper !is InlinedLambdaRemapper || parentFieldRemapper.parent!!.isRoot) {
// Possible cases:
//
// 1. Top-level object in an inline lambda that is *not* being inlined into another object. In this case, we
// have no choice but to add a separate field for each captured variable. `capturedLambdas` is either empty
// (already have the fields) or contains the parent lambda object (captures used to be read from it, but
// the object will be removed and its contents inlined).
//
// 2. Top-level object in a named inline function. Again, there's no option but to add separate fields.
// `capturedLambdas` contains all lambdas used by this object and nested objects.
//
// 3. Nested object, either in an inline lambda or an inline function. This case has two subcases:
// * The object's captures are passed as separate arguments (e.g. KT-28064 style object that used to be in a lambda);
// we could group them into `this$0` now, but choose not to. Lambdas are replaced by their captures.
// * The object's captures are already grouped into `this$0`; this includes captured lambda parameters (for objects in
// inline functions) and a reference to the outer object or lambda (for objects in lambdas), so `capturedLambdas` is
// empty and the choice doesn't matter.
//
val alreadyAdded = HashMap<String, CapturedParamInfo>()
if (!topLevelInCrossinlineLambda) {
val capturedOuterThisTypes = mutableSetOf<String>()
for (info in capturedLambdas) {
for (desc in info.capturedVars) {
val key = desc.fieldName + "$$$" + desc.type.className
val alreadyAddedParam = alreadyAdded[key]
val recapturedParamInfo = capturedParamBuilder.addCapturedParam(
desc,
alreadyAddedParam?.newFieldName ?: getNewFieldName(desc.fieldName, false),
alreadyAddedParam != null
)
// Merge all outer `this` of the same type captured by inlined lambdas, since they have to be the same
// object. Outer `this` captured by the original object itself should have been renamed above,
// and can have a different value even if the same type is captured by a lambda.
val recapturedParamInfo = if (isThis0(desc.fieldName))
capturedParamBuilder.addCapturedParam(desc, desc.fieldName, !capturedOuterThisTypes.add(desc.type.className))
else
capturedParamBuilder.addCapturedParam(desc, addUniqueField(desc.fieldName + INLINE_TRANSFORMATION_SUFFIX), false)
if (info is ExpressionLambda && info.isCapturedSuspend(desc)) {
recapturedParamInfo.functionalArgument = NonInlineableArgumentForInlineableParameterCalledInSuspend
}
@@ -551,10 +561,6 @@ class AnonymousObjectTransformer(
allRecapturedParameters.add(desc)
constructorParamBuilder.addCapturedParam(recapturedParamInfo, recapturedParamInfo.newFieldName).remapValue = composed
if (isThis0(desc.fieldName)) {
alreadyAdded.put(key, recapturedParamInfo)
}
}
}
} else if (capturedLambdas.isNotEmpty()) {
@@ -579,24 +585,6 @@ class AnonymousObjectTransformer(
return constructorAdditionalFakeParams
}
private fun shouldRenameThis0(parentFieldRemapper: FieldRemapper, values: Collection<FunctionalArgument>): Boolean {
return if (isFirstDeclSiteLambdaFieldRemapper(parentFieldRemapper)) {
values.any { it is LambdaInfo && it.capturedVars.any { isThis0(it.fieldName) } }
} else false
}
private fun getNewFieldName(oldName: String, originalField: Boolean): String {
if (AsmUtil.CAPTURED_THIS_FIELD == oldName) {
return if (!originalField) {
oldName
} else {
//rename original 'this$0' in declaration site lambda (inside inline function) to use this$0 only for outer lambda/object access on call site
addUniqueField(oldName + INLINE_FUN_THIS_0_SUFFIX)
}
}
return addUniqueField(oldName + INLINE_TRANSFORMATION_SUFFIX)
}
private fun addUniqueField(name: String): String {
val existNames = fieldNames.getOrPut(name) { LinkedList() }
val suffix = if (existNames.isEmpty()) "" else "$" + existNames.size
@@ -604,7 +592,4 @@ class AnonymousObjectTransformer(
existNames.add(newName)
return newName
}
private fun isFirstDeclSiteLambdaFieldRemapper(parentRemapper: FieldRemapper): Boolean =
parentRemapper !is RegeneratedLambdaFieldRemapper && parentRemapper !is InlinedLambdaRemapper
}

View File

@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.incremental.components.Position
import org.jetbrains.kotlin.incremental.components.ScopeKind
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
@@ -42,8 +41,6 @@ import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.commons.Method
import org.jetbrains.org.objectweb.asm.tree.*
import java.util.*
import kotlin.collections.HashSet
import kotlin.math.max
abstract class InlineCodegen<out T : BaseExpressionCodegen>(
@@ -111,11 +108,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
)
}
protected fun generateStub(resolvedCall: ResolvedCall<*>?, codegen: BaseExpressionCodegen) {
protected fun generateStub(text: String, codegen: BaseExpressionCodegen) {
leaveTemps()
assert(resolvedCall != null)
val message = "Call is part of inline cycle: " + resolvedCall!!.call.callElement.text
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", message)
AsmUtil.genThrow(codegen.v, "java/lang/UnsupportedOperationException", "Call is part of inline cycle: $text")
}
protected fun endCall(result: InlineResult, registerLineNumberAfterwards: Boolean) {
@@ -243,12 +238,10 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
//hack to keep linenumber info, otherwise jdi will skip begin of linenumber chain
adapter.visitInsn(Opcodes.NOP)
val result = inliner.doInline(adapter, remapper, true, ReturnLabelOwner.SKIP_ALL)
val result = inliner.doInline(adapter, remapper, true, mapOf())
result.reifiedTypeParametersUsages.mergeAll(reificationResult)
val labels = sourceCompiler.getContextLabels()
val infos = MethodInliner.processReturns(adapter, ReturnLabelOwner { labels.contains(it) }, true, null)
val infos = MethodInliner.processReturns(adapter, sourceCompiler.getContextLabels(), null)
generateAndInsertFinallyBlocks(
adapter, infos, (remapper.remap(parameters.argsSizeOnStack + 1).value as StackValue.Local).index
)
@@ -319,7 +312,9 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
frameMap.enterTemp(Type.INT_TYPE)
}
sourceCompiler.generateFinallyBlocksIfNeeded(finallyCodegen, extension.returnType, extension.finallyIntervalEnd.label)
sourceCompiler.generateFinallyBlocksIfNeeded(
finallyCodegen, extension.returnType, extension.finallyIntervalEnd.label, extension.jumpTarget
)
//Exception table for external try/catch/finally blocks will be generated in original codegen after exiting this method
insertNodeBefore(finallyNode, intoNode, curInstr)
@@ -639,35 +634,17 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
?: throw IllegalStateException("Couldn't find declaration file for $containerId")
}
val methodNode = getMethodNodeInner(containerId, bytes, asmMethod, callableDescriptor) ?: return null
// KLUDGE: Inline suspend function built with compiler version less than 1.1.4/1.2-M1 did not contain proper
// before/after suspension point marks, so we detect those functions here and insert the corresponding marks
if (isLegacySuspendInlineFunction(callableDescriptor)) {
insertLegacySuspendInlineMarks(methodNode.node)
}
return methodNode
}
private fun getMethodNodeInner(
containerId: ClassId,
bytes: ByteArray,
asmMethod: Method,
callableDescriptor: CallableMemberDescriptor
): SMAPAndMethodNode? {
val classType = AsmUtil.asmTypeByClassId(containerId)
var methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
val methodNode = getMethodNode(bytes, asmMethod.name, asmMethod.descriptor, classType)
if (methodNode == null && requiresFunctionNameManglingForReturnType(callableDescriptor)) {
val nameWithoutManglingSuffix = asmMethod.name.stripManglingSuffixOrNull()
if (nameWithoutManglingSuffix != null) {
methodNode = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
}
if (methodNode == null) {
val nameWithImplSuffix = "$nameWithoutManglingSuffix-impl"
methodNode = getMethodNode(bytes, nameWithImplSuffix, asmMethod.descriptor, classType)
val methodWithoutMangling = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
if (methodWithoutMangling != null) return methodWithoutMangling
}
return getMethodNode(bytes, "$nameWithoutManglingSuffix-impl", asmMethod.descriptor, classType)
}
return methodNode
}

View File

@@ -30,17 +30,14 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCallWithAssert
import org.jetbrains.kotlin.resolve.jvm.AsmTypes.*
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.util.OperatorNameConventions
import org.jetbrains.org.objectweb.asm.ClassReader
import org.jetbrains.org.objectweb.asm.ClassVisitor
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.org.objectweb.asm.Type
import org.jetbrains.org.objectweb.asm.*
import org.jetbrains.org.objectweb.asm.commons.Method
import org.jetbrains.org.objectweb.asm.tree.FieldInsnNode
import kotlin.properties.Delegates
interface FunctionalArgument
abstract class LambdaInfo(@JvmField val isCrossInline: Boolean) : FunctionalArgument, ReturnLabelOwner {
abstract class LambdaInfo(@JvmField val isCrossInline: Boolean) : FunctionalArgument {
abstract val isBoundCallableReference: Boolean
@@ -54,6 +51,9 @@ abstract class LambdaInfo(@JvmField val isCrossInline: Boolean) : FunctionalArgu
abstract val capturedVars: List<CapturedParamDesc>
open val returnLabels: Map<String, Label?>
get() = mapOf()
lateinit var node: SMAPAndMethodNode
abstract fun generateLambdaBody(sourceCompiler: SourceCompilerForInline, reifiedTypeInliner: ReifiedTypeInliner<*>)
@@ -129,8 +129,6 @@ abstract class DefaultLambda(
final override lateinit var capturedVars: List<CapturedParamDesc>
private set
override fun isReturnFromMe(labelName: String): Boolean = false
var originalBoundReceiverType: Type? = null
private set
@@ -247,7 +245,7 @@ class PsiExpressionLambda(
val functionWithBodyOrCallableReference: KtExpression = (expression as? KtLambdaExpression)?.functionLiteral ?: expression
private val labels: Set<String>
override val returnLabels: Map<String, Label?>
override val isSuspend: Boolean
@@ -284,7 +282,7 @@ class PsiExpressionLambda(
closure = it!!
}
labels = InlineCodegen.getDeclarationLabels(expression, invokeMethodDescriptor)
returnLabels = InlineCodegen.getDeclarationLabels(expression, invokeMethodDescriptor).associateWith { null }
invokeMethod = typeMapper.mapAsmMethod(invokeMethodDescriptor)
isSuspend = invokeMethodDescriptor.isSuspend
}
@@ -324,10 +322,6 @@ class PsiExpressionLambda(
}
}
override fun isReturnFromMe(labelName: String): Boolean {
return labels.contains(labelName)
}
val isPropertyReference: Boolean
get() = propertyReferenceInfo != null

View File

@@ -1,54 +0,0 @@
/*
* 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.codegen.inline
import org.jetbrains.org.objectweb.asm.Opcodes
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.load.kotlin.getContainingKotlinJvmBinaryClass
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.tree.AbstractInsnNode
import org.jetbrains.org.objectweb.asm.tree.MethodNode
// KLUDGE: Inline suspend function built with compiler version less than 1.1.4/1.2-M1 did not contain proper
// before/after suspension point marks, so we detect those functions here and insert the corresponding marks
fun insertLegacySuspendInlineMarks(node: MethodNode) {
with(node.instructions) {
// look for return instruction before the end and insert "afterSuspendMarker" there
insertBefore(findLastReturn(last) ?: return, produceSuspendMarker(false).instructions)
// insert "beforeSuspendMarker" at the beginning
insertBefore(first, produceSuspendMarker(true).instructions)
}
node.maxStack = node.maxStack.coerceAtLeast(2) // min stack need for suspend marker before return
}
fun findLastReturn(node: AbstractInsnNode?): AbstractInsnNode? {
var cur = node
while (cur != null && cur.opcode != Opcodes.ARETURN) cur = cur.previous
return cur
}
private fun produceSuspendMarker(isStartNotEnd: Boolean): MethodNode =
MethodNode().also { addSuspendMarker(InstructionAdapter(it), isStartNotEnd) }
fun isLegacySuspendInlineFunction(descriptor: CallableMemberDescriptor): Boolean {
if (descriptor !is FunctionDescriptor) return false
if (!descriptor.isSuspend || !descriptor.isInline) return false
val jvmBytecodeVersion = descriptor.getContainingKotlinJvmBinaryClass()?.classHeader?.bytecodeVersion ?: return false
return !jvmBytecodeVersion.isAtLeast(1, 0, 2)
}

View File

@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.codegen.optimization.common.isMeaningful
import org.jetbrains.kotlin.codegen.optimization.fixStack.peek
import org.jetbrains.kotlin.codegen.optimization.fixStack.top
import org.jetbrains.kotlin.codegen.optimization.nullCheck.isCheckParameterIsNotNull
import org.jetbrains.kotlin.codegen.pseudoInsns.PseudoInsn
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
@@ -72,9 +73,9 @@ class MethodInliner(
adapter: MethodVisitor,
remapper: LocalVarRemapper,
remapReturn: Boolean,
returnLabelOwner: ReturnLabelOwner
returnLabels: Map<String, Label?>
): InlineResult {
return doInline(adapter, remapper, remapReturn, returnLabelOwner, 0)
return doInline(adapter, remapper, remapReturn, returnLabels, 0)
}
private fun recordTransformation(info: TransformationInfo) {
@@ -91,11 +92,11 @@ class MethodInliner(
adapter: MethodVisitor,
remapper: LocalVarRemapper,
remapReturn: Boolean,
returnLabelOwner: ReturnLabelOwner,
returnLabels: Map<String, Label?>,
finallyDeepShift: Int
): InlineResult {
//analyze body
var transformedNode = markPlacesForInlineAndRemoveInlinable(node, returnLabelOwner, finallyDeepShift)
var transformedNode = markPlacesForInlineAndRemoveInlinable(node, returnLabels, finallyDeepShift)
if (inliningContext.isInliningLambda && isDefaultLambdaWithReification(inliningContext.lambdaInfo!!)) {
//TODO maybe move reification in one place
inliningContext.root.inlineMethodReifier.reifyInstructions(transformedNode)
@@ -139,7 +140,9 @@ class MethodInliner(
)
}
processReturns(resultNode, returnLabelOwner, remapReturn, end)
if (remapReturn) {
processReturns(resultNode, returnLabels, end)
}
//flush transformed node to output
resultNode.accept(SkipMaxAndEndVisitor(adapter))
return result
@@ -297,7 +300,7 @@ class MethodInliner(
val varRemapper = LocalVarRemapper(lambdaParameters, valueParamShift)
//TODO add skipped this and receiver
val lambdaResult = inliner.doInline(localVariablesSorter, varRemapper, true, info, invokeCall.finallyDepthShift)
val lambdaResult = inliner.doInline(localVariablesSorter, varRemapper, true, info.returnLabels, invokeCall.finallyDepthShift)
result.mergeWithNotChangeInfo(lambdaResult)
result.reifiedTypeParametersUsages.mergeAll(lambdaResult.reifiedTypeParametersUsages)
@@ -486,11 +489,11 @@ class MethodInliner(
}
private fun markPlacesForInlineAndRemoveInlinable(
node: MethodNode, returnLabelOwner: ReturnLabelOwner, finallyDeepShift: Int
node: MethodNode, returnLabels: Map<String, Label?>, finallyDeepShift: Int
): MethodNode {
val processingNode = prepareNode(node, finallyDeepShift)
preprocessNodeBeforeInline(processingNode, returnLabelOwner)
preprocessNodeBeforeInline(processingNode, returnLabels)
replaceContinuationAccessesWithFakeContinuationsIfNeeded(processingNode)
@@ -765,7 +768,7 @@ class MethodInliner(
}
}
private fun preprocessNodeBeforeInline(node: MethodNode, returnLabelOwner: ReturnLabelOwner) {
private fun preprocessNodeBeforeInline(node: MethodNode, returnLabels: Map<String, Label?>) {
try {
FixStackWithLabelNormalizationMethodTransformer().transform("fake", node)
} catch (e: Throwable) {
@@ -787,16 +790,13 @@ class MethodInliner(
if (!isReturnOpcode(insnNode.opcode)) continue
var insertBeforeInsn = insnNode
// TODO extract isLocalReturn / isNonLocalReturn, see processReturns
val labelName = getMarkedReturnLabelOrNull(insnNode)
if (labelName != null) {
if (!returnLabelOwner.isReturnFromMe(labelName)) continue
insertBeforeInsn = insnNode.previous
if (labelName == null) {
localReturnsNormalizer.addLocalReturnToTransform(insnNode, insnNode, frame)
} else if (labelName in returnLabels) {
localReturnsNormalizer.addLocalReturnToTransform(insnNode, insnNode.previous, frame)
}
localReturnsNormalizer.addLocalReturnToTransform(insnNode, insertBeforeInsn, frame)
}
localReturnsNormalizer.transform(node)
@@ -1001,7 +1001,8 @@ class MethodInliner(
class PointForExternalFinallyBlocks(
@JvmField val beforeIns: AbstractInsnNode,
@JvmField val returnType: Type,
@JvmField val finallyIntervalEnd: LabelNode
@JvmField val finallyIntervalEnd: LabelNode,
@JvmField val jumpTarget: Label?
)
companion object {
@@ -1115,55 +1116,44 @@ class MethodInliner(
//process local and global returns (local substituted with goto end-label global kept unchanged)
@JvmStatic
fun processReturns(
node: MethodNode, returnLabelOwner: ReturnLabelOwner, remapReturn: Boolean, endLabel: Label?
node: MethodNode, returnLabels: Map<String, Label?>, endLabel: Label?
): List<PointForExternalFinallyBlocks> {
if (!remapReturn) {
return emptyList()
}
val result = ArrayList<PointForExternalFinallyBlocks>()
val instructions = node.instructions
var insnNode: AbstractInsnNode? = instructions.first
while (insnNode != null) {
if (isReturnOpcode(insnNode.opcode)) {
var isLocalReturn = true
val labelName = getMarkedReturnLabelOrNull(insnNode)
val returnType = getReturnType(insnNode.opcode)
if (labelName != null) {
isLocalReturn = returnLabelOwner.isReturnFromMe(labelName)
//remove global return flag
if (isLocalReturn) {
instructions.remove(insnNode.previous)
}
val isLocalReturn = labelName == null || labelName in returnLabels
val jumpTarget = returnLabels[labelName] ?: endLabel
if (isLocalReturn && labelName != null) {
// remove non-local return flag
instructions.remove(insnNode.previous)
}
if (isLocalReturn && endLabel != null) {
val nop = InsnNode(Opcodes.NOP)
instructions.insert(insnNode, nop)
val labelNode = endLabel.info as LabelNode
val jumpInsnNode = JumpInsnNode(Opcodes.GOTO, labelNode)
instructions.insert(nop, jumpInsnNode)
if (isLocalReturn && jumpTarget != null) {
val jumpInsnNode = JumpInsnNode(Opcodes.GOTO, jumpTarget.info as LabelNode)
instructions.insertBefore(insnNode, InsnNode(Opcodes.NOP))
if (jumpTarget != endLabel) {
instructions.insertBefore(insnNode, PseudoInsn.FIX_STACK_BEFORE_JUMP.createInsnNode())
}
instructions.insertBefore(insnNode, jumpInsnNode)
instructions.remove(insnNode)
insnNode = jumpInsnNode
}
//generate finally block before nonLocalReturn flag/return/goto
val label = LabelNode()
instructions.insert(insnNode, label)
result.add(
PointForExternalFinallyBlocks(
getInstructionToInsertFinallyBefore(insnNode, isLocalReturn), getReturnType(insnNode.opcode), label
)
)
// generate finally blocks before the non-local return flag or the stack fixup pseudo instruction
val finallyInsertionPoint = if (isLocalReturn && jumpTarget == endLabel) insnNode else insnNode.previous
result.add(PointForExternalFinallyBlocks(finallyInsertionPoint, returnType, label, jumpTarget))
}
insnNode = insnNode.next
}
return result
}
private fun getInstructionToInsertFinallyBefore(nonLocalReturnOrJump: AbstractInsnNode, isLocal: Boolean): AbstractInsnNode {
return if (isLocal) nonLocalReturnOrJump else nonLocalReturnOrJump.previous
}
}
}

View File

@@ -60,8 +60,8 @@ class PsiInlineCodegen(
callDefault: Boolean,
codegen: ExpressionCodegen
) {
if (!state.globalInlineContext.enterIntoInlining(resolvedCall?.resultingDescriptor, resolvedCall?.call?.callElement)) {
generateStub(resolvedCall, codegen)
if (!state.globalInlineContext.enterIntoInlining(functionDescriptor, resolvedCall?.call?.callElement)) {
generateStub(resolvedCall?.call?.callElement?.text ?: "<no source>", codegen)
return
}
try {

View File

@@ -1,29 +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.codegen.inline;
import org.jetbrains.annotations.NotNull;
public interface ReturnLabelOwner {
boolean isReturnFromMe(@NotNull String labelName);
ReturnLabelOwner SKIP_ALL = name -> false;
ReturnLabelOwner NOT_APPLICABLE = name -> {
throw new RuntimeException("This operation not applicable for current context");
};
}

View File

@@ -64,7 +64,7 @@ interface SourceCompilerForInline {
curFinallyDepth: Int
): BaseExpressionCodegen
fun generateFinallyBlocksIfNeeded(finallyCodegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label)
fun generateFinallyBlocksIfNeeded(codegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label, target: Label?)
fun isCallInsideSameModuleAsDeclared(functionDescriptor: FunctionDescriptor): Boolean
@@ -74,7 +74,7 @@ interface SourceCompilerForInline {
val compilationContextFunctionDescriptor: FunctionDescriptor
fun getContextLabels(): Set<String>
fun getContextLabels(): Map<String, Label?>
fun reportSuspensionPointInsideMonitor(stackTraceElement: String)
}
@@ -311,9 +311,10 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
override fun hasFinallyBlocks() = codegen.hasFinallyBlocks()
override fun generateFinallyBlocksIfNeeded(finallyCodegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label) {
require(finallyCodegen is ExpressionCodegen)
finallyCodegen.generateFinallyBlocksIfNeeded(returnType, null, afterReturnLabel)
override fun generateFinallyBlocksIfNeeded(codegen: BaseExpressionCodegen, returnType: Type, afterReturnLabel: Label, target: Label?) {
// TODO use the target label for non-local break/continue
require(codegen is ExpressionCodegen)
codegen.generateFinallyBlocksIfNeeded(returnType, null, afterReturnLabel)
}
override fun createCodegenForExternalFinallyBlockGenerationOnNonLocalReturn(finallyNode: MethodNode, curFinallyDepth: Int) =
@@ -337,14 +338,15 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
override val compilationContextFunctionDescriptor
get() = codegen.getContext().functionDescriptor
override fun getContextLabels(): Set<String> {
override fun getContextLabels(): Map<String, Label?> {
val context = codegen.getContext()
val parentContext = context.parentContext
val descriptor = if (parentContext is ClosureContext && parentContext.originalSuspendLambdaDescriptor != null) {
parentContext.originalSuspendLambdaDescriptor!!
} else context.contextDescriptor
return InlineCodegen.getDeclarationLabels(DescriptorToSourceUtils.descriptorToDeclaration(descriptor), descriptor)
val labels = InlineCodegen.getDeclarationLabels(DescriptorToSourceUtils.descriptorToDeclaration(descriptor), descriptor)
return labels.associateWith { null } // TODO add break/continue labels
}
fun initializeInlineFunctionContext(functionDescriptor: FunctionDescriptor) {

View File

@@ -84,9 +84,11 @@ private fun createSpecialEnumMethodBody(
Opcodes.INVOKESTATIC, ENUM_TYPE.internalName, "valueOf",
Type.getMethodDescriptor(ENUM_TYPE, JAVA_CLASS_TYPE, JAVA_STRING_TYPE), false
)
node.visitTypeInsn(Opcodes.CHECKCAST, ENUM_TYPE.internalName)
} else {
node.visitInsn(Opcodes.ICONST_0)
node.visitTypeInsn(Opcodes.ANEWARRAY, ENUM_TYPE.internalName)
node.visitTypeInsn(Opcodes.CHECKCAST, AsmUtil.getArrayType(ENUM_TYPE).internalName)
}
node.visitInsn(Opcodes.ARETURN)
node.visitMaxs(if (isValueOf) 3 else 2, if (isValueOf) 1 else 0)

View File

@@ -37,17 +37,9 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
// Tracks proper usages of objects corresponding to captured variables.
//
// The 'kotlin.jvm.internal.Ref.*' instance can be replaced with a local variable,
// if all of the following conditions are satisfied:
// * It is created inside a current method.
// * The only permitted operations on it are:
// - store to a local variable
// - ALOAD, ASTORE
// - DUP, POP
// - GETFIELD <owner>.element, PUTFIELD <owner>.element
// * There's a corresponding local variable definition,
// and all ALOAD/ASTORE instructions operate on that particular local variable.
// * Its 'element' field is initialized at start of local variable visibility range.
// The 'kotlin.jvm.internal.Ref.*' instance can be replaced with a local variable, if
// * it is created inside a current method;
// * the only operations on it are ALOAD, ASTORE, DUP, POP, GETFIELD element, PUTFIELD element.
//
// Note that for code that doesn't create Ref objects explicitly these conditions are true,
// unless the Ref object escapes to a local class constructor (including local classes for lambdas).
@@ -58,47 +50,43 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
var initCallInsn: MethodInsnNode? = null
var localVar: LocalVariableNode? = null
var localVarIndex = -1
val astoreInsns: MutableCollection<VarInsnNode> = LinkedHashSet()
val aloadInsns: MutableCollection<VarInsnNode> = LinkedHashSet()
val stackInsns: MutableCollection<AbstractInsnNode> = LinkedHashSet()
val wrapperInsns: MutableCollection<AbstractInsnNode> = LinkedHashSet()
val getFieldInsns: MutableCollection<FieldInsnNode> = LinkedHashSet()
val putFieldInsns: MutableCollection<FieldInsnNode> = LinkedHashSet()
var cleanVarInstruction: VarInsnNode? = null
fun canRewrite(): Boolean =
!hazard &&
initCallInsn != null &&
localVar != null &&
localVarIndex >= 0
override fun onUseAsTainted() {
hazard = true
}
fun canRewrite() = !hazard && initCallInsn != null
}
private class Transformer(private val internalClassName: String, private val methodNode: MethodNode) {
private val refValues = ArrayList<CapturedVarDescriptor>()
private val refValuesByNewInsn = LinkedHashMap<TypeInsnNode, CapturedVarDescriptor>()
private val insns = methodNode.instructions.toArray()
private lateinit var frames: Array<out Frame<BasicValue>?>
val hasRewritableRefValues: Boolean
get() = refValues.isNotEmpty()
fun run() {
createRefValues()
if (!hasRewritableRefValues) return
if (refValues.isEmpty()) return
analyze()
if (!hasRewritableRefValues) return
val frames = analyze(internalClassName, methodNode, Interpreter())
trackPops(frames)
assignLocalVars(frames)
rewrite()
for (refValue in refValues) {
if (refValue.canRewrite()) {
rewriteRefValue(refValue)
}
}
methodNode.removeEmptyCatchBlocks()
methodNode.removeUnusedLocalVariables()
}
private fun AbstractInsnNode.getIndex() = methodNode.instructions.indexOf(this)
private fun createRefValues() {
for (insn in insns) {
for (insn in methodNode.instructions.asSequence()) {
if (insn.opcode == Opcodes.NEW && insn is TypeInsnNode) {
val type = Type.getObjectType(insn.desc)
if (AsmTypes.isSharedVarType(type)) {
@@ -113,19 +101,15 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
private inner class Interpreter : ReferenceTrackingInterpreter() {
override fun newOperation(insn: AbstractInsnNode): BasicValue =
refValuesByNewInsn[insn]?.let { descriptor ->
ProperTrackedReferenceValue(descriptor.refType, descriptor)
}
?: super.newOperation(insn)
refValuesByNewInsn[insn]?.let { ProperTrackedReferenceValue(it.refType, it) } ?: super.newOperation(insn)
override fun processRefValueUsage(value: TrackedReferenceValue, insn: AbstractInsnNode, position: Int) {
for (descriptor in value.descriptors) {
if (descriptor !is CapturedVarDescriptor) throw AssertionError("Unexpected descriptor: $descriptor")
when {
insn.opcode == Opcodes.ALOAD ->
descriptor.aloadInsns.add(insn as VarInsnNode)
insn.opcode == Opcodes.ASTORE ->
descriptor.astoreInsns.add(insn as VarInsnNode)
insn.opcode == Opcodes.DUP -> descriptor.wrapperInsns.add(insn)
insn.opcode == Opcodes.ALOAD -> descriptor.wrapperInsns.add(insn)
insn.opcode == Opcodes.ASTORE -> descriptor.wrapperInsns.add(insn)
insn.opcode == Opcodes.GETFIELD && insn is FieldInsnNode && insn.name == REF_ELEMENT_FIELD && position == 0 ->
descriptor.getFieldInsns.add(insn)
insn.opcode == Opcodes.PUTFIELD && insn is FieldInsnNode && insn.name == REF_ELEMENT_FIELD && position == 0 ->
@@ -135,32 +119,18 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
descriptor.hazard = true
else
descriptor.initCallInsn = insn
insn.opcode == Opcodes.DUP ->
descriptor.stackInsns.add(insn)
else ->
descriptor.hazard = true
else -> descriptor.hazard = true
}
}
}
}
private fun analyze() {
frames = MethodTransformer.analyze(internalClassName, methodNode, Interpreter())
trackPops()
assignLocalVars()
refValues.removeAll { !it.canRewrite() }
}
private fun trackPops() {
for (i in insns.indices) {
private fun trackPops(frames: Array<out Frame<BasicValue>?>) {
for ((i, insn) in methodNode.instructions.asSequence().withIndex()) {
val frame = frames[i] ?: continue
val insn = insns[i]
when (insn.opcode) {
Opcodes.POP -> {
frame.top()?.getCapturedVarOrNull()?.run { stackInsns.add(insn) }
frame.top()?.getCapturedVarOrNull()?.run { wrapperInsns.add(insn) }
}
Opcodes.POP2 -> {
val top = frame.top()
@@ -176,7 +146,7 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
private fun BasicValue.getCapturedVarOrNull() =
safeAs<ProperTrackedReferenceValue>()?.descriptor?.safeAs<CapturedVarDescriptor>()
private fun assignLocalVars() {
private fun assignLocalVars(frames: Array<out Frame<BasicValue>?>) {
for (localVar in methodNode.localVariables) {
val type = Type.getType(localVar.desc)
if (!AsmTypes.isSharedVarType(type)) continue
@@ -197,51 +167,20 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
for (refValue in refValues) {
if (refValue.hazard) continue
val localVar = refValue.localVar ?: continue
val oldVarIndex = localVar.index
if (refValue.valueType.size != 1) {
if (refValue.localVar == null || refValue.valueType.size != 1) {
refValue.localVarIndex = methodNode.maxLocals
methodNode.maxLocals += 2
localVar.index = refValue.localVarIndex
methodNode.maxLocals += refValue.valueType.size
} else {
refValue.localVarIndex = localVar.index
refValue.localVarIndex = refValue.localVar!!.index
}
val cleanInstructions = findCleanInstructions(refValue, oldVarIndex, methodNode.instructions)
if (cleanInstructions.size > 1) {
refValue.hazard = true
continue
}
refValue.cleanVarInstruction = cleanInstructions.firstOrNull()
}
}
private fun findCleanInstructions(refValue: CapturedVarDescriptor, oldVarIndex: Int, instructions: InsnList): List<VarInsnNode> {
return InsnSequence(instructions).filterIsInstance<VarInsnNode>().filter {
it.opcode == Opcodes.ASTORE && it.`var` == oldVarIndex
}.filter {
it.previous?.opcode == Opcodes.ACONST_NULL
}.filter {
val operationIndex = instructions.indexOf(it)
val localVariableNode = refValue.localVar!!
instructions.indexOf(localVariableNode.start) < operationIndex && operationIndex < instructions.indexOf(
localVariableNode.end
)
}.toList()
}
private fun rewrite() {
for (refValue in refValues) {
if (!refValue.canRewrite()) continue
rewriteRefValue(refValue)
private fun LocalVariableNode.findCleanInstructions() =
InsnSequence(methodNode.instructions).dropWhile { it != start }.takeWhile { it != end }.filter {
it is VarInsnNode && it.opcode == Opcodes.ASTORE && it.`var` == index && it.previous?.opcode == Opcodes.ACONST_NULL
}
methodNode.removeEmptyCatchBlocks()
methodNode.removeUnusedLocalVariables()
}
// Be careful to not remove instructions that are the only instruction for a line number. That will
// break debugging. If the previous instruction is a line number and the following instruction is
// a label followed by a line number, insert a nop instead of deleting the instruction.
@@ -255,34 +194,38 @@ class CapturedVarsOptimizationMethodTransformer : MethodTransformer() {
private fun rewriteRefValue(capturedVar: CapturedVarDescriptor) {
methodNode.instructions.run {
val localVar = capturedVar.localVar!!
localVar.signature = null
localVar.desc = capturedVar.valueType.descriptor
val loadOpcode = capturedVar.valueType.getOpcode(Opcodes.ILOAD)
val storeOpcode = capturedVar.valueType.getOpcode(Opcodes.ISTORE)
if (capturedVar.putFieldInsns.none { it.getIndex() < localVar.start.getIndex() }) {
// variable needs to be initialized before its live range can begin
insertBefore(capturedVar.newInsn, InsnNode(AsmUtil.defaultValueOpcode(capturedVar.valueType)))
insertBefore(capturedVar.newInsn, VarInsnNode(storeOpcode, capturedVar.localVarIndex))
val localVar = capturedVar.localVar
if (localVar != null) {
if (capturedVar.putFieldInsns.none { it.getIndex() < localVar.start.getIndex() }) {
// variable needs to be initialized before its live range can begin
insertBefore(capturedVar.newInsn, InsnNode(AsmUtil.defaultValueOpcode(capturedVar.valueType)))
insertBefore(capturedVar.newInsn, VarInsnNode(storeOpcode, capturedVar.localVarIndex))
}
for (insn in localVar.findCleanInstructions()) {
// after visiting block codegen tries to delete all allocated references:
// see ExpressionCodegen.addLeaveTaskToRemoveLocalVariableFromFrameMap
if (storeOpcode == Opcodes.ASTORE) {
set(insn.previous, InsnNode(AsmUtil.defaultValueOpcode(capturedVar.valueType)))
} else {
remove(insn.previous)
remove(insn)
}
}
localVar.index = capturedVar.localVarIndex
localVar.desc = capturedVar.valueType.descriptor
localVar.signature = null
}
remove(capturedVar.newInsn)
remove(capturedVar.initCallInsn!!)
capturedVar.stackInsns.forEach { removeOrReplaceByNop(it) }
capturedVar.aloadInsns.forEach { removeOrReplaceByNop(it) }
capturedVar.astoreInsns.forEach { removeOrReplaceByNop(it) }
capturedVar.wrapperInsns.forEach { removeOrReplaceByNop(it) }
capturedVar.getFieldInsns.forEach { set(it, VarInsnNode(loadOpcode, capturedVar.localVarIndex)) }
capturedVar.putFieldInsns.forEach { set(it, VarInsnNode(storeOpcode, capturedVar.localVarIndex)) }
//after visiting block codegen tries to delete all allocated references:
// see ExpressionCodegen.addLeaveTaskToRemoveLocalVariableFromFrameMap
capturedVar.cleanVarInstruction?.let {
remove(it.previous)
remove(it)
}
}
}

View File

@@ -28,7 +28,8 @@ import org.jetbrains.org.objectweb.asm.tree.TypeInsnNode
class RedundantCheckCastEliminationMethodTransformer : MethodTransformer() {
override fun transform(internalClassName: String, methodNode: MethodNode) {
val insns = methodNode.instructions.toArray()
if (!insns.any { it.opcode == Opcodes.CHECKCAST }) return
if (!insns.any { it.opcode == Opcodes.CHECKCAST}) return
if (insns.any { ReifiedTypeInliner.isOperationReifiedMarker(it) }) return
val redundantCheckCasts = ArrayList<TypeInsnNode>()
@@ -36,7 +37,6 @@ class RedundantCheckCastEliminationMethodTransformer : MethodTransformer() {
for (i in insns.indices) {
val valueType = frames[i]?.top()?.type ?: continue
val insn = insns[i]
if (ReifiedTypeInliner.isOperationReifiedMarker(insn.previous)) continue
if (insn is TypeInsnNode) {
val insnType = Type.getObjectType(insn.desc)

View File

@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.codegen.optimization.transformer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.org.objectweb.asm.tree.MethodNode;
import org.jetbrains.org.objectweb.asm.tree.analysis.*;
@@ -31,7 +32,7 @@ public abstract class MethodTransformer {
return analyzer.analyze(internalClassName, node);
}
catch (AnalyzerException e) {
throw new RuntimeException(e);
throw ExceptionUtilsKt.rethrow(e);
}
}

View File

@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.codegen.createFreeFakeLocalPropertyDescriptor
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.*
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapperBase
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.JvmDefaultMode
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.descriptors.*
@@ -32,7 +31,6 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils.isInterface
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPrivateApi
import org.jetbrains.kotlin.resolve.descriptorUtil.nonSourceAnnotations
import org.jetbrains.kotlin.resolve.jvm.annotations.hasJvmDefaultAnnotation
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForParameterTypes
import org.jetbrains.kotlin.resolve.jvm.requiresFunctionNameManglingForReturnType
import org.jetbrains.kotlin.serialization.DescriptorSerializer
@@ -91,7 +89,7 @@ class JvmSerializerExtension @JvmOverloads constructor(
}
//TODO: support local delegated properties in new defaults scheme
val containerAsmType =
if (isInterface(descriptor)) typeMapper.mapDefaultImpls(descriptor) else typeMapper.mapClass(descriptor)
if (isInterface(descriptor) && !jvmDefaultMode.forAllMethodsWithBody) typeMapper.mapDefaultImpls(descriptor) else typeMapper.mapClass(descriptor)
writeLocalProperties(proto, containerAsmType, JvmProtoBuf.classLocalVariable)
writeVersionRequirementForJvmDefaultIfNeeded(descriptor, proto, versionRequirementTable)
@@ -114,13 +112,6 @@ class JvmSerializerExtension @JvmOverloads constructor(
versionRequirementTable: MutableVersionRequirementTable
) {
if (isInterface(classDescriptor)) {
if (jvmDefaultMode == JvmDefaultMode.ENABLE && classDescriptor.unsubstitutedMemberScope.getContributedDescriptors().any {
it is CallableMemberDescriptor && it.hasJvmDefaultAnnotation()
}) {
builder.addVersionRequirement(
writeVersionRequirement(1, 2, 40, ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, versionRequirementTable)
)
}
if (jvmDefaultMode == JvmDefaultMode.ALL_INCOMPATIBLE) {
builder.addVersionRequirement(
writeVersionRequirement(1, 4, 0, ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, versionRequirementTable)
@@ -280,10 +271,6 @@ class JvmSerializerExtension @JvmOverloads constructor(
if (descriptor.isJvmFieldPropertyInInterfaceCompanion() && versionRequirementTable != null) {
proto.setExtension(JvmProtoBuf.flags, JvmFlags.getPropertyFlags(true))
proto.addVersionRequirement(
writeVersionRequirement(1, 2, 70, ProtoBuf.VersionRequirement.VersionKind.COMPILER_VERSION, versionRequirementTable)
)
}
if (getter?.needsInlineParameterNullCheckRequirement() == true || setter?.needsInlineParameterNullCheckRequirement() == true) {

View File

@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
import org.jetbrains.kotlin.codegen.optimization.OptimizationClassBuilderFactory
import org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.config.LanguageVersion.*
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
@@ -49,6 +50,7 @@ import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeApproximator
import org.jetbrains.org.objectweb.asm.Type
import java.io.File
import java.util.*
class GenerationState private constructor(
val project: Project,
@@ -204,15 +206,29 @@ class GenerationState private constructor(
val target = configuration.get(JVMConfigurationKeys.JVM_TARGET) ?: JvmTarget.DEFAULT
val runtimeStringConcat =
if (target.majorVersion >= JvmTarget.JVM_9.majorVersion)
configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INLINE
configuration.get(JVMConfigurationKeys.STRING_CONCAT) ?: JvmStringConcat.INDY_WITH_CONSTANTS
else JvmStringConcat.INLINE
val samConversionsScheme = run {
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS) ?: JvmSamConversions.DEFAULT
val fromConfig = configuration.get(JVMConfigurationKeys.SAM_CONVERSIONS)
if (fromConfig != null && target >= fromConfig.minJvmTarget)
fromConfig
else if (
target >= JvmClosureGenerationScheme.INDY.minJvmTarget &&
languageVersionSettings.supportsFeature(LanguageFeature.SamWrapperClassesAreSynthetic)
)
JvmClosureGenerationScheme.INDY
else
JvmClosureGenerationScheme.CLASS
}
val lambdasScheme = run {
val fromConfig = configuration.get(JVMConfigurationKeys.LAMBDAS)
?: JvmClosureGenerationScheme.DEFAULT
if (target >= fromConfig.minJvmTarget)
fromConfig
else
JvmSamConversions.DEFAULT
JvmClosureGenerationScheme.DEFAULT
}
val moduleName: String = moduleName ?: JvmCodegenUtil.getModuleName(module)
@@ -229,7 +245,6 @@ class GenerationState private constructor(
this.moduleName,
languageVersionSettings,
useOldManglingSchemeForFunctionsWithInlineClassesInSignatures,
IncompatibleClassTrackerImpl(extraJvmDiagnosticsTrace),
target,
isIrBackend
)
@@ -306,8 +321,7 @@ class GenerationState private constructor(
val metadataVersion =
configuration.get(CommonConfigurationKeys.METADATA_VERSION)
?: if (languageVersionSettings.languageVersion >= LanguageVersion.LATEST_STABLE) JvmMetadataVersion.INSTANCE
else JvmMetadataVersion(1, 1, 18)
?: LANGUAGE_TO_METADATA_VERSION.getValue(languageVersionSettings.languageVersion)
val abiStability = configuration.get(JVMConfigurationKeys.ABI_STABILITY)
@@ -378,6 +392,24 @@ class GenerationState private constructor(
private fun shouldOnlyCollectSignatures(origin: JvmDeclarationOrigin) =
classBuilderMode == ClassBuilderMode.LIGHT_CLASSES && origin.originKind in doNotGenerateInLightClassMode
companion object {
private val LANGUAGE_TO_METADATA_VERSION = EnumMap<LanguageVersion, JvmMetadataVersion>(LanguageVersion::class.java).apply {
val oldMetadataVersion = JvmMetadataVersion(1, 1, 18)
this[KOTLIN_1_0] = oldMetadataVersion
this[KOTLIN_1_1] = oldMetadataVersion
this[KOTLIN_1_2] = oldMetadataVersion
this[KOTLIN_1_3] = oldMetadataVersion
this[KOTLIN_1_4] = JvmMetadataVersion(1, 4, 3)
this[KOTLIN_1_5] = JvmMetadataVersion.INSTANCE
this[KOTLIN_1_6] = JvmMetadataVersion(1, 6, 0)
check(size == LanguageVersion.values().size) {
"Please add mappings from the missing LanguageVersion instances to the corresponding JvmMetadataVersion " +
"in `GenerationState.LANGUAGE_TO_METADATA_VERSION`"
}
}
}
}
private val doNotGenerateInLightClassMode = setOf(CLASS_MEMBER_DELEGATION_TO_DEFAULT_IMPL, BRIDGE, COLLECTION_STUB, AUGMENTED_BUILTIN_API)

View File

@@ -1,54 +0,0 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.codegen.state
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
import org.jetbrains.kotlin.util.slicedMap.Slices
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
interface IncompatibleClassTracker {
fun record(binaryClass: KotlinJvmBinaryClass)
object DoNothing : IncompatibleClassTracker {
override fun record(binaryClass: KotlinJvmBinaryClass) {
}
}
}
class IncompatibleClassTrackerImpl(val trace: BindingTrace) : IncompatibleClassTracker {
private val classes = linkedSetOf<String>()
override fun record(binaryClass: KotlinJvmBinaryClass) {
if (classes.add(binaryClass.location)) {
val errorData = IncompatibleVersionErrorData(
binaryClass.classHeader.bytecodeVersion,
JvmBytecodeBinaryVersion.INSTANCE,
binaryClass.location,
binaryClass.classId
)
trace.record(BYTECODE_VERSION_ERRORS, binaryClass.location, errorData)
}
}
companion object {
@JvmField
val BYTECODE_VERSION_ERRORS: WritableSlice<String, IncompatibleVersionErrorData<JvmBytecodeBinaryVersion>> = Slices.createCollectiveSlice()
}
}

View File

@@ -87,7 +87,6 @@ class KotlinTypeMapper @JvmOverloads constructor(
private val moduleName: String,
val languageVersionSettings: LanguageVersionSettings,
private val useOldInlineClassesManglingScheme: Boolean,
private val incompatibleClassTracker: IncompatibleClassTracker = IncompatibleClassTracker.DoNothing,
val jvmTarget: JvmTarget = JvmTarget.DEFAULT,
private val isIrBackend: Boolean = false,
private val typePreprocessor: ((KotlinType) -> KotlinType?)? = null,
@@ -494,9 +493,8 @@ class KotlinTypeMapper @JvmOverloads constructor(
boxInlineClassBeforeInvoke = true
}
else -> {
val isPrivateFunInvocation =
DescriptorVisibilities.isPrivate(functionDescriptor.visibility) && !functionDescriptor.isSuspend
invokeOpcode = if (superCall || isPrivateFunInvocation) INVOKESPECIAL else INVOKEVIRTUAL
invokeOpcode =
if (superCall || DescriptorVisibilities.isPrivate(functionDescriptor.visibility)) INVOKESPECIAL else INVOKEVIRTUAL
isInterfaceMember = false
}
}
@@ -845,8 +843,6 @@ class KotlinTypeMapper @JvmOverloads constructor(
skipGenericSignature: Boolean,
hasSpecialBridge: Boolean
): JvmMethodGenericSignature {
checkOwnerCompatibility(f)
val sw = if (skipGenericSignature || f is AccessorForCallableDescriptor<*>)
JvmSignatureWriter()
else
@@ -969,15 +965,6 @@ class KotlinTypeMapper @JvmOverloads constructor(
}
}
private fun checkOwnerCompatibility(descriptor: FunctionDescriptor) {
val ownerClass = descriptor.getContainingKotlinJvmBinaryClass() ?: return
val version = ownerClass.classHeader.bytecodeVersion
if (!version.isCompatible()) {
incompatibleClassTracker.record(ownerClass)
}
}
fun mapDefaultMethod(functionDescriptor: FunctionDescriptor, kind: OwnerKind): Method {
val jvmSignature = mapAsmMethod(functionDescriptor, kind)
val ownerType = mapOwner(functionDescriptor)

View File

@@ -19,8 +19,8 @@ package org.jetbrains.kotlin.codegen
import org.jetbrains.kotlin.codegen.state.GenerationState
import org.jetbrains.kotlin.config.JvmAnalysisFlags
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
import org.jetbrains.kotlin.load.kotlin.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.org.objectweb.asm.AnnotationVisitor
fun writeKotlinMetadata(
@@ -32,7 +32,9 @@ fun writeKotlinMetadata(
) {
val av = cb.newAnnotation(JvmAnnotationNames.METADATA_DESC, true)
av.visit(JvmAnnotationNames.METADATA_VERSION_FIELD_NAME, state.metadataVersion.toArray())
av.visit(JvmAnnotationNames.BYTECODE_VERSION_FIELD_NAME, JvmBytecodeBinaryVersion.INSTANCE.toArray())
if (!state.metadataVersion.isAtLeast(1, 5, 0)) {
av.visit("bv", JvmBytecodeBinaryVersion.INSTANCE.toArray())
}
av.visit(JvmAnnotationNames.KIND_FIELD_NAME, kind.id)
var flags = extraFlags
if (state.languageVersionSettings.isPreRelease()) {

View File

@@ -1,18 +1,7 @@
#!/usr/bin/env bash
# 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.
# 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.
export KOTLIN_TOOL=kotlin-annotation-processing-cli.jar

View File

@@ -1,18 +1,7 @@
@echo off
rem Copyright 2010-2015 JetBrains s.r.o.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
setlocal
set _KOTLIN_COMPILER=org.jetbrains.kotlin.kapt.cli.KaptCli

View File

@@ -1,18 +1,7 @@
#!/usr/bin/env bash
# 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.
# 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.
export KOTLIN_RUNNER=1

View File

@@ -1,18 +1,7 @@
#!/usr/bin/env bash
# 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.
# 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.
export KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.dce.K2JSDce

View File

@@ -1,18 +1,7 @@
@echo off
rem Copyright 2010-2015 JetBrains s.r.o.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
setlocal
set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.dce.K2JSDce

View File

@@ -1,18 +1,7 @@
@echo off
rem Copyright 2010-2015 JetBrains s.r.o.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
setlocal
set _KOTLIN_RUNNER=1

View File

@@ -1,13 +1,9 @@
#!/usr/bin/env bash
#
##############################################################################
# Based on scalac from the Scala distribution
# Copyright 2002-2011, LAMP/EPFL
# Copyright 2011-2015, JetBrains
#
# This is free software; see the distribution for copying conditions.
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
##############################################################################
# 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.
cygwin=false;
case "`uname`" in
@@ -25,6 +21,17 @@ findKotlinHome() {
(cd -P "$(dirname "$source")/.." && pwd)
}
findJavaVersion() {
# Note that this only loads the first component of the version, so "1.8.0_265" -> "1".
# But it's fine because major version is 9 for JDK 9, and so on.
regex='^.*version "([[:digit:]]+).*$'
while read -r line; do
if [[ "$line" =~ $regex ]]; then
echo ${BASH_REMATCH[1]}
fi
done <<< $("${JAVACMD:=java}" -version 2>&1)
}
KOTLIN_HOME="$(findKotlinHome)"
if $cygwin; then
@@ -60,17 +67,24 @@ fi
declare -a kotlin_app
if [ -n "$KOTLIN_RUNNER" ];
then
java_version="$(findJavaVersion)"
if [[ $java_version -ge 9 ]]; then
# Workaround the illegal reflective access warning from ReflectionUtil to ResourceBundle.setParent, see IDEA-248785.
java_args=("${java_args[@]}" "--add-opens" "java.base/java.util=ALL-UNNAMED")
fi
if [ -n "$KOTLIN_RUNNER" ]; then
java_args=("${java_args[@]}" "-Dkotlin.home=${KOTLIN_HOME}")
kotlin_app=("${KOTLIN_HOME}/lib/kotlin-runner.jar" "org.jetbrains.kotlin.runner.Main")
else
[ -n "$KOTLIN_COMPILER" ] || KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
java_args=("${java_args[@]}" "-noverify")
if [[ $java_version < 13 ]]; then
java_args=("${java_args[@]}" "-noverify")
fi
declare additional_classpath=""
if [ -n "$KOTLIN_TOOL" ];
then
if [ -n "$KOTLIN_TOOL" ]; then
additional_classpath=":${KOTLIN_HOME}/lib/${KOTLIN_TOOL}"
fi

View File

@@ -1,18 +1,7 @@
#!/usr/bin/env bash
# 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.
# 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.
export KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.K2JSCompiler

View File

@@ -1,18 +1,7 @@
@echo off
rem Copyright 2010-2015 JetBrains s.r.o.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
setlocal
set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.js.K2JSCompiler

View File

@@ -1,18 +1,7 @@
#!/usr/bin/env bash
# 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.
# 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.
DIR="${BASH_SOURCE[0]%/*}"
: ${DIR:="."}

View File

@@ -1,17 +1,6 @@
@echo off
rem Copyright 2010-2015 JetBrains s.r.o.
rem
rem Licensed under the Apache License, Version 2.0 (the "License");
rem you may not use this file except in compliance with the License.
rem You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
call %~dps0kotlinc.bat %*

View File

@@ -1,13 +1,9 @@
@echo off
rem based on scalac.bat from the Scala distribution
rem ##########################################################################
rem # Copyright 2002-2011, LAMP/EPFL
rem # Copyright 2011-2015, JetBrains
rem #
rem # This is free software; see the distribution for copying conditions.
rem # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
rem # PARTICULAR PURPOSE.
rem ##########################################################################
rem Based on scalac.bat from the Scala distribution
rem Copyright 2002-2011, LAMP/EPFL
rem Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
rem Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
rem We adopt the following conventions:
rem - System/user environment variables start with a letter
@@ -19,11 +15,10 @@ call :set_home
if "%_KOTLIN_COMPILER%"=="" set _KOTLIN_COMPILER=org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
if not "%JAVA_HOME%"=="" (
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
rem Prepend JAVA_HOME to local PATH to be able to simply execute "java" later in the script.
set "PATH=%JAVA_HOME%\bin;%PATH%"
)
if "%_JAVACMD%"=="" set _JAVACMD=java
rem We use the value of the JAVA_OPTS environment variable if defined
if "%JAVA_OPTS%"=="" set JAVA_OPTS=-Xmx256M -Xms32M
@@ -45,18 +40,29 @@ shift
goto loop
:loopend
if "%_KOTLIN_RUNNER%"=="1" (
"%_JAVACMD%" %JAVA_OPTS% "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
setlocal EnableDelayedExpansion
call :set_java_version
if !_java_major_version! geq 9 (
rem Workaround the illegal reflective access warning from ReflectionUtil to ResourceBundle.setParent, see IDEA-248785.
set JAVA_OPTS=!JAVA_OPTS! "--add-opens" "java.base/java.util=ALL-UNNAMED"
)
if "!_KOTLIN_RUNNER!"=="1" (
java !JAVA_OPTS! "-Dkotlin.home=%_KOTLIN_HOME%" -cp "%_KOTLIN_HOME%\lib\kotlin-runner.jar" ^
org.jetbrains.kotlin.runner.Main %KOTLIN_OPTS%
) else (
setlocal EnableDelayedExpansion
SET _ADDITIONAL_CLASSPATH=
set _ADDITIONAL_CLASSPATH=
if !_java_major_version! lss 13 (
set JAVA_OPTS=!JAVA_OPTS! "-noverify"
)
if not "%_KOTLIN_TOOL%"=="" (
set _ADDITIONAL_CLASSPATH=;%_KOTLIN_HOME%\lib\%_KOTLIN_TOOL%
)
"%_JAVACMD%" %JAVA_OPTS% -noverify -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
java !JAVA_OPTS! -cp "%_KOTLIN_HOME%\lib\kotlin-preloader.jar" ^
org.jetbrains.kotlin.preloading.Preloader -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar!_ADDITIONAL_CLASSPATH!" ^
%_KOTLIN_COMPILER% %KOTLIN_OPTS%
)
@@ -73,6 +79,29 @@ rem # subroutines
set _KOTLIN_HOME=%_BIN_DIR%..
goto :eof
rem Parses "java -version" output and stores the major version to _java_major_version.
rem Note that this only loads the first component of the version, so "1.8.0_265" -> "1".
rem But it's fine because major version is 9 for JDK 9, and so on.
rem Needs to be executed in the EnableDelayedExpansion mode.
:set_java_version
set _version=
rem Parse output and take the third token from the string containing " version ".
rem It should be something like "1.8.0_275" or "15.0.1".
for /f "tokens=3" %%i in ('java -version 2^>^&1 ^| findstr /i " version "') do (
rem Split the string by "-" or "." and take the first token.
for /f "delims=-. tokens=1" %%j in ("%%i") do (
rem At this point, _version should be something like "1 or "15. Note the leading quote.
set _version=%%j
)
)
if "!_version!"=="" (
rem If failed to parse the output, set the version to 1.
set _java_major_version=1
) else (
rem Strip the leading quote.
set _java_major_version=!_version:~1!
)
goto :eof
:end
endlocal

View File

@@ -16,8 +16,54 @@
package org.jetbrains.kotlin.cli.common
val KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY = "kotlin.environment.keepalive"
import com.intellij.util.LineSeparator
import java.util.*
enum class CompilerSystemProperties(val property: String) {
COMPILE_DAEMON_ENABLED_PROPERTY("kotlin.daemon.enabled"),
COMPILE_DAEMON_JVM_OPTIONS_PROPERTY("kotlin.daemon.jvm.options"),
COMPILE_DAEMON_OPTIONS_PROPERTY("kotlin.daemon.options"),
COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY("kotlin.daemon.client.options"),
COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY("kotlin.daemon.client.alive.path"),
COMPILE_DAEMON_LOG_PATH_PROPERTY("kotlin.daemon.log.path"),
COMPILE_DAEMON_REPORT_PERF_PROPERTY("kotlin.daemon.perf"),
COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY("kotlin.daemon.verbose"),
COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY("kotlin.daemon.startup.timeout"),
JAVA_RMI_SERVER_HOSTNAME("java.rmi.server.hostname"),
DAEMON_RMI_SOCKET_BACKLOG_SIZE_PROPERTY("kotlin.daemon.socket.backlog.size"),
DAEMON_RMI_SOCKET_CONNECT_ATTEMPTS_PROPERTY("kotlin.daemon.socket.connect.attempts"),
DAEMON_RMI_SOCKET_CONNECT_INTERVAL_PROPERTY("kotlin.daemon.socket.connect.interval"),
KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY("kotlin.environment.keepalive"),
COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS("kotlin.daemon.custom.run.files.path.for.tests"),
KOTLIN_COLORS_ENABLED_PROPERTY("kotlin.colors.enabled"),
OS_NAME("os.name")
;
var value
get() = systemPropertyGetter(property)
set(value) {
systemPropertySetter(property, value!!)
}
fun clear(): String? = systemPropertyCleaner(property)
companion object {
var systemPropertyGetter: (String) -> String? = {
System.getProperty(it)
}
var systemPropertySetter: (String, String) -> String? = { key, value ->
System.setProperty(key, value)
}
var systemPropertyCleaner: (String) -> String? = { key ->
System.clearProperty(key)
}
}
}
val isWindows: Boolean
get() = CompilerSystemProperties.OS_NAME.value!!.toLowerCase(Locale.ENGLISH).startsWith("windows")
fun String?.toBooleanLenient(): Boolean? = when (this?.toLowerCase()) {
null -> false

View File

@@ -351,6 +351,13 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
)
var inferenceCompatibility: Boolean by FreezableVar(false)
@Argument(
value = "-Xextended-compiler-checks",
description = "Enable additional compiler checks that might provide verbose diagnostic information for certain errors.\n" +
"Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code."
)
var extendedCompilerChecks: Boolean by FreezableVar(false)
open fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
return HashMap<AnalysisFlag<*>, Any>().apply {
put(AnalysisFlags.skipMetadataVersionCheck, skipMetadataVersionCheck)
@@ -369,6 +376,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
CompilerMessageSeverity.ERROR,
"Unknown value for parameter -Xexplicit-api: '$explicitApi'. Value should be one of ${ExplicitApiMode.availableValues()}"
)
put(AnalysisFlags.extendedCompilerChecks, extendedCompilerChecks)
}
}

View File

@@ -0,0 +1,13 @@
/*
* 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.cli.common.arguments
@Retention(AnnotationRetention.RUNTIME)
annotation class DeprecatedOption(
val message: String = "This option has no effect and will be removed in a future release.",
val removeAfter: String,
val level: DeprecationLevel
)

View File

@@ -5,8 +5,7 @@
package org.jetbrains.kotlin.cli.common.arguments
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.CALL
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.NO_CALL
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.*
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.config.ApiVersion
@@ -126,6 +125,13 @@ class K2JSCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-Xir-dce", description = "Perform experimental dead code elimination")
var irDce: Boolean by FreezableVar(false)
@Argument(
value = "-Xir-dce-runtime-diagnostic",
valueDescription = "{$DCE_RUNTIME_DIAGNOSTIC_LOG|$DCE_RUNTIME_DIAGNOSTIC_EXCEPTION}",
description = "Enable runtime diagnostics when performing DCE instead of removing declarations"
)
var irDceRuntimeDiagnostic: String? by NullableStringFreezableVar(null)
@Argument(value = "-Xir-dce-driven", description = "Perform a more experimental faster dead code elimination")
var irDceDriven: Boolean by FreezableVar(false)

View File

@@ -25,6 +25,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
description = "List of directories and JAR/ZIP archives to search for user class files")
var classpath: String? by NullableStringFreezableVar(null)
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument(value = "-include-runtime", description = "Include Kotlin runtime into the resulting JAR")
var includeRuntime: Boolean by FreezableVar(false)
@@ -41,10 +42,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(value = "-no-jdk", description = "Don't automatically include the Java runtime into the classpath")
var noJdk: Boolean by FreezableVar(false)
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
@GradleOption(DefaultValues.BooleanTrueDefault::class)
@Argument(value = "-no-stdlib", description = "Don't automatically include the Kotlin/JVM stdlib and Kotlin reflection into the classpath")
var noStdlib: Boolean by FreezableVar(false)
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.ERROR)
@GradleOption(DefaultValues.BooleanTrueDefault::class)
@Argument(value = "-no-reflect", description = "Don't automatically include Kotlin reflection into the classpath")
var noReflect: Boolean by FreezableVar(false)
@@ -71,7 +74,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(
value = "-jvm-target",
valueDescription = "<version>",
description = "Target version of the generated JVM bytecode (1.6, 1.8, 9, 10, 11, 12, 13, 14 or 15), default is 1.6"
description = "Target version of the generated JVM bytecode (1.6 (DEPRECATED), 1.8, 9, 10, 11, 12, 13, 14, 15 or 16), default is 1.8"
)
var jvmTarget: String? by NullableStringFreezableVar(JvmTarget.DEFAULT.description)
@@ -81,8 +84,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
// Advanced options
@DeprecatedOption(removeAfter = "1.5", level = DeprecationLevel.WARNING)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@Argument(value = "-Xuse-ir", description = "Use the IR backend")
@Argument(
value = "-Xuse-ir",
description = "Use the IR backend. This option has no effect unless the language version less than 1.5 is used"
)
var useIR: Boolean by FreezableVar(false)
@GradleOption(DefaultValues.BooleanFalseDefault::class)
@@ -355,10 +362,12 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
@Argument(
value = "-Xstring-concat",
valueDescription = "{indy-with-constants|indy|inline}",
description = """Switch a way in which string concatenation is performed.
-Xstring-concat=indy-with-constants Performs string concatenation via `invokedynamic` 'makeConcatWithConstants'. Works only with `-jvm-target 9` or greater
-Xstring-concat=indy Performs string concatenation via `invokedynamic` 'makeConcat'. Works only with `-jvm-target 9` or greater
-Xstring-concat=inline Performs string concatenation via `StringBuilder`"""
description = """Select code generation scheme for string concatenation.
-Xstring-concat=indy-with-constants Concatenate strings using `invokedynamic` `makeConcatWithConstants`. Requires `-jvm-target 9` or greater.
-Xstring-concat=indy Concatenate strings using `invokedynamic` `makeConcat`. Requires `-jvm-target 9` or greater.
-Xstring-concat=inline Concatenate strings using `StringBuilder`
default: `indy-with-constants` for JVM target 9 or greater, `inline` otherwise"""
)
var stringConcat: String? by NullableStringFreezableVar(JvmStringConcat.INLINE.description)
@@ -366,10 +375,20 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
value = "-Xsam-conversions",
valueDescription = "{class|indy}",
description = """Select code generation scheme for SAM conversions.
-Xsam-conversions=indy Generate SAM conversions using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 8` or greater.
-Xsam-conversions=indy Generate SAM conversions using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater.
-Xsam-conversions=class Generate SAM conversions as explicit classes"""
)
var samConversions: String? by NullableStringFreezableVar(JvmSamConversions.CLASS.description)
var samConversions: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xlambdas",
valueDescription = "{class|indy}",
description = """Select code generation scheme for lambdas.
-Xlambdas=indy Generate lambdas using `invokedynamic` with `LambdaMetafactory.metafactory`. Requires `-jvm-target 1.8` or greater.
Lambda objects created using `LambdaMetafactory.metafactory` will have different `toString()`.
-Xlambdas=class Generate lambdas as explicit classes"""
)
var lambdas: String? by NullableStringFreezableVar(null)
@Argument(
value = "-Xklib",
@@ -438,6 +457,20 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
)
var enableJvmPreview: Boolean by FreezableVar(false)
@Argument(
value = "-Xsuppress-deprecated-jvm-target-warning",
description = "Suppress deprecation warning about deprecated JVM target versions"
)
var suppressDeprecatedJvmTargetWarning: Boolean by FreezableVar(false)
@Argument(
value = "-Xtype-enhancement-improvements-strict-mode",
description = "Enable strict mode for some improvements in the type enhancement for loaded Java types based on nullability annotations," +
"including freshly supported reading of the type use annotations from class files. " +
"See KT-45671 for more details"
)
var typeEnhancementImprovementsInStrictMode: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics
@@ -460,6 +493,7 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
result[JvmAnalysisFlags.enableJvmPreview] = enableJvmPreview
result[AnalysisFlags.allowUnstableDependencies] = allowUnstableDependencies || useFir
result[JvmAnalysisFlags.disableUltraLightClasses] = disableUltraLightClasses
result[JvmAnalysisFlags.useIR] = useIR
return result
}
@@ -468,6 +502,9 @@ class K2JVMCompilerArguments : CommonCompilerArguments() {
if (strictJavaNullabilityAssertions) {
result[LanguageFeature.StrictJavaNullabilityAssertions] = LanguageFeature.State.ENABLED
}
if (typeEnhancementImprovementsInStrictMode) {
result[LanguageFeature.TypeEnhancementImprovementsInStrictMode] = LanguageFeature.State.ENABLED
}
return result
}

View File

@@ -28,4 +28,7 @@ public interface K2JsArgumentConstants {
String SOURCE_MAP_SOURCE_CONTENT_ALWAYS = "always";
String SOURCE_MAP_SOURCE_CONTENT_NEVER = "never";
String SOURCE_MAP_SOURCE_CONTENT_INLINING = "inlining";
String DCE_RUNTIME_DIAGNOSTIC_LOG = "log";
String DCE_RUNTIME_DIAGNOSTIC_EXCEPTION = "exception";
}

View File

@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.cli.common.ExitCode.COMPILATION_ERROR
import org.jetbrains.kotlin.cli.common.ExitCode.OK
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.*
import org.jetbrains.kotlin.cli.common.config.addKotlinSourceRoot
import org.jetbrains.kotlin.cli.common.extensions.ScriptEvaluationExtension
import org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport
@@ -264,6 +265,10 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
mainArguments = mainCallArguments,
generateFullJs = !arguments.irDce,
generateDceJs = arguments.irDce,
dceRuntimeDiagnostic = DceRuntimeDiagnostic.resolve(
arguments.irDceRuntimeDiagnostic,
messageCollector
),
dceDriven = arguments.irDceDriven,
multiModule = arguments.irPerModule,
relativeRequirePath = true,
@@ -273,6 +278,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
return COMPILATION_ERROR
}
val jsCode = if (arguments.irDce && !arguments.irDceDriven) compiledModule.dceJsCode!! else compiledModule.jsCode!!
outputFile.writeText(jsCode.mainModule)
jsCode.dependencies.forEach { (name, content) ->
@@ -430,6 +436,19 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
}
}
fun DceRuntimeDiagnostic.Companion.resolve(
value: String?,
messageCollector: MessageCollector
): DceRuntimeDiagnostic? = when (value?.toLowerCase()) {
DCE_RUNTIME_DIAGNOSTIC_LOG -> DceRuntimeDiagnostic.LOG
DCE_RUNTIME_DIAGNOSTIC_EXCEPTION -> DceRuntimeDiagnostic.EXCEPTION
null -> null
else -> {
messageCollector.report(STRONG_WARNING, "Unknown DCE runtime diagnostic '$value'")
null
}
}
fun messageCollectorLogger(collector: MessageCollector) = object : Logger {
override fun warning(message: String) = collector.report(STRONG_WARNING, message)
override fun error(message: String) = collector.report(ERROR, message)

View File

@@ -76,17 +76,23 @@ class K2JSDce : CLITool<K2JSDceArguments>() {
messageCollector.report(severity, message)
}
val dceResult = DeadCodeElimination.run(files, includedDeclarations, logConsumer)
val dceResult = DeadCodeElimination.run(
files,
includedDeclarations,
arguments.printReachabilityInfo,
logConsumer
)
if (dceResult.status == DeadCodeEliminationStatus.FAILED) return ExitCode.COMPILATION_ERROR
val nodes = dceResult.reachableNodes.filterTo(mutableSetOf()) { it.reachable }
val reachabilitySeverity = if (arguments.printReachabilityInfo) CompilerMessageSeverity.INFO else CompilerMessageSeverity.LOGGING
messageCollector.report(reachabilitySeverity, "")
for (node in nodes.extractRoots()) {
printTree(
node, { messageCollector.report(reachabilitySeverity, it) },
printNestedMembers = false, showLocations = true
)
if (arguments.printReachabilityInfo) {
val reachabilitySeverity = CompilerMessageSeverity.INFO
messageCollector.report(reachabilitySeverity, "")
for (node in dceResult.reachableNodes.extractReachableRoots(dceResult.context!!)) {
printTree(
node, { messageCollector.report(reachabilitySeverity, it) },
printNestedMembers = false, showLocations = true
)
}
}
return ExitCode.OK

View File

@@ -0,0 +1,137 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.Map;
import java.util.ResourceBundle;
public abstract class DynamicBundle extends AbstractBundle {
private final static Logger LOG = Logger.getInstance(DynamicBundle.class);
protected DynamicBundle(@NotNull String pathToBundle) {
super(pathToBundle);
}
// see BundleUtil
@Override
protected ResourceBundle findBundle(@NotNull String pathToBundle,
@NotNull ClassLoader baseLoader,
@NotNull ResourceBundle.Control control) {
ResourceBundle base = super.findBundle(pathToBundle, baseLoader, control);
LanguageBundleEP langBundle = findLanguageBundle();
if (langBundle == null) return base;
ResourceBundle pluginBundle = super.findBundle(pathToBundle, langBundle.getLoaderForClass(), control);
if (pluginBundle == null) return base;
try {
if (DynamicBundleInternal.SET_PARENT != null) {
DynamicBundleInternal.SET_PARENT.invoke(pluginBundle, base);
}
}
catch (Throwable e) {
LOG.warn(e);
return base;
}
return pluginBundle;
}
/**
* "SET_PARENT" has been temporary moved into the internal class to fix Kotlin compiler.
* It's to be refactored with "ResourceBundleProvider" since 'core-api' module will use java 1.9+
*/
private static class DynamicBundleInternal {
private static final MethodHandle SET_PARENT;
static {
try {
Method method = ResourceBundle.class.getDeclaredMethod("setParent", ResourceBundle.class);
method.setAccessible(true);
SET_PARENT = MethodHandles.lookup().unreflect(method);
}
catch (NoSuchMethodException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
// todo: one language per application
@Nullable
private static LanguageBundleEP findLanguageBundle() {
try {
Application application = ApplicationManager.getApplication();
if (application == null) return null;
if (application.isUnitTestMode() && !application.getExtensionArea().hasExtensionPoint(LanguageBundleEP.EP_NAME)) {
return null;
}
return LanguageBundleEP.EP_NAME.findExtension(LanguageBundleEP.class);
}
catch (ProcessCanceledException e) {
throw e;
}
catch (Exception e) {
LOG.error(e);
return null;
}
}
public static final DynamicBundle INSTANCE = new DynamicBundle("") {
};
public static class LanguageBundleEP extends AbstractExtensionPointBean {
public static final ExtensionPointName<LanguageBundleEP> EP_NAME = ExtensionPointName.create("com.intellij.languageBundle");
}
private static final Map<String, DynamicBundle> ourBundlesForForms = ContainerUtil.createConcurrentSoftValueMap();
/**
* @deprecated used only dy GUI form builder
*/
@Deprecated
public static ResourceBundle getBundle(@NotNull String baseName) {
Class<?> callerClass = ReflectionUtil.findCallerClass(2);
return getBundle(baseName, callerClass == null ? DynamicBundle.class : callerClass);
}
/**
* @deprecated used only dy GUI form builder
*/
@Deprecated
public static ResourceBundle getBundle(@NotNull String baseName, @NotNull Class<?> formClass) {
DynamicBundle dynamic = ourBundlesForForms.computeIfAbsent(baseName, s -> new DynamicBundle(s) {});
ResourceBundle rb = dynamic.getResourceBundle(formClass.getClassLoader());
if (BundleBase.SHOW_LOCALIZED_MESSAGES) {
return new ResourceBundle() {
@Override
protected Object handleGetObject(@NotNull String key) {
Object get = rb.getObject(key);
assert get instanceof String : "Language bundles should contain only strings";
return BundleBase.appendLocalizationMarker((String)get);
}
@NotNull
@Override
public Enumeration<String> getKeys() {
return rb.getKeys();
}
};
}
return rb;
}
}

View File

@@ -205,8 +205,8 @@ abstract class CLITool<A : CommonToolArguments> {
if (System.getProperty("java.awt.headless") == null) {
System.setProperty("java.awt.headless", "true")
}
if (System.getProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY) == null) {
System.setProperty(PlainTextMessageRenderer.KOTLIN_COLORS_ENABLED_PROPERTY, "true")
if (CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value == null) {
CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.value = "true"
}
setupIdeaStandaloneExecution()

View File

@@ -16,7 +16,6 @@
package org.jetbrains.kotlin.cli.common.messages
import com.intellij.openapi.util.io.FileUtil.toSystemDependentName
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.*
import com.intellij.psi.util.PsiFormatUtil
@@ -24,7 +23,7 @@ import org.jetbrains.kotlin.analyzer.AbstractAnalyzerWithCompilerReport
import org.jetbrains.kotlin.analyzer.AnalysisResult
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*
import org.jetbrains.kotlin.codegen.state.IncompatibleClassTrackerImpl
import org.jetbrains.kotlin.config.AnalysisFlags
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.config.languageVersionSettings
@@ -32,16 +31,12 @@ import org.jetbrains.kotlin.diagnostics.*
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils.sortedDiagnostics
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
import org.jetbrains.kotlin.load.java.components.TraceBasedErrorReporter
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.resolve.AnalyzingUtils
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.checkers.ExperimentalUsageChecker
import org.jetbrains.kotlin.resolve.jvm.JvmBindingContextSlices
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData
class AnalyzerWithCompilerReport(
private val messageCollector: MessageCollector,
@@ -72,6 +67,9 @@ class AnalyzerWithCompilerReport(
.append(", unresolved supertypes: ").append(unresolved!!.joinToString())
.append("\n")
}
if (!languageVersionSettings.getFlag(AnalysisFlags.extendedCompilerChecks)) {
message.append("Adding -Xextended-compiler-checks argument might provide additional information.\n")
}
messageCollector.report(ERROR, message.toString())
}
}
@@ -242,33 +240,5 @@ class AnalyzerWithCompilerReport(
fun reportSyntaxErrors(file: PsiElement, messageCollector: MessageCollector): SyntaxErrorReport {
return reportSyntaxErrors(file, DefaultDiagnosticReporter(messageCollector))
}
fun reportBytecodeVersionErrors(bindingContext: BindingContext, messageCollector: MessageCollector) {
val severity =
if (System.getProperty("kotlin.jvm.disable.bytecode.version.error") == "true") STRONG_WARNING
else ERROR
val locations = bindingContext.getKeys(IncompatibleClassTrackerImpl.BYTECODE_VERSION_ERRORS)
if (locations.isEmpty()) return
for (location in locations) {
val data = bindingContext.get(IncompatibleClassTrackerImpl.BYTECODE_VERSION_ERRORS, location)
?: error("Value is missing for key in binding context: $location")
reportIncompatibleBinaryVersion(messageCollector, data, severity)
}
}
private fun reportIncompatibleBinaryVersion(
messageCollector: MessageCollector,
data: IncompatibleVersionErrorData<JvmBytecodeBinaryVersion>,
severity: CompilerMessageSeverity
) {
messageCollector.report(
severity,
"Class '" + JvmClassName.byClassId(data.classId) + "' was compiled with an incompatible version of Kotlin. " +
"The binary version of its bytecode is " + data.actualVersion + ", expected version is " + data.expectedVersion,
CompilerMessageLocation.create(toSystemDependentName(data.filePath))
)
}
}
}

View File

@@ -16,13 +16,13 @@
package org.jetbrains.kotlin.cli.common.messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.LineSeparator;
import kotlin.text.StringsKt;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.internal.CLibrary;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties;
import org.jetbrains.kotlin.cli.common.PropertiesKt;
import org.jetbrains.kotlin.util.capitalizeDecapitalize.CapitalizeDecapitalizeKt;
import java.util.EnumSet;
@@ -31,13 +31,12 @@ import java.util.Set;
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.*;
public abstract class PlainTextMessageRenderer implements MessageRenderer {
public static final String KOTLIN_COLORS_ENABLED_PROPERTY = "kotlin.colors.enabled";
public static final boolean COLOR_ENABLED;
static {
boolean colorEnabled = false;
// TODO: investigate why ANSI escape codes on Windows only work in REPL for some reason
if (!SystemInfo.isWindows && "true".equals(System.getProperty(KOTLIN_COLORS_ENABLED_PROPERTY))) {
if (!PropertiesKt.isWindows() && "true".equals(CompilerSystemProperties.KOTLIN_COLORS_ENABLED_PROPERTY.getValue())) {
try {
// AnsiConsole doesn't check isatty() for stderr (see https://github.com/fusesource/jansi/pull/35).
colorEnabled = CLibrary.isatty(CLibrary.STDERR_FILENO) != 0;
@@ -49,7 +48,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
COLOR_ENABLED = colorEnabled;
}
private static final String LINE_SEPARATOR = LineSeparator.getSystemLineSeparator().getSeparatorString();
private static final String LINE_SEPARATOR = System.lineSeparator();
private static final Set<CompilerMessageSeverity> IMPORTANT_MESSAGE_SEVERITIES = EnumSet.of(EXCEPTION, ERROR, STRONG_WARNING, WARNING);

View File

@@ -22,6 +22,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiJavaModule
import com.intellij.psi.PsiManager
import com.intellij.psi.impl.light.LightJavaModule
import com.intellij.testFramework.LightVirtualFile
import org.jetbrains.kotlin.cli.common.config.ContentRoot
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
@@ -37,6 +38,7 @@ import org.jetbrains.kotlin.cli.jvm.modules.CliJavaModuleFinder
import org.jetbrains.kotlin.cli.jvm.modules.JavaModuleGraph
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.isValidJavaFqName
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo
import org.jetbrains.kotlin.resolve.jvm.modules.KOTLIN_STDLIB_MODULE_NAME
@@ -52,7 +54,8 @@ class ClasspathRootsResolver(
private val contentRootToVirtualFile: (JvmContentRoot) -> VirtualFile?,
private val javaModuleFinder: CliJavaModuleFinder,
private val requireStdlibModule: Boolean,
private val outputDirectory: VirtualFile?
private val outputDirectory: VirtualFile?,
private val javaFileManager: KotlinCliJavaFileManager
) {
val javaModuleGraph = JavaModuleGraph(javaModuleFinder)
@@ -160,7 +163,7 @@ class ClasspathRootsResolver(
}
if (moduleInfoFile != null) {
val moduleInfo = JavaModuleInfo.read(moduleInfoFile) ?: return null
val moduleInfo = JavaModuleInfo.read(moduleInfoFile, javaFileManager) ?: return null
return JavaModule.Explicit(moduleInfo, listOf(JavaModule.Root(root, isBinary = true)), moduleInfoFile)
}

View File

@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.asJava.classes.KtLightClass
import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade
import org.jetbrains.kotlin.asJava.classes.KtLightClassForScript
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration
import org.jetbrains.kotlin.config.JvmAnalysisFlags
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
import org.jetbrains.kotlin.load.java.components.FilesByFacadeFqNameIndexer
@@ -110,7 +111,7 @@ class CliKotlinAsJavaSupport(
}
override fun getLightClass(classOrObject: KtClassOrObject): KtLightClass? =
KtLightClassForSourceDeclaration.create(classOrObject)
KtLightClassForSourceDeclaration.create(classOrObject, traceHolder.languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode))
override fun getLightClassForScript(script: KtScript): KtLightClassForScript? =
KtLightClassForScript.create(script)

View File

@@ -23,11 +23,17 @@ import org.jetbrains.kotlin.asJava.builder.InvalidLightClassDataHolder
import org.jetbrains.kotlin.asJava.builder.LightClassConstructionContext
import org.jetbrains.kotlin.asJava.builder.LightClassDataHolder
import org.jetbrains.kotlin.asJava.builder.LightClassDataHolderImpl
import org.jetbrains.kotlin.asJava.classes.*
import org.jetbrains.kotlin.asJava.classes.KtUltraLightSupport
import org.jetbrains.kotlin.asJava.classes.cleanFromAnonymousTypes
import org.jetbrains.kotlin.asJava.classes.lazyPub
import org.jetbrains.kotlin.asJava.classes.tryGetPredefinedName
import org.jetbrains.kotlin.codegen.ClassBuilderMode
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.config.JvmAnalysisFlags
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.load.java.components.JavaDeprecationSettings
import org.jetbrains.kotlin.name.Name
@@ -57,7 +63,8 @@ class CliLightClassGenerationSupport(
private class CliLightClassSupport(
private val project: Project,
override val languageVersionSettings: LanguageVersionSettings
override val languageVersionSettings: LanguageVersionSettings,
private val jvmTarget: JvmTarget
) : KtUltraLightSupport {
// This is the way to untie CliLightClassSupport and CliLightClassGenerationSupport to prevent descriptors leak
@@ -88,7 +95,7 @@ class CliLightClassGenerationSupport(
moduleName,
languageVersionSettings,
useOldInlineClassesManglingScheme = false,
jvmTarget = JvmTarget.JVM_1_8,
jvmTarget = jvmTarget,
typePreprocessor = KotlinType::cleanFromAnonymousTypes,
namePreprocessor = ::tryGetPredefinedName
)
@@ -96,7 +103,7 @@ class CliLightClassGenerationSupport(
}
private val ultraLightSupport: KtUltraLightSupport by lazyPub {
CliLightClassSupport(project, traceHolder.languageVersionSettings)
CliLightClassSupport(project, traceHolder.languageVersionSettings, traceHolder.jvmTarget)
}
override fun getUltraLightClassSupport(element: KtElement): KtUltraLightSupport {
@@ -129,7 +136,9 @@ class CliLightClassGenerationSupport(
}
private fun getContext(): LightClassConstructionContext =
LightClassConstructionContext(traceHolder.bindingContext, traceHolder.module)
LightClassConstructionContext(
traceHolder.bindingContext, traceHolder.module, null /* TODO: traceHolder.languageVersionSettings? */, traceHolder.jvmTarget
)
override fun resolveToDescriptor(declaration: KtDeclaration): DeclarationDescriptor? {
return traceHolder.bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, declaration)
@@ -140,4 +149,4 @@ class CliLightClassGenerationSupport(
override fun analyzeAnnotation(element: KtAnnotationEntry) = traceHolder.bindingContext.get(BindingContext.ANNOTATION, element)
override fun analyzeWithContent(element: KtClassOrObject) = traceHolder.bindingContext
}
}

View File

@@ -6,6 +6,7 @@
package org.jetbrains.kotlin.cli.jvm.compiler
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.config.JvmTarget
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.psi.KtDeclaration
@@ -13,30 +14,32 @@ import org.jetbrains.kotlin.psi.KtPsiUtil
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.BindingTrace
import org.jetbrains.kotlin.resolve.BindingTraceContext
import org.jetbrains.kotlin.resolve.CodeAnalyzerInitializer
import org.jetbrains.kotlin.resolve.jvm.JvmCodeAnalyzerInitializer
import org.jetbrains.kotlin.resolve.lazy.KotlinCodeAnalyzer
import org.jetbrains.kotlin.util.slicedMap.ReadOnlySlice
import org.jetbrains.kotlin.util.slicedMap.WritableSlice
import kotlin.properties.Delegates
class CliTraceHolder : CodeAnalyzerInitializer {
var bindingContext: BindingContext by Delegates.notNull()
class CliTraceHolder : JvmCodeAnalyzerInitializer() {
lateinit var bindingContext: BindingContext
private set
var module: ModuleDescriptor by Delegates.notNull()
lateinit var module: ModuleDescriptor
private set
var languageVersionSettings: LanguageVersionSettings by Delegates.notNull()
lateinit var languageVersionSettings: LanguageVersionSettings
private set
lateinit var jvmTarget: JvmTarget
private set
override fun initialize(
trace: BindingTrace,
module: ModuleDescriptor,
codeAnalyzer: KotlinCodeAnalyzer,
languageVersionSettings: LanguageVersionSettings
languageVersionSettings: LanguageVersionSettings,
jvmTarget: JvmTarget
) {
this.bindingContext = trace.bindingContext
this.module = module
this.languageVersionSettings = languageVersionSettings
this.jvmTarget = jvmTarget
if (trace !is CliBindingTrace) {
throw IllegalArgumentException("Shared trace is expected to be subclass of ${CliBindingTrace::class.java.simpleName} class")

View File

@@ -35,6 +35,10 @@ class CliVirtualFileFinder(
override fun findVirtualFileWithHeader(classId: ClassId): VirtualFile? =
findBinaryClass(classId, classId.relativeClassName.asString().replace('.', '$') + ".class")
override fun findSourceOrBinaryVirtualFile(classId: ClassId) =
findBinaryClass(classId, classId.relativeClassName.asString().replace('.', '$') + ".class")
?: findSourceClass(classId, classId.relativeClassName.asString() + ".java")
override fun findMetadata(classId: ClassId): InputStream? {
assert(!classId.isNestedClass) { "Nested classes are not supported here: $classId" }
@@ -61,8 +65,11 @@ class CliVirtualFileFinder(
return findBinaryClass(classId, BuiltInSerializerProtocol.getBuiltInsFileName(packageFqName))?.inputStream
}
private fun findBinaryClass(classId: ClassId, fileName: String): VirtualFile? =
index.findClass(classId, acceptedRootTypes = JavaRoot.OnlyBinary) { dir, _ ->
private fun findClass(classId: ClassId, fileName: String, rootType: Set<JavaRoot.RootType>) =
index.findClass(classId, acceptedRootTypes = rootType) { dir, _ ->
dir.findChild(fileName)?.takeIf(VirtualFile::isValid)
}?.takeIf { it in scope }
private fun findBinaryClass(classId: ClassId, fileName: String) = findClass(classId, fileName, JavaRoot.OnlyBinary)
private fun findSourceClass(classId: ClassId, fileName: String) = findClass(classId, fileName, JavaRoot.OnlySource)
}

View File

@@ -28,11 +28,13 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector;
import org.jetbrains.kotlin.cli.common.modules.ModuleChunk;
import org.jetbrains.kotlin.cli.common.modules.ModuleXmlParser;
import org.jetbrains.kotlin.name.FqName;
import org.jetbrains.kotlin.serialization.deserialization.builtins.BuiltInSerializerProtocol;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import org.jetbrains.kotlin.utils.PathUtil;
import java.io.*;
import java.util.*;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.jar.*;
import static org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity.ERROR;
@@ -60,6 +62,7 @@ public class CompileEnvironmentUtil {
OutputStream fos,
@Nullable FqName mainClass,
boolean includeRuntime,
boolean noReflect,
boolean resetJarTimestamps
) {
try {
@@ -89,6 +92,9 @@ public class CompileEnvironmentUtil {
}
if (includeRuntime) {
writeRuntimeToJar(stream, resetJarTimestamps);
if (!noReflect) {
writeReflectToJar(stream, resetJarTimestamps);
}
}
stream.finish();
}
@@ -98,12 +104,12 @@ public class CompileEnvironmentUtil {
}
public static void writeToJar(
File jarPath, boolean jarRuntime, boolean resetJarTimestamps, FqName mainClass, OutputFileCollection outputFiles
File jarPath, boolean jarRuntime, boolean noReflect, boolean resetJarTimestamps, FqName mainClass, OutputFileCollection outputFiles
) {
FileOutputStream outputStream = null;
try {
outputStream = new FileOutputStream(jarPath);
doWriteToJar(outputFiles, outputStream, mainClass, jarRuntime, resetJarTimestamps);
doWriteToJar(outputFiles, outputStream, mainClass, jarRuntime, noReflect, resetJarTimestamps);
outputStream.close();
}
catch (FileNotFoundException e) {
@@ -125,16 +131,27 @@ public class CompileEnvironmentUtil {
copyJarImpl(stream, stdlibPath, resetJarTimestamps);
}
private static void writeReflectToJar(JarOutputStream stream, boolean resetJarTimestamps) throws IOException {
File reflectPath = PathUtil.getKotlinPathsForCompiler().getReflectPath();
if (!reflectPath.exists()) {
throw new CompileEnvironmentException("Couldn't find kotlin-reflect at " + reflectPath);
}
copyJarImpl(stream, reflectPath, resetJarTimestamps);
}
private static void copyJarImpl(JarOutputStream stream, File jarPath, boolean resetJarTimestamps) throws IOException {
try (JarInputStream jis = new JarInputStream(new FileInputStream(jarPath))) {
while (true) {
JarEntry e = jis.getNextJarEntry();
if (e == null) break;
if (!FileUtilRt.extensionEquals(e.getName(), "class") ||
StringsKt.substringAfterLast(e.getName(), "/", e.getName()).equals("module-info.class")) {
String name = e.getName();
if (!FileUtilRt.extensionEquals(name, "class") &&
!FileUtilRt.extensionEquals(name, BuiltInSerializerProtocol.BUILTINS_FILE_EXTENSION) &&
!name.startsWith("META-INF/services/")) {
continue;
}
if (StringsKt.substringAfterLast(name, "/", name).equals("module-info.class")) continue;
if (resetJarTimestamps) {
e.setTime(DOS_EPOCH);
}

View File

@@ -82,7 +82,9 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
private val binaryCache: MutableMap<ClassId, JavaClass?> = THashMap()
private val signatureParsingComponent = BinaryClassSignatureParser()
fun findClass(classId: ClassId, searchScope: GlobalSearchScope): JavaClass? = findClass(JavaClassFinder.Request(classId), searchScope)
fun findClass(classId: ClassId, searchScope: GlobalSearchScope) = findClass(JavaClassFinder.Request(classId), searchScope)
override fun findClass(classId: ClassId): JavaClass? = findClass(JavaClassFinder.Request(classId), allScope)
override fun findClass(request: JavaClassFinder.Request, searchScope: GlobalSearchScope): JavaClass? {
val (classId, classFileContentFromRequest, outerClassFromRequest) = request
@@ -110,7 +112,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
val classContent = classFileContentFromRequest ?: virtualFile.contentsToByteArray()
if (virtualFile.nameWithoutExtension.contains("$") && isNotTopLevelClass(classContent)) return@getOrPut null
val resolver = ClassifierResolutionContext { findClass(it, allScope) }
val resolver = ClassifierResolutionContext { findClass(it) }
BinaryJavaClass(
virtualFile, classId.asSingleFqName(), resolver, signatureParsingComponent,

View File

@@ -33,13 +33,11 @@ import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.ExtensionsArea
import com.intellij.openapi.fileTypes.PlainTextFileType
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.LanguageLevelProjectExtension
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.io.FileUtilRt
import com.intellij.openapi.util.text.StringUtil
import com.intellij.openapi.vfs.*
import com.intellij.openapi.vfs.impl.ZipHandler
import com.intellij.pom.java.LanguageLevel
import com.intellij.psi.PsiElementFinder
import com.intellij.psi.PsiManager
import com.intellij.psi.impl.JavaClassSupersImpl
@@ -58,7 +56,7 @@ import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.common.CliModuleVisibilityManagerImpl
import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
import org.jetbrains.kotlin.cli.common.CompilerSystemProperties
import org.jetbrains.kotlin.cli.common.config.ContentRoot
import org.jetbrains.kotlin.cli.common.config.KotlinSourceRoot
import org.jetbrains.kotlin.cli.common.config.kotlinSourceRoots
@@ -191,11 +189,16 @@ class KotlinCoreEnvironment private constructor(
sourceFiles.sortBy { it.virtualFile.path }
val javaFileManager = ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl
val jdkHome = configuration.get(JVMConfigurationKeys.JDK_HOME)
val jrtFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JRT_PROTOCOL)
val javaModuleFinder = CliJavaModuleFinder(jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
})
val javaModuleFinder = CliJavaModuleFinder(
jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
},
javaFileManager
)
val outputDirectory =
configuration.get(JVMConfigurationKeys.MODULES)?.singleOrNull()?.getOutputDirectory()
@@ -208,7 +211,8 @@ class KotlinCoreEnvironment private constructor(
this::contentRootToVirtualFile,
javaModuleFinder,
!configuration.getBoolean(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE),
outputDirectory?.let(this::findLocalFile)
outputDirectory?.let(this::findLocalFile),
javaFileManager
)
val (initialRoots, javaModules) =
@@ -232,7 +236,7 @@ class KotlinCoreEnvironment private constructor(
updateClasspathFromRootsIndex(this)
}
(ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl).initialize(
javaFileManager.initialize(
rootsIndex,
packagePartProviders,
SingleJavaFileRootsIndex(singleJavaFileRoots),
@@ -241,7 +245,7 @@ class KotlinCoreEnvironment private constructor(
project.registerService(
JavaModuleResolver::class.java,
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList())
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList(), project)
)
val finderFactory = CliVirtualFileFinderFactory(rootsIndex)
@@ -283,7 +287,7 @@ class KotlinCoreEnvironment private constructor(
fun addKotlinSourceRoots(rootDirs: List<File>) {
val roots = rootDirs.map { KotlinSourceRoot(it.absolutePath, isCommon = false) }
sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots)
sourceFiles += createSourceFilesFromSourceRoots(configuration, project, roots).toSet() - sourceFiles
}
fun createPackagePartProvider(scope: GlobalSearchScope): JvmPackagePartProvider {
@@ -498,16 +502,13 @@ class KotlinCoreEnvironment private constructor(
}
// Disposing of the environment is unsafe in production then parallel builds are enabled, but turning it off universally
// breaks a lot of tests, therefore it is disabled for production and enabled for tests
if (System.getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY).toBooleanLenient() != true) {
if (CompilerSystemProperties.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY.value.toBooleanLenient() != true) {
// JPS may run many instances of the compiler in parallel (there's an option for compiling independent modules in parallel in IntelliJ)
// All projects share the same ApplicationEnvironment, and when the last project is disposed, the ApplicationEnvironment is disposed as well
@Suppress("ObjectLiteralToLambda") // Disposer tree depends on identity of disposables.
Disposer.register(parentDisposable, object : Disposable {
override fun dispose() {
synchronized(APPLICATION_LOCK) {
if (--ourProjectCount <= 0) {
disposeApplicationEnvironment()
}
Disposer.register(parentDisposable, Disposable {
synchronized(APPLICATION_LOCK) {
if (--ourProjectCount <= 0) {
disposeApplicationEnvironment()
}
}
})

View File

@@ -78,10 +78,7 @@ import org.jetbrains.kotlin.cli.jvm.modules.CoreJrtFileSystem
import org.jetbrains.kotlin.codegen.extensions.ClassBuilderInterceptorExtension
import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
import org.jetbrains.kotlin.config.APPEND_JAVA_SOURCE_ROOTS_HANDLER_KEY
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.config.languageVersionSettings
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.extensions.*
import org.jetbrains.kotlin.extensions.internal.CandidateInterceptor
import org.jetbrains.kotlin.extensions.internal.TypeResolutionInterceptor
@@ -192,11 +189,16 @@ class KotlinCoreEnvironment private constructor(
sourceFiles.sortBy { it.virtualFile.path }
val javaFileManager = ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl
val jdkHome = configuration.get(JVMConfigurationKeys.JDK_HOME)
val jrtFileSystem = VirtualFileManager.getInstance().getFileSystem(StandardFileSystems.JRT_PROTOCOL)
val javaModuleFinder = CliJavaModuleFinder(jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
})
val javaModuleFinder = CliJavaModuleFinder(
jdkHome?.path?.let { path ->
jrtFileSystem?.findFileByPath(path + URLUtil.JAR_SEPARATOR)
},
javaFileManager
)
val outputDirectory =
configuration.get(JVMConfigurationKeys.MODULES)?.singleOrNull()?.getOutputDirectory()
@@ -209,7 +211,8 @@ class KotlinCoreEnvironment private constructor(
this::contentRootToVirtualFile,
javaModuleFinder,
!configuration.getBoolean(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE),
outputDirectory?.let(this::findLocalFile)
outputDirectory?.let(this::findLocalFile),
javaFileManager
)
val (initialRoots, javaModules) =
@@ -233,7 +236,7 @@ class KotlinCoreEnvironment private constructor(
updateClasspathFromRootsIndex(this)
}
(ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl).initialize(
javaFileManager.initialize(
rootsIndex,
packagePartProviders,
SingleJavaFileRootsIndex(singleJavaFileRoots),
@@ -242,7 +245,7 @@ class KotlinCoreEnvironment private constructor(
project.registerService(
JavaModuleResolver::class.java,
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList())
CliJavaModuleResolver(classpathRootsResolver.javaModuleGraph, javaModules, javaModuleFinder.systemModules.toList(), project)
)
val finderFactory = CliVirtualFileFinderFactory(rootsIndex)

View File

@@ -86,8 +86,9 @@ object KotlinToJVMBytecodeCompiler {
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
if (jarPath != null) {
val includeRuntime = configuration.get(JVMConfigurationKeys.INCLUDE_RUNTIME, false)
val noReflect = configuration.get(JVMConfigurationKeys.NO_REFLECT, false)
val resetJarTimestamps = !configuration.get(JVMConfigurationKeys.NO_RESET_JAR_TIMESTAMPS, false)
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, resetJarTimestamps, mainClassFqName, outputFiles)
CompileEnvironmentUtil.writeToJar(jarPath, includeRuntime, noReflect, resetJarTimestamps, mainClassFqName, outputFiles)
if (reportOutputFiles) {
val message = OutputMessageUtil.formatOutputMessage(outputFiles.asList().flatMap { it.sourceFiles }.distinct(), jarPath)
messageCollector.report(OUTPUT, message)
@@ -404,10 +405,6 @@ object KotlinToJVMBytecodeCompiler {
environment.messageCollector
)
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector
)
performanceManager?.notifyIRGenerationFinished()
performanceManager?.notifyGenerationFinished()
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
@@ -606,10 +603,6 @@ object KotlinToJVMBytecodeCompiler {
environment.messageCollector
)
AnalyzerWithCompilerReport.reportBytecodeVersionErrors(
generationState.extraJvmDiagnosticsTrace.bindingContext, environment.messageCollector
)
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
return generationState
}

View File

@@ -49,6 +49,9 @@ fun CompilerConfiguration.addJvmSdkRoots(files: List<File>) {
val CompilerConfiguration.jvmClasspathRoots: List<File>
get() = getList(CLIConfigurationKeys.CONTENT_ROOTS).filterIsInstance<JvmClasspathRoot>().map(JvmContentRoot::file)
val CompilerConfiguration.jvmModularRoots: List<File>
get() = getList(CLIConfigurationKeys.CONTENT_ROOTS).filterIsInstance<JvmModulePathRoot>().map(JvmContentRoot::file)
@JvmOverloads
fun CompilerConfiguration.addJavaSourceRoot(file: File, packagePrefix: String? = null) {
add(CLIConfigurationKeys.CONTENT_ROOTS, JavaSourceRoot(file, packagePrefix))

View File

@@ -45,6 +45,7 @@ data class JavaRoot(val file: VirtualFile, val type: RootType, val prefixFqName:
companion object RootTypes {
val OnlyBinary: Set<RootType> = EnumSet.of(RootType.BINARY)
val OnlySource: Set<RootType> = EnumSet.of(RootType.SOURCE)
val SourceAndBinary: Set<RootType> = EnumSet.of(RootType.BINARY, RootType.SOURCE)
}
}

View File

@@ -21,6 +21,7 @@ import java.io.File
fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArguments) {
put(JVMConfigurationKeys.INCLUDE_RUNTIME, arguments.includeRuntime)
put(JVMConfigurationKeys.NO_REFLECT, arguments.noReflect)
putIfNotNull(JVMConfigurationKeys.FRIEND_PATHS, arguments.friendPaths?.asList())
@@ -28,6 +29,12 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
val jvmTarget = JvmTarget.fromString(arguments.jvmTarget!!)
if (jvmTarget != null) {
put(JVMConfigurationKeys.JVM_TARGET, jvmTarget)
if (jvmTarget == JvmTarget.JVM_1_6 && !arguments.suppressDeprecatedJvmTargetWarning) {
messageCollector.report(
STRONG_WARNING,
"JVM target 1.6 is deprecated and will be removed in a future release. Please migrate to JVM target 1.8 or above"
)
}
} else {
messageCollector.report(
ERROR, "Unknown JVM target version: ${arguments.jvmTarget}\n" +
@@ -65,27 +72,37 @@ fun CompilerConfiguration.setupJvmSpecificArguments(arguments: K2JVMCompilerArgu
}
}
if (arguments.samConversions != null) {
val samConversions = JvmSamConversions.fromString(arguments.samConversions)
if (samConversions != null) {
put(JVMConfigurationKeys.SAM_CONVERSIONS, samConversions)
if (jvmTarget < samConversions.minJvmTarget) {
handleClosureGenerationSchemeArgument("-Xsam-conversions", arguments.samConversions, JVMConfigurationKeys.SAM_CONVERSIONS, jvmTarget)
handleClosureGenerationSchemeArgument("-Xlambdas", arguments.lambdas, JVMConfigurationKeys.LAMBDAS, jvmTarget)
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
}
private fun CompilerConfiguration.handleClosureGenerationSchemeArgument(
flag: String,
value: String?,
key: CompilerConfigurationKey<JvmClosureGenerationScheme>,
jvmTarget: JvmTarget
) {
if (value != null) {
val parsedValue = JvmClosureGenerationScheme.fromString(value)
if (parsedValue != null) {
put(key, parsedValue)
if (jvmTarget < parsedValue.minJvmTarget) {
messageCollector.report(
WARNING,
"`-Xsam-conversions=${arguments.samConversions}` requires JVM target at least " +
"${samConversions.minJvmTarget.description} and is ignored."
"`$flag=$value` requires JVM target at least " +
"${parsedValue.minJvmTarget.description} and is ignored."
)
}
} else {
messageCollector.report(
ERROR,
"Unknown `-Xsam-conversions` argument: ${arguments.samConversions}\n" +
"Supported arguments: ${JvmSamConversions.values().joinToString { it.description }}"
"Unknown `$flag` argument: ${value}\n." +
"Supported arguments: ${JvmClosureGenerationScheme.values().joinToString { it.description }}"
)
}
}
addAll(JVMConfigurationKeys.ADDITIONAL_JAVA_MODULES, arguments.additionalJavaModules?.asList())
}
fun CompilerConfiguration.configureJdkHome(arguments: K2JVMCompilerArguments): Boolean {
@@ -185,11 +202,13 @@ fun CompilerConfiguration.configureAdvancedJvmOptions(arguments: K2JVMCompilerAr
put(JVMConfigurationKeys.PARAMETERS_METADATA, arguments.javaParameters)
// TODO: ignore previous configuration value when we do not need old backend in scripting by default
val useOldBackend = arguments.useOldBackend || (!arguments.useIR && get(JVMConfigurationKeys.IR) == false)
val useIR = arguments.useFir ||
if (languageVersionSettings.supportsFeature(LanguageFeature.JvmIrEnabledByDefault)) {
!arguments.useOldBackend
!useOldBackend
} else {
arguments.useIR && !arguments.useOldBackend
arguments.useIR && !useOldBackend
}
if (arguments.useIR && arguments.useOldBackend) {

View File

@@ -18,11 +18,12 @@ package org.jetbrains.kotlin.cli.jvm.modules
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiJavaModule
import org.jetbrains.kotlin.resolve.jvm.KotlinCliJavaFileManager
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleFinder
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo
class CliJavaModuleFinder(jrtFileSystemRoot: VirtualFile?) : JavaModuleFinder {
class CliJavaModuleFinder(jrtFileSystemRoot: VirtualFile?, val javaFileManager: KotlinCliJavaFileManager) : JavaModuleFinder {
private val modulesRoot = jrtFileSystemRoot?.findChild("modules")
private val userModules = linkedMapOf<String, JavaModule>()
@@ -41,7 +42,7 @@ class CliJavaModuleFinder(jrtFileSystemRoot: VirtualFile?) : JavaModuleFinder {
private fun findSystemModule(moduleRoot: VirtualFile): JavaModule.Explicit? {
val file = moduleRoot.findChild(PsiJavaModule.MODULE_INFO_CLS_FILE) ?: return null
val moduleInfo = JavaModuleInfo.read(file) ?: return null
val moduleInfo = JavaModuleInfo.read(file, javaFileManager) ?: return null
return JavaModule.Explicit(moduleInfo, listOf(JavaModule.Root(moduleRoot, isBinary = true)), file)
}
}

View File

@@ -18,10 +18,14 @@ package org.jetbrains.kotlin.cli.jvm.modules
import com.intellij.ide.highlighter.JavaClassFileType
import com.intellij.ide.highlighter.JavaFileType
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.StandardFileSystems
import com.intellij.openapi.vfs.VfsUtilCore
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.load.java.structure.JavaAnnotation
import org.jetbrains.kotlin.load.kotlin.VirtualFileFinder
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModule
import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleResolver
@@ -29,7 +33,8 @@ import org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleResolver
class CliJavaModuleResolver(
private val moduleGraph: JavaModuleGraph,
private val userModules: List<JavaModule>,
private val systemModules: List<JavaModule.Explicit>
private val systemModules: List<JavaModule.Explicit>,
private val project: Project
) : JavaModuleResolver {
init {
assert(userModules.count(JavaModule::isSourceModule) <= 1) {
@@ -37,6 +42,13 @@ class CliJavaModuleResolver(
}
}
private val virtualFileFinder by lazy { VirtualFileFinder.getInstance(project) }
override fun getModuleAnnotations(classId: ClassId): List<JavaAnnotation>? {
val virtualFile = virtualFileFinder.findSourceOrBinaryVirtualFile(classId) ?: return null
return (findJavaModule(virtualFile) as? JavaModule.Explicit)?.moduleInfo?.annotations
}
private val sourceModule: JavaModule? = userModules.firstOrNull(JavaModule::isSourceModule)
private fun findJavaModule(file: VirtualFile): JavaModule? {

View File

@@ -19,7 +19,7 @@ public class KotlinCompilerVersion {
// Binaries produced by this compiler with that language version (or any future language version) are going to be marked
// as "pre-release" and will not be loaded by release versions of the compiler.
// Change this value before and after every major release
private static final boolean IS_PRE_RELEASE = true;
private static final boolean IS_PRE_RELEASE = false;
public static final String TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY = "kotlin.test.is.pre.release";

View File

@@ -114,9 +114,12 @@ public class JVMConfigurationKeys {
public static final CompilerConfigurationKey<JvmStringConcat> STRING_CONCAT =
CompilerConfigurationKey.create("Specifies string concatenation scheme");
public static final CompilerConfigurationKey<JvmSamConversions> SAM_CONVERSIONS =
public static final CompilerConfigurationKey<JvmClosureGenerationScheme> SAM_CONVERSIONS =
CompilerConfigurationKey.create("SAM conversions code generation scheme");
public static final CompilerConfigurationKey<JvmClosureGenerationScheme> LAMBDAS =
CompilerConfigurationKey.create("Lambdas code generation scheme");
public static final CompilerConfigurationKey<List<String>> KLIB_PATHS =
CompilerConfigurationKey.create("Paths to .klib libraries");
@@ -146,4 +149,7 @@ public class JVMConfigurationKeys {
public static final CompilerConfigurationKey<Boolean> ENABLE_JVM_PREVIEW =
CompilerConfigurationKey.create("Enable Java language preview features");
public static final CompilerConfigurationKey<Boolean> NO_REFLECT =
CompilerConfigurationKey.create("Don't automatically include kotlin-reflect.jar into the output if the output is a jar");
}

View File

@@ -33,6 +33,9 @@ object JvmAnalysisFlags {
@JvmStatic
val enableJvmPreview by AnalysisFlag.Delegates.Boolean
@JvmStatic
val useIR by AnalysisFlag.Delegates.Boolean
private object Delegates {
object JavaTypeEnhancementStateWarnByDefault {
operator fun provideDelegate(instance: Any?, property: KProperty<*>): AnalysisFlag.Delegate<JavaTypeEnhancementState> =

View File

@@ -5,7 +5,9 @@
package org.jetbrains.kotlin.config
enum class JvmSamConversions(
import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
enum class JvmClosureGenerationScheme(
val description: String,
val minJvmTarget: JvmTarget
) {
@@ -17,7 +19,9 @@ enum class JvmSamConversions(
val DEFAULT = CLASS
@JvmStatic
fun fromString(string: String?) =
values().find { it.description == string }
fun fromString(string: String?): JvmClosureGenerationScheme? {
val lowerStr = string?.toLowerCaseAsciiOnly() ?: return null
return values().find { it.description == lowerStr }
}
}
}

View File

@@ -32,11 +32,12 @@ enum class JvmTarget(
JVM_13("13", Opcodes.V12 + 1),
JVM_14("14", Opcodes.V12 + 2),
JVM_15("15", Opcodes.V12 + 3),
JVM_16("16", Opcodes.V12 + 4),
;
companion object {
@JvmField
val DEFAULT = JVM_1_6
val DEFAULT = JVM_1_8
@JvmStatic
fun fromString(string: String) = values().find { it.description == string }

View File

@@ -50,4 +50,7 @@ object AnalysisFlags {
@JvmStatic
val libraryToSourceAnalysis by AnalysisFlag.Delegates.Boolean
@JvmStatic
val extendedCompilerChecks by AnalysisFlag.Delegates.Boolean
}

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