Commit Graph

97 Commits

Author SHA1 Message Date
Alexander Udalov
7dcb690254 Additional tests on reflection calls 2015-08-24 01:29:58 +03:00
Dmitry Jemerov
341f09afd3 rename platformStatic to jvmStatic 2015-08-21 16:59:05 +02:00
Mikhail Glukhikh
b2653ad1e9 Deprecated enum syntax removed: most compiler tests 2015-08-10 16:24:12 +03:00
Alexander Udalov
d3e39812cb Support mapping of KType to j.l.reflect.Type 2015-08-07 00:55:35 +03:00
Alexander Udalov
9c522b4d49 Refactor property calls in reflection, fix some corner cases
- compute a FunctionCaller instance for getter and setter so that "call" only
  delegates to that FunctionCaller's "call", in the same way it's done in
  KFunctionImpl
- use RuntimeTypeMapper.mapPropertySignature to get the exact origin and
  signature of a property and its accessors. This makes unwrapFakeOverride call
  unnecessary and also fixes some cases like private Java fields
- temporarily drop custom range checks, will be re-added soon
2015-08-07 00:55:30 +03:00
Alexander Udalov
d1e67805fc Fix supertypes for reflected Java classes, always include j.l.Object
equals/hashCode/toString had not appeared in Java classes' "members" because of
this
2015-08-03 23:06:15 +03:00
Alexander Udalov
8f0885ca03 Rename KClass.properties and extensionProperties: prepend 'member'
To better emphasize the fact that all returned properties require an instance
of the class they are declared in. Another issue was that
'Some::class.extensionProperties' was sometimes incorrectly perceived as
"get all extension properties available on the class Some"
2015-07-29 21:36:47 +03:00
Alexander Udalov
50dbda1e1a Introduce KClass.members, make properties/extensionProperties extensions
To avoid significant growth of KClass and KPackage interfaces
2015-07-29 21:36:36 +03:00
Alexander Udalov
2492977274 Additional tests on reflection for Java methods 2015-07-29 21:36:35 +03:00
Mikhail Glukhikh
0d2a81f098 Annotation target checking in front-end, a set of tests for different annotation targets, existing test fixes
No checks for erroneous annotations. Additional checks for identifiers.
2015-07-14 16:25:04 +03:00
Mikhail Glukhikh
609d696202 Annotations have now retention of "RUNTIME" by default. Java retention is generated as given by kotlin annotation. Annotation rendering changed.
Annotation arguments with default values are rendered as ... if renderDefaultAnnotationArguments is true.
Tests: java retention does not taken into account by Descriptor comparator.
Java retentinon changed to kotlin retention in some tests + one new test with java retention added.
More accurate tests for intentions in byte code (visibility controlled).
2015-07-14 16:25:01 +03:00
Alexander Udalov
3b2be6212d Add some tests on Java property references 2015-07-10 20:10:13 +03:00
Alexander Udalov
30794060a9 Simplify property hierarchy in reflection
Leave only 3*2 = 6 classes: KProperty0, KProperty1, KProperty2 and their
mutable analogs, depending on the number of receivers a property takes
2015-07-10 20:10:09 +03:00
Alexander Udalov
c3b97e0668 Simplify function hierarchy in reflection
Get rid of all classes except kotlin.reflect.KFunction, which will be used to
represent all kinds of simple functions.

Lots of changes to test data are related to the fact that KFunction is not an
extension function (as opposed to KMemberFunction and KExtensionFunction who
were) and so a member or an extension function reference now requires all
arguments be passed to it in the parentheses, including receivers. This is
probably temporary until we support calling any function both as a free
function and as an extension. In JS, functions and extension functions are not
interchangeable, so tests on this behavior are removed until this is supported
2015-07-10 20:10:08 +03:00
Yan Zhulanow
74f44dddb0 Add tests for publicField 2015-07-07 16:35:23 +03:00
Alexander Udalov
feb4dd7b8f Drop 'OBJECT$' field deprecated in M11 2015-07-06 16:19:54 +03:00
Alexander Udalov
98ce0d529c Fix incorrect 'original' in property accessors
#KT-3930 Fixed
2015-06-17 16:23:56 +03:00
Alexander Udalov
f81c364999 Add test cases for obsolete issues
#KT-3407 Obsolete
 #KT-4753 Obsolete
2015-06-17 16:23:55 +03:00
Denis Zharkov
c9f79c2d05 Adjust testData: get rid of obsolete annotations 2015-06-12 09:23:31 +03:00
dnpetrov
50ea67ba13 KT-5524 Support [platformName] annotation for class members
@platformName is now supported for final non-overriding class member functions
(including property accessors).
Front-end provides diagnostics for inapplicable annotation cases.
Code generation updated:
- ignore kotlin.platform.platformName annotation for Java class methods;
- bridges generation generates proper JVM declarations in case of methods renamed with @platformName.
@platformName-related tests added.

#KT-5524 Fixed
2015-06-04 17:54:08 +03:00
Dmitry Jemerov
1188e57597 rename @overloads annotation to @jvmOverloads 2015-05-27 12:23:08 +02:00
Alexander Udalov
6ae7ed1cc4 Add some new tests on functions and extension functions 2015-05-27 01:44:19 +03:00
Denis Zharkov
e98b9ea84e Save annotations of lambda on SAM's method
Also add tests checking that annotations on 'invoke' methods of common lambdas are saved properly

 #KT-6932 Fixed
2015-05-20 09:24:57 +03:00
Alexander Udalov
189286efee Support platformStatic members in companion object of enums
#KT-7777 Fixed
2015-05-19 18:47:00 +03:00
Michael Bogdanov
576ead2afe Test for obsolete KT-3698: Static fields of primitive types and String must be compile-time constants
#KT-3698 Obsolete
2015-05-15 18:06:51 +03:00
Dmitry Jemerov
4bdf598bfe compiler testdata: s/trait/interface 2015-05-12 19:43:17 +02:00
Denis Zharkov
cc17f7d82d JVM: Support using KClass as annotation parameter type 2015-04-16 10:40:19 +03:00
Dmitry Jemerov
9434e4bee9 mark wrapper methods that pass default values of parameters as synthetic
#KT-7314 Fixed
2015-04-13 15:26:20 +02:00
Dmitry Jemerov
39828bfd32 Implement kotlin.jvm.overloads annotation for generating all overloads of a method that has default parameter values.
#KT-2095 Fixed

fix backend-side issues with kotlin.jvm.overloads: support the annotation on constructors, generate nullablity annotations on parameters, generate generic signatures, add various tests
2015-04-02 20:30:26 +02:00
Alexander Udalov
4cea9ecca4 Minor, add reflection test on inherited Java property 2015-04-02 03:22:12 +03:00
Alexander Udalov
d3abd54b06 Add 'val KClass.declaredProperties', make getProperties a property 2015-03-17 23:39:13 +03:00
Pavel V. Talanov
06916d98c6 default -> companion: replace all mentions of default and default object 2015-03-17 15:47:39 +03:00
Denis Zharkov
e65382e6ec Support secondary constructors in JVM backend
There is a lot of changes about closures calculating and generating.

1. As classes can have more than one constructor each of them should
have closure arguments.

2. Captured variables set is the same for all of them.

3. Within constructors bodies/delegating calls closure parameters
should be accessed through method arguments because fields may be
not initialized yet.
2015-03-11 17:45:27 +03:00
Alexander Udalov
b3cdd818f0 Support member extension properties, implement KClass.getExtensionProperties()
#KT-6570 Fixed
2015-03-11 16:42:38 +03:00
Pavel V. Talanov
59f192ef90 Replace 'class object' with 'default object' in renderers and test data
Includes changes to decompiled text
Old syntax is used in builtins and project code for now
2015-03-06 19:36:54 +03:00
Pavel V. Talanov
96e54b4872 Test accessing class object from java 2015-02-16 15:38:45 +03:00
Alexander Udalov
5c2d0c6173 Generate not-null assertions on extension receiver parameters 2015-02-03 21:40:39 +03:00
Michael Bogdanov
9e864f3c36 Fix java visibility publicity
#KT-6478 Fixed
2014-12-23 16:28:44 +03:00
Michael Bogdanov
2cc9d8e29b Support platformStatic for properties
#KT-5766 Fixed
2014-11-20 10:20:31 +03:00
Alexander Udalov
70d0c2ff92 Generate generic signature to collection method stubs
#KT-6213 Fixed
2014-11-07 16:10:12 +03:00
Alexander Udalov
35e956609a Rewrite mutable collection stub method generation
The main problem of the previous approach was that we were only generating
erased method signatures, which was incorrect in case a class also had a member
from another supertype with the same signature as the substituted one from the
collection. Javac issues compilation errors when compiling Java code against
such classes.

Also all the needed method stub signatures were hardcoded in
generateBuiltInMethodStubs() and the case of MutableListIterator was missing
2014-10-27 17:17:31 +03:00
Michael Bogdanov
2a1520228e Support inheritance from java 8 interfaces
#KT-5969 In Progress
2014-10-11 13:53:43 +04:00
Alexander Udalov
e0ee890486 Move properties of enum class object to the enum class
Similar to how it's done for usual classes
2014-09-11 17:56:43 +04:00
Michael Bogdanov
08e02f4176 Moving platformStatic annotation to kotlin.platform package 2014-09-10 17:35:59 +04:00
Michael Bogdanov
e26d635633 Initial implementation of platformStatic 2014-09-09 16:28:28 +04:00
Alexander Udalov
1ad037f621 Fix KClassOrigin for non-Kotlin classes
Check against presence of KotlinClass annotation
2014-07-02 01:55:21 +04:00
Alexander Udalov
aea230d677 Introduce black box with Java codegen tests
In contrast to "black box against Java", it supports cyclic dependencies
between Java and Kotlin sources in one test case
2014-06-26 20:57:40 +04:00
Alexander Udalov
09863445bb Rename tests: boxWithJava -> boxAgainstJava 2014-06-26 20:57:40 +04:00
Alexander Udalov
de8b2b3668 Fix generic signature for SAM adapters and constructors
SAM-related code in codegen was using JavaClassDescriptor directly, which has
an erased signature. Create and use a new abstraction SamType which has a full
generic signature of a type which was used in the SAM construct
2014-05-19 19:50:58 +04:00
Alexander Udalov
d913dfb1aa Correctly map declaration owner in JVM codegen
"context.contextKind()" was incorrect in
ExpressionCodegen.intermediateValueForProperty(), because it represents the
context of the call site, not the context of the property declaration

 #KT-4878 Fixed
2014-04-24 16:10:12 +04:00