Commit Graph

3229 Commits

Author SHA1 Message Date
Sergey.Shanshin 503f4d924d Added support of MetaSerializable to the FIR 2022-10-12 20:10:58 +00:00
Nikolay Krasko f43ad1cb7a Remove packed stdlib from Kotlin compiler plugin artefacts
Remove annotations, kotlin-stdlib-common, kotlin-stdlib.

Packing those libraries is wrong and probably unexpected. It leads to
artifacts size increase. Can be dangerous because of bad classpath.
And also have a reproducibility issue because of caching tricks around
KotlinVersionCurrentValue class.

KTI-942
2022-10-12 13:44:30 +00:00
Leonid Startsev 090aec6b3b Prohibit Array<T> in @Serializable classes
because it's impossible to correctly create array reflectively without
knowing correct KClass.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1243
2022-10-12 11:48:21 +00:00
Leonid Startsev 596949a501 Correctly handle star projections according to logic of the old FE.
#KT-54297 Fixed

Properly substitute surrogate UnitSerializer in the Companion.serializer()
function generated on classes that use polymorphic or sealed serializer
by default. (Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1692)
2022-10-12 10:36:26 +00:00
Leonid Startsev 2a626b27d3 Correctly determine the type of serializable property
when supertype of serializable class is generic and also serializable,
and contains the property with type with its generic parameter.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1264
#KT-43910 Fixed
#KT-49660 Fixed
2022-10-12 10:34:53 +00:00
Daniel Santiago 189be2b117 [KAPT] Setup KaptJavaLog writers during initialization.
Migrate KaptJavaLog to not used deprecated constructor in newer JDKs and instead set up the writers during initialization. This enables us to get rid of KaptJavaLog17.

Fixes KT-54030
2022-10-11 23:48:18 +02:00
Sergey.Shanshin f4845b8dd9 Marked write$Self and $serializer from serialization as synthetic 2022-10-11 17:05:03 +00:00
Ilya Muradyan 7f6bd2ab1e Fix compatibility issue for kotlin.jupyter 2022-10-08 04:02:39 +02:00
mvicsokolova cb23dbb492 atomicfu-compiler-plugin: support declaration of properties in objects for JVM IR
Fix: https://github.com/Kotlin/kotlinx-atomicfu/issues/241
Merge-request: KT-MR-6871
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2022-10-07 17:10:41 +00:00
pyos 8d33de4297 JVM: partially reify typeOf and signatures as soon as possible
E.g. when substituting T -> Array<T>, write the bytecode for the
Array<...> part for typeOf.

This fixes various issues where either Array nesting levels, nullability
information (for typeOf), or entire reification markers were missing,
causing incorrect outputs ranging from missing `?`s to missing `[]`s to
just reified types not really being reified.

^KT-53761 Fixed
2022-10-06 00:58:25 +02:00
Dmitriy Novozhilov c543a2e6d5 [Assign plugin] Publish embeddable version of assign plugin 2022-10-04 19:47:34 +00:00
Simon Ogorodnik 0fea8073ef Scripting Plugin. Update CoreFileTypeRegistry under lock
CoreFileTypeRegistry isn't thread-safe, so it should be updated under
application lock, to avoid concurrently mutating underlying structure
2022-10-03 13:36:06 +00:00
Leonid Startsev a20ce06102 Support @Serializable(ContextualSerializer) on class
It was fixed some time ago (https://github.com/Kotlin/kotlinx.serialization/issues/957)
but for some reason only for old backend.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1776
2022-09-28 12:40:20 +00:00
pyos 72e671c8f1 FIR Parcelize: allow anonymous local objects if they're enum entries 2022-09-28 15:14:25 +03:00
Nicklas Ansman Giertz b02948b5f7 KAPT: Kapt generates illegal stubs for private interface methods
Interface methods that were private got both the `default` and `private`
modifiers when using `jvm-default=all` which is not valid.

The stub will now just contain `private` in this case.

This fixes KT-48013.
2022-09-26 12:21:56 +02:00
Dmitriy Novozhilov 7ce3934cf7 [FIR] Add type resolution service into SerializationFirSupertypesExtension
This service allows resolve custom user types from plugins, which allows
  to support specifying type arguments of generated supertypes basing
  on arguments passed to annotations
2022-09-26 10:09:09 +00:00
Sergey.Shanshin 9210108d5a Added test on Serializable(with=...) in K2 2022-09-23 11:56:19 +00:00
Nikolay Krasko 1630386712 Move to JDK_X_Y variables 2022-09-21 22:53:19 +00:00
Ilya Goncharov d203dc35bf [JS IR] Add to IR keep possibility similar to legacy-dce one
It helps to:

- keep declarations even if they are not reachable and not exported
- not minify names of not exported declarations

Compiler argument: -Xir-keep=A,B

Can be used for top-level declarations or for member

^KT-54118 fixed
2022-09-20 16:06:17 +00:00
Dmitriy Novozhilov 367761008b [Lombok] Make FQNs of Guava collections shade-safe
^KT-53683
2022-09-20 11:08:30 +03:00
Dmitriy Novozhilov b1d42e1383 [Lombok] Update incorrect testdata according to KT-53965 2022-09-20 10:38:00 +03:00
Dmitriy Novozhilov 111dab7a88 [Lombok] Fix test configuration 2022-09-20 10:37:59 +03:00
Leonid Startsev c8647841dc Added documentation for MagicApiIntrinsics.voidMagicApiCall
Remove mavenLocal() from repos
2022-09-16 14:34:30 +00:00
Leonid Startsev 69c00785f2 Support plugin-defined instrinsics that can be non-typeOf operation types. 2022-09-16 14:34:30 +00:00
Leonid Startsev 033538161e Determine more precise conditions when to enable serialization intrinsic
Disable it if we do not have required `noCompiledSerializer` function in
runtime. Leave it enabled in tests.

Rollback some changes for old backend as it is unsupported now.
2022-09-16 14:34:30 +00:00
Leonid Startsev 637e8c7d8a Provide feature-flag to disable intrinsics in serialization plugin 2022-09-16 14:34:29 +00:00
Leonid Startsev ad2adadb36 Remove OperationType.PLUGIN_DEFINED type:
instead, plugins should emit the code similar to the TYPE_OF one with
a special call to MagicApiIntrinsics.voidMagicApiCall directly afterwards.

This is required because old compiler need to correctly inline code
rewritten by plugin.
2022-09-16 14:34:29 +00:00
Leonid Startsev 763303fe97 Refactor extensions for plugin intrinsics entry points
so platform-specific parts won't have unsafe downcasts.
2022-09-16 14:34:29 +00:00
Leonid Startsev eae588abea Improve line numbers handling in serialization intrinsic
Fix nullable serializers on top-level & method with incorrect receiver

Improve handling of different runtime versions
2022-09-16 14:34:29 +00:00
Leonid Startsev aac9a06474 Also support intrinsification for SerializersModule.serializer<T>()
method that fallbacks to module.getContextual().
2022-09-16 14:34:28 +00:00
Leonid Startsev a59f5f407b Introduce support for plugin-defined intrinsics in JVM IR backend:
Add intrinsic for kotlinx.serialization.serializer<T>() function.

Plugin intrinsic for old backend is removed because it is too hard
and unjustifiable to unify them.
2022-09-16 14:34:28 +00:00
Leonid Startsev f9edbd825a Introduce support for plugin-defined intrinsics in old JVM backend:
(Old is created first because all intrinsics emit bytecode anyway)

Provide intrinsic for serializer<T>() function so it won't
invoke typeOf() construction and KType->KSerializer conversion
making it fast and truly reflectionless

Add support for recalculating stack size in plugin-defined intrinsics
since it is needed for correct work:
Unify method for recalculating stack size with existing typeOf intrinsic

Add testdata for IR for future intrinsic in IR
2022-09-16 14:34:28 +00:00
Mads Ager 294395f4cc Rebase bytecode text expectations for parcel part of android-extensions. 2022-09-16 15:03:01 +02:00
Mads Ager 2d720a09c3 Add layout lib system properties so that parcel tests run.
This is for the parcel part of deprecated android extensions.
So this will be removed soon, but it is still there and the
tests should run.
2022-09-16 15:03:01 +02:00
Mads Ager ff84c19eff Make kotlin-android-extensions always cause a compilation error.
kotlin-android-extensions are deprecated and have been scheduled
for removal in 1.8.0.

https://android-developers.googleblog.com/2022/02/discontinuing-kotlin-synthetics-for-views.html
2022-09-16 15:03:01 +02:00
Dmitriy Novozhilov ed1a1c067c [Assign plugin] Add experimentality warning 2022-09-16 10:12:41 +03:00
Anže Sodja 09d6dfc8bf [Assign plugin] Add a compiler plugin for overloading assign ('=') operator 2022-09-16 10:12:41 +03:00
Alexander Udalov 0569f429dd Report error on -Xuse-old-backend, remove Gradle option useOldBackend
Allow using old JVM backend only to compile kts.

 #KT-48532 Fixed
2022-09-16 00:16:31 +02:00
Alexander Udalov 97f63d539c Remove tests on jvm-abi-gen with old JVM backend
#KT-48532 Fixed
2022-09-16 00:16:31 +02:00
Dmitriy Novozhilov efc443e7ef [NoArg] Add test for KT-53122 2022-09-15 17:27:19 +03:00
Dmitriy Dolovov e4556ecc0d [IR] User-friendly message about unexpected unlinked symbols
^KT-53649
2022-09-13 17:12:13 +00:00
Dmitriy Novozhilov a78d43c1ec [Lombok] Support RawTypes in fields wtih @Singular in K2 version
^KT-53657 Fixed
2022-09-12 11:29:17 +00:00
Dmitriy Novozhilov 06119a4670 [Lombok] Fix support of Iterable field marked with @Singular
^KT-53647 Fixed
2022-09-12 11:29:17 +00:00
Dmitriy Novozhilov 4ab79ed97d [Lombok] Fix behavior of ignoreNullCollections parameter of @Singular
^KT-53724 Fixed
^KT-53721 Fixed
2022-09-12 11:29:16 +00:00
Dmitriy Novozhilov 2aadaee69f [Lombok] Properly support Guava collections with @Singular
^KT-53683 Fixed
2022-09-12 11:29:16 +00:00
Leonid Startsev 62f67e46fd Add SerializerFactory supertype for Native & JS in FIR serialization plugin.
This supertype is intended to be used with @AssociatedObject on platforms
where reflection possibilities are limited.
2022-09-12 10:19:39 +00:00
Vladimir Sukharev c8864369fd Use main class as test generator name
Merge-request: KT-MR-7031
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2022-09-09 12:51:18 +00:00
Alexander Udalov e83819e682 Minor, remove obsolete directives from jvm-abi-gen tests
Language version 1.6 was needed in these tests to enable annotation
instantiation, but that feature is now enabled by default.
2022-09-09 14:32:36 +02:00
Alexander Udalov 6e1cddd039 Disable @SourceDebugExtension generation in jvm-abi-gen tests
In these two tests, contents of the annotation differ by design, and
that does not constitute a difference in ABI.
2022-09-09 14:32:35 +02:00
Alexander Udalov 7dad47cd76 Add -X argument to disable generation of @SourceDebugExtension
This will be used in tests in the subsequent commit.
2022-09-09 14:32:35 +02:00