Commit Graph

51 Commits

Author SHA1 Message Date
Pavel Mikhailovskii 12552e4e04 [KAPT] KT-44706 Support @JvmRecord-annotated classes
Don't parse Java stubs in tests if no validation is needed

Merge-request: KT-MR-14308
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-02-29 12:44:56 +00:00
Marco Pennekamp 708ed81eb2 [Test] Avoid importing unused @Nested annotations in generated tests
- Unused `Nested` imports frequently cause unused import warnings in the
  IDE, which are especially annoying in after-commit warning/error
  analysis.
2024-02-27 20:30:06 +00:00
Yahor Berdnikau 6b19b8b9d0 [Repo] Don't use kotlinOptions in repo build scripts
^KT-63419 In Progress
2024-02-22 14:48:10 +00:00
Dmitriy Novozhilov acf2296590 [Test] Regenerate tests after two previous commits 2024-02-16 12:48:24 +00:00
Leonid Startsev 09e89db82f Change kotlinx- to kotlin- in kotlin-metadata-jvm and related projects
Change package, artifact group, artifact name, and Gradle module name to
kotlin-metadata and kotlin-metadata-jvm, respectively.

In Kotlin 2.0, kotlin-metadata-jvm library is promoted to stable, and is
a part of Kotlin distribution now.

Note that kotlinx-metadata-klib is left with org.jetbrains.kotlinx group, artifact name and package
because -klib part is considered not stable and for internal use. Since it is still published via Sonatype,
it should have kotlinx group. Therefore, it will have both classes from kotlin.metadata and kotlinx.metadata packages. This is not a problem, because we already had kotlinx.metadata split package between -jvm and -klib before.

#KT-63219 Fixed
2024-02-15 15:32:33 +00:00
Alexander Udalov 88fbaed22e Tests: minor, do not use target backend in kapt tests
These tests now only make sense for JVM_IR. Incidentally this fixes the
JVM illegal access warnings from generateTests, because the test
framework no longer tries to instantiate these tests (which leads to
`doOpenInternalPackagesIfRequired`) to determine the target backend.

The change in JvmEnvironmentConfigurator is needed so that JVM tests
without target backend would default to JVM IR instead of the old
backend.

Also rename files to match the class names.
2024-02-15 10:13:24 +00:00
Dmitriy Dolovov 03418c11c3 [kotlinp] Change the package name in :tools:kotlinp-jvm subproject
Change the package name for all *.kt files inside
the :tools:kotlinp-jvm subproject from "org.jetbrains.kotlin.kotlinp"
to "org.jetbrains.kotlin.kotlinp.jvm"

^KT-62340
2024-02-13 21:01:08 +00:00
Dmitriy Dolovov eec76865a7 [kotlinp] Refactor to separate common part from JVM-specific part
This refactoring includes the following:
1. Separate backend-neutral part of the metadata printer `Kotlinp`
   from the part that accesses JVM-specifics: `JvmKotlinp`.
2. Introduce `org.jetbrains.kotlin.kotlinp.Printer`: The component
   that renders both individual `Km*` nodes and the whole metadata
   tree, and does so with the proper indentation.

^KT-62340
2024-02-13 21:01:08 +00:00
strangepleasures e363a1228d KT-65404 KAPT should print a warning if stub generation is triggered for an interface with method bodies but without -Xjvm-default=all or -Xjvm-default=all-compatibility
Merge-request: KT-MR-14139
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-02-12 11:17:32 +00:00
Pavel Mikhailovskii d75463a7d5 [KAPT] KT-65399 Fix rendering of types with names starting with $.
Solves a specific issue with Kotlin serialization, and most likely,
similar issues with synthetic classes.

Types with `$` in other positions will be still rendered incorrectly
due to imprecise conversion of such types from Kotlin to Java
in the analysis API.


Merge-request: KT-MR-14235
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-02-12 11:15:36 +00:00
strangepleasures 9688c3e761 [KAPT] Improve stub formatting; check raw stubs in tests
Merge-request: KT-MR-14244
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-02-09 15:41:37 +00:00
Pavel Mikhailovskii f81b1150b2 [KAPT] KT-65453 Disable generation of type annotations in Java stubs
A workaround for KT-65608


Merge-request: KT-MR-14236
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-02-08 18:05:49 +00:00
Alexander Udalov 28797a31b4 JVM: refactor JvmDefaultMode, remove/rename some entries
- remove ENABLE/COMPATIBILITY because they can no longer be used
- remove forAllMethodsWithBody because its behavior is now equivalent to
  isEnabled
- inline isCompatibility
- inline DEFAULT
- rename ALL_INCOMPATIBLE -> ALL
2024-02-06 17:18:44 +00:00
strangepleasures 85c9c57da4 [KAPT] KT-65006 fix issues when using Kapt+Serialization
This MR fixes two independent issues causing build failures when using Kapt in combination with the Kotlin serialization plugin (and, very likely, with other plugins as well):
Kapt applied compiler plugins twice, causing errors similar to the one described in KT-65006
Kapt failed to generate @Metadata annotations for plugin-generated companion objects because the corresponding SLC missed containingFile needed for generation of method and class signatures

Merge-request: KT-MR-13970
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-01-23 20:35:32 +00:00
Kirill Rakhman d74b5c59fb [kapt] Fix new compilation warnings after #KT-63208
(cherry picked from commit 9b4ebc31c1)
2024-01-18 08:27:10 +00:00
Kirill Rakhman 77f83ce816 Revert "[kapt] Fix new compilation warnings after #KT-63208"
This reverts commit 9b4ebc31c1.
2024-01-16 09:14:18 +01:00
Kirill Rakhman 9b4ebc31c1 [kapt] Fix new compilation warnings after #KT-63208 2024-01-15 12:23:27 +00:00
strangepleasures 0dd3abba2a [KAPT] Support type annotations in K2 KAPT. Fixes KT-64479 2024-01-15 10:24:38 +00:00
strangepleasures 7e9d6e601d KT-64385 Enable K2 KAPT by default
Also adds support for front-end compiler plugins in Kapt
2024-01-15 10:22:32 +00:00
strangepleasures 894df8f641 KT-64719 K2 KAPT stub generation should fail on syntax errors 2024-01-05 15:58:41 +00:00
Dmitrii Gridin b6d373d8e5 Update copyright to 2024 2024-01-05 13:43:17 +00:00
Alexander Udalov a9f85d75f4 Kapt: remove support for old JVM backend
#KT-64680 Fixed
2024-01-03 19:37:40 +00:00
strangepleasures b32f408767 [KAPT] KT-64389 Fix stub generation with generic type constraints 2023-12-19 13:33:38 +00:00
Marco Pennekamp bba5447b12 [Test/AA] Pass project disposable to getOrCreateApplicationEnvironment instead of application disposable
- The disposable passed to `getOrCreateApplicationEnvironment` should
  not actually be the application environment's disposable, which is
  created inside the function. Instead, it should be the project's
  disposable, which is used to track how many projects still rely on the
  shared application environment.
- This issue wasn't apparent before because there is no visible
  consequence when an application isn't disposed after all projects have
  been disposed (during tests). However, the solution for KT-63650
  relies on application environments being disposed after all projects
  are disposed, so that a new application environment with a different
  configuration can be created. (Only one shared application environment
  may be active at the same time.)

^KT-63650
2023-12-19 11:12:23 +00:00
strangepleasures 7b841d90e6 [KAPT] KT-64303 Dispose resources allocated by Standalone Analysis API; re-enable Kapt4IT
Merge-request: KT-MR-13510
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-12-14 14:10:14 +00:00
strangepleasures 1015ae858e [KAPT] KT-64301 Report invalid enum value names
Merge-request: KT-MR-13520
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-12-13 17:53:52 +00:00
strangepleasures b84aa190d7 [KAPT] KT-64297 Mark deprecated members with @java.lang.Deprecated
Merge-request: KT-MR-13521
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-12-13 17:18:54 +00:00
Leonid Startsev 36703ff9ae Implement strict and lenient modes for Kotlin metadata reading
In strict mode, an exception will be thrown when inconsistent metadata is encountered. In lenient mode, the reader will attempt to handle the inconsistent metadata by ignoring certain inconsistencies. This is a solution to a problem of reading metadata 'from the future' that is not allowed by default, but desired in certain cases. See updated ReadMe for details.

Also fix problem with Strict Semantics flag.

#KT-57922 Fixed
#KT-59441 Fixed
2023-12-01 17:43:11 +00:00
Ilmir Usmanov 87aed4bf47 KAPT: Run tests on JDK 21
Previously, some tests have also been disabled on JDK 11+, since
we did not filter out empty filesets, which led to failed assertion
inside JDK.
 #KT-57389
2023-11-22 14:58:55 +00:00
strangepleasures a35191706f [KAPT] Minor. Fix the signature of printField method
Merge-request: KT-MR-13154
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-11-21 17:55:51 +00:00
strangepleasures f32fd314f8 [KAPT] Adhere to the call conventions when instantiating and using KtAnalysisSession
Merge-request: KT-MR-13098
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-11-21 13:21:19 +00:00
strangepleasures 03ed1d1d31 KT-62560 [SLC] Fix handling of empty varargs in annotations 2023-11-20 20:57:21 +00:00
strangepleasures 9c2ce475e2 KT-60821 [KAPT] Generate stubs without KaptTreeMaker
Merge-request: KT-MR-12979
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-11-16 21:14:36 +00:00
strangepleasures 6a2cea8a8e [KAPT4] KT-62097 Keep import statements for unresolved annotation classes 2023-10-20 08:33:17 +00:00
Mikhail Glukhikh a77b758efa LV 2.0: drop reporting FIR_COMPILED_CLASS and relevant stuff
#KT-62056 Fixed
Related to KT-59171, KT-61951
2023-09-21 11:14:09 +00:00
strangepleasures c31a3869c6 [KAPT] Fix package names org.jetbrains.kotlin.base.kapt3 -> org.jetbrains.kotlin.kapt3.base 2023-09-15 19:36:30 +00:00
strangepleasures 8fb7ea1126 [KAPT4] KT-61333 Support REPORT_OUTPUT_FILES
Add extra logging
2023-09-15 11:05:05 +00:00
strangepleasures cf01d2970f [SLC] [KAPT] KT-61916 Fix generation of annotations in annotation arguments 2023-09-14 13:21:07 +00:00
strangepleasures 52b0ea65d2 [KAPT4] KT-61761 Prevent Kapt from reporting unsupported plugin in K2/PSI
Also:
- remove the redundant KaptOptions.USE_K2
- prevent registration of Kapt4AnalysisHandlerExtension in K1
2023-09-12 16:58:38 +00:00
strangepleasures 6475942ced [KAPT4] A temporary workaround for KT-60482 2023-09-12 16:58:13 +00:00
Alexander.Likhachev 6eaccc997f [Build] Fix the typo junit jupyter -> jupiter 2023-09-06 22:47:34 +00:00
Alexander.Likhachev 6f96be0b76 [Build] Get rid of the testApiJUnit5 method
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
strangepleasures 9d43945b19 [KAPT4] KT-61729 Resolve annotation arguments during generation of @Metadata annotations 2023-09-06 19:47:28 +00:00
strangepleasures f2078caf64 [KAPT4] Support -Xmetadata-version in Kapt for testing with external projects 2023-09-05 23:23:24 +00:00
Alexander Udalov 761221904c K2 kapt: add kapt.use.k2 Gradle property
... and `-Kapt-use-k2` CLI flag to enable K2 kapt.

 #KT-61114 Fixed
2023-09-01 22:51:19 +00:00
Alexander Udalov 5c19cb3fcb [KAPT4] KT-51982 Implement Kapt4AnalysisHandlerExtension, add KAPT CLI and Gradle IT
Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-08-31 22:19:13 +00:00
Alexander Udalov d50d36f16c Kapt+JVM_IR: add regression test for KT-61212
#KT-61212
2023-08-31 17:58:04 +00:00
strangepleasures 2423b7b62f [KAPT4] KT-51982 Implement generation of @Metadata annotations in Java stubs
Also adds rendering of @Metadata annotations in Kapt3 and Kapt4 tests
(currently disabled for a few tests).

Co-authored-by: Alexander Udalov <alexander.udalov@jetbrains.com>
2023-08-17 21:43:54 +00:00
Alexander Udalov 5b0c075c8d Rework list of dependencies of kotlin-annotation-processing 2023-08-09 01:17:21 +00:00
Pavel Mikhailovskii 2002542ad2 Stub generation infrastructure (except for metadata generation) for KAPT+K2
This commit includes the basic Java stubs generation infrastructure and
the corresponding tests. The main entry point is called
Kapt4StubGenerator. Calls to it from production code will be added in a
separate commit.

 #KT-51982
2023-08-09 01:17:21 +00:00