Commit Graph

3745 Commits

Author SHA1 Message Date
Dmitriy Novozhilov 6d00dcf972 [FIR] Strip comments in Fir2IrAnnotationsFromPluginRegistrar
Fir2IrAnnotationsFromPluginRegistrar stores elements using start and end
  offsets from IR elements, which strip comments from the start offset.
  So it's also needed to strip it from FIR source to keep the consistency

^KT-61872 Fixed
2023-09-12 13:21:05 +00:00
Dmitriy Novozhilov 1f49266c4b [Test] Reproduce KT-61872 2023-09-12 13:21:05 +00:00
Dmitriy Novozhilov 49071374b4 [FIR] Look for annotations generated by backend based on declaration-site session
Test dump for klib does not correlate to real case (CLI compilation of
  JS or Native), because for some reason KLib facade in MPP scenario
  uses session/module of each specific file, instand of session for
  leaf platform module
In CLI scenario only one session is used, so annotations are generated
  properly

^KT-61833 Fixed
2023-09-12 13:21:05 +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
Alexander.Likhachev 53fde520d5 [Build] Add jUnit dependencies in testApiJUnit5 to the implementation configuration
Adding these dependencies to the `api` configuration pollutes classpath for each dependant modules even if it doesn't need them. Instead, the dependencies should be declared more granularly if they're required
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
Alexander.Likhachev 0ecbb64c64 [Build] Remove testApiJUnit5 parameters
Instead of declaring additional dependencies inside the method, declare them directly
#KTI-1349 In Progress
2023-09-06 22:47:34 +00:00
Alexander.Likhachev ef0fb557a5 [Build] Split junit-jupiter into api and engine
#KTI-1349 In Progress
2023-09-06 22:47:33 +00:00
Alexander.Likhachev 357d12fc8e [Build] Move JUnit dependencies into the version catalog
The `kotlin-test` dependencies are left untouched as changing them affects publications, thus these versions are independent from the used inside our build
#KTI-1349 In Progress
2023-09-06 22:47:33 +00:00
strangepleasures 9d43945b19 [KAPT4] KT-61729 Resolve annotation arguments during generation of @Metadata annotations 2023-09-06 19:47:28 +00:00
Mikhail Glukhikh c695d2759a K2: add test plugin visitor checking source elements presence
Related to KT-60555, KT-61330
2023-09-06 13:14:16 +00:00
strangepleasures f2078caf64 [KAPT4] Support -Xmetadata-version in Kapt for testing with external projects 2023-09-05 23:23:24 +00:00
Vyacheslav Gerasimov 009cda0c60 Build: Make robolectric tests run offline without downloading artifacts
#KTI-1367
2023-09-04 08:57:19 +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
Dmitriy Novozhilov e4a51dfa1b [Serialization] Don't report errors on properties from supertypes
^KT-53926 Fixed
2023-09-01 09:35:43 +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
Ilmir Usmanov 168076766f Minor. Fix test 2023-08-31 15:55:06 +00:00
Ilmir Usmanov 6c13250a08 KAPT3: Use another class in com.sun.tools.javac.main
Instead of CommandLine use Option, since CommandLine was moved or
removed from JDK 21.

 #KT-60507 Fixed
2023-08-31 15:55:06 +00:00
Ilmir Usmanov 62effc49fa KAPT3: Suppress useless cast, since it is not useless on JDK 21 2023-08-31 15:55:06 +00:00
Donald Duo Zhao a8fcdddf24 Move to use reflection to access JDK8 APIs
Currently, KAPT3 uses JDK internal API to build Java AST.
Since the API is internal, it has changed in newer JDKs.
So, for them, use reflection to access new API.
 #KT-59349 Fixed
2023-08-31 15:55:06 +00:00
mvicsokolova 8f4136f145 [atomicfu] Added a check that atomic properties are declared as final values.
Fixes: https://github.com/Kotlin/kotlinx-atomicfu/issues/237

YT: KT-61550


Merge-request: KT-MR-11886
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-08-29 12:15:56 +00:00
Kirill Rakhman c30ce4aabe [FIR] Print operator keyword and token to unresolved diagnostic message
#KT-55672 Fixed
2023-08-28 08:12:25 +00:00
Bogdan Mukvich 7b00323b89 [Build] Update guava
Fix some reports from "Show Vulnerable Dependencies"

^KTI-1342
2023-08-25 14:10:37 +00:00
Mikhail Glukhikh 824208e7f5 Use LV 1.9 in ImportsDumperTest 2023-08-25 08:57:53 +00:00
Mikhail Glukhikh f9c7a88175 Add -Xuse-fir-lt=false to some scripting tests
make them compatible with K2
2023-08-25 08:57:53 +00:00
Kirill Rakhman 7fde5af7f8 [FIR] Rename FirExpression.coneType to resolvedType 2023-08-24 07:54:57 +00:00
Kirill Rakhman 8d7c5b375e [FIR] Replace usages of FirExpression.typeRef with coneTypeOrNull
#KT-59855 Fixed
2023-08-24 07:54:57 +00:00
Kirill Rakhman 9ec814b7ad [FIR] Replace FirExpression.typeRef.coneType (and variants) with FirExpression.coneType
#KT-59855
2023-08-24 07:54:56 +00:00
Jingbo Yang 7a13173e6a Support fileAccessHistoryReportFile in KAPT
This change expanded KAPT to support a new param
'fileAccessHistoryReportFile', which reports all the classes used during
 annotation processing into a file, in the form of a list of URIs.

This is useful for build speed improvements described in https://engineering.fb.com/2017/11/09/android/rethinking-android-app-compilation-with-buck/.
Essentially, using the list of used classes, we can compile only
the dependencies that are really affected by the developer's
code changes and improve Kotlin build speed.

^KT-52853
2023-08-23 14:59:59 +00:00
mvicsokolova 76a1091820 [K/N]: Do not require JDK11 for :native:native.tests
This commit provides a small fix in the code of a native test runner so that JDK11 is not required and removes the JDK11 target for the atomicfu-compiler-plugin.

Fixes KT-61293

Merge-request: KT-MR-11757
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-08-22 13:32:38 +00:00
Kirill Rakhman d0cc86f52c [Tests] Update test data after changes to FIR diagnostic messages 2023-08-21 16:28:48 +00:00
Kirill Rakhman de1c92a32f [FIR] Update diagnostic messages 2023-08-21 16:28:48 +00:00
Dmitriy Novozhilov efb96e31fb [FIR] Fix implementation of primaryConstructorSymbol utility
Originally it used list of declarations, which is incorrect, because
  some constructors may be contributed by compiler plugin. And those
  constructors will be contained only in scope
2023-08-21 13:51:12 +00:00
Nikolay Lunyak f9c6af4d2a [FIR] Properly assign <local> packages to symbols
This prevents `FirConflictsExpressionChecker.kt`
from missing conflicting local functions. It used
to due to inconsistencies in assigning `<local>`,
and this commit makes it a bit more
straightforward.

The change in KtClassTypeQualifierRenderer
prevents `FirOverrideImplementTest.testLocalClass`
from failing in `intellij`. It didn't fail for
callables, because `KtCallableSignatureRenderer`
doesn't try to render packages.

^KT-59186 Fixed
2023-08-18 13:31:04 +00:00
Kirill Rakhman 5b9c35de2e [Tests] Update test data with error suppression warnings
#KT-61129 Fixed
2023-08-18 13:29:20 +00:00
Ilya Kirillov bdfc68468f [FIR] optimize direct allocation of empty ConeTypeProjection arrays
On the snapshot from KTIJ-26260 empty ConeTypeProjection arrays take about 10mb
2023-08-18 11:36:42 +00:00
Nikolay Lunyak 4958196c51 [FIR] Forbid mixing supertypes with different functional kinds
^KT-61277 Fixed
2023-08-17 21:45:42 +00:00
Alexander Udalov b3e4099703 Kapt tests: minor, remove STRIP_METADATA from properties.kt 2023-08-17 21:43:54 +00:00
Alexander Udalov e700a38a87 Kapt tests: minor, add some cases to properties.kt
To check that boolean "is" prefix is treated correctly, and Unit return
type is not translated to void. `@Deprecated` annotations are added just
so that the `$annotations` methods would also be generated.
2023-08-17 21:43:54 +00:00
Alexander Udalov 28e232f54f Kapt tests: minor, add case with optimized delegated property
In normal circumstances, it leads to the field `c$delegate` NOT being
generated (see KT-39054). However, it's not the case in kapt in any
mode:
- In the old JVM backend, this optimization is not supported.
- In JVM IR, property initializers are missing in light analysis, so
  backend cannot figure out that this property is optimizable.
- In kapt4, backend is not being run, and symbol light classes do not
  have information about this optimization.

Overall it doesn't matter much which stub is generated here because the
field is private, the test is added just in case.
2023-08-17 21:43:54 +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
Dmitriy Novozhilov 697d0d5638 [IR] Mark IrSymbol.owner with OptIn annotation
^KT-60923 Fixed
2023-08-16 17:47:29 +00:00
mvicsokolova 9ff0e0b046 [atomicfu-K/N] Tests for K/N atomicfu-compiler-plugin
* `nativeTest` task now allows to provide compiler plugins that may be enabled during test compilation
* test sets for JVM and K/N backends are equal

KT-60800 describes all the issues with native tests that were solved in this commit.

Co-authored-by: Dmitriy Dolovov <Dmitriy.Dolovov@jetbrains.com>

Merge-request: KT-MR-11401
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-08-16 09:41:29 +00:00
Alexander Udalov 7f5bc94117 Jvm-abi-gen: do not treat KmProperty.hasConstant as part of ABI
... for non-const properties.

The meaning of this flag for non-const properties is in reality not
well-established, and it can vary from one release to another. In
particular, it's different in K2.

This commit has two parts:
1) The test (added in 5891617674) about clinit is changed. Original
   motivation was to check that presence or absence of `<clinit>` is not
   a part of the ABI. However, in addition to that, the test also
   involuntarily checked that the aforementioned "hasConstant" flag for
   the property y/Object.y is the same in both cases (which I believe
   was not the intention) because these tests check that Kotlin metadata
   is _exactly the same_ after applying jvm-abi-gen. So I've changed it
   to be more straightforward: one version declares an obvious constant,
   while another declares an obvious non-constant. After this change,
   the test started to fail (even on K1) because the value of the
   "hasConstant" flag was different between two versions.
2) Remove "hasConstant" flag for non-const properties when transforming
   metadata via jvm-abi-gen. This fixes the test and assures it won't
   fail when the project is migrated to LV 2.0.

 #KT-60849 Fixed
2023-08-10 20:24:17 +00:00
Yahor Berdnikau 380062c511 [repo] Update the shadow version to 8.1.1 release
https://github.com/johnrengelman/shadow/releases/tag/8.1.1
2023-08-09 08:36:46 +00:00
Yahor Berdnikau c701677e45 [repo] Remove the shadow version from version.properties 2023-08-09 08:36:45 +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
Aleksei.Cherepanov 7a97a43036 Fix JPS import after bed16f92 (KT-58358)
Some native test dependencies were excluded from JPS import of `:kotlin-atomicfu-compiler-pligin`


Merge-request: KT-MR-11477
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-08-07 15:06:01 +00:00