Commit Graph

485 Commits

Author SHA1 Message Date
Andrey Uskov 52e45062cf KAPT does not fail with default settings on JDK 16+
If KAPT process is executed on latest JDKs and module
'jdk.compiler' does not export required packages, KAPT will
configure this module to export required packages.

#KT-45545 Fixed
2021-10-10 16:40:34 +03:00
Dmitriy Novozhilov de7fb9606a Migrate all JDK 9 related tests to JDK 11 2021-09-28 13:01:47 +03:00
Victor Petukhov a264cbfe7d Move CallUtil.kt under the resolve.util package 2021-09-27 16:12:01 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
Yigit Boyar 95f990adab Support line location information in KAPT for top level declarations
This CL fixes a bug in KAPT's MAP_DIAGNOSTIC_LOCATIONS flag where the
location mapping for top level elements didn't work.

I also needed to changes the Kapt3IntegrationTest to copy input files,
otherwise, it cannot map file paths since the mock project has no root
location.

Cleanup tmp folders in KAPT tests, update Kapt3IT test for new lines.

^KT-47934 Fixed
Test: KotlinKapt3IntegrationTests#testErrorLocationMapping
2021-09-14 10:48:37 +02:00
Ilmir Usmanov 486c6b3c15 Remove obsolete experimental coroutines support
in compiler.
2021-08-13 22:31:30 +02:00
Mikhael Bogdanov 1760befa37 [KAPT] Add experimental JDK 17 support
#KT-47583 Fixed
2021-08-11 10:05:24 +02:00
Alexander Udalov 0a9498f7e2 Build: suppress deprecated JVM target warning globally
There seems to be no point in configuring the compiler argument per
project. This argument will be deleted soon anyway, when we remove
support for JDK 1.6 & 1.7.

Also remove `disableDeprecatedJvmTargetWarning`. It didn't have any
effect in all modules where it was applied because these modules
reassign `freeCompilerArgs` anyway, with
`-Xsuppress-deprecated-jvm-target-warning` in it.
2021-07-27 13:35:39 +02:00
Nikita Bobko 39fa2b0baf Delete Kotlin IntelliJ IDEA plugin sources
Kotlin plugin sources were migrated to intellij-community:
https://github.com/JetBrains/intellij-community/tree/master/plugins/kotlin

Preserve `jps-plugin/testData/incremental`
because it's used in `compiler/incremental-compilation-impl/test`

Preserve `idea/testData/multiModuleHighlighting/multiplatform`
because it's used in `MppHighlightingTestDataWithGradleIT`
2021-07-21 11:23:43 +02:00
Yahor Berdnikau 7789054547 Migrate repo to use JVM toolchains Gradle feature.
^KT-46972 Fixed
2021-07-05 14:11:12 +00:00
Nikolay Krasko 48a4d7d418 Build: drop maven publication for Kotlin plugin artifacts 2021-06-09 17:43:54 +03:00
Nikolay Krasko 32f811e0ec Build: Cleanup old platforms from the build 2021-06-09 17:43:53 +03:00
Andrey Zinovyev 78e20c1098 [KAPT] Keep original expressions in annotations vararg
#KT-29929 Fixed
2021-05-31 08:08:37 +00:00
Udi Cohen b8002cb54f [Kapt] Support dumping processors stats to a file
Using the option -Kapt-dump-processor-timings
2021-04-28 11:48:19 +03:00
Andrey Zinovyev 0c6066db74 [KAPT] Don't fail on illegal delegate
Kapt ignores error diagnostics, but backend can't
 compile such code at all
This is workaround so backend won't fail.
#KT-46176 Fixed
2021-04-27 16:18:44 +03:00
Andrey Zinovyev 1093bffc62 [KAPT] Cache annotation processors' classloaders
Adds experimental feature to cache annotation processors' classloaders
It should increase speed of KAPT for consecutive runs
Works for gradle only (it stores cl in gradle daemon)
#KT-28901 Fixed
2021-04-22 11:51:14 +03:00
Andrey Zinovyev 8071a1e246 [KAPT] Keep constant references in annotations with array values
#KT-29929 Fixed
2021-04-20 15:47:03 +03:00
Andrey Zinovyev 8c464b4de5 [KAPT] Bring back properties resolution in light analysis
Because kapt fails on evaluation constant expressions of SomeType::class
2021-04-14 07:50:22 +00:00
Abduqodiri Qurbonzoda 40d1849f33 Migrate compiler, idea and others to new case conversion api 2021-04-08 03:22:02 +03:00
Ilya Gorbunov e450a6494a Migrate deprecations in core, compiler, idea, tests
Replacing deprecated Char.toInt() with Char.code and
Number.toChar() with Number.toInt().toChar(), where Number is not Int.

KT-23451
2021-04-07 18:30:20 +03:00
Alexander Udalov ce0c0ad2e3 JVM IR: get rid of toIrBasedKotlinType in MethodSignatureMapper
Commonize (in terms of TypeSystemCommonBackendContext implementations
for KotlinType/IrType) code that computes optimal TypeMappingMode to
apply to different positions where inline class types can be present.
2021-04-01 20:17:45 +02:00
hungvietnguyen 7c4225b9d1 [Kapt] Ensure flag names and default values are consistent
Group flag names and default values in one place to make the code easier
to read and prevent mistakes and inconsistencies.
2021-03-23 10:41:28 +03:00
Andrey b7dc1e64b1 [KAPT] Disable JPMS when running annotation processing
If sources contain module-info.java javac tries to validate modules existence/visibility during AP phase and fails, because we don't specify modules-path/patch-module. All these checks will be done in kotlin compiler and in javac for java classes. And it is not necessary to do it in AP too.
So we go for easiest path possible - disable jpms for AP. 

#KT-32202 Fixed
2021-03-17 11:10:27 +03:00
Zac Sweers 12a6352bef Fix NPE in KaptJavaLog
See https://issuetracker.google.com/issues/162446295 for more context, but in short: this will fail if the project:
* targets java 8
* consumes external libraries targeting a higher version (java 9+). This includes Android SDK 30's android.jar, which targets java 9
* has `mapDiagnosticLocations` enabled for kapt

targetElement is a nullable type, so this seems like a pretty cut-and-dry NPE fix
2021-03-16 19:21:44 +09:00
Andrey fe6ddcc1fa [KAPT] Skip kapt tasks if no annotations processors are provided (#4190)
So we don't do any preparation, don't spin up compiler.  And user will see SKIPPED in task execution
2021-03-15 11:37:06 +03:00
Andrey Zinovyev b128577508 [KAPT] Some optimizations for stubs generation
* Add index to resolve compiled class by name
* Disable full property resolution
2021-03-03 12:05:49 +03:00
Tianyu Geng 56854a8b1a FIR IDE: register quickfix for the following
1. NON_ABSTRACT_FUNCTION_WITH_NO_BODY
  2. ABSTRACT_PROPERTY_IN_NON_ABSTRACT_CLASS
  3. ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS
2021-02-19 13:16:42 +01:00
Hung Nguyen 592c285198 Kapt: Don't create KDocCommentKeeper when not needed
Previously, even if `keepKdocComments=false`, we would still create the
KDocCommentKeeper object unnecessarily.

This commit makes sure we create the object only if
`keepKdocComments=true`.

Bug: Clean-up after commit e252171 for KT-43593
Test: Existing tests
2021-02-16 11:53:49 +03:00
Andrey Zinovyev cc51869a2a [KAPT] Take function argument names from original descriptor
#KT-43804 Fixed
2021-02-14 10:45:00 +03:00
Andrey Zinovyev 4a0437a507 [KAPT] Fix field type correction for delegates (#4107)
#KT-37586 Fixes
2021-02-14 10:38:38 +03:00
Andrey Zinovyev 6eaf0a95ca [KAPT] Fix expected resolve errors in tests (#4105) 2021-02-10 19:40:28 +03:00
Andrey Zinovyev 48ec227aaf [KAPT] Suppress resolve error in annotation procssing
#KT-33223
2021-02-10 10:59:46 +03:00
Andrey Zinovyev 10cc86c975 [KAPT] Warn about usage of types from default package
Java doesn't support import from default package. 
We can't fix it, so we warn about it.
#KT-36743
2021-02-09 13:32:27 +03:00
Andrey Zinovyev c75d2c05f0 [KAPT] Correct type for property with accessor
^KT-39060 Fixed
2021-02-08 10:11:50 +03:00
Andrey Zinovyev 08111031ec [KAPT] Keep annotations from kotlin.jvm. in stubs
^KT-35104 Fixed
2021-02-05 13:41:46 +03:00
Andrey Zinovyev dacf012a78 [KAPT] Add newline after each java compiler log (#4087)
^KT-27123 Fixed
2021-02-04 17:29:13 +03:00
Andrey Zinovyev 923a4427c5 [KAPT] Fix stub generation for anonymous delegates
Replace anonymous classes with superclass in delegate properties
#KT-34838 Fixed
2021-02-03 17:27:41 +03:00
Alexander Udalov e0b6d4d917 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.
2021-02-03 12:51:39 +01:00
Dmitriy Novozhilov 09ec3f6eaf [Test] Support various jdk targets in test infrastructure 2021-02-02 17:54:51 +03:00
Denis.Zharkov 7e6abffb62 FIR: Fix incorrectly serialized type
See the test added: there's a non-denotable T!! type inside flexible type
that wasn't handled before.

ConeKotlinType::contains handles flexible types content and some other cases
Also, it has better asymptotics
2021-01-29 10:50:23 +03:00
Hung Nguyen e2521718dd Kapt: Add flag to keep KDoc comments in stubs
Currently, KaptGenerateStubsTask may not generate KDoc comments
correctly. See KT-43593 for more details.

This commit provides a Kapt flag called
`kapt.keep.kdoc.comments.in.stubs`
to control whether KDoc comments will be included in the generated
stubs.

This flag is currently enabled by default to keep the existing behavior
and avoid breaking existing users.

Users who don't need KDoc comments in stubs but are hitting KT-43593 can
disable the flag.

Whether this flag will be disabled by default later is to be determined.

Bug: https://youtrack.jetbrains.com/issue/KT-43593
     (Note that this commit only provides a workaround, it doesn't
     actually fix the bug.)
Test: (Ir)ClassFileToSourceStubConverterTestGenerated#testCommentsRemoved
2021-01-26 15:28:52 +03:00
Alexander Udalov 221f44da5f Fix warnings in stdlib/compiler/plugins/test code 2021-01-13 19:18:20 +01:00
Ivan Gavrilovic dfdd107fc0 Update KAPT stubs for tests
Update expected outputs so they match
the new sorting rules.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic 3b2986f069 Apply consistent sorting for elements from the same position
There could be multiple elements originating from the same
position in the source file, so make sure to use name+desc to
sort those.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic ecc0eee3cf KT-44130: Sort fields and methods in generated stubs
Use the position in the source file if possible, and
only if the members are coming from other source files,
use their name and descriptor. This is necessary in order
to ensure deterministic output in clean and incremental
runs, while preserving the order of members in the sources.
2021-01-13 22:49:09 +09:00
Ivan Gavrilovic a320152a03 Revert "Sort class members to ensure deterministic builds"
This reverts commit 4bf63a9539.
2021-01-13 22:49:09 +09:00
Alexander Udalov ed9a0e514d Regenerate tests and fir-tree 2021-01-03 14:53:41 +01:00
Alexander Udalov 77a9d14f93 Capitalize/decapitalize only ASCII characters across project
Use {de,}capitalizeAsciiOnly and to{Lower,Upper}CaseAsciiOnly where
possible, and stdlib's functions with Locale.US everywhere else.

Otherwise, if the default system locale is Turkish, the capital latin
letter "I" is transformed in toLowerCase to "ı" (see
https://github.com/JetBrains/kotlin/blob/66bc142f92085047a1ca64f9a291f0496e33dd98/libraries/stdlib/jvm/test/text/StringJVMTest.kt#L119),
which for example breaks the codegen for `intArrayOf` in
KT-25400/KT-43405.

Similarly, lower case latin letter "i" is transformed to "İ".

 #KT-13631 Fixed
 #KT-25400 Fixed
 #KT-43405 Fixed
2020-12-28 16:10:30 +01:00
Dmitriy Novozhilov bc7e18fb8a [TEST] Regenerate tests after previous commit 2020-12-16 19:52:28 +03:00
Dmitriy Novozhilov c8f3a4802e [TEST] Introduce test-infrastructure-utils module and extract common test utilities here 2020-12-16 19:52:22 +03:00