Commit Graph

291 Commits

Author SHA1 Message Date
Alexander Udalov 15efbcae02 Use Class->KClass cache in Class.kotlin extension
#KT-17594 Fixed
2017-04-27 20:34:45 +03:00
Ilya Gorbunov a87da4338f arrayIterators: Restore index to the previous value after NoSuchElementException has been thrown
Relates to #KT-17453
2017-04-19 18:12:58 +03:00
Ilya Gorbunov 4a5d8534c1 Fix array iterators to adhere to Iterator contract
#KT-17453 Fixed

Change expected exceptions in tests.
2017-04-18 18:51:20 +03:00
Alexander Udalov 93d5f6e635 Fix NPE on equals/hashCode of local function references
Anonymous classes for local function references implement their
getOwner() as "return null" currently (KT-14291). To avoid NPE in this
case, we now consider two local functions the same if their name and
signature are equal. This is incorrect in general, but unlikely to cause
major problems and is going to be fixed by KT-14291 eventually anyway

 #KT-17055
2017-04-03 18:05:04 +03:00
Dmitry Jemerov 03a26c4ce0 Set language level 6 for modules using JDK 6 2017-03-29 18:41:00 +02:00
Alexander Udalov af5fbef4ea Use JDK 1.6 to compile modules under "core"
Outputs of these modules go into kotlin-stdlib and kotlin-reflect, both
of which must be usable on Java 6
2017-03-21 13:03:18 +03:00
Ilya Gorbunov 5867d27fb7 [Standard Library] Take the javaClass deprecation back as its replacement is often inconvenient. 2017-02-22 17:27:20 +03:00
Alexander Udalov 1ee2053a16 Make callable references Serializable on JVM
#KT-11254 Fixed
2017-02-16 18:00:18 +03:00
Alexander Udalov 46bd64f59a Rename FunctionImpl -> FunctionBase, restore abstract class FunctionImpl
This fixes the IncompatibleClassChangeError which happens when kotlin-reflect
1.0.x and kotlin-stdlib 1.1.x are in the classpath

 #KT-16358 In Progress
2017-02-15 20:43:25 +03:00
Alexander Udalov 8e3cb912c7 Make Ref classes for shared vars Serializable
#KT-14566 Fixed
2017-02-15 10:46:48 +03:00
Alexander Udalov 6793861fd4 Add target FIELD for SinceKotlin, annotate CallableReference.receiver/NO_RECEIVER 2017-02-13 14:09:43 +03:00
Ilya Gorbunov 9a7405adc6 Make javaClass extension property inline to remove further references from Kotlin. 2017-02-09 22:15:25 +03:00
Alexander Udalov 845d6526b0 Annotate new API in runtime.jvm with SinceKotlin(1.1) 2017-02-08 13:05:27 +03:00
Ilya Gorbunov b8de78dd43 Deprecate javaClass with replacement this::class.java.
Suppress deprecation in diagnostics tests.
2017-02-07 16:30:22 +03:00
Alexander Udalov b784680fe2 Fix NPE on equals/hashCode for callable references without kotlin-reflect
#KT-11316 Fixed
 #KT-15847 Fixed
2017-02-03 19:35:16 +03:00
Mikhael Bogdanov 5cffb3892d Added intrinsics for nullable Double/Float equals check 2017-02-02 16:31:49 +01:00
Stanislav Erokhin 2aa2df75ae Make property java available on KClass<T> where T is type parameter without upper bounds. 2017-01-28 03:25:43 +03:00
Denis Zharkov 0e132b9857 Move all coroutine-related declarations from built-ins to stdlib
Also move internal declarations from runtime.jvm module into new package
kotlin.coroutines.jvm.internal in stdlib

The necessity of these declarations being in built-ins is controversial,
but also it will complicate the migration of current coroutine runtime
to a separate jar if we ever need this
2017-01-27 23:24:13 +03:00
Alexander Udalov 78f2515e95 Introduce KProperty{0,1,2}.getDelegate
#KT-8384 In Progress
2017-01-23 12:25:35 +03:00
Denis Zharkov 85a3fefcc6 Get rid of SuspendFunctionX interfaces
Use a pair of effectively abstract methods in CoroutineImpl instead
2017-01-14 15:13:37 +03:00
Roman Elizarov 8d6a913cee CoroutineContext and ContinuationInterceptor (instead of dispatcher) 2017-01-14 13:24:53 +03:00
Denis Zharkov 7837d736f7 Merge RestrictedCoroutineImpl into CoroutineImpl 2017-01-14 13:24:53 +03:00
Denis Zharkov d487c1ef0f Refine dispatching convention
Dispatching happens only via `suspendWithCurrentContinuation` calls
instead of each `resume` call

 #KT-15657 Fixed
2017-01-14 13:24:53 +03:00
Denis Zharkov 2cb9d3a8ad Move coroutine intrinsics to kotlin.coroutine.intrinsics package
Also rename val SUSPENDED to SUSPENDED_MARKER

 #KT-15698 Fixed
2017-01-14 13:24:53 +03:00
Alexander Udalov e860d620c6 Add script flag to kotlin.Metadata
This will allow to distinguish compiled scripts from ordinary classes in the
compiler, reflection, IDE, etc.

 #KT-13382 Fixed
2017-01-11 19:28:51 +03:00
Mikhail Zarechenskiy 101ad11db5 Regenerate all automatically-generated data 2017-01-10 14:24:01 +03:00
Mikhael Bogdanov 2566a7a25e Rename receiver$0 in CallableReference to receiver
#KT-15449 Fixed
2016-12-29 16:57:02 +01:00
Denis Zharkov d0ba048342 Refine coroutine/suspend functions ABI
- `invoke` method must always start a suspend functions
- For creation of coroutine that has not been started yet, there are
two special internal interfaces `SuspendFunction0`/`SuspendFunction1`
2016-12-22 11:08:42 +03:00
Roman Elizarov 7b079bd1f7 Renaming after DM 2016-12-15 23:58:22 +03:00
Roman Elizarov a70ac0160d fixed runWithCurrentContinuation 2016-12-15 23:58:04 +03:00
Stanislav Erokhin 0132f3eea7 Remove kotlin.coroutine package from default imports. 2016-12-15 23:57:51 +03:00
Stanislav Erokhin 642ea81625 Remove annotation Suspend. Use modificator instead. 2016-12-15 23:57:47 +03:00
Denis Zharkov 72401efb9f Update coroutine related runtime parts 2016-12-15 23:32:08 +03:00
Roman Elizarov 852a5ee064 New coroutine builder convention API 2016-12-15 23:32:07 +03:00
Ilya Gorbunov 3bedbfae33 Move kotlin.comparisons.Comparator to kotlin package and remove the former from default imports. 2016-12-15 13:39:10 +03:00
Alexander Udalov 1342743001 Add KotlinVersion.IS_PRE_RELEASE and a flag to kotlin/Metadata 2016-12-09 01:59:33 +03:00
Ilya Gorbunov c3921d1e40 Docs: improve code formatting in PurelyImplements docs, fix MutableList fq-name in example. 2016-12-08 20:34:54 +03:00
Alexander Udalov 0d99801783 Revert "Add NonVolatileRef to runtime"
This reverts commit 1e9624901a.

For more information, see
https://discuss.kotlinlang.org/t/non-volatile-vs-volatile-captured-refs-by-default/

 #KT-14746 Fixed
2016-12-06 14:59:15 +03:00
Alexander Udalov 04d4351e30 Revert "Make Ref fields volatile"
This reverts commit 6b348bfc6e.

For more information, see
https://discuss.kotlinlang.org/t/non-volatile-vs-volatile-captured-refs-by-default/

 #KT-14746 In Progress
2016-12-06 14:59:14 +03:00
Dmitry Petrov 5879e201cd Proper equality comparison for bound callable references represented as reflection objects
(including references to property accessors).
2016-11-25 14:49:24 +03:00
Dmitry Petrov 3dd0c9d1c7 Equality comparison for bound callable references takes into account bound receiver.
Fixed KT-14939: use expected receiver type when generating receiver code in get/set methods for bound property references.
Otherwise we have VerifyError for bound receiver 'null' of type 'Nothing?', which is mapped to 'java.lang.Void'.

TODO: proper equality comparison for property accessors ('x::prop.getter', 'x::prop.setter').
2016-11-25 14:49:24 +03:00
Ilya Gorbunov 03bbe875d4 Fix the links to the language docs from JvmStatic and JvmName annotations. Add a link from JvmField annotation.
#KT-14953 Fixed
2016-11-23 23:41:16 +03:00
Ilya Gorbunov b556adf8db Move/alias Appendable and StringBuilder to kotlin.text
#KT-2084
2016-11-16 18:47:42 +03:00
Alexander Udalov 7e82d139cf Drop KFunction.isTailrec
The fate of this modifier seems unclear, and there doesn't seem to be any
valuable use cases for it in reflection
2016-11-15 11:01:16 +03:00
Denis Zharkov 50a5c08603 Optimize visibility for controller field in CoroutineImpl
While it's impossible to declare a property with protected field and public
getter we split these entities

- `_controller` field is used inside coroutines
- `controller` getter is used for accesing controller from noinline lambdas
 (also it can be used to obtain controller from continuation by explicit cast)
2016-11-09 12:25:31 +03:00
Denis Zharkov 7e49db8768 Introduce CoroutineImpl as a common super class for coroutines
The main benefit are class-files sizes for them
(not repeating the same declaration for each coroutine)
Also it helped to simplify coroutine codegen code a little

Note that controller/label field become non-volatile (see KT-14636)

 #KT-14636 In Progress
2016-11-09 12:25:31 +03:00
Ilya Ryzhenkov f79116a6d8 Optimize reflection by using Class.getName instead of Class.getCanonicalName 2016-10-31 20:17:33 +03:00
Ilya Gorbunov 11b03ebbb3 Annotate type aliases in kotlin-runtime with SinceKotlin 2016-10-21 18:19:03 +03:00
Ilya Gorbunov 2a7717214b Annotate new API with @SinceKotlin in kotlin-runtime except reflection and type aliases. 2016-10-13 08:37:31 +03:00
Ilya Chernikov 846797ff61 Switch to templates in the separate script runtime 2016-10-12 15:38:52 +02:00