Commit Graph

66 Commits

Author SHA1 Message Date
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
Alexander Udalov b00022ef1c Add JetBrains license to HashPMap, remove obsolete author tags and javadocs 2014-07-02 01:26:23 +04:00
Alexander Udalov 41aa12d249 Remove unneeded dependency on ListIterator in ConsPStack 2014-07-02 01:26:22 +04:00
Alexander Udalov 862a785c11 Use pcollections' HashPMap instead of ConcurrentHashMap in reflection 2014-07-02 01:26:22 +04:00
Alexander Udalov fca9a0bca2 Delete unneeded interface dependencies of HashPMap
To reduce class count and to avoid unneeded invokeinterface's
2014-07-02 01:26:22 +04:00
Alexander Udalov d83df541b7 Remove unneeded code and beautify HashPMap and its dependencies 2014-07-02 01:26:21 +04:00
Alexander Udalov 58bc611e3a Copy pcollections's HashPMap to kotlin/reflect/jvm/internal
It will be used for caching KClass instances for foreign (Java) classes
2014-07-02 01:26:21 +04:00
Alexander Udalov c17f515d06 Construct reflection objects via static factory methods
JVM back-end now generates invocations of these methods instead of
KClass/K*Property/... constructors for two reasons:

1. It occupies less space in the bytecode
2. We can (to some degree) alter the implementation of the factory methods
   without changing the ABI compatibility version
2014-07-02 01:26:20 +04:00
Alexander Udalov e7f19c531a Support 'accessible' for reflected properties on JVM
Calls Java reflection's isAccessible/setAccessible
2014-07-02 01:26:20 +04:00
Alexander Udalov 1275c84f92 Fail with IllegalAccessException on :: reference to private property
Instead of mysterious NoSuchMethodException
2014-07-02 01:26:20 +04:00
Alexander Udalov a8e1de48b8 Support :: references to Java instance fields in codegen
#KT-1183 In Progress
2014-07-02 01:26:19 +04:00
Alexander Udalov 5ab83aad8a Support references to extension properties in JVM codegen
#KT-1183 In Progress
2014-07-02 01:26:19 +04:00
Alexander Udalov 461cce103b Support references to top level and member properties in JVM codegen
#KT-1183 In Progress
2014-07-02 01:26:19 +04:00
Alexander Udalov 4ef089d2ed Introduce KClass, KPackage and their JVM implementations 2014-07-02 01:26:18 +04:00
Alexander Udalov 254a95ba1a Improve non-null assertion messages 2014-07-02 00:38:50 +04:00
Alexander Udalov 2ce4219b43 Add sensible "toString()" to kotlin.jvm.internal.Ref
No tests added because it's difficult to test: codegen always unwraps refs to
the objects they are referencing

 #KT-5205 Fixed
2014-06-26 22:03:01 +04:00
Alexander Udalov 54c21ffbf3 Delete K*FunctionNImpl classes
In favor of KFunctionImpl, KMemberFunctionImpl and KExtensionFunctionImpl
2014-05-19 19:50:59 +04:00
Alexander Udalov 8f7c0f0b65 Introduce KFunctionImpl, KMemberFunctionImpl, KExtensionFunctionImpl
Old 23*3 classes will be dropped, since they have no value.

Simplify JvmFunctionImplTypes significantly because of that
2014-05-19 19:50:59 +04:00
Alexander Udalov 5488a8402f Move and rename KFunctionImpl classes
Move from package "kotlin.reflect" to "kotlin.reflect.jvm.internal". They are
internal detail of the compiler and should not be used directly (especially now
that "kotlin.reflect" is in default import paths).

Also rename "KFunctionImplN" to "KFunctionNImpl", because this name makes more
sense
2014-05-19 19:50:58 +04:00
Alexander Udalov 51a16fe491 Drop FunctionImplN and ExtensionFunctionImplN
We have FunctionImpl and ExtensionFunctionImpl classes now (2 classes, not 46)
2014-05-19 19:50:58 +04:00
Alexander Udalov 41eb0deaa0 Introduce FunctionImpl and ExtensionFunctionImpl classes
Old FunctionImpl0,1,2,... will be dropped since they had no purpose
2014-05-19 19:50:58 +04:00
Alexander Udalov c7a7f31e82 Introduce module 'reflection', move KFunctionN to it
Metadata for KFunction classes is now longer serialized along with built-in
classes. This effectively means that it's no longer possible to find KFunction
classes via dependency on built-ins. There should be a kotlin-runtime library
in the specified classpath for reflection types to be resolvable.

A lot of tests were moved and changed, because tests on callable references
require stdlib in classpath from now on
2014-05-19 19:50:57 +04:00
Alexander Udalov 6b348bfc6e Make Ref fields volatile
Otherwise local shared variables are not safe to use from several threads
2014-04-24 16:10:11 +04:00
Alexander Udalov 0b2c832343 Write KotlinSyntheticClass to anonymous and local classes 2014-03-07 03:08:19 +04:00
Alexander Udalov cbfb626d50 Write KotlinSyntheticClass to generated classes for functions
That is SAM wrappers, callable reference wrappers, local functions and
anonymous functions
2014-03-07 03:08:18 +04:00
Alexander Udalov cfe3619db7 Introduce KotlinSyntheticClass annotation
Will be used instead of KotlinPackagePart, KotlinTraitImpl and other
hypothetical annotations we were planning to write on our synthesized classes
(lambdas, local functions, etc.)
2014-03-02 19:55:29 +04:00
Alexander Udalov 8762a02844 Add/update copyrights in built-ins sources 2014-03-02 19:55:29 +04:00
Alexander Udalov 787b4753c7 Copy KotlinSignature to package "kotlin.jvm"
Support both KotlinSignature classes in the compiler and in the IDEA plugin.
The old one will be deprecated later and dropped eventually
2014-03-02 19:55:28 +04:00
Alexander Udalov d9029917eb Move built-ins from package "jet" to "kotlin"
#KT-2896 Fixed
2014-03-02 19:55:20 +04:00