Commit Graph

55 Commits

Author SHA1 Message Date
Mikhael Bogdanov
2ed0cb2a89 Support type annotations
#KT-35843 Fixed
2020-01-09 14:00:11 +01:00
Alexander Udalov
fde9b21a40 Fix syntheticMethodForProperty.kt for JDK 9+ and Android tests 2020-01-09 11:34:51 +01:00
Alexander Udalov
cc0b231b3b Convert SyntheticMethodForAnnotatedPropertyGenTest to a box test 2019-12-30 16:30:50 +01:00
pyos
59f2aa7add JVM_IR: remove constructors of nested annotations 2019-12-23 13:59:42 +01:00
Georgy Bronnikov
119a3f1306 JVM_IR: do not generate accessors to lateinit private properties 2019-11-19 16:30:04 +03:00
Mikhail Glukhikh
f3d0a976b2 Disable recently added FIR black box tests 2019-11-19 11:00:10 +03:00
Mark Punzalan
9df2f69f09 [FIR] Disable failing blackbox codegen tests for FIR. 2019-11-19 11:00:09 +03:00
Alexander Udalov
cdb7703947 JVM IR: fix VerifyError on annotated annotation properties
The problem was that we tried to generate an `$annotations` method for a
property declared in an annotation class. That method is final and has a
body, which is not allowed in annotation classes. Now we're generating
this method in the separate `$DefaultImpls` class as for properties in
interfaces.

Note that the added test still doesn't find any annotations because the
proper support is needed in reflection (KT-22463). Currently it only
checks that no VerifyError happens.
2019-11-18 18:58:41 +01:00
pyos
1bc48c3df9 IR: copy annotations when making lateinit fields nullable 2019-11-18 18:35:15 +01:00
Kristoffer Andersen
52dc469657 JVM IR: Generate synthetic methods for type aliases with annotations 2019-09-24 12:21:42 +02:00
Alexander Udalov
c69997491f JVM IR: generate file annotations on file facade classes 2019-09-18 14:05:28 +02:00
Mads Ager
6c7a904663 Psi2Ir: Mark accessors with no bodies as default accessors.
They are currently marked as defined even when they get a
default implementation. That makes it hard to figure out
if the accessor should be removed when introducing a backing
field in the JVM_IR backend.
2019-08-28 19:25:13 +02:00
Steven Schäfer
efb938a7c8 (Un)mute tests 2019-07-31 11:18:44 +02:00
Mads Ager
0c586ef5c1 JVM_IR: Maintain annotations in SAM conversion.
Copy method and parameter annotations to the generated SAM
implementation method.
2019-06-05 08:21:59 +02:00
Ting-Yuan Huang
75646f97a4 MoveCompanionObjectFields: copy constants into interfaces
Fields having const attribute in companion objects are observable in
Java and should be copied to outer interfaces.
2019-05-20 08:43:00 +02:00
Mads Ager
34cf5a19df JVM_IR: Support @JvmSynthetic annotations. 2019-05-16 17:07:22 +03:00
Mads Ager
e8fbd42f7c JVM_IR: Support access flag jvm annotations on fields and methods. 2019-05-13 08:34:52 +02:00
pyos
b23f2a4dbb JVM_IR: set ConstantValue on static final primitive fields 2019-04-18 09:16:32 +02:00
Steven Schäfer
29b7da7c49 Implement support for KClass fields in annotation classes. 2019-03-26 11:54:16 +01:00
Georgy Bronnikov
451cda79de Rewrite AnnotationCodegen for IR, removing descriptors 2019-03-23 19:04:36 +03:00
pyos
8c55376f0c Unmute almost all JVM_IR tests that use property references 2019-03-19 12:00:29 +01:00
Alexander Udalov
c357967c2c JVM IR: generate Kotlin metadata
Introduce MetadataSource as a way to store the original descriptor for
any element (before any lowerings) and maintain it until the end of the
codegen where it's used in generating the metadata. Note that JVM
signatures written to the metadata are formed from the _resulting_
generated elements, not by mapping the original descriptors.

Some corner cases are not supported yet, namely properties declared in
companion objects, synthetic methods for property annotations,
JvmPackageName, etc.

 #KT-29119 Fixed
2019-02-19 16:37:47 +01:00
Mads Ager
e9ec8e2cee JVM_IR: Do not generate annotations on $default methods. 2019-02-19 13:23:42 +01:00
Mikhael Bogdanov
19d2bac2f8 Temporary disable test in IR 2019-02-19 13:05:05 +01:00
Mikhael Bogdanov
3b57ceeafe Don't generate annotations on $default methods
#KT-29965 Fixed
2019-02-19 10:51:37 +01:00
Mikhael Bogdanov
f2a51d3b80 Support reflection tests on Android 2019-01-26 08:26:49 +01:00
Mikhael Bogdanov
f4e532e449 Specify JVM target backend for test with '@JvmXXX' annotations 2018-12-21 16:09:07 +01:00
Mikhael Bogdanov
3ef06c1e44 Specify JVM target backend for test with 'import java...' 2018-12-21 16:09:06 +01:00
Mikhael Bogdanov
f36519d4f5 Specify JVM target backend for test with '.javaClass' usage 2018-12-21 16:09:05 +01:00
Mikhael Bogdanov
1217d3591b Specify JVM target backend for test with '::class.java' usage 2018-12-21 16:09:04 +01:00
Mikhael Bogdanov
a4206a543a Skip test on JDK 6 2018-10-22 16:32:55 +02:00
Mikhael Bogdanov
ac8e1a0124 Move JVM8 box test to common 2018-10-22 16:32:52 +02:00
Georgy Bronnikov
bbac1d802f JVM_IR. Support annotation classes with JvmField fields 2018-10-17 21:15:28 +03:00
Alexander Udalov
ab3f8db743 Consider property accessor non-default if it has annotations
Otherwise we're not trying to load annotations on the parameter of the
property setter in MemberDeserializer.loadProperty.

Note that after this commit, we could now also assume that if
getter/setter is default, it has no annotations, and thus use
Annotations.EMPTY for default getter/setter in loadProperty. However,
this would cause reflection to work incorrectly on classes compiled by
an older Kotlin compiler, so we'll still try to load annotations on
default accessors for an indefinite time.

 #KT-25499 Fixed
2018-09-07 11:49:42 +03:00
Alexander Udalov
06ce0cb0f0 Fix deserialization of default property accessor flags
In MemberDeserializer.loadProperty, we incorrectly passed 0 to
getAnnotations when loading annotations on property accessors in case
the protobuf field getter_flags/setter_flags was not present. The
correct behavior, as described in metadata.proto, was to pass a special
"default accessor flags" value, constructed from the main property
flags. Otherwise in case there were annotations both on the property and
on the accessor (as in PropertyAndAccessor.kt) and the accessor was
otherwise default, we would assume that it had no annotations and would
not load them in compiler and reflection

 #KT-25499 In Progress
2018-09-07 11:49:41 +03:00
Alexander Udalov
823a24e0a3 Use AnnotationSplitter for annotations on setter parameter
Make it possible to specify annotations of the setter parameter when
constructing the default setter via DescriptorFactory; pass the split
annotations in DescriptorResolver.resolvePropertySetterDescriptor

 #KT-25500 Fixed
2018-09-06 19:13:09 +03:00
Alexander Udalov
dc1f4c7d5b Generate get-targeted annotations on annotation constructor parameters
This change would also make NotNull annotations to be generated on
non-primitive annotation methods, but we skip this deliberately because
annotation methods never return null on JVM anyway

 #KT-25287 Fixed
2018-08-30 14:56:40 +03:00
Pavel Punegov
1a7d366733 Disable JVM tests in native 2018-08-28 13:48:44 +03:00
Alexander Udalov
1c2a9e4b21 Map annotation target TYPE -> TYPE_USE if JVM target >= 1.8
And TYPE_PARAMETER -> TYPE_PARAMETER similarly

 #KT-23857 Fixed
2018-08-21 12:38:05 +02:00
Zalim Bashorov
2fb286e39c [JS IR BE] Update tests 2018-07-31 11:28:39 +03:00
Svyatoslav Kuzmich
625983b28a [JS IR BE] Enum class lowering 2018-07-23 15:08:18 +03:00
Mikhail Zarechenskiy
b6db8971e4 Warn about annotations that targets non-existing accessors
#KT-15453 In Progress
2018-07-17 00:22:53 +03:00
Mikhail Zarechenskiy
857cc0f728 Make tests about mod and varargs valid for 1.3 version 2018-07-16 14:01:59 +03:00
Mikhael Bogdanov
e149cbe852 Mute failed jvm ir tests 2018-06-28 12:26:41 +02:00
Anton Bannykh
96355e2732 JS IR: mute codegen box tests automatically 2018-06-09 19:15:38 +03:00
Alexander Udalov
543db380d2 Use isJvmInterface in JVM back-end instead of isInterface
To support const vals and proper initialization order for companions of
annotations (since 1.3+) as well as interfaces

 #KT-16962 Fixed
2018-01-24 15:54:35 +01:00
Alexander Udalov
a46a2b9b1c Support nested classes in annotation classes
#KT-16962 In Progress
2018-01-24 15:54:35 +01:00
Mikhael Bogdanov
ea5505f80c Generate annotations in proper order in DefaultImpls 2017-12-22 10:02:04 +01:00
Mikhail Zarechenskiy
682fe9e9ca Don't forget to resolve annotations from constructor parameter
#KT-12245 Fixed
2017-04-10 12:48:10 +03:00
Ilya Matveev
a5e4e0284e Mute some box tests for native backend
This patch mutes the following test categories:
   * Tests with java dependencies (System class,
     java stdlib, jvm-oriented annotations etc).
   * Coroutines tests.
   * Reflection tests.
   * Tests with an inheritance from the standard
     collections.
2017-03-10 19:59:37 +03:00