Commit Graph

94 Commits

Author SHA1 Message Date
Alexander Udalov 2b090e02a1 Build kotlin-reflect.jar in build.xml and for Maven
Reflection will be distributed in a separate jar and not in kotlin-runtime.jar
for two primary reasons:
- Reflection implementation at the moment takes almost 2Mb
- Separate libraries for separate features is a technique encouraged by Maven,
  and it's inconvenient to make it different in the compiler distribution
2015-03-11 16:42:28 +03:00
Alexander Udalov a8046020fb Rename kotlin.reflect.IllegalAccessException -> IllegalPropertyAccessException
The former name clashes with java.lang.IllegalAccessException and proved to be
inconvenient because it should always be qualified in the source.

Also use java.lang exception's message as kotlin.reflect exception's message
2015-03-07 02:32:15 +03:00
Alexander Udalov 0bd5264b5e Get rid of module reflection.stub.jvm
Generate K*Function as a supertype for a function reference instead of
K*FunctionImpl; this will allow one binary library to be used with or without
reflection
2015-03-07 02:31:26 +03:00
Nikolay Krasko 1f79e0905f Intrinsic default objects implementation 2015-03-05 01:30:37 +03:00
Alexander Udalov e705ff2517 Write KotlinSyntheticClass annotation on when-by-enum mapping classes 2015-02-16 21:46:22 +03:00
Alexander Udalov 6ce8d6bd2e Serialize descriptors for local/anonymous classes on JVM
Reflection needs this information to work for local classes and anonymous
objects
2015-02-16 21:46:21 +03:00
Alexander Udalov e812c4e67f Introduce KotlinSyntheticClass.Kind.LOCAL_TRAIT_IMPL 2015-02-16 20:19:50 +03:00
Alexander Udalov 1609bbcd10 Minor, add FQ name to avoid clash
Maven build compiles runtime.jvm and reflection.jvm together and
IllegalAccessException is ambiguous between java.lang and kotlin.reflect
2015-02-16 20:19:48 +03:00
Alexander Udalov 245b16dccc Drop unneeded factory methods due to ABI version increase
Either ReflectionFactory or direct creation is now used instead
2015-02-16 20:19:14 +03:00
Alexander Udalov 17c930c84f Use abstract factory for reflection objects on JVM
Introduce an abstract factory class ReflectionFactory which is responsible for creating
reflection objects (KClass, KProperty, ...). The meaningful implementation is
located in "reflection.jvm" where KClassImpl/KPropertyImpl/... are accessible
and can be instantiated. The default implementation will be used in the lite
runtime with no reflection and will return nulls / throw exceptions there.

Put all functions, calls to which are generated by JVM back-end, in one place:
the class named Reflection which contains only static methods. Previously these
functions were scattered across different files in module "reflection.jvm".

The code using reflection may now be compiled against either runtime, but
reflection features will work if and only if reflection is accessible at
runtime
2015-02-16 20:19:13 +03:00
Alexander Udalov 5170ab3588 Fix Intrinsics.sanitizeStackTrace for depth > 1 2015-02-03 21:40:40 +03:00
Alexander Udalov 39c9216edc Fix shameful assertion message error introduced after extracting method 2015-02-03 21:20:25 +03:00
Denis Zharkov aecb925b7b Refined skipping last goto when inlining try/catch/finally block 2015-01-15 15:13:05 +03:00
Denis Zharkov 5a0a05e5c7 Removed unused inline markers 2015-01-15 15:13:04 +03:00
Alexander Udalov 21b2fa2509 Update copyrights to 2015 2015-01-13 01:15:18 +03:00
Alexander Udalov 11ff051924 Regenerate built-ins, keywords, operations map 2015-01-03 00:19:03 +03:00
Michael Nedzelsky eded72d633 fix KT-6192: VerifyError when using spreads with primitive arrays
#KT-6192 Fixed
2014-12-25 22:07:24 +03:00
Denis Zharkov 3b2d0b88f3 Supported nested reified parameter declarations
Also switched to using type names as identifiers instead of their
indices
2014-11-27 15:15:04 +04:00
Alexander Udalov 93696ff9bd Make Array.indices extension property, move to stdlib
This is not something that needs to be intrinsified. Note that compiler
optimizations are still possible and the fact whether 'indices' is a member or
an extension is irrelevant to the optimizer
2014-11-17 15:20:44 +03:00
Alexander Udalov 128c938965 Make Array.size() a function instead of a property
Also add a deprecated extension property to help migration. This is done to
unify getting size of arrays and collections
2014-11-17 15:02:38 +03:00
Denis Zharkov 0087d861e1 Introduced new reified marker needClassReification
It's not parametrised by index
2014-11-13 20:56:08 +03:00
Denis Zharkov fc1d8dd9ce javaClass<T> is supported for reified T 2014-11-13 20:56:06 +03:00
Denis Zharkov f3c49c605f Typecheck instructions are supported for reified T 2014-11-13 20:56:06 +03:00
Denis Zharkov 4a66ab3627 Support generic array creation for reified inlined 2014-11-13 20:56:06 +03:00
Alexander Udalov 57d37a3860 Extract reflection implementation to module runtime.jvm 2014-11-11 18:35:40 +03:00
Alexander Udalov c50ca3ab86 Fix empty stack trace in assertion for platform typed expression 2014-10-23 18:32:47 +04:00
Andrey Breslav f1c66fa6b0 Assertions on approximation of platform types to non-null types
- for most expressions (ExpressionCodegen.genQualified)
2014-10-13 15:38:13 +04:00
Michael Bogdanov 469db95662 Inline markers added 2014-09-29 17:16:57 +04:00
Alexander Udalov 2284e3de5a Decompose Intrinsics#checkParameterIsNotNull to make it JIT-able
#KT-5635 Fixed
2014-08-14 12:48:16 +04:00
Alexander Udalov a5321ba9f0 Drop deprecated Intrinsics#stupidSync 2014-07-25 21:19:39 +04:00
Alexander Udalov a79398fa00 Don't load Object as a supertype for Java classes
#KT-4890 In Progress
 #KT-5002 Fixed
2014-07-25 21:19:37 +04:00
Alexander Udalov a07909bb52 Don't generate unnecessary accessors for private class properties 2014-07-17 19:18:05 +04:00
Andrey Breslav 98e87f2f95 Removing unneeded "public override val" from constructors across the project
#KT-4295 Fixed
2014-07-05 18:31:55 +04:00
Andrey Breslav 90690e0711 KT-4825 Implement "synchronized" properly via monitorenter/monitorexit
#KT-4825 Fixed
2014-07-02 22:05:45 +04:00
Alexander Udalov 36f7cc742f Introduce NoSuchPropertyException and IllegalAccessException
No new tests added because it's difficult to model a situation where a
::-access is allowed but the code throws these exceptions at runtime
2014-07-02 01:58:22 +04:00
Alexander Udalov a84d528325 Improve performance of $kotlinClass field initializer
Don't load annotations reflectively in each class' <clinit>
2014-07-02 01:55:56 +04:00
Alexander Udalov bc8bce7ca1 Provide "toString" for reflection objects 2014-07-02 01:55:55 +04:00
Alexander Udalov c5d92cc03e Provide "equals" and "hashCode" for reflection objects 2014-07-02 01:55:55 +04:00
Alexander Udalov 704de8992e Support mapping between Java and Kotlin reflection objects 2014-07-02 01:55:55 +04:00
Alexander Udalov a38a396a43 Remove default import "kotlin.reflect"
Basic reflection is usable without any imports (with :: literals)

This reverts commit 9503056dd5.
2014-07-02 01:55:53 +04:00
Alexander Udalov d32a02f21a Modify top-level/extension property hierarchy
- rename KTopLevelProperty to KTopLevelVariable
- create KTopLevelExtensionProperty, a subclass of KExtensionProperty
- create KTopLevelProperty, a superclass of KTopLevelVariable and
  KTopLevelExtensionProperty. (In the future, it will have a container of type
  KPackage.)
2014-07-02 01:55:53 +04:00
Alexander Udalov f73b8b9ff8 Extract KForeignMemberProperty out of KMemberPropertyImpl
KClassImpl is now able to create a property by the name, according to its
origin
2014-07-02 01:55:52 +04:00
Alexander Udalov 9c5596cddb Expose Java reflection objects out of Kotlin ones 2014-07-02 01:55:52 +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 8b619eceed Make KMemberProperty's T parameter have a non-null bound 2014-07-02 01:26:25 +04:00
Alexander Udalov 7cbbeb257e Add NotNull annotations to HashPMap 2014-07-02 01:26:25 +04:00
Alexander Udalov e60428b540 Improve performance of foreignKClasses, add comments 2014-07-02 01:26:24 +04:00
Alexander Udalov 0fa6b40731 Make intermediate *Impl properties traits, not classes
Otherwise multiple inheritance of classes would be needed to make
implementations inherit correctly for mutable properties
2014-07-02 01:26:24 +04:00
Alexander Udalov ef7fbe55cf Make KClass instances weak in foreignKClasses 2014-07-02 01:26:24 +04:00
Alexander Udalov 47b08af66c Inline HashPMap entry's getter methods 2014-07-02 01:26:23 +04:00