Commit Graph

156 Commits

Author SHA1 Message Date
Dmitry Petrov 9e546bda27 Support is/as/as? with Function[K]<...> types. 2015-10-06 10:06:27 +03:00
Alexander Udalov 041af28166 Deprecate and don't write KotlinClass$Kind, to be removed later 2015-10-03 00:59:30 +03:00
Alexander Udalov 056bb3f833 Deprecate and don't write KotlinSyntheticClass$Kind, to be removed later 2015-10-03 00:59:28 +03:00
Alexander Udalov 5bb47c8365 Write KotlinInterfaceDefaultImpls annotation to DefaultImpls classes
Instead of KotlinSyntheticClass with kind = TRAIT_IMPL
2015-10-03 00:58:52 +03:00
Dmitry Petrov 06d9ff6a71 KT-9377 Support is-checks for read-only collections
Generate better code for 'as?' with mutable collection types:
use CHECKCAST, do not introduce special intrinsics for safe-as.
2015-10-02 15:17:00 +03:00
Dmitry Petrov e033d093d4 KT-9377 Support is-checks for read-only collections
Reorganize marker interfaces and is/as/as? intrinsics.
2015-10-02 15:17:00 +03:00
Dmitry Petrov 6cb0e5151c KT-9377 Support is-checks for read-only collections
Intrinsics for is/as/as? with mutable Kotlin collections and related types.
2015-10-02 15:17:00 +03:00
Dmitry Petrov 35881198c3 KT-9377 Support is-checks for read-only collections
Marker interfaces for mutable Kotlin collections and related classes.
2015-10-02 15:17:00 +03:00
Alexander Udalov 6a8d0fbd75 Introduce infrastructure to separate string table from metadata on JVM
Nothing especially helpful happens here, this is only a big refactoring
introducing a separate string array for the string table, which is currently
always empty, but will contain actual strings soon
2015-09-29 16:26:27 +03:00
Alexander Udalov 5fe958f034 Add target TYPE to JVM metadata annotations 2015-09-29 16:26:26 +03:00
Yan Zhulanow 1139a8dd0e Mark builtins and stblib functions with 'operator' 2015-09-25 19:20:18 +03:00
Dmitry Petrov 5cdbdfc2cc - Annotate package facades with java.lang.Deprecated.
- Provide KotlinDelegatedMethod annotation on package facade members.
2015-09-23 17:41:12 +03:00
Denis Zharkov 9c4564a5a6 Get rid of deprecated annotations and modifiers in project code 2015-09-18 09:34:27 +03:00
Mikhail Glukhikh b4399b8b8b AnnotationTarget.CLASSIFIER and KotlinTarget.CLASSIFIER both dropped (second step) 2015-09-14 12:51:11 +03:00
Alexander Udalov 6cecc66d10 Improve ABI version from one number to "major.minor.patch" 2015-09-11 19:28:46 +03:00
Dmitry Petrov cd341e957e Cleanup after review
+ stub builder test for multifile class
2015-09-09 19:08:19 +03:00
Dmitry Petrov a00346a141 MultifileClassCodegen
- initial implementation
- new Kotlin file kinds + stub builder
2015-09-09 19:08:17 +03:00
Dmitry Petrov e050ff3271 Generate ex-package parts as file facades.
Support new facade kind in stub building and incremental compilation.
2015-09-07 16:28:52 +03:00
Michael Bogdanov e83ec1017b Reflection support 2015-09-07 16:28:51 +03:00
Mikhail Glukhikh 8f7b29f80a Annotation rename: target --> @Target 2015-09-07 13:42:26 +03:00
Yan Zhulanow 4ca127ecb3 Create custom exception for lateinit 2015-09-05 00:54:20 +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
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
Alexander Udalov f1a75508d3 Optimize non-generic CollectionToArray.toArray for empty collection 2015-09-03 14:52:24 +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 94d45f35d4 Support KClass.nestedClasses 2015-08-29 17:59:45 +03:00
Alexander Udalov 9f7cb752db Minor, rename KCallableContainerImpl -> KDeclarationContainerImpl
Also rename DeclarationContainerImpl -> ClassBasedDeclarationContainer and make
non-public
2015-08-24 01:29:57 +03:00
Mikhail Glukhikh bd3b5690a2 Standard annotations: must be documented 2015-08-05 18:32:12 +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 628bb774fd Support class reference expressions without kotlin-reflect.jar in classpath
Currently not much you can do with them, but in the future '.java' extension
property will allow to get the Class instance from it.

Also introduce codegen tests with stdlib but without reflection in the
classpath.

Based on the work by @dnpetrov
2015-07-30 12:18:28 +03:00
Alexander Udalov 699a801ce9 Add KCallable.returnType 2015-07-29 21:36:45 +03:00
Alexander Udalov e079b8f425 Support KCallable.call
#KT-2187 Fixed
2015-07-29 21:36:42 +03:00
Alexander Udalov 95be8b11f5 Don't write JetValueParameter to the bytecode
The class itself can't be deleted at this point because it's used in the old
bytecode and tools (e.g. proguard) will complain if they can't find it in the
new runtime
2015-07-29 21:36:39 +03:00
Alexander Udalov 5962b79126 Support introspection of parameter names and indices in reflection 2015-07-29 21:36:34 +03:00
Mikhail Glukhikh 8beafe90a0 Retention / target for some standard annotations 2015-07-28 17:13:29 +03:00
Mikhail Glukhikh 94a00540be Targeting / retention for a set of standard annotations, some inapplicable annotation checks replaced with target check, some fixed tests 2015-07-21 15:36:53 +03:00
Alexander Udalov de94778846 Restore deprecated K*Function classes for compatibility
The code compiled with old compiler will work with the new runtime, but not
vice versa
2015-07-16 15:36:07 +03:00
Alexander Udalov 4f1247f03f Support property getters/setters in reflection 2015-07-10 20:10:10 +03:00
Alexander Udalov 048a9b686e Generate separate anonymous class for each property reference
Each property reference obtained by the '::' operator now causes back-end to
generate an anonymous subclass of the corresponding KProperty class, with the
customized behavior. This fixes a number of issues:

- get/set/name of property references now works without kotlin-reflect.jar in
  the classpath
- get/set/name methods are now overridden with statically-generated property
  access instead of the default KPropertyImpl's behavior of using Java
  reflection, which should be a lot faster
- references to private/protected properties now work without the need to set
  'accessible' flag, because corresponding synthetic accessors are generated at
  compile-time near the target property

 #KT-6870 Fixed
 #KT-6873 Fixed
 #KT-7033 Fixed
2015-07-10 20:10:09 +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
Alexander Udalov ab297a4da0 Generate reflection info to classes for function references
The information includes the owner (class, package, script, or null for local
functions) and the JVM signature -- this information will be used by reflection
to locate the symbol
2015-07-10 20:10:07 +03:00
Denis Zharkov 8b49a1d660 Add PurelyImplements annotation
It's parameter is FQ-name of class (currently only from builtins) that added as supertype to annotated Java class.

Parameters of annotated class used as non-flexible arguments of added supertype, that helps to propagate more precise types when using in Kotlin.
Some standard JDK collections loaded as they annotated with PurelyImplements.

See tests for clarification.
Before: ArrayList<Int>.add(x: Int!) // possible to add null
After: ArrayList<Int>.add(x: Int)   // impossible to add null

 #KT-7628 Fixed
 #KT-7835 Fixed
2015-07-09 16:36:47 +03:00
Alexander Udalov f9afb4f95b Make CLASS default class kind in binary metadata
Don't write the kind to the class file if it's CLASS to save some bytes
2015-07-06 16:19:57 +03:00
Alexander Udalov 5e011b92ef Add source roots to modules 'builtins' and 'runtime.jvm'
This is done to be able to write code in the module 'reflection.jvm' in the IDE
without lots of unresolved errors and such
2015-07-06 16:19:55 +03:00
Michael Bogdanov 9ef00f0621 Code clean 2015-06-24 09:48:56 +03:00
Michael Bogdanov a018e4e12a Updated exception table generation: support new exception table in non-local returns 2015-06-24 09:48:55 +03:00
Alexander Udalov 16b20cf910 Fix NoSuchMethodError on FunctionReference#init 2015-06-02 17:29:52 +03:00
Alexander Udalov 596d378962 Fix abstract method error: implement arity in function references 2015-06-01 19:23:09 +03:00