Commit Graph

390 Commits

Author SHA1 Message Date
Tianyu Geng 8ba2e4d221 FIR: move JavaAnnotationMapper.javaToKotlinNameMap to common
so that FIR IDE logic can reference it
2021-11-04 20:52:50 +01:00
Victor Petukhov d015d3bc0e Don't enhance previously erased value parameters for jspecify strict mode
^KT-48261 Fixed
2021-10-26 19:37:55 +03:00
Yan Zhulanow 516dd825c2 [FIR IDE] Initial descriptor-based implementation of the Analysis API 2021-10-20 19:41:24 +03:00
Georgy Bronnikov 41e38d5a1a JVM_IR: move serialized IR to a separate annotation 2021-10-02 00:56:46 +03:00
Victor Petukhov 0cb56be14f Have "in type" for java fields to be able to check that type in assignment positions (against rhs' type)
^KT-46727 Fixed
2021-09-30 20:08:52 +03:00
Denis.Zharkov 4733a0d970 Refine naming: *TypeVariable -> *TypeParameter 2021-09-30 14:36:27 +03:00
Denis.Zharkov 9ac29e0714 Fix enhancement when mixing TYPE_USE and non-TYPE_USE annotations 2021-09-28 22:59:18 +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
Dmitry Gridin a0d36d7e29 [core] annotation loader: pull up isRepeatableWithImplicitContainer to AbstractBinaryClassAnnotationAndConstantLoader to reuse from plugin
^KTIJ-19676
2021-09-22 04:54:28 +00:00
pyos 8f699248f1 FE: force flexibility on unannotated ?
TODO: unify this code with FIR

 #KT-48515 Fixed
2021-09-08 16:54:17 +03:00
pyos f793afbfea FE: do not enhance ? into ? extends @NotNull Object in JSR-305
This is already done in jspecify and makes more sense anyway.
2021-09-08 16:54:17 +03:00
pyos 34ae5387b3 FE: clean up typeEnhancement.kt a bit 2021-09-08 16:54:17 +03:00
Alexander Udalov 5dbf5b1d45 Cleanup type enhancement, remove ValueParameterData
`ValueParameterData.hasDefaultValue` is now always equal to the original
value parameter's `declaresDefaultValue` flag, so `ValueParameterData`
usages can be simplified to just `KotlinType`.
2021-09-07 19:05:48 +02:00
Alexander Udalov 7e43000d9b JVM: do not lose default parameter values during enhancement
The change in signatureEnhancement.kt in 432f581cb2 was incorrect.
Contrary to its name, the removed method `hasDefaultValueInAnnotation`
checked not only if the enhancement annotation has default value (which
is what the removed feature was about), but also if the parameter itself
declares default value. This was mistakenly substituted by just `false`
on line 234. The correct change is to use the `declaresDefaultValue`
flag of the original parameter.

It's kind of weird though that in case there's a nullability annotation
on the whole package (like in KT-48316) type enhancement is being done
on everything, including annotation constructors, whose parameter types
can't have any enhancement information. Maybe this should be improved
independently.

 #KT-48316 Fixed
2021-09-07 19:05:48 +02:00
pyos 0d78bcebca FE: rename an extension to avoid conflicts with FIR member 2021-09-06 13:11:20 +03:00
pyos 090b90f62e FIR: load type qualifiers from module, package, and parent classes 2021-09-06 13:11:13 +03:00
pyos c85329905c FE: remove ? enhancement code that is never used
Using `starProjectionType` to enhance `?` is pointless because
 1. we explicitly ignore nullability annotations for `?` below;
 2. mutability is irrelevant;
 3. `starProjectionType` never returns references to other type
    parameters due to how the type substitutor works.
2021-09-06 13:11:01 +03:00
pyos a8b09a2016 FE: extract FIR-reusable code from SignatureParts 2021-09-06 13:11:00 +03:00
pyos b31925e6c9 FE: slowly refactor extractQualifiersFromAnnotations 3 2021-09-06 13:10:59 +03:00
pyos 5c8d3180f7 FE: slowly refactor extractQualifiersFromAnnotations 2 2021-09-06 13:10:59 +03:00
pyos 9af8abb8b9 FE: slowly refactor extractQualifiersFromAnnotations 1
That code is convoluted, better take it slow to avoid accidentally
breaking (or fixing) anything.
2021-09-06 13:10:58 +03:00
pyos 8d39d155bb FE/FIR: extract common code for mutability qualifiers 2021-09-06 13:10:57 +03:00
pyos c753e547c6 FE/FIR: extract common code for type qualifier inheritance 2021-09-06 13:10:56 +03:00
pyos 19a9de32f8 FE: move SignatureParts out of SignatureEnhancement 2021-09-06 13:10:55 +03:00
pyos 56d37c8e1c FE: separate type enhancement and FunctionN@Java warnings 2021-09-06 13:10:55 +03:00
pyos f4f9b1b27b FE: refactor propagation of type qualifier defaults though arguments 2021-09-06 13:10:54 +03:00
pyos e0d0bf9ede FIR/FE: extract common code for type qualifier defaults 2021-09-06 13:10:54 +03:00
pyos 8bf5e86788 FIR/FE: extract common code for handling known nullability annotations 2021-09-06 13:10:53 +03:00
pyos 9349d4b0d2 FIR/FE: extract common AnnotationTypeQualifierResolver code
TODO: extract the equivalent code that uses it...
2021-09-06 13:10:52 +03:00
pyos 29a240b261 FE: refactor AnnotationTypeQualifierResolver
Preparing for commonization with FIR
2021-09-06 13:10:51 +03:00
Dmitriy Novozhilov d46e2dd749 Fix OVERRIDE_DEPRECATION warnings in project code 2021-09-02 15:04:07 +03:00
Dmitriy Novozhilov 69c3831865 Rename Deprecation to DeprecationInfo 2021-09-02 15:04:07 +03:00
Dmitriy Novozhilov 762d225bd7 Unify Deprecation classes from :core:compiler.common and :compiler:frontend modules 2021-09-02 15:04:06 +03:00
Hung Nguyen a342c81a9f KT-45777: Take snapshots and compute changes for Java classes
Create `JavaClassDescriptor`s for Java classes
Ignore anonymous and synthetic classes
as they can't impact recompilation.
Clean up handling of local and anonymous classes

Bug: KT-45777
Test: New JavaClassDescriptorCreatorTest
2021-09-01 13:29:17 +03:00
Ilmir Usmanov 1f8dd45c2b Remove experimental coroutines support. Part 2 2021-08-30 14:21:57 +03: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
Victor Petukhov d730db094a Don't look at raw type's arguments while enhancing super types
^KT-48172 Fixed
2021-08-20 13:10:45 +03:00
Victor Petukhov 63cefe228d Extract computing raw type arguments into separate method 2021-08-20 13:10:42 +03:00
pyos 47d0211370 FE: do not enhance ? in jspecify NullMarked scope
No clue whether this should be done for `@TypeQualifierDefault` since it
appears to have no specification whatsoever.

 #KT-48262 Fixed
2021-08-18 16:41:00 +03:00
Ilmir Usmanov 486c6b3c15 Remove obsolete experimental coroutines support
in compiler.
2021-08-13 22:31:30 +02:00
Hung Nguyen eb94167ff2 Move RuntimeModuleData from :core:descriptors.runtime to :core:descriptors.jvm
We are working on a feature in the Kotlin Gradle plugin called
`kotlin.incremental.useClasspathSnapshot` to improve incremental
Kotlin compilation.

To allow reuse when writing this feature, this commit moves most of the
code in RuntimeModuleData (in the ':core:descriptors.runtime' project)
to DeserializationComponentsForJava (in the ':core:descriptors.jvm'
project), so that the API can be accessed from the
':kotlin-gradle-plugin' and ':kotlin-build-common' projects where the
feature is written.

Bug: KT-45777
Test: Existing tests should pass (this is a refactoring-only change)
2021-08-10 12:29:45 +03:00
Alexander Udalov f8af127a4e Do not load Java @Repeatable for Kotlin-repeatable annotations
#KT-48131 Fixed
2021-08-06 22:47:36 +02:00
Dmitriy Novozhilov fa1d09c778 [FE 1.0] Support java sealed classes
^KT-46778 Fixed
2021-08-01 22:23:45 +03:00
Alexander Udalov f723389565 Remove mapping of java.Repeatable to kotlin.Repeatable in JavaAnnotationMapper
The main motivation for this change is that
java.lang.annotation.Repeatable has a parameter for the container
annotation, which is lost during conversion to
kotlin.annotation.Repeatable. To support j.l.a.Repeatable in backend
properly, it's absolutely necessary to be able to load the container
annotation for any repeatable annotation class, so the original
j.l.a.Repeatable needs to be stored in the descriptor and accessible
from the backend.

Instead of mapping j.l.a.Repeatable -> k.a.Repeatable, add a frontend
service PlatformAnnotationFeaturesSupport that will determine if an
annotation is repeatable "according to the platform rules", which for
JVM means that it's annotated with j.l.a.Repeatable.

Some effects of this change include:
- Usages of j.l.a.Repeatable are no longer reported as "deprecated", the
  corresponding test is deleted
- Usages of repeatable annotations declared in Java with non-SOURCE
  retention with LV 1.5 and earlier will now result in a slightly
  different error (REPEATED_ANNOTATION instead of
  NON_SOURCE_REPEATED_ANNOTATION)

 #KT-12794
2021-07-30 19:53:32 +02:00
Denis.Zharkov 8f484fcf88 Fix propagation of definitelyNotNull types from overrides 2021-07-29 19:45:57 +02:00
pyos 8c524c2f89 FE: do not attach enhancements to parts of enhanced flexible types 2021-07-29 14:52:51 +03:00
Victor Petukhov 20d50cfee7 Prevent leaking of type parameter erasion results cache into static scope 2021-07-29 14:23:55 +03:00
Victor Petukhov 6706ee87ad Introduce TypeParameterUpperBoundEraser to memorize results of type parameters erasion computation
^KT-47785 Fixed
2021-07-29 14:23:54 +03:00
Victor Petukhov f9cb0d61a8 Don't apply Java defaulting nullability annotations rules to unbounded wildcards
^KT-47396 Fixed
2021-07-29 14:23:53 +03:00
Victor Petukhov 99491014e4 Prefer flexible nullability by Java annotations to nullable one if the corresponding type parameter has nullable bound
^KT-47422 Fixed
2021-07-29 14:23:52 +03:00