Commit Graph

178 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
e1a4bd01f5 Add anonymousObjectOriginName/lambdaClassOriginName to kotlinx-metadata
#KT-21320
 #KT-23198
2018-05-16 17:16:22 +02: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
Denis Zharkov
2ad93a0330 Use extension registry when unpacking serialized type alias
It's funny here that "extension" here means protobuf extensions
while initial issue is about extension function types

 #Fixed KT-22728
2018-02-08 12:39:26 +03:00
Alexander Udalov
71fe8c02a3 Fix rendering of type aliases
- render 'actual' modifier if it's present
- do not render a space after type parameter list
2018-02-05 13:38:06 +01:00
Alexander Udalov
f2be34ca1c Support KClass<*> annotation arguments in serialization/deserialization
#KT-11586 Fixed
2017-10-23 19:16:44 +02:00
baratynskiy
01883a41cb javac-wrapper: refactoring, fixes and tests 2017-08-29 18:01:36 +03: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
Denis Zharkov
bc564af2fc Regenerate mockJDK using openJDK 7 2017-06-24 17:26:01 +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
d7566d84d0 Fixed testdata. 2016-12-16 02:01:12 +03:00
Stanislav Erokhin
ab53978793 Allowed ast access for some tests. 2016-12-16 00:57:04 +03:00
Dmitry Petrov
80bd916f5d 'SuspendFunction$n' should not be visible in member scopes (should be unresolved).
'SuspendFunction$n' class descriptors are created on demand by KotlinBuiltIns (and cached).
On serialization, types constructed with 'SuspendFunction$n' are written as 'Function$n' with extra flag (SUSPEND_TYPE).
On deserialization, corresponding 'SuspendFunction$n' classes are used.
2016-12-15 23:58:05 +03:00
Denis Zharkov
4737b3dd7f Update stubBuilder/deserialization tests on coroutines 2016-12-15 23:58:02 +03:00
Dmitry Petrov
e6fcf20cf2 No variance elision in type alias substitution.
Add test with cyclic inheritance via type alias.
2016-11-22 10:04:47 +03:00
Dmitry Petrov
4c47d77a9f Report error on non-top-level type aliases (unsupported in 1.1).
Get rid of nested type aliases in project.
2016-11-21 10:25:51 +03:00
Dmitry Petrov
d2d8f72ffc Annotations on type aliases: typealias is not a "default target".
Add diagnostic test for annotations on type aliases.
2016-10-13 17:52:21 +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
257417bc4a Minor. Lower type aliase declarations priority
There are several reasons for doing this:
- See org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberScope.computeDescriptors,
  classifiers are being deserialized in the last turn, so it's necessary to preserve consistent order
- Their priority should be close to classes
2016-09-09 10:27:35 +03:00
Denis Zharkov
d53c53a900 Support annotations on type aliases declarations 2016-06-28 10:33:29 +03:00
Denis Zharkov
d39d36b94c Render unabbreviated part of type wrapped in common comments
It's necessary for preserving DescriptorRenderer invariant, namely
only valid code should be generated
2016-06-28 10:33:29 +03:00
Stanislav Erokhin
42857992ed Minor. Add ALLOW_AST_ACCESS to two tests.
We suppose, that AST access is allowed if we have property with initializer.
2016-06-09 12:57:47 +03:00
Denis Zharkov
329fb9d619 Introduce 'coroutine'/'suspend' modifiers 2016-06-08 18:53:16 +03:00
Dmitry Petrov
0319d5a5aa KT-11588 Type aliases
- Nested type aliases
- UNSUPPORTED_TYPEALIAS error (language level < 1.1)
- tests for is/as/as? with type alias
2016-06-01 14:32:46 +03:00
Dmitry Petrov
a2ec580119 KT-11588 Type aliases
Type alias stubs indexing (required for index-based declaration providers)
2016-05-20 14:17:26 +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
Mikhail Glukhikh
fe57a9e48f Setter visibility must be worse or the same as property visibility 2015-12-17 19:03:06 +03:00
Zalim Bashorov
674a15daa1 Disable test until KT-10405 not fixed 2015-12-15 20:07:35 +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
fe78f944a6 Private setter for open property: is now an error, not a warning 2015-12-11 18:54:40 +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
Yan Zhulanow
a3ff3ffc45 Fix tests: "Placing function type parameters after the function name" error 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
Mikhail Glukhikh
f81a5c06ea Protected in allowed in companion objects but forbidden in other objects, relevant test fixes 2015-11-20 16:32:59 +03:00
Mikhail Glukhikh
cd1b58f2eb Final in interfaces: deprecation ---> error + relevant test fixes 2015-11-20 15:43:19 +03:00
Denis Zharkov
e920ce709b Render captured type parameters in verbose mode 2015-11-13 14:59:04 +03:00