Commit Graph

525 Commits

Author SHA1 Message Date
Vyacheslav Gerasimov bc2f0936bd Build: Rename commonDep -> commonDependency 2021-12-16 21:48:19 +03:00
Victor Petukhov 6fed67b36c Revert "Revert "Fix setCompileTimeInitializer usage in MemberDeserializer.kt""
This reverts commit 965bab2d2d.
2021-12-14 14:21:48 +03:00
Victor Petukhov 24900630cb Revert "Revert "[FE 1.0] Provide an API to clean compile time initializer cache for variable descriptor""
This reverts commit faeb5d21ab.
2021-12-14 14:21:46 +03:00
Nikolay Krasko faeb5d21ab Revert "[FE 1.0] Provide an API to clean compile time initializer cache for variable descriptor"
This reverts commit 0e6762acc3.
2021-12-10 16:54:55 +03:00
Nikolay Krasko 965bab2d2d Revert "Fix setCompileTimeInitializer usage in MemberDeserializer.kt"
This reverts commit 9281ab334a.
2021-12-10 16:54:55 +03:00
Victor Petukhov 9281ab334a Fix setCompileTimeInitializer usage in MemberDeserializer.kt 2021-12-09 17:07:07 +03:00
Victor Petukhov 0e6762acc3 [FE 1.0] Provide an API to clean compile time initializer cache for variable descriptor 2021-12-09 16:15:24 +03:00
Leonid Startsev 767c570af4 Load default values for annotation members from classfiles
so that defaults are available to synthetic implementations.

#KT-48181 Fixed

Implementation is for JVM IR; other backends & FIR need to be supported
separately.
2021-12-07 10:10:04 +00:00
Anastasiya Shadrina 617af898b0 [FE, IR] Support deserialization 2021-12-02 20:24:37 +03:00
Anastasiya Shadrina e3f987459c [PSI, FE] Support functional types 2021-12-02 20:24:11 +03:00
Anastasiya Shadrina a39fbd3822 [FE] Add getContextReceivers to CallableDescriptor interface 2021-12-02 20:23:17 +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
Dmitriy Novozhilov d46e2dd749 Fix OVERRIDE_DEPRECATION warnings in project code 2021-09-02 15:04:07 +03:00
Ilmir Usmanov 1f8dd45c2b Remove experimental coroutines support. Part 2 2021-08-30 14:21:57 +03:00
Ilmir Usmanov fdd069ddec Read experimental suspend functional types as suspend
Before 1.6 we wrote suspend functional types with last parameter of
kotlin.coroutines.experimental.Continuation type to .kotlin_metadata
files. For example, kotlin-stdlib-common. Thus, we need to read
them, since coroutines have been released in 1.3 and we need to be able
to read stable binaries.
2021-08-30 10:44:30 +02:00
Dmitriy Novozhilov e07512a847 Delegate refineType and prepareType in TypeCheckerState to special services
This is needed to add ability to create type system independent TypeCheckerState
2021-08-26 10:08:51 +03:00
Ilmir Usmanov 486c6b3c15 Remove obsolete experimental coroutines support
in compiler.
2021-08-13 22:31:30 +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
Yahor Berdnikau 7789054547 Migrate repo to use JVM toolchains Gradle feature.
^KT-46972 Fixed
2021-07-05 14:11:12 +00:00
Dmitry Savvinov 708fead1cc Add debug strings to frontend scopes-related structures
Such as:
- PackageFragmentProviders, and, in particular,
CompositePackageFragmentProviders
- JavaPackageFragments
- Scopes produced by those providers

The rationale is that a lot of frontend-facing bugs (like red code) are
easily recognizeable in resolution. But at that point you just see a
bunch of scopes, without meaningful toStrings, you don't know who has
produced them, and what's exactly wrong.

With this commit it should make debugging slightly easier: now at least
you'll be able to see that "this scope is a scope of package fragment
for foo.bar of module baz" and decide whether the declaration should or
should not have been resolved from such scope.
2021-06-03 17:21:59 +03:00
Alexander Udalov c1021623e8 Do not use ClassLoader.getResourceAsStream in reflection
Use ClassLoader.getResource + openStream instead, to workaround an issue
in URLClassLoader.

Also set useCaches to false because kotlin-reflect only reads builtins
metadata once per class loader, and doesn't need it to be cached. Using
caches here might also lead to the problem of closed input streams when
protobuf is read in parallel. The test doesn't check exactly this,
though (it seems to succeed even if cached connections are used).

Note that BuiltInsResourceLoader has a JDK 9+ specialization at
libraries/reflect/api/src/java9, but that implementation does not need
any changes because it uses Module.getResourceAsStream which is not
affected by this issue in URLClassLoader.

 #KT-18277 Fixed
2021-06-02 22:54:16 +02:00
Mikhael Bogdanov a8186d19d6 Support annotations on class type parameters
#KT-43714
2021-06-01 06:33:50 +02:00
Alexander Udalov ceec451f3f Minor, slightly refactor TypeDeserializer.typeConstructor 2021-05-21 19:36:30 +02:00
Alexander Udalov 8308f5d7d3 Create array instances of correct types in reflection
Based on #4168.

 #KT-44977 Fixed

Co-authored-by: Arkady Bazhanov <arkady.bazhanov@gmail.com>
2021-05-14 11:16:29 +02:00
Alexander Udalov 7fb3f48c67 Add ClassDescriptor.getInlineClassRepresentation
This will be used at least in the JVM backend instead of the current
approach where we're loading the primary constructor's first parameter,
which isn't good enough since primary constructor can be private, and
we can't rely on private declarations in case they're declared in
another module.
2021-05-13 13:54:02 +02:00
Denis.Zharkov 30eb9ad32f Add serialization/deserialization of definitely-not-null types
^KT-26245 In Progress
2021-04-09 13:06:31 +03:00
Vladimir Dolzhenko e511eec90e Added optimized PackageFragmentProvider#isEmpty(FqName) 2021-04-09 09:27:39 +00: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
Ilya Kirillov 6f887896ff FIR IDE: use CallableId for KtCallableSymbol instead of FqName 2021-03-24 18:13:04 +01: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
Alexander Udalov b7d32a8754 Minor, invert analysis flag that allows unstable dependencies 2020-12-20 23:13:50 +01:00
Andrei Klunnyi 3af0257b38 KTIJ-664 [SealedClassInheritorsProvider]: IDE-specific implementation 2020-12-15 18:43:00 +01:00
Dmitriy Novozhilov 6809adee9c [FE] Extract computation of sealed class inheritors into separate component
This is needed to provide more optimal provider in IDE plugin
2020-12-09 22:54:31 +03:00
Dmitriy Novozhilov e76acc8ee0 [FE] Collect inheritors of sealed classes from new places in computeSealedSubclasses
#KT-13495
2020-12-09 22:54:24 +03:00
Ilmir Usmanov 361ed117bb Value classes: Add isValue property to class descriptors
Reuse isInline flag in proto and IR.
Check metadata version on deserialization.
2020-11-27 23:52:05 +01:00
Roman Golyshev ebfbc2f601 KT-43205 Ignore annotations in CallableClsStubBuilder when needed
Kotlin compiler can add `@Deprecated` annotations to the fields of
private companion objects, and if those annotations are not supposed to
be shown in decompiled code and used, the field is marked with
`HAS_ANNOTATIONS=false` flag (see KT-25009)

However, it was not taken into account in stubs building process, which
led to the 'Stubs vs PSI mismatch' exceptions

^KT-43205 Fixed

Also, restore the order of nested typealiases and classes (see KT-41859)

We didn't want to bump the version of the stubs when we fixed this
issue; now we have an opportunity to restore the order back to
match the `MemberComparator`

Also, some refactoring is done to underscore that
`createPackageDeclarationsStubs` is suitable only for packages, not
for any declarations container
2020-11-09 15:49:50 +00:00
Alexander Udalov b2d49e9615 Minor, fix whitespace in toString 2020-11-06 19:26:49 +01:00
Mikhail Zarechenskiy bb2e9e2d56 Extract new method from the publicly used interface for compatibility
Note that we can't just use ``@JvmDefault` annotation as the main change
 is in the `core` module which targets Java 6

 #KT-42259 Fixed
2020-10-27 14:14:39 +03:00
Vladimir Dolzhenko 3c380faeb5 Added deprecated PackageFragmentProvider#getPackageFragments for BWC
Relates to ^KT-33394
^KT-42259 Fixed
2020-09-29 19:14:44 +00:00
Roman Golyshev 945edfe987 KT-41859 Place classes after typealiases in DeserializedMemberScope
This way, the order in stubs and in deserialized text would be the same

On the next stub version bump, this fix should be reworked: the order
in the `DeserializedMemberScope` should be restored, and the order in
the stubs should be fixed to match the order in `MemberComparator`

^KT-41859 Fixed
2020-09-25 09:03:12 +00:00
Roman Golyshev 6d0a5a0bb2 KT-41346 Implement NoReorderImplementation without reordering
- See the documentation for `DeserializedMemberScopeHelper` for the full
info about the fix and the issue
- Add `preserveDeclarationsOrdering` setting to
`DeserializationConfiguration`
- Enable this setting in `DeserializerForClassfileDecompiler`
- Also, use `List` instead of `Collection` to pass members to
`DeserializedMemberScope`. It is done to emphasize that the order of
the members is important and may be used
- Review: https://jetbrains.team/p/kt/review/1627
- ^KT-41346 Fixed
2020-09-23 15:27:51 +00:00
Roman Golyshev bf371ff98a KT-41346 Refactor computeNonDeclared*
Change the signature of the `computeNonDeclared*` methods so they expect
mutable lists - it better suits their contracts. Also, add a little
documentations about the contract

Also, change `Collection` to `List` for incoming protos to `emphasize`
that their order might be used
2020-09-23 15:27:50 +00:00
Roman Golyshev b1097c49d3 KT-41346 Move Implementation to DeserializedMemberScope 2020-09-23 15:27:49 +00:00
Roman Golyshev 5596bf33d8 KT-41346 Move related code to OptimizedImplementation
This does not change any semantics, only moves the code around
2020-09-23 15:27:49 +00:00
Roman Golyshev c8878f862d KT-41346 Introduce inner OptimizedImplementation class
Make it implement `Implementation` and move definitions
there
2020-09-23 15:27:48 +00:00
Roman Golyshev 683dd57f24 KT-41346 Extract Implementation interface
This is a temporary interface to make refactoring easier
2020-09-23 15:27:47 +00:00
Roman Golyshev 341a7478ed KT-41346 Move removing non-available functions to protected method
This would allow to stricten contract on `computeNonDeclaredFunctions`
2020-09-23 15:27:47 +00:00
Roman Golyshev 4f4c25ca5e KT-41346 Cleanup DeserializedMemberScope 2020-09-23 15:27:46 +00:00
Dmitriy Novozhilov 07a3009d43 Introduce new modules for common parts of deserialization 2020-09-11 10:08:37 +03:00
Dmitriy Novozhilov 5d4d07066b Move common deserialization components to :core:metadata and :core:metadata.jvm 2020-09-11 10:08:35 +03:00