Commit Graph

81 Commits

Author SHA1 Message Date
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00
pyos e1520c61da IR: use parameters for captures in field/instance initializers
val y = 1
    object { val x = y }
  ->
    class XKt$1(`$y`: Int) { val x: Int = `$y` }

Note that `$y` is not stored in a field because it's not used outside
the primary constructor.

One exception is captured inline parameters on the JVM backend, as the
bytecode inliner uses field assignment instructions (setfield) to locate
them; removing the field is thus not possible.
2021-09-29 16:25:43 +02:00
Steven Schäfer 6d518c8e57 JVM IR: Mark annotation implementation classes as anonymous
And add tests to ensure that annotation implementation classes are
handled correctly in jvm-abi-gen.
2021-08-23 18:25:33 +02:00
Alexander Udalov bc5a79ffcc Minor, add test on repeatable annotations on property getters
#KT-14392
 #KT-36476
2021-08-06 22:47:44 +02:00
Alexander Udalov 3636118743 Introduce typealias JvmRepeatable for j.l.a.Repeatable
#KT-12794 Fixed
2021-07-30 19:53:44 +02:00
Alexander Udalov 0a6d010d1c Support new repeatable annotations in kotlin-reflect
- Unwrap Kotlin-repeatable annotations (with implicit container)
- Introduce `KAnnotatedElement.findAnnotations` to find instances of
  repeated annotations

 #KT-12794
2021-07-30 19:53:33 +02:00
Alexander Udalov 26043f3968 Generate Java @Repeatable on Kotlin-repeatable annotation classes
#KT-12794
2021-07-30 19:53:32 +02:00
Alexander Udalov 92a73d7636 Generate container class for repeatable annotations
#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 104188c035 Render annotation arguments in bytecodeListing tests 2021-07-26 14:33:30 +02:00
Leonid Startsev 83c1a75c1e Revert "Revert "Instantiation of annotations for JVM IR with the corresponding feature flag""
Fix incorrectly rebased ce0a3a57df

This reverts commit 3d0126d5
2021-07-21 18:24:07 +03:00
Leonid Startsev 3d0126d5dd Revert "Instantiation of annotations for JVM IR with the corresponding feature flag"
because of incorrect rebase

This reverts commit ce0a3a57
2021-07-21 15:23:24 +03:00
Leonid Startsev ce0a3a57df Instantiation of annotations for JVM IR with the corresponding feature flag
Seperate checker for platforms that do not support this language feature yet

Synthetic implementations of annotations are generated on-demand with proper 
equals, hashCode, and annotationType methods

#KT-47699 Fixed
2021-07-21 10:23:51 +00:00
pyos 288451db4d JVM_IR: remove an unnecessary hack from BridgeLowering
Correct IR is more important than whether some inaccessible members
precisely match what was generated by the old backend.
2021-06-03 12:35:23 +03:00
Alexander Udalov 0c3f2eefe0 Migrate bytecodeListing tests to new test infrastructure 2021-04-23 17:58:16 +02:00
Alexander Udalov a917ebd11e JVM IR: use origin to detect property/typealias $annotations methods
Now that DEFAULT_IMPLS origins for methods do not exist after previous
commits, the name heuristic is no longer needed.
2020-12-02 15:54:15 +01:00
Dmitry Petrov 2b4564059e JVM_IR KT-43459 fix $annotations method receiver type 2020-12-01 19:43:51 +03:00
Dmitry Petrov 2662679579 KT-43399 properly erase extension receiver type in property$annotations 2020-11-23 13:58:52 +03:00
Dmitry Petrov 08b761ae7a PSI2IR don't copy annotations for properties implemented by delegation
KT-43012
2020-10-29 16:23:02 +03:00
Alexander Udalov fbf56c054b JVM IR: fix names of $annotations methods for internal properties
#KT-40384 Fixed
2020-10-14 19:32:51 +02:00
Dmitry Petrov c8bf74c7d5 Bytecode listing test fails if JVM and JVM_IR have same testData 2020-10-13 19:20:29 +03:00
Alexander Udalov b8d16f3d46 Add EnclosingMethod information to bytecode listing tests 2020-09-02 16:46:05 +02:00
Alexander Udalov a639915a34 JVM IR: do not mangle property accessors of unsigned types in annotations
Before this change, we incorrectly mangled the names of annotation
methods (e.g. `getI-pVg5ArA` instead of `i`) because the isSpecial
condition was false.
2020-08-31 14:19:14 +02:00
Steven Schäfer 02e78bcd76 JVM IR: Use package visibility for fields of captured variables 2020-08-28 20:03:19 +02:00
Dmitry Petrov 89a0b3e944 Check class source in bytecode listing tests 2020-07-27 19:13:37 +03:00
Dmitry Petrov 0741781462 Compare inner class access flags in bytecode listing tests 2020-07-23 19:13:28 +03:00
Dmitry Petrov 2e31f95554 Update testData 2020-07-20 20:04:32 +03:00
Dmitry Petrov e4198466b8 JVM_IR: No nullability annotations on static lambda instances 2020-06-29 19:32:03 +03:00
Alexander Udalov b94a4d9fc3 Render more information on inner classes in bytecode listing tests 2020-06-29 17:33:39 +02:00
Dmitry Petrov 3f266aafb4 JVM: no nullability annotations on private and synthetic fields 2020-06-25 22:31:12 +03:00
Kristoffer Andersen b95d3e711e [JVM IR] KT-36985: $default respects @Deprecated
$default dispatch methods gains @Deprecated if the original function
with default arguments has it.
2020-06-25 18:43:45 +03:00
Dmitry Petrov 4e92c79bc4 JVM_IR: don't generate nullability annotations on synthetic declarations
Fixes KT-36993 and some other related issues.
2020-06-23 20:51:48 +03:00
Dmitry Petrov 5bfec7f6bc JVM: don't generate nullability annotations on property delegate fields
Such fields are private, so these annotations are redundant.

They were incorrect, anyway (property type was used instead of delegate
type).
2020-06-23 20:18:42 +03:00
Dmitry Petrov e9231b5624 JVM: Generate object and companion object INSTANCE fields as @NotNull 2020-06-22 16:28:00 +03:00
Dmitry Petrov 4739adb6dc KT-36992 Do not generate annotations on synthetic accessors
Also, do not generate nullability annotations on synthetic methods.
2020-06-17 23:54:51 +03:00
Dmitry Petrov 84baa0b4c2 Check more flags in bytecode listing tests 2020-02-26 12:03:37 +03:00
Mark Punzalan b782e8f0f0 Add IR equivalent of AbstractBytecodeListingTest and muted failures. 2020-02-13 23:44:53 +03:00
Alexander Udalov e2a42446ed Use getter names for $annotations methods in most codegen tests
This is needed to update master to 1.4, while still testing the latest
compiler by default. Also add one test on the old behavior.
2019-12-30 16:29:13 +01:00
Ilya Chernikov f38bb19fc6 [minor] Fix testdata for compiler 1.4 2019-12-19 14:01:01 +01:00
Alexander Udalov 01ddac58e1 Add language feature for changed name of property annotations method
#KT-31352 Fixed
2019-08-12 16:48:26 +02:00
Alexander Udalov ea0142da60 Use JVM name of getter in synthetic method for property annotations
#KT-31352 In Progress
2019-08-12 16:48:25 +02:00
Mikhael Bogdanov 3b57ceeafe Don't generate annotations on $default methods
#KT-29965 Fixed
2019-02-19 10:51:37 +01:00
Mikhael Bogdanov d2a205c72d Update synthetic parameter processing logic according to ASM 7 changes
#KT-27774 Fixed
2018-11-07 15:42:57 +01:00
Alexander Udalov 17d740a373 Do not try computing return type in OverloadChecker
Return type is not needed for checking overloads, but querying it may
involve resolving function bodies, which usually happens after overload
checking (see LazyTopDownAnalyzer.analyzeDeclarations) and at this point
can lead to incorrect BACKING_FIELD_REQUIRED value being computed for
some properties (see KT-27895)

 #KT-27895 Fixed
2018-11-07 11:00:15 +01:00
Mikhael Bogdanov 1face1c334 Don't generate annotations on synthetic accessor parameters 2018-09-19 12:14:09 +02:00
Mikhael Bogdanov 9e6637dced Don't generate additional annotations on synthetic accessors 2018-09-14 16:23:57 +02:00
Dmitry Petrov acf0bb349c Update testData for restricted expression annotations retention 2018-07-20 10:39:51 +03:00
Mikhael Bogdanov d24ebf711b Fix for KT-16441: NoSuchFieldError: $$delegatedProperties when delegating through provideDelegate in companion object
#KT-16441 Fixed
2017-02-21 13:01:40 +01:00
Alexander Udalov 0db60bf6cb Do not always generate synthetic "$annotations" as private
Since annotations are a part of the declaration, they must have the same
visibility as the declaration in the bytecode. Otherwise obfuscators like
Proguard might strip the "$annotations" method and no annotations would be
found via Kotlin reflection

 #KT-15993 Fixed
2017-02-03 19:35:15 +03:00
Yan Zhulanow e31a39386e Minor: Fix testDeprecatedJvmOverloads test (Kotlin runtime is not enabled by default now in bytecode listing tests) 2016-12-05 19:58:06 +03:00