Commit Graph

92 Commits

Author SHA1 Message Date
Dmitry Petrov
b930e6e8e8 Fix annotations loading for inline class constructors 2018-09-14 16:11:09 +03:00
Dmitry Petrov
1b519b340e Generate metadata and annotations for hidden constructor
Reflection expects to see a callable method for a hidden constructor,
thus, it should be a synthetic accessor.
JVM method signature in metadata should point to the synthetic accessor.
Annotations for hidden constructor should be written on the synthetic
accessor.
2018-09-12 15:37:20 +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
f90303315d Support array class literals in annotation serializer/deserializer
Note that this change brings an incompatibility: `Array<Foo>::class`
will be seen as `Foo::class` by the old deserializer. We consider this
OK because the compiler never had any logic that relied on reading class
literal arguments correctly (otherwise it wouldn't have worked because
it could only see `Array<*>::class` before this commit), and the support
of annotations on types in JVM reflection is only available in the
upcoming 1.3 release (KT-16795)

 #KT-22069 Fixed
2018-09-06 14:40:06 +03:00
Ilya Chernikov
fd0eb6ee34 Implement support for class literals as annotation arguments...
on deserialization and reflection
2018-08-31 15:17:51 +03:00
Dmitry Petrov
8f103dd8e5 Fix ConstantValue-related testData for loadJava tests 2018-07-24 10:52:16 +03:00
Alexander Udalov
965e3ebab2 Do not serialize SOURCE-retained annotations
Also, fix the value of "hasAnnotations" flag to reflect if there are any
_non-source_ annotations on a declaration.

Unfortunately, after this change
IncrementalJsCompilerRunnerTestGenerated$PureKotlin.testAnnotations
starts to fail because of the following problem. The problem is that
annotations on property accessors are not serialized yet on JS (see
KT-14529), yet property proto message has setterFlags field which has
the hasAnnotations flag. Upon the full rebuild of the code in that test,
we correctly write hasAnnotations = true, but annotations themselves are
not serialized. After an incremental build, we deserialize property
setter descriptor, observe its Annotations object which happens to be an
instance of NonEmptyDeserializedAnnotationsWithPossibleTargets. Now,
because annotations itself are not serialized, that Annotations object
has no annotations, yet its isEmpty always returns false (see the code).
Everything worked correctly before the change because in
DescriptorSerializer.hasAnnotations, we used Annotations.isEmpty and the
result was the same in the full rebuild and in the incremental scenario.
But now we're actually loading annotations, to determine their
retention, and that's why the setterFlags are becoming different here
and the test fails

 #KT-23360 Fixed
2018-04-23 18:42:33 +02:00
Alexander Udalov
f2be34ca1c Support KClass<*> annotation arguments in serialization/deserialization
#KT-11586 Fixed
2017-10-23 19:16:44 +02:00
Alexander Udalov
e42b151561 Support primitive array annotation arguments in ConstantValueFactory
This has no visible consequences at the moment, but will help once we
need to load such argument from some annotation in the compiler in the
future
2017-06-27 14:53:39 +03:00
Alexander Udalov
33e9e660c4 Fix JvmRuntimeDescriptorLoaderTestGenerated
- Use FULL_JDK instead of mock JDK in some tests because mock JDK is
  created from JDK 6 and full JDK is now JDK 8, so there are differences
  in the behavior in the compiler and at runtime
- Remove some '*.runtime.txt' files which were workarounds to JDK 6
  reflection issues regarding generic inner classes; code in these tests
  is now loaded exactly the same in the compiler and at runtime
- Change supertype in SupertypesAndBounds.kt: the class in the supertype
  is not relevant to that test, it checks that annotations can be loaded
  on types
2017-03-20 18:46:05 +01:00
Stanislav Erokhin
ab53978793 Allowed ast access for some tests. 2016-12-16 00:57:04 +03:00
Valentin Kipyatkov
ec51076355 DescriptorRenderer to render annotations for all types + separate option to render annotation arguments + use it in IdeDescriptorRenderers 2016-10-11 23:38:54 +03:00
Denis Zharkov
d0acb3674a Fix rendered testData
New members in enum member scope
2016-05-16 15:38:13 +03:00
Mikhail Glukhikh
4c03aaabd4 Implicit nothing / intersection types are now checked also for member functions #KT-11666 Fixed 2016-03-31 11:59:17 +03:00
Alexander Udalov
1b8f934b54 Delete deprecated enum 'values' property 2016-02-19 22:28:44 +03:00
Denis Zharkov
4cf1393e81 Minor. Render annotations on type parameters 2016-01-22 19:17:22 +03:00
Ilya Gorbunov
f4822cd757 Fix testData in compiler: add collections and ranges package to fq-names. 2016-01-22 05:54:38 +03:00
Alexander Udalov
aef6d49b48 Drop isLocalClass, do not write KotlinLocalClass 2016-01-19 18:39:59 +03:00
Mikhail Glukhikh
7f2624c9a1 Handling of annotations on delegated property in descriptor loader & stub builder 2016-01-19 11:38:58 +03:00
Alexander Udalov
6f347f351a Load annotations on compiled Kotlin enum entries
#KT-10339 Fixed
2015-12-13 03:52:42 +03:00
Mikhail Glukhikh
c8b50eec1e Enum.values: deprecation (warning) --> deprecation (error) 2015-12-11 11:11:42 +03:00
Alexander Udalov
5541224288 Minor, add test on annotation on type argument 2015-12-07 15:47:47 +03:00
Yan Zhulanow
9d1af5a17e Fix tests: "infix modifier required" and "operator modifier required" errors 2015-11-27 15:51:11 +03:00
Mikhail Glukhikh
dc60c62781 Enum.values is now deprecated but Enum.values() is no more deprecated 2015-11-23 17:29:36 +03:00
Ilya Gorbunov
21f509511c Fix CharSequence parameter names in testData 2015-11-21 07:09:05 +03:00
Alexey Tsvetkov
dc27363452 Remove @annotation from test data 2015-10-19 20:45:01 +03:00
Alexey Tsvetkov
1973573a89 Remove @data from test data 2015-10-19 20:45:00 +03:00
Denis Zharkov
1c02231cda Regenerate rendered descriptors after transforming Enum.values to property 2015-10-17 17:46:16 +03:00
Svetlana Isakova
25b40455ad Serialize/deserialize annotations on type parameters 2015-10-16 21:58:47 +03:00
Alexander Udalov
51bf68ce27 Update compiler tests to use KProperty instead of PropertyMetadata 2015-10-14 20:45:54 +03:00
Mikhail Glukhikh
f8a356747e Stdlib rename: 'name' and 'ordinal' are now properties in Enum, same name functions are deprecated 2015-10-14 20:40:13 +03:00
Denis Zharkov
f0e3fd617d Adjust testData to CharSequence.length transformation 2015-10-14 20:39:35 +03:00
Denis Zharkov
1305d9755a Transform CharSequence.length to property 2015-10-14 20:39:29 +03:00
Denis Zharkov
6f4579213c Adjust rendered descriptors after remove/charAt transformations 2015-10-11 19:59:30 +03:00
Yan Zhulanow
1f2b4e20fe Replace get() and set() to getValue() and setValue() (property delegates) 2015-10-09 22:49:16 +03:00
Yan Zhulanow
d90585624f Add 'DeprecationLevel' parameter to 'Deprecated' 2015-10-08 18:31:08 +03:00
Yan Zhulanow
6db9344659 Fix compiler tests 2015-09-25 19:20:20 +03:00
Dmitry Jemerov
4ca434da54 remove support for 'trait' keyword 2015-09-22 15:00:24 +02:00
Denis Zharkov
4850fd10f0 Regenerate test data containing rendered descriptors
Introduced '@' after each annotation
2015-09-18 10:14:39 +03:00
Denis Zharkov
bae3320d52 Get rid of deprecated annotations in testData 2015-09-18 10:14:32 +03:00
Mikhail Glukhikh
3770e7f49f Introduction of AnnotationTarget.CLASS as a replacement for CLASSIFIER (first step) 2015-09-11 17:59:40 +03:00
Michael Nedzelsky
aa8c90893e fix tests in org.jetbrains.kotlin.idea.stubs 2015-09-08 02:05:54 +03:00
Michael Nedzelsky
bc5c9065d2 fix tests in org.jetbrains.kotlin.checkers 2015-09-08 02:04:32 +03:00
Mikhail Glukhikh
8f7b29f80a Annotation rename: target --> @Target 2015-09-07 13:42:26 +03:00
Mikhail Glukhikh
eab288bdd7 annotation() now has no arguments. Syntax migration to Retention / Repeatable / MustBeDocumented combination
Deprecated test for annotation(params) completion deleted. A lot of tests changed.
2015-09-04 19:21:12 +03:00
Denis Zharkov
31244edec9 Deprecate deprecated in favor of Deprecated 2015-09-04 18:19:31 +03:00
Yan Zhulanow
2ce9903356 Fix tests 2015-08-31 15:33:13 +03:00
Yan Zhulanow
1a477bd540 Add field and property deserialization tests 2015-08-31 15:33:04 +03:00
Yan Zhulanow
4ead50352d Put @receiver-targeted annotations on receiver type 2015-08-31 15:33:01 +03:00
Yan Zhulanow
08c678ef46 Deserialize receiver parameter annotations for extension functions 2015-08-31 15:32:55 +03:00