Commit Graph

2626 Commits

Author SHA1 Message Date
Vladimir Lagunov
1d8ca26477 Update copyrights in Kotlin Tests to let Test Aggregator pass
Otherwise, `org.jetbrains.kotlin.idea.testGenerator.all.AllTestsGeneratedTest.testAllTestsIsUpToDate` fails with an error like:

```
com.intellij.platform.testFramework.core.FileComparisonFailedError: 'GradleBuildFileHighlightingTestGenerated.java' is not up to date
Use 'Generate Kotlin Tests' run configuration to regenerate tests
  at org.jetbrains.kotlin.testGenerator.generator.TestGeneratorKt.write(TestGenerator.kt:156)
  at org.jetbrains.kotlin.testGenerator.generator.TestGenerator.write(TestGenerator.kt:72)
  at org.jetbrains.kotlin.testGenerator.generator.TestGenerator.write(TestGenerator.kt:32)
  at org.jetbrains.kotlin.fe10.testGenerator.Fe10GenerateTestsKt.generateK1Tests(Fe10GenerateTests.kt:172)
  at org.jetbrains.kotlin.idea.testGenerator.all.AllTestsGeneratedTest.testAllTestsIsUpToDate(AllTestsGeneratedTest.kt:10)
  at java.base/java.lang.reflect.Method.invoke(Method.java:580)
  at junit.framework.TestCase.runTest(TestCase.java:177)
  at junit.framework.TestCase.runBare(TestCase.java:142)
  at junit.framework.TestResult$1.protect(TestResult.java:122)
  at junit.framework.TestResult.runProtected(TestResult.java:142)
  at junit.framework.TestResult.run(TestResult.java:125)
  at junit.framework.TestCase.run(TestCase.java:130)
  at junit.framework.TestSuite.runTest(TestSuite.java:241)
  at junit.framework.TestSuite.run(TestSuite.java:236)
  at com.intellij.TestAll.runOrCollectNextTest(TestAll.java:399)
  at com.intellij.TestAll.run(TestAll.java:280)
  at junit.framework.TestSuite.runTest(TestSuite.java:241)
  at junit.framework.TestSuite.run(TestSuite.java:236)
```

GitOrigin-RevId: c8a0adce00acd8196ac923bf62425f682be70931
2025-01-02 17:06:48 +00:00
Alexey Belkov
d553c9555c [kotlin] J2K copy-paste cleanup: rename DataForConversion
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 13cfdd96db96306f742e3d102053a13a988f492b)

GitOrigin-RevId: 2ae30885302c38ab5066914353235fbd5be2d292
2024-12-05 21:53:56 +00:00
Alexey Belkov
2596b067cf [kotlin] J2K copy-paste cleanup: rename ConversionTargetData
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 325142ffeb5aa7fae9eade95e2d726f1237c522b)

GitOrigin-RevId: 4de0eb92594443955ced2152c04ce3af648dc500
2024-12-05 21:53:56 +00:00
Alexey Belkov
bf6e12e87f [kotlin] J2K copy-paste: add threading assertions to copy-paste converters
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 916187d830b07108e3e14b00dac642c734d1248b)

GitOrigin-RevId: b3b150dd33329e7ccc2c17a00ef1d67f44d68477
2024-12-05 21:53:56 +00:00
Alexey Belkov
143ae41304 [kotlin] J2K copy-paste: commit document correctly
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 406f144ef15f81becf35a59bb3d844885d959683)

GitOrigin-RevId: f60767b9d805b84eeb7c46038a05680113019d99
2024-12-05 21:53:56 +00:00
Alexey Belkov
fe5b7f66f2 [kotlin] J2K copy-paste: replace not-null assertion with logging
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 6c206a696e5fcd9d675a6d5b9976acc925cd17d5)

GitOrigin-RevId: ff3b2ea902388cfd4a1f96673e4d79498f068a48
2024-12-05 21:53:56 +00:00
Alexey Belkov
55dd9a893a [kotlin] J2K cleanup: simplify JavaToJKTreeBuilder.buildTree
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 114c64349e75cc7c4a87e86da0ae5638ac92cdf4)

GitOrigin-RevId: 0d3ffda45115bc1ac78ff9a67392ba930134d0d8
2024-12-05 21:53:56 +00:00
Alexey Belkov
d6875a02cc [kotlin] J2K copy-paste cleanup: specialize signature of K2J2KCopyPasteConverter
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 28025edbc9f4389e03efd814fcff7257d23d7dc8)

GitOrigin-RevId: 54aebb3bdf724c0ecbda94b1d7b389aef3ec7f9b
2024-12-05 21:53:56 +00:00
Alexey Belkov
bea2817afa [kotlin] J2K copy-paste cleanup: simplify constructors of copy-paste converters
KTIJ-28714
IJ-CR-150614

(cherry picked from commit 9f3efbc7640814e2fcb7324ae99c964534e0bd45)

GitOrigin-RevId: 9634d974a32a3e0087550e0409dc11148546bb54
2024-12-05 21:53:56 +00:00
Alexey Belkov
7480bc2492 [kotlin] J2K copy-paste cleanup: drop kind parameter from createCopyPasteConverter function
KTIJ-28714
IJ-CR-150614

(cherry picked from commit a0f4b61052b1839e2f38da8d78df00f39328395a)

GitOrigin-RevId: ba3eab3025a50f4b0e3ddb7977d45b1686176919
2024-12-05 21:53:56 +00:00
Alexey Belkov
731d1484c8 [kotlin] J2K copy-paste: K2J2KCopyPasteConverter cleanup
KTIJ-28714
IJ-CR-150614

(cherry picked from commit dc3638c78c77c725f14f2f723c2181f93014c0c6)

GitOrigin-RevId: ee5a3b2654a065b2d66f4a6e768a0cee4c001a3c
2024-12-05 21:53:56 +00:00
Alexey Belkov
7afe051179 [kotlin] J2K copy-paste: ignore a couple of K2 tests
1. testImportFromTarget:

Some bug in nullability inferrer.

2. testAddImportsDummyConflict, testAddImportsButNoConversion:

Imports are not added in these specific cases because
in K2 we don't use KotlinCopyPasteReferenceProcessor (KTIJ-32359).

Note: in most cases, however, we correctly insert imports
even without the KotlinCopyPasteReferenceProcessor thanks
to the "shorten references" post-processing. So maybe we don't
even need the KotlinCopyPasteReferenceProcessor.

KTIJ-28714

(cherry picked from commit 01c295af7e18ce3083fa729c4a8dcacdd4d5ed8d)

GitOrigin-RevId: 116ae4c0e6bc38dca75c85a3671f141bc3a1e604
2024-12-05 21:53:56 +00:00
Alexey Belkov
80d5d88bfd [kotlin] J2K copy-paste tests: K2-specific testdata
Mostly small differences in nullability, mutability
and some other things.

KTIJ-28714

(cherry picked from commit 37aadb47d4f04c66c41778e5b8b9bc4bc98465d0)

GitOrigin-RevId: 57956284eca03441dbb9fe72df3df8d7e81855ca
2024-12-05 21:53:56 +00:00
Alexey Belkov
235f3a2012 [kotlin] J2K copy-paste tests: stop dumping errors
Almost every copy-paste test file has expected errors
(usually, unresolved references), so it looks noisy to dump them all.

Also, this will help to share expected results between K1 and K2,
because they often differ only in exact wording of error messages.

KTIJ-28714

(cherry picked from commit 4d2e181ee3d4781f3064f046f4f6ac3005d1e9fc)

GitOrigin-RevId: 69501d6a2916dc8959707a4c7ada3a3322f8209e
2024-12-05 21:53:56 +00:00
Alexey Belkov
c9a580ce41 [kotlin] J2K copy-paste tests: use J2K_PROJECT_DESCRIPTOR
KTIJ-28714

(cherry picked from commit 43dc8c19eacb6afd60b00c7bbf4fe116c62cdc18)

GitOrigin-RevId: ba7d7c55f88032059b1dde7ce06a60d60da90acb
2024-12-05 21:53:56 +00:00
Alexey Belkov
4764b6c130 [kotlin] J2K copy-paste: K2 implementation
^KTIJ-28714 Fixed

(cherry picked from commit 1a0cd473a498151f64e49cd096f1f70a9d50484b)

GitOrigin-RevId: c379cb97043d75c86700f9d401b158ef57e2f014
2024-12-05 21:53:56 +00:00
Alexey Belkov
a8ce2902f0 [kotlin] J2K copy-paste: recreate K1PlainTextPasteImportResolver in K1 module
KTIJ-28714

(cherry picked from commit 08fb34aaec3ecaac8790371a1bf7aea60b5d5271)

GitOrigin-RevId: 8444ac6dc97e50b5b2553a9736ea6b5024c5aaa5
2024-12-05 21:53:56 +00:00
Alexey Belkov
5563ec7b49 [kotlin] J2K copy-paste: move K1PlainTextPasteImportResolver to K2
Technical commit to preserve git history (code does not compile).

KTIJ-28714

(cherry picked from commit 238ccf885463d82334151ad6c1105402699b226c)

GitOrigin-RevId: 98785e63a10e7fdafc64c9dbbbbb339af284dd0e
2024-12-05 21:53:55 +00:00
Alexey Belkov
d3622f59eb [kotlin] J2K copy-paste: share most code, create extensions for K1/K2-specific classes
J2K copy-paste processors are enabled in K2 but don't work yet.

Now all J2K-related code (except JavaToKotlinAction)
is located in `j2k` modules.

KTIJ-28714

(cherry picked from commit 71774b698b53420dc95637b720ab3e4c3ec05867)

GitOrigin-RevId: 2e5432817ec7d8d512be25704dd0bb4f57e0c999
2024-12-05 21:53:55 +00:00
Alexey Belkov
a7ffbe766f [kotlin] J2K copy-paste tests: delete class AbstractJ2kCopyPasteTest
KTIJ-28714

(cherry picked from commit 45955845573f70f816115a89438604d5eb560ac1)

GitOrigin-RevId: 617358c9d50433ba16f21e3a0bc4cc298b90bb88
2024-12-05 21:53:55 +00:00
Alexey Belkov
c6cc135367 [kotlin] J2K tests: rename K1 tests
KTIJ-28714

(cherry picked from commit 7668f881f6e74a2021980e1839d254b7d76e0963)

GitOrigin-RevId: 808e5784ceaa358d5bea8a117507114c7a2ddba1
2024-12-05 21:53:55 +00:00
Alexey Belkov
4b29eee3c8 [kotlin] J2K tests: cleanup
KTIJ-28714

(cherry picked from commit aef40fee7ab11587324533b2e3503b4b740996d1)

GitOrigin-RevId: 15b9d402abd267636e0aed071a16baa9c45dda8b
2024-12-05 21:53:55 +00:00
Alexey Belkov
46820cf154 [kotlin] J2K: AfterConversionPass cleanup
KTIJ-28714

(cherry picked from commit a1e5a2b6df1f06d75a26e42bf639344c4e40b9cb)

GitOrigin-RevId: cbbdd60b535d2303b69414260fe242ab48a7d4a3
2024-12-05 21:53:55 +00:00
Alexey Belkov
316afedd5a [kotlin] J2K copy-paste: extend tests for in-context declarations to regular copy-paste converter
It seems like the fix for ConvertTextJavaCopyPasteProcessor
implemented in KTIJ-14329 is not necessary for ConvertJavaCopyPasteProcessor,
but we should still have the tests for it (from user's POV use cases are similar).

KTIJ-14329
KTIJ-28714

(cherry picked from commit cb181d85923627e052882d32892519ac8af641e0)

GitOrigin-RevId: e2846124c73f2013f0f5c0fe465d2fcc18273193
2024-12-05 21:53:55 +00:00
Alexey Belkov
a918bcb221 [kotlin] J2K: "Variable expected" for converting unary prefix expression argument to String.valueOf (no parentheses)
^KTIJ-31441 Fixed

GitOrigin-RevId: f17091901fa9e55c1f530ac7a3145131ffdbd4d6
2024-10-01 20:46:11 +00:00
Frederik Haselmeier
9df85104f5 [Kotlin] Updated J2K tests to work with Kotlin 2.0
KTIJ-30704

(cherry picked from commit 781486f26b3e1d51cebb582705a2dfa55f707ba1)

GitOrigin-RevId: f4855b74026078fec42f7b90dc9a6417dbd02dd5
2024-09-30 12:16:32 +00:00
Vladimir Dolzhenko
3f86df8792 Merge branch 'kt-master'
GitOrigin-RevId: 70255674850983ff30928a74d5a2d1faef5d9973
2024-09-29 09:18:59 +02:00
Alexey Belkov
0728527608 [kotlin] J2K K2: type mismatch with boxed floating point type conversion to short and byte
^KTIJ-31411 Fixed

GitOrigin-RevId: 2e2b2dee023edf160cb28b96e1ba42629509e87b
2024-09-27 00:40:56 +00:00
Alexey Belkov
a497f3cad3 [kotlin] J2K: BoxedTypeOperationsConversion cleanup
KTIJ-31411

GitOrigin-RevId: 83875ae4f2fb0910e47abef315b6a954ce3ced0b
2024-09-27 00:40:56 +00:00
Alexey Belkov
2f528fca64 [kotlin] J2K K2: support implicit cast with foreach range right part with a floating-point type
^KTIJ-31396 Fixed

GitOrigin-RevId: eddc2afd62d9436ec399f0f6c93d761081d72a45
2024-09-27 00:40:56 +00:00
Alexey Belkov
0c37c38c32 [kotlin] J2K: ImplicitCastsConversion cleanup
KTIJ-31396

GitOrigin-RevId: 89c83de784c897d8e47370a57530eb5f56bb2c94
2024-09-27 00:40:56 +00:00
Alexey Belkov
c13c58697d [kotlin] J2K K2: Fix compound assignment implicit cast with Char
^KTIJ-31383 Fixed

GitOrigin-RevId: b7a70a2255458a20d570eae57741fd8bef931ee3
2024-09-27 00:40:56 +00:00
Alexey Belkov
50d504b6bd [kotlin] J2K: Provide JK expression types in more places
Otherwise, some conversions may not work without the types.

KTIJ-31383

GitOrigin-RevId: 32adadc5d96ca03c50cdf45fe8c51a6c07171849
2024-09-27 00:40:56 +00:00
Alexey Belkov
a277c00a71 [kotlin] J2K: ImplicitCastsConversion cleanup
KTIJ-31383

GitOrigin-RevId: 01942ecd737aaceb71f7a7934cfd09afc762a471
2024-09-27 00:40:56 +00:00
Alexey Belkov
5e2eccf03e [kotlin] J2K K2: support implicit casts in return statement
^KTIJ-31313 Fixed

GitOrigin-RevId: 09e26e5f253757b612e2cafebea011b4053dde2f
2024-09-27 00:40:56 +00:00
Alexey Belkov
2f7f48f046 [kotlin] J2K K2: support implicit casts in array access expression
^KTIJ-31311 Fixed

GitOrigin-RevId: ede0da6f13d2db0c1bb57a34c932426e3e9aec96
2024-09-27 00:40:56 +00:00
Alexey Belkov
97985de7ef [kotlin] J2K K2: Fix vararg parameter type calculation
^KTIJ-30675 Fixed

GitOrigin-RevId: 3ac64786a39050c25ea226aacf96ab2a8c17c135
2024-09-27 00:40:56 +00:00
Alexey Belkov
06ed167a6f [kotlin] J2K: Add a regression test
KTIJ-31182

GitOrigin-RevId: 0050dc04213037f3454e67a584513b5a1669daeb
2024-09-27 00:40:56 +00:00
Alexey Belkov
2e019e6020 [kotlin] J2K: remove var-to-val post-processings
This work is now done during the JK building phase, mostly on the Java analysis side.

1. New var-to-val analysis may not work on red Java code (some testdata is affected).
2. It is also more conservative and doesn't attempt to analyze public fields.
3. "Partial converter" tests are related to cross-language "inline" refactoring,
which still works the same (the real tests are in `InlineTestGenerated`)

^KTIJ-31124 Fixed
^KTIJ-31182 Fixed
^KTIJ-31196 Fixed

GitOrigin-RevId: 812379dcf5a6dab0002fceba82488bcc7c450d7f
2024-09-27 00:40:55 +00:00
Alexey Belkov
b4416d7351 [kotlin] J2K: cleanup tests
KTIJ-31123

GitOrigin-RevId: 41a59c77b2f51cfcafc1c622f744b3aee5a32617
2024-09-27 00:40:55 +00:00
Alexey Belkov
a6b4782009 [kotlin] J2K: use range until operator by default with api version >= 1.9
^KTIJ-31397 Fixed

GitOrigin-RevId: b3d6f90eab4af5afd42dabac45aae1564bba2a28
2024-09-27 00:40:55 +00:00
Kirill Rakhman
e45732e353 [kotlin] Fix test data after #KT-34911
GitOrigin-RevId: 5f5f31d38b64b4ecb030b79a69d7f532c95c2341
2024-09-25 07:46:44 +00:00
Yan Zhulanow
2d98b82498 Merge commit '01ea7febdf60fc553fa00e01f3c26bc65ea86093'
GitOrigin-RevId: fdc1aeb406753b305b71f04d8137ab190b52a1aa
2024-09-20 14:57:29 +02:00
Tagir Valeev
b50767f679 [java] Basic support for external type annotations
Only in XML directly; no editing UI for now; no inlays for now; only for libraries (Cls), currently no intent to extend to sources (Psi)
Part of IDEA-231901 Support TYPE_USE in external annotations

GitOrigin-RevId: 672ed09f57ffc40b61e8fe4dd33d0f9acdac92dc
2024-09-18 20:06:30 +00:00
Andrey Cherkasov
1caa8c6de1 [kotlin] Port AddAnnotationUseSiteTargetIntention to K2
^KTIJ-31237

GitOrigin-RevId: 1eb82f05e36ee335650023880761bca01fd1440a
2024-09-08 21:38:22 +00:00
Mikhail Filippov
f13d92e82f IJPL-150165 switch to invoke dynamic lambdas in Kotlin
GitOrigin-RevId: 63ba45a21874cc723917982996fce1a510b2a182
2024-09-05 11:19:31 +00:00
Anna Kozlova
c4cfdcc275 [kotlin] fix configuration files format
GitOrigin-RevId: fc18fd93aaf1b7b7761a48f9fca60e065373d0f6
2024-09-04 18:34:02 +02:00
Denis.Zharkov
c1eaf092d4 IJPL-160628: Replace javaslang library with io.vavr
Initially, the library (javaslang) was brought with
Kotlin compiler parts and now it's being updated to
its new reincarnation (vavr) which resolves
ClassLoader-related issue in the compiler (see KT-63502).

Thus, we replace it in the IJ repository, too.

GitOrigin-RevId: c91d98a842670a8c98cd731f4e3827235a487cec
2024-09-04 15:30:24 +02:00
Anna Kozlova
6df95b84b2 Merge commit '435b74f6b9df6a05436cfe8f23b34276ee237d8b'
GitOrigin-RevId: e7debcbaf624ae15ea5eee032a7af1851eb55c20
2024-09-04 12:06:55 +02:00
Kirill Rakhman
b3fd9e677a [kotlin] Fix test data after #KT-69389
GitOrigin-RevId: 435b74f6b9df6a05436cfe8f23b34276ee237d8b
2024-09-03 13:56:50 +00:00