451 Commits

Author SHA1 Message Date
Mikhail Glukhikh c4bcdc42c1 K2: don't count use-sites of Java type parameter with nullable bounds as not null 2024-03-11 18:05:04 +00:00
Mikhail Glukhikh 91e9fbd9bf K1: change depr. level of List.getFirst to HIDDEN but don't force it on overrides
#KT-65441 Fixed
2024-02-27 08:40:53 +00:00
Kirill Rakhman ac203591e5 [FE, Java resolve] Support inheritors of sealed Java type without permits clause
This fixes a false negative NO_ELSE_IN_WHEN in K2 and incidentally
also fixes a false positive NO_ELSE_IN_WHEN in K1 since the fix is in
the common code.

#KT-62491 Fixed
2023-10-31 13:41:56 +00:00
Ivan Kochurkin 1827df82c4 Removed useless as casts from compiler code
It allows compiling code with K2 and enabled `-Werror`
2023-10-24 20:59:56 +00:00
Mikhail Glukhikh 8b8088720b Rename: DeserializedContainerAbiStability.IR_UNSTABLE -> UNSTABLE
Related to KT-62056
2023-09-21 11:14:09 +00:00
Mikhail Glukhikh a77b758efa LV 2.0: drop reporting FIR_COMPILED_CLASS and relevant stuff
#KT-62056 Fixed
Related to KT-59171, KT-61951
2023-09-21 11:14:09 +00:00
Alexander Udalov bb381e7aef IR: check visibility when building fake overrides
This fixes the difference at least in the IR text test
testFakeOverridesForJavaNonStaticMembers. There's no fake override
created anymore for `packagePrivateMethod` in Test2.

 #KT-61366 Fixed
2023-09-18 12:33:07 +00:00
Iaroslav Postovalov 059046a2b1 [JVM] Micro-optimize method signature mapping
This commit optimizes functions related to method signature mapping on
the JVM backend. The most significant change is avoiding re-allocations
in StringBuilder when building internal names. The commit also includes
minor optimizations, such as removing redundant allocations of strings
and other objects.
2023-09-01 20:26:17 +00:00
Denis.Zharkov bd46bb02c1 K1: Enhance deprecation messages for getFirst/getLast JDK 21 members
^KT-60659 Fixed
^KT-60769 Fixed
2023-08-03 13:31:07 +00:00
Denis.Zharkov eae97e4f76 K1: Force propagating deprecation on NOT_CONSIDERED JDK members to overrides
^KT-60858 Related
KT-60659 In Progress
^KT-60769 In Progress
2023-08-03 13:31:07 +00:00
Denis.Zharkov 180a3bb320 K1: Fix false-positive ABSTRACT_MEMBER_NOT_IMPLEMENTED with JDK 21
Previously, it was reported for List.toArray because, when traversing
supertypes, we've been stopped at j.u.SequencedCollection
as it has no JavaAnalogue.

^KT-60770 Fixed
2023-08-02 15:32:25 +00:00
Nikita Bobko f4ba5aaf9a [FE 1.0] Prohibit implicit Java actualization in K1
^KT-58545 Fixed
Review: https://jetbrains.team/p/kt/reviews/10561

It's not yet supported in K2 KT-59213

Related tests:
- ApiTest.testStdlib
- RuntimePublicAPITest.kotlinStdlibRuntimeMerged
- KotlinProjectViewTestGenerated.test_Arrays (in Kotlin plugin)
2023-07-25 22:30:09 +02:00
Karl Wingblade 72e678ad69 KT-52071 Fallback if sys prop read is blocked
If the Java Security Manager blocks reading the system property
`kotlin.ignore.old.metadata`, then continue gracefully with the
default value.
2023-05-22 16:06:56 +02:00
Anna Kozlova 7ee648a4f5 [cls] include annotation arguments in cls stubs
^ KTIJ-24666
this would allow to build fir based on stubs,
do not keep ProtoBuf in memory and
search in decompiled code by stubs
2023-04-26 21:43:15 +02:00
Anna Kozlova f0af7c4228 [cls] include property constant initializer in stubs
^KTIJ-24667
this would allow building FirElements from stubs
2023-04-26 21:43:15 +02:00
Mikhail Glukhikh 41e551e321 K1: add deprecation warning for property/field pair with different types
#KT-57905 Fixed
2023-04-26 11:47:16 +00:00
Marco Pennekamp f9785c1050 [LL FIR] KT-57455 Avoid creating optional annotation class providers
- An `OptionalAnnotationClassesProvider` only needs to be created if the
  package part provider may even have optional annotation classes.
- In the IDE case, the package part provider never provides optional
  annotation classes, so especially in the IDE, we can avoid a lot of
  useless symbol providers with this.
2023-03-27 10:38:50 +00:00
Evgeniy.Zhelenskiy 5b868becf4 [IR] Hide regular class constructor with MFVC parameters
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
2023-03-07 21:44:41 +00:00
Dmitriy Novozhilov 0550f0d394 [Lombok] Make visibility of fields of @Value classes private by default (K1)
^KT-51092
2023-02-10 12:30:12 +00:00
Ivan Kochurkin a9bac2f18b Add PackageAndMetadataPartProvider interface
Use it for parameter in MetadataSymbolProvider
2023-02-07 14:16:29 +00:00
Roman Efremov 878608b7b2 Don't add Enum.entries to scope if it can't be called
^KT-53929 Fixed
2023-01-23 12:53:06 +01:00
Denis.Zharkov 58c1b5dd1f K2: Optimize AbstractFirDeserializedSymbolProvider
Avoid filling caches with keys that are definitely empty
(if it's cheap to compute that), to decrease the size of backing maps.

The strategy is pre-computing the sets of names that might be met.
NB: the size of the sets is way fewer than a size of all queried names.
2023-01-19 10:57:42 +00:00
Mikhail Glukhikh cbedbda527 Enhance API/messages around BinaryVersion / JvmMetadataVersion 2023-01-16 18:16:07 +01:00
Mikhail Glukhikh 0c4a0360ac Deserialization/class reading: pass chosen JvmMetadataVersion whenever possible 2023-01-16 18:16:07 +01:00
Vladimir Dolzhenko d6e587171e Optimize isDefinitelyNotSamInterface
Do not generate intermediate garbage and no reason to iterate over
all non-SAM candidates when more than one found

#KTIJ-23032
2023-01-03 14:36:01 +00:00
pyos 6c6d653e85 FE: don't lose annotations on Java primitive arrays
but only use them to enhance for warnings for now.

^KT-48861 Fixed
2022-10-26 09:33:40 +02:00
Dmitriy Novozhilov d423782fac [FE 1.0] Remove usages of safeAs and cast from most of FE 1.0 modules:
- :core:descriptors
- :core:descriptors.jvm
- :core:deserialization
- :compiler:cli
- :compiler:frontend
- :compiler:frontend:cfg
- :compiler:frontend.java
- :compiler:frontend.common.jvm
- :compiler:psi
- :compiler:resolution
- :compiler:resolution.common
- :compiler:resolution.common.jvm
- :kotlin-reflect-api
2022-10-12 13:58:56 +00:00
Alexander Udalov 4dcf50d483 Fix reflection for repeated annotations with array arguments
This is related to 8308f5d7d3 (KT-44977).

It turns out that it's necessary to create `ArrayValue` with a
precomputed type not only in case of annotations stored directly in
Kotlin metadata (i.e. annotations on types and type parameters), but
also for arguments of repeated annotations. The reason is that repeated
annotations are stored in an array themselves, as an argument to another
(container) annotation. The annotation-reading code unwraps this array
to load repeated annotations as individual instances of
`AnnotationDescriptor`, but in contrast to loading normal annotations,
it doesn't set `source` to the reflection object, it uses `NO_SOURCE`
(see BinaryClassAnnotationAndConstantLoaderImpl.AbstractAnnotationArgumentVisitor.visitArray).

So when kotlin-reflect is later asked for the arguments of the
annotation, it needs to recreate the reflection object from
`AnnotationDescriptor` in `util.kt`. Doing so requires knowing the array
type, which is now present because we're creating a `TypedArrayValue`
(previously `DeserializedArrayValue`) in places where arrays are read as
annotation arguments.

Alternative solution would be to fix source passed to
`AnnotationDescriptorImpl` in the annotation-reading code, but that
seems a bit messy because the code is very abstract and is used in lots
of other places.

 #KT-53279 Fixed
2022-10-07 10:48:51 +00:00
Vladimir Dolzhenko bd085fbf43 Optimize isDefinitelyNotSamInterface
Do not generate intermediate garbage and no reason to iterate over
all non-SAM candidates when more than one found

#KTIJ-23032
2022-09-27 15:17:27 +00:00
Roman Golyshev 3ea78ae745 Revert some changes from 3042a80f
Too many places right now depend on `KotlinClassHeader.data` and
`KotlinClassHeader.strings` being saved even if empty,
and not being null

See KT-39492
2022-08-25 14:43:25 +00:00
Roman Golyshev 3042a80faf KT-39492: Ignore default values from Kotlin Metadata in KotlinMetadataArgumentVisitor
^KT-39492 Fixed
^KTIJ-18094 Fixed
^KTIJ-17632 Fixed

Merge-request: KT-MR-6914
2022-08-24 12:30:33 +00:00
Aleksei.Cherepanov df017ea187 Clean JavaClassesTracker and LookupTracker on call RetryWithAdditionalRoots
#KT-38576 Fixed
2022-08-16 14:38:01 +00:00
Abduqodiri Qurbonzoda 34e50649e8 Switch JVM target of the standard libraries to 1.8 #KT-51907 2022-08-13 01:33:45 +03:00
Mikhail Glukhikh 3a2d69225c K1: add support for Enum.entries in Java scopes 2022-08-12 09:35:25 +00:00
Dmitriy Novozhilov b32f9dcac2 [Lombok K1] Support @Singular annotation
^KT-46959
2022-08-11 15:22:35 +03:00
Dmitriy Novozhilov 6fde784b55 [FE 1.0] Allow generation of nested classes for java classes from plugins 2022-08-11 15:22:35 +03:00
Dmitry Gridin 4f18e7091b [light classes] analysis-api-fir: migrate from :compiler:backend to :compiler:backend.common.jvm
^KT-53097
2022-08-01 13:56:35 +00:00
Victor Petukhov cb2dbca0c3 [FE 1.0] Support loading rxjava3 nullability annotations on bounded wildcards
^KT-53041 Fixed
2022-07-11 12:44:07 +00:00
Yahor Berdnikau af6f17c243 Unify kotlinCompilerClasspath for all projects
This will prevent spawning second Kotlin daemon during compilation
except 'buildSrc' compilation. Original change was introduced in
2e515f3945 commit.
2022-05-24 07:58:38 +00:00
Victor Petukhov 4293b546ba [FE] Provide org.jetbrains.kotlin.load.java.components.TypeUsage as an alias of org.jetbrains.kotlin.types.TypeUsage for IDEA 2022-04-27 19:50:27 +00:00
Victor Petukhov f31cf90de2 [FE 1.0] Unbind type parameter erasing from java 2022-04-27 19:50:22 +00:00
Alexander Udalov 2e515f3945 Prohibit JVM target 1.6
But still compile stdlib, reflect, kotlin.test and scripting runtimes
with JVM target 1.6 to simplify migration from Kotlin 1.6 to 1.7.

 #KT-45165 Fixed
2022-04-19 22:54:40 +02:00
Ilya Chernikov 5d6e2b57a7 Sort sealed class inheritors to ensure reproducible builds with IC
without this sorting the inheritors field in the metadata may depend on
whether some inheritors are compiled in the IC round or not.
2022-03-30 08:35:30 +00:00
Evgeniy.Zhelenskiy 28bf83ceac [IR] Unite inline class and multi-field value class representation
#KT-1179
2022-03-24 11:38:43 +00:00
Evgeniy.Zhelenskiy 282ab398c6 [IR] Generify lowerings
#KT-1179
2022-03-24 11:38:42 +00:00
Victor Petukhov b5933c70e2 [FE 1.0] Refactor error utils: split error entities and introduce error type and error scope kinds 2022-03-23 21:13:33 +00:00
Ilmir Usmanov 8811f62300 Fix mapping of nullable generic underlying types of inline classes
#KT-32162 Fixed
2022-02-23 01:23:07 +03:00
Dmitriy Novozhilov 17916d4a63 [FE] Return Name? instead of List<Name> from getBuiltinFunctionNamesByJvmName
This is much more correct, because we have one to one mapping for
  special java functions in this case, so using single nullable name
  instead of list of names makes code more readable
2022-01-19 15:24:43 +03:00
Irene Dea 374d287d08 Reorganize TypeAttributeTranslatorExtension 2022-01-08 15:26:38 +03:00
Irene Dea 19bfc43bee Fixes and refactors 2022-01-08 15:25:07 +03:00