Commit Graph

17 Commits

Author SHA1 Message Date
Alexander Udalov
1a618deeab Use descriptors for reflection on top level properties
This also allows to obtain a Field object from the package part (see
mapping.kt)
2015-03-11 16:42:33 +03:00
Alexander Udalov
64fdb18ad3 Use descriptors for reflection on class properties
- use ConcurrentHashMap as a cache of class loaders to module descriptors
- KClassImpl now has a lazy class descriptor and it manages property creation
  by looking (also lazily) for the property descriptor in the corresponding
  scope
- since deserialized descriptors have full information about where a JVM symbol
  is located and what signature it has, new tests will begin to pass where
  Kotlin model and Java reflection model differ, see classObjectVar.kt
2015-03-11 16:42:31 +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
Pavel V. Talanov
59f192ef90 Replace 'class object' with 'default object' in renderers and test data
Includes changes to decompiled text
Old syntax is used in builtins and project code for now
2015-03-06 19:36:54 +03:00
Michael Bogdanov
6eaa6201f0 Test for obsolete KT-6020: Type inference failed on property reference of generic class
#KT-6020 Can't Reproduce
2014-10-21 09:47:17 +04:00
Alexander Udalov
cd0551078c Support static method references
#KT-5123 Fixed
2014-09-26 18:48:43 +04:00
Svetlana Isakova
9d366cb896 Prohibit local objects and enum classes
#KT-5402 Fixed
  #KT-4838 Fixed

Resolve type of object inside local object as special, not supertype('Any').
Changed visibility of constructor of anonymous object to 'internal' to be able to resolve the following:
fun box(): String {
    var foo = object {
        val bar = object {
            val baz = "ok"
        }
    }
    return foo.bar.baz
}
The containing declaration of property initializers is constructor, so 'baz' was invisible inside private constructor.
2014-09-01 12:32:52 +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
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
89d6f25fb6 Fix initialization order of KClass field and class object fields 2014-07-02 01:26:21 +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
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
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
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