Commit Graph

117 Commits

Author SHA1 Message Date
Ilya Gorbunov 3639afafce Deprecated with ERROR preconditions with eager message. 2015-11-11 19:00:03 +03:00
Alexander Udalov 1576160390 Improve implementation of callable reference superclasses
Previously to use reflection on them, you had to wrap an already created object
with a "Reflection.function" or "Reflection.propertyN" call, which the JVM
back-end was doing. This was not optimal in several senses and current solution
fixes that
2015-11-09 22:24:40 +03:00
Alexander Udalov 1c889c4e67 Support equals, hashCode, toString for ::-references without reflection 2015-11-09 22:24:39 +03:00
Ilya Gorbunov 850c1518c8 Fix Delegates.lazy usages in testData 2015-11-06 01:12:09 +03:00
Dmitry Jemerov 736b496f6a drop deprecated @platformName and @platformStatic annotations 2015-11-02 17:00:44 +01:00
Ilya Gorbunov e2c9267305 Fix compiler tests with incompatible types in assertEquals arguments. 2015-10-27 21:48:29 +03:00
Alexander Udalov ced1edcf98 Prohibit callable references to object members
To be able to make them more useful in the future, i.e. bound to the object
instance
2015-10-14 20:45:56 +03:00
Alexander Udalov 0218e0351b Deprecate KPackage, to be removed later 2015-10-11 17:10:37 +03:00
Alexander Udalov a4732b442d Don't create KClass and KPackage instances in <clinit>
This proved to be a fragile technique, which probably doesn't even improve
performance in most cases but has lots of unexpected problems: unconditional
initialization of reflection classes, increasing the size of the bytecode, bugs
with <clinit> in annotations on JVM 6, inability to support conversion of a
class from Kotlin to Java without recompiling clients which use it
reflectively, etc.
2015-10-11 17:10:35 +03:00
Alexander Udalov 8c4d7fdf24 Drop deprecated nested classes from Kotlin metadata annotations 2015-10-11 17:10:33 +03:00
Michael Bogdanov 12afbffb09 Copy to interface just companion object public const properties 2015-10-09 16:25:15 +03:00
Ilya Gorbunov 43a74e575e Fix testData/codegen: replace deprecated sort usages. 2015-10-07 22:36:43 +03:00
Alexander Udalov 661f4efc68 Forbid callable references to members and extensions with empty LHS
This syntax is reserved to be likely used in the future as a shorthand for
"this::foo" where the resulting expression doesn't take the receiver as a
parameter but has "this" already bound to it
2015-10-03 04:37:04 +03:00
Denis Zharkov 3f6cadf9b7 Change FUNCTION_EXPRESSION_WITH_NAME severity to ERROR
Also drop deprecation related parts and get rid of usages of this `feature` within testData
2015-09-25 08:29:26 +03:00
Ilya Gorbunov 9c974b6c5c Fix deprecations in testData: BlackBoxWithStdLibCodegenTest 2015-09-19 04:33:20 +03:00
Denis Zharkov bae3320d52 Get rid of deprecated annotations in testData 2015-09-18 10:14:32 +03:00
Dmitry Petrov 50ff2a3ad2 Multifile facade should contain reflection data,
otherwise callable references to stdlib functions will not work in the migration scheme.
2015-09-14 17:47:49 +03:00
Dmitry Petrov cd6ff31129 Update tests depending on part class naming 2015-09-07 16:28:43 +03:00
Dmitry Petrov a47eaa2cb5 Change part class naming scheme
update tests depending on part class naming
2015-09-07 16:28:42 +03:00
Alexander Udalov d0a4f82203 Fix NO_KOTLIN_REFLECT directive handling in codegen tests
It was disabling reflection on classpath at compile time, but not at runtime
2015-09-04 20:18:59 +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
Denis Zharkov 952d45dc8b Deprecate JVM platform annotations in favor of capitilized themselves 2015-09-04 18:19:31 +03:00
Alexander Udalov df935f5bb7 Support reflection on lambdas and function expressions
Write a special annotation containing the bytes for the Callable protobuf
message and deserialize it at runtime properly

 #KT-9005 Fixed
2015-09-03 21:43:58 +03:00
Yan Zhulanow 2ce9903356 Fix tests 2015-08-31 15:33:13 +03:00
Alexander Udalov 593937d302 Support KCallable.callBy with map of parameters to arguments
callBy is able to handle optional parameters.

 #KT-8827 Fixed
2015-08-29 18:37:40 +03:00
Alexander Udalov 0d62680f63 Support KParameter.isOptional
#KT-8825 Fixed
2015-08-29 18:37:39 +03:00
Alexander Udalov fd97383f8a Fix mapping of jvmStatic functions
#KT-8800 Fixed
2015-08-29 18:37:38 +03:00
Alexander Udalov 9a8cf23ed4 Support KClass.companionObject and companionObjectInstance
#KT-7636 Fixed
2015-08-29 18:37:32 +03:00
Alexander Udalov 94d45f35d4 Support KClass.nestedClasses 2015-08-29 17:59:45 +03:00
Alexander Udalov 7c28a2e732 Support KClass.defaultType 2015-08-28 21:22:11 +03:00
Alexander Udalov ea8fe56704 Include property type to KProperty.toString 2015-08-28 21:11:31 +03:00
Alexander Udalov d36ef90dd6 Provide equals/hashCode/toString for KParameter implementation
Two KParameter instances are equal iff their backing descriptors are equal and
their callables are equal
2015-08-28 21:11:30 +03:00
Alexander Udalov d4825cf4f0 Support KParameter.kind: instance, extension receiver, or value 2015-08-28 21:11:22 +03:00
Alexander Udalov ebe4a8ec89 Provide equals/hashCode/toString for KType implementation 2015-08-28 21:11:20 +03:00
Denis Zharkov e8f91e596c Adjust test data after fixes about generic nullability 2015-08-28 18:50:26 +03:00
Alexander Udalov 8d9618348d Move .java and .kotlin extension properties to kotlin.jvm
Delete the old ones in package kotlin.reflect.jvm because otherwise the code
using those functions will become red in a lot less meaningful way (overload
resolution ambiguity) than if they're deleted (unresolved import)

Based on the work originally done by @dnpetrov

 #KT-8380 Fixed
2015-08-27 08:19:50 +03:00
Dmitry Jemerov 4743a69d76 rename platformName annotation to jvmName 2015-08-25 15:40:46 +02:00
Alexander Udalov 7dcb690254 Additional tests on reflection calls 2015-08-24 01:29:58 +03:00
Alexander Udalov ccb58d8601 Minor, add some tests on get/set/name/instanceof for properties w/o reflection 2015-08-24 01:29:58 +03:00
Alexander Udalov d3e39812cb Support mapping of KType to j.l.reflect.Type 2015-08-07 00:55:35 +03:00
Alexander Udalov 49b689f883 Do not allow to assign null to a non-null property via reflection
This was already working for accessor-based properties because the assertions
were already generated into corresponding accessors, but for fields we must
manually check the value against null
2015-08-07 00:55:33 +03:00
Alexander Udalov 3091f2af3b Report argument number mismatch nicely on wrong 'call()' invocation
The default Java reflection message in such case is not very helpful: "wrong
number of arguments"
2015-08-07 00:55:32 +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 a91729e041 Fix isAccessible for property accessors 2015-08-07 00:55:30 +03:00
Alexander Udalov 6878453d44 Support KClass.objectInstance for objects and companion objects 2015-08-03 23:33:21 +03:00
Alexander Udalov 2eb5201575 Introduce KAnnotatedElement and val annotations: List<Annotation> 2015-08-03 23:32:23 +03:00
Alexander Udalov af9ae46f9a Minor, fix test on KParameter.index 2015-08-03 23:06:14 +03:00
Dmitry Petrov 9bf0211152 KT-8408 Prohibit Array<T>::class for non-reified T 2015-07-30 12:18:29 +03:00
Alexander Udalov a0cc313156 Support class reference expression for reified type parameters
Also make KClass::java an intrinsic property.

Based on the work by @dnpetrov

 #KT-6976 Fixed
2015-07-30 12:18:28 +03:00