Commit Graph

3025 Commits

Author SHA1 Message Date
pyos 3a80cb1808 FIR: hide construction of JavaSymbolProvider 2021-09-14 19:00:45 +03:00
Ilya Kirillov a8d321db63 FIR IDE: do not use FE1.0 compiler jars in frontend-independent-modules 2021-09-14 14:45:43 +02:00
Ivan Kochurkin 8cdb79f969 Move JvmNames, JvmFieldApplicabilityProblem to common.jvm module 2021-09-10 00:49:10 +03:00
Ivan Kochurkin 6fa1c0353c Use deprecation type for some REPEATABLE_* diagnostics 2021-09-10 00:49:06 +03:00
Ivan Kochurkin 2baed77598 [FIR] Add JVM_SYNTHETIC_ON_DELEGATE diagnostic
Extract JVM names to common JvmNames
2021-09-10 00:49:03 +03:00
Ivan Kochurkin e3805c9b98 Extract JvmNames, JvmFieldApplicabilityProblem to compiler.common 2021-09-10 00:49:01 +03:00
Dmitriy Novozhilov 0260bf8767 [FE] Move diagnostic parameter renderers to common module 2021-09-09 17:20:20 +03:00
Dmitriy Novozhilov 850ca1916f [FE] Commonize positioning strategies and move them to :frontend-psi module 2021-09-09 17:20:17 +03:00
pyos 090b90f62e FIR: load type qualifiers from module, package, and parent classes 2021-09-06 13:11:13 +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
Ilmir Usmanov 92fac304e7 Forbid @Synchronized annotation on suspend functions
and lambdas. With warning for now.
 #KT-27333
2021-08-30 13:47:34 +02:00
Ilmir Usmanov 1f8dd45c2b Remove experimental coroutines support. Part 2 2021-08-30 14:21:57 +03:00
Dmitriy Novozhilov 7e6e0a3dd6 Remove all type system-specific inheritors of TypeCheckerState 2021-08-26 10:08:51 +03:00
Dmitriy Novozhilov 8b5548df49 Rename AbstractTypeCheckerContext to TypeCheckerState 2021-08-26 10:08:51 +03:00
Mikhail Glukhikh 255eb87375 Provide more clear API around AnnotationChecker.applicableTargetSet 2021-08-23 14:18:38 +03:00
Victor Petukhov 7567597be6 Java nullability checker: take type arguments' types from resolution atom if possible, instead of from resolved call directly
^KT-47833 Fixed
2021-08-04 17:36:51 +03:00
Dmitriy Novozhilov d17f984edf [FE 1.0] Migrate most of warning/error pairs to DiagnosticFactoryForDeprecation 2021-08-03 00:17:33 +03:00
Alexander Udalov 847c58d574 Report error on class named Container inside repeatable annotation
#KT-12794
 #KT-47971
2021-07-30 19:53:44 +02:00
Alexander Udalov e20b354dbd Check repeatable annotation container parameters, retention, target
#KT-12794
 #KT-47928
2021-07-30 19:53:33 +02:00
Alexander Udalov 67128c022a Report error if both repeatable annotation and its container are used
#KT-12794
2021-07-30 19:53:32 +02:00
Alexander Udalov b2550f69bc Report error if repeated annotation is used with JVM target 1.6
#KT-12794
2021-07-30 19:53:32 +02:00
Alexander Udalov 87130edfa2 Support using Java-repeatable annotations in Kotlin
#KT-12794
2021-07-30 19:53:32 +02: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
Victor Petukhov c5d783596d Check type parameter bounds by java nullability annotations not only in basic resolution context
^KT-47920 Fixed
2021-07-29 14:23:55 +03:00
Mikhail Glukhikh 810def829c Make EXPERIMENTAL_ANNOTATION_ON_OVERRIDE warning till 1.6 2021-07-27 14:58:55 +03:00
Alexander Udalov 50f7594d9e Minor, move RepeatableAnnotationChecker to separate file 2021-07-26 14:33:31 +02:00
Alexander Udalov 9ebd665c96 Report error on annotated type inside typeOf on JVM
Since it's not feasible to support annotated types in 1.6, we're making
this an explicit error in 1.6, so that typeOf can become stable and this
feature can be supported in the future without breaking changes to the
existing code.

Note that extension function types are a special case of annotated
types. A separate error is created for them just because the message
"annotated types are not supported" would be confusing, since such types
don't have explicit annotations in the source code.

 #KT-29919
2021-07-22 15:54:48 +02:00
pyos f5dd5ead1f JVM: produce a better error on @JvmStatic external in interface
Java does not permit `static native` methods in interfaces, so this
never worked on any existing JRE.

 #KT-43696 Fixed
2021-07-16 15:24:09 +02:00
Alexander Udalov 02774fae0c Report error on non-reified type parameter with recursive bound in typeOf
Instead of throwing an exception.

 #KT-40173
2021-07-09 14:31:52 +02:00
Alexander Udalov 438ce57183 Report error on typeOf<suspend ...>()
Otherwise an invalid type is constructed which causes kotlin-reflect to
crash, and stdlib implementation to render the type incorrectly. The
reason is that suspend functional types are not properly supported in
reflection. Once they are supported, this error can be removed.

 #KT-47562
2021-07-09 14:31:52 +02:00
Victor Petukhov 46d0b16142 Use new default settings for java nullability annotations in JavaTypeEnhancementState and get rid of all hardcoded defaults 2021-07-06 09:54:24 +03:00
Victor Petukhov c8af1b735f Introduce compiler flag to manage status of specific Java nullability annotations 2021-07-06 09:54:23 +03:00
Denis.Zharkov 7645663d12 Deprecate (V)::a reference resolution to companion in FE 1.0
^KT-45315 Fixed
2021-06-25 18:41:14 +03:00
Vladimir Dolzhenko 2c8d583d8b Added ad-hoc KtValueArgument.stringTemplateExpression
Use only stub stringTemplateExpression if it is present and don't use ast nodes as it could be unbounded

#KT-47034 Fixed
2021-06-10 21:14:32 +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
Victor Petukhov 5a11450d77 Split stub types into stub type for subtyping and for builder inference and use them in the proper way 2021-05-28 15:36:17 +03:00
Victor Petukhov b78c645fb0 Report warnings by enhanced base types 2021-05-18 17:52:39 +03:00
Victor Petukhov 937e82db46 [Jspecify] Report warnings on violated bounds of method type parameters 2021-05-18 17:52:06 +03:00
Dmitriy Novozhilov 28be3a0dbc [FIR] Replace Path with String in KotlinJvmBinaryClass.containingLibrary
This is needed because :core:deserialization.common.jvm uses JDK 6
2021-05-14 14:30:37 +03:00
Dmitriy Novozhilov 02c58b7a8f [FIR] Refactor deserialized dependency providers and session factories with FirModuleData 2021-05-14 14:30:33 +03:00
Dmitriy Novozhilov d114913cd2 Replace usages of addToStdlib.firstNotNullResult with firstNotNullOfOrNull 2021-05-14 14:30:19 +03:00
Vladimir Dolzhenko cf5e6b242b Wrap exception with file details
Relates to #KT-39776
2021-05-07 23:48:12 +02:00
n-p-s d70b889004 Update declarations to be searchable by their JvmName annotation
Relates to #KT-23653
2021-05-07 17:43:26 +03:00
Victor Petukhov 2e57ff25ee Leave KotlinCliJavaFileManager::findClass only passing JavaClassFinder.Request 2021-04-30 14:43:27 +03:00
Victor Petukhov bc5e92033b Support reading annotations on java 9 module on sources and binaries 2021-04-30 14:43:27 +03:00
Victor Petukhov 49e838781c Clean-up JavaModuleInfo.kt 2021-04-30 14:43:25 +03:00
Andrey Zinovyev 01dd3d6ed4 [lombok] Refactoring, cleaning, better tests
Add assertions to tests
Add lombok license
Provide String.[de]capitalize() implementation
Get rid of weak map because it seems it is useless here
2021-04-25 18:18:18 +03:00
Andrey Zinovyev f71e08df4d [lombok] Experimental lombok plugin prototype
Add extension point for java descriptors
Add simple usage of this point to generate getter method
Add simple test infrastructure to test compilation with lombok plugin
2021-04-25 18:17:53 +03:00
Ting-Yuan Huang 6c989bfd4b Support array of annotation in KotlinJvmBinaryClass
KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor didn't cover the
case when the element type is an Annotation. Therefore, when the
compiler read an array of annotations from JVM binary classes built from
Kotlin sources, it got an empty array regardless of what was written in
the bytecode.

For example, Foo.value below is read as an empty array when SomeClass
resides in another Kotlin module.

  @Foo(
    value = [Bar(1), Bar(2)]
  )
  class SomeClass
2021-04-14 13:14:26 +02:00