Commit Graph

103407 Commits

Author SHA1 Message Date
Alexander Udalov 7fc3e60854 K2: add JVM checker for NO_REFLECTION_IN_CLASS_PATH warning
It's based on the existing K1 checker `JvmReflectionAPICallChecker`.

 #KT-60587 Fixed
2023-08-03 13:42:03 +00:00
Denis.Zharkov bd46bb02c1 K1: Enhance deprecation messages for getFirst/getLast JDK 21 members
^KT-60659 Fixed
^KT-60769 Fixed
2023-08-03 13:31:07 +00:00
Denis.Zharkov 0694ee50a3 K1: Report deprecation on synthetic properties for NOT_CONSIDERED JDK members
Currently, for other synthetic properties, deprecation from the original
method is already being propagated to the relevant new synthetic
property accessor.

But what we need is also reporting warnings on synthetic properties
accessors call-sites if original methods are considered deprecated
as a result of deprecation propagation.

KT-60659 Fixed
^KT-60769 Fixed
2023-08-03 13:31:07 +00:00
Denis.Zharkov eae97e4f76 K1: Force propagating deprecation on NOT_CONSIDERED JDK members to overrides
^KT-60858 Related
KT-60659 In Progress
^KT-60769 In Progress
2023-08-03 13:31:07 +00:00
Denis.Zharkov 1e86a82ee1 K1: Change how Kotlin sees some of the new JDK 21 collections members
- Make addFirst/Last and removeFirst/removeLast as members
- Leave getFirst/getLast unprocessed, thus visible for K1, but marked
as deprecated

Though the implementations of getFirst/getLast and synthetic property
access to them are expected to be deprecated as well, it's expected
to be fixed in later commits.

^KT-60659 In Progress
^KT-60769 In Progress
2023-08-03 13:31:07 +00:00
Stanislav Erokhin d99f8ac9b4 [mpp] Test that every deprecated pre-HMPP property triggers an Error
Previously all these properties were put together, so only one
of them could have triggered the Error

#KT-59304 Verification Pending
2023-08-03 13:27:37 +00:00
Stanislav Erokhin fcd440fd9e KT-59304 Elevate warning to Error for pre-HMPP flags
Flag `kotlin.mpp.deprecatedProperties.nowarn` was removed.
Diagnostic could be temporarily suppressed by the:
kotlin.internal.suppressGradlePluginErrors=PreHMPPFlagsError
2023-08-03 13:27:37 +00:00
Stanislav Erokhin cfcb0690d7 [mpp] Remove usage of deprecated pre-HMPP properties from tests
#KT-59304 In Progress
2023-08-03 13:27:36 +00:00
Stanislav Erokhin a3eb472e5f [mpp] Update the IdeImportPropertiesConsistencyTest
#KT-48554 Fixed
2023-08-03 13:27:36 +00:00
Stanislav Erokhin a58dd84cdc [mpp] Remove the kotlin.native.enableDependencyPropagation property
This property isn't used in IDE import since 222 (KTIJ-21525)
De-facto it was set to false by the code in
hierarchicalStructureMigrationHandling.kt if HMPP is enabled.
And in the future commit we will forbid to disable the HMPP

#KT-48554 In progress
2023-08-03 13:27:36 +00:00
Artem Kobzar 2c4569568b [K/JS] Fix importing behavior for external interfaces in case of implementing them 2023-08-03 13:10:03 +00:00
Yahor Berdnikau 020ad64b3c [Gradle] Update documentation for Kotlin tasks
^KT-58858 In Progress
2023-08-03 12:39:51 +00:00
Yahor Berdnikau 365c04a7f7 [Gradle] Update documentation for CompileUsingKotlinDaemon
^KT-58858 In Progress
2023-08-03 12:39:51 +00:00
Yahor Berdnikau 6d36ba04f8 [Gradle] Document IncrementalSyncTask
^KT-58858 In Progress
2023-08-03 12:39:51 +00:00
Yahor Berdnikau f988de60c3 [Gradle] Document KotlinToolTask
^KT-58858 In Progress
2023-08-03 12:39:51 +00:00
Yahor Berdnikau 2e8d2800f5 [Gradle] Document KotlinCompilationTask
Remove KotlinCompilationTask from KotlinCompile class as it anyway comes
via KotlinJvmCompile interface.

^KT-58858 In Progress
2023-08-03 12:39:51 +00:00
Roman Golyshev 73bfc88613 KTIJ-26501 [Analysis API] Do not ignore vararg type references in KtFirImportOptimizer
Turns out they have fake sources, so ignoring all
type qualifiers with fake sources in e1ebbc10d9
was incorrect.

^KTIJ-26501 Fixed
2023-08-03 11:55:57 +00:00
Leonid Startsev 7f795f212f Support instantiation of Java annotations with defaults
For annotations defined in Java, IrProperties do not contain initializers in backing fields,
as annotation properties are represented as Java methods.
Therefore, it is not possible to use initializer values as default values for constructor parameters.

However, K2 stores default values in annotation's constructor parameters,
so it is possible to fix this issue if they're properly transfered to the IR
and inspected in JvmAnnotationImplementationTransformer

#KT-47702 Fixed
#KT-47702 tag fixed-in-k2
2023-08-03 10:25:13 +00:00
Dmitriy Novozhilov cc2bc5e8b1 [FIR2IR] Reuse IR fake overrides for FIR fake overrides for all MPP modules
^KT-58229 Fixed
2023-08-03 10:02:57 +00:00
Dmitry Savvinov 027fdb86a5 [Gradle] Print diagnostics stacktrace only under --stacktrace or higher
Most of the changes in commit are test-related, as our tests launched
with '-full-stacktrace' by defayult + asserting full stacktrace is
flaky and unreliable

^KT-59774 Fixed
2023-08-03 10:02:25 +00:00
Dmitry Savvinov e334523fd8 [Gradle] Minor: rename verboseDiagnostics -> useParsableDiagnosticsFormat
^KT-59615 Fixed
2023-08-03 10:02:25 +00:00
Alexander.Likhachev 83c53b7ce3 [BT] Implement classpath snapshotting in the Build Tools API
#KT-57565 In Progress
2023-08-03 08:55:32 +00:00
Alexander.Likhachev 329fd6be45 [BT] Move ClassSnapshotGranularity to the Build Tools API module
#KT-57565 In Progress
2023-08-03 08:55:32 +00:00
Alexander.Likhachev 442d1cf711 [BT] Move ClassSnapshotGranularity to the Build Tools API package 2023-08-03 08:55:32 +00:00
Alexander Udalov d4b5599373 Add JVM target bytecode version 21
Unfortunately, there are still problems with running JVM backend tests
with JVM target 21 because:

1) The D8 version that we use does not support bytecode version 21, and
   updating to a newer version requires to change JVM target of compiler
   tests to 11. This will be addressed separately when we enable JVM 21
   in tests-different-jdk.
2) Some tests are failing because of KT-60659 and KT-60770:
   - builtinStubMethods/bridgesForStubs/emptyStringListAdd.kt
   - jdk/stream.kt
   - regressions/kt528.kt

 #KT-60662 Fixed
2023-08-03 08:43:22 +00:00
Alexander Shabalin 5cbf5ad529 [K/N] Fix SP synchronization 2023-08-03 08:13:07 +00:00
Alexander Shabalin d70f891a82 [K/N] Address AtomicStack tsan reports. 2023-08-03 08:09:02 +00:00
aleksandrina-streltsova 9548486b55 [FIR] don't transform analyzed lambda
Inside `transformDeclarationContent` current tower data context is saved. Previously, stored context could be incomplete, because `dataFlowAnalyzer.enterFunction(function)` wasn't called in all cases.
^KTIJ-26419 Fixed
2023-08-03 07:54:24 +00:00
Egor Kulikov 673ac2227a [FIR] Refactor getFir to return only sane option or null
Merge-request: KT-MR-11138
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-08-02 18:24:57 +00:00
Vsevolod Tolstopyatov 64c8ce18a0 Make enumEntries intrinsic public
It is implemented in JVM, JS and Native backends already

^KT-53154 fixed


Merge-request: KT-MR-11355
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-08-02 18:07:51 +00:00
Dmitrii Gridin 77344c0845 [LL FIR] add checks about resolved context receivers
^KT-60728
^KT-60519
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 0e0847bc9d [LL FIR] support lazy bodies in scripts
Also, it adds guards to avoid problems with PCE

^KT-60728 Fixed
^KT-60519 Fixed
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 2f57916869 [FIR] add replaceStatements to FirScript
It is required to implement StateKeeper for scripts
statements should be MutableOrEmptyList to avoid CME

^KT-60728
^KT-60519
2023-08-02 16:50:45 +00:00
Dmitrii Gridin a2dc6ca8f2 [FIR] add RawFirBuilder test for script
^KT-60728
^KT-60519
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 2c932c9e1d [LL FIR] add proper lazy resolve support for script dependent declarations
Such declarations (only `ResultProperty` for now) should delegate
resolution to the script, because they depend on its content

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin f549712912 [FIR] FirCallableSymbol: introduce calculateReturnType
It will help to avoid copy-pasted logic there it is needed

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 35b0cd65e9 [FIR] PsiRawFirBuilder: add missing script configurator
PsiRawFirBuilder#visitScript didn't work because it didn't
have a configurator
Now FirScriptConfiguratorExtension split into two parts:
* File
* Script

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 32e3b67416 [LL FIR] LLFirTargetResolver: add default implementation to withFile and withRegularClassImpl
To drop redundant implementations in resolvers

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin de48a51711 [LL FIR] avoid redundant context collection
We assume that declaration context will be collected
during `LLFirAnnotationArgumentsTargetResolver`, so other
`LLFirAbstractBodyTargetResolver` shouldn't repeat this process

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 1a3b0fa9d5 [LL FIR] provide script scopes to declarations
All transformations inside a script should be
under the script context for proper resolution

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 544341412a [LL FIR] extract LLFirResolveTargetWithDedicatedElement
It is required to simplify the logic in the next commit.
Also, it drops redundant inheritance from [firFile] and [path] properties

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin dc347e2aa6 [LL FIR] add tests on specific cases in scripts resolve
* args
* $$result

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 63c6c38952 [LL FIR] LLFirPhaseUpdater: update phases inside delegate expression
^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 7a2dad5ca5 [LL FIR] create separate FileStructureElement for script
It is required to avoid duplication visiting on declarations

^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 97e330997b [LL FIR] support scripts in BODY_RESOLVE transformer
^KT-60728
2023-08-02 16:50:45 +00:00
Dmitrii Gridin 6cb1142210 [LL FIR] support scripts in annotation transformers
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin efc6ca27b2 [LL FIR] support scripts in TYPES transformer
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin 64bdcc1131 [LL FIR] support scripts in COMPILER_REQUIRED_ANNOTATIONS transformer
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin 95e04c97cc [LL FIR] LLFirWholeFileResolveTarget should process script declarations
^KT-60728
2023-08-02 16:50:44 +00:00
Dmitrii Gridin 3686bf7ff9 [LL FIR] allow independent resolve for declarations in scripts
^KT-60728
2023-08-02 16:50:44 +00:00