Commit Graph

1294 Commits

Author SHA1 Message Date
Alexander Udalov fdfd808d80 Remove KForeignMemberProperty and KClassOrigin, use KMemberPropertyImpl instead 2015-03-11 16:42:36 +03:00
Alexander Udalov ff0044f66a Use descriptors for reflection on extension properties 2015-03-11 16:42:34 +03:00
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 d1debf586c Support local classes in reflection 2015-03-11 16:42:32 +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 ba0ea1515b Minor, simplify/optimize KClassImpl creation 2015-03-11 16:42:30 +03:00
Alexander Udalov ecde41d9ab Introduce ReflectProperties for lazy weak/soft property delegates
This class needs to be written in Java because no Kotlin classes can be used in
KClassImpl constructor (otherwise since each Kotlin class creates a KClassImpl
in its static initializer, this would result in infinite recursion)
2015-03-11 16:42:29 +03:00
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 af6e7cf140 Minor, remove ReflectJavaTypeProvider, throw unsupported instead
getTypeProvider() is in fact a bad abstraction because it's only used in SAM
construction, which does not happen at runtime
2015-03-11 16:42:26 +03:00
Alexander Udalov e95d22dcfe Refactor ReflectJavaConstructor.getValueParameters()
See https://youtrack.jetbrains.com/issue/KT-6886 for more information
2015-03-11 16:42:25 +03:00
Alexander Udalov 1054f004aa Load annotations on constructors and parameters of Kotlin reflected classes 2015-03-11 16:42:24 +03:00
Alexander Udalov 4fb420f3f1 Fix deserialization of enum annotation arguments at runtime 2015-03-11 16:42:23 +03:00
Alexander Udalov f36ef6f546 Provide equals, hashCode, toString for classes in reflection model 2015-03-11 16:42:21 +03:00
Alexander Udalov a14b301f31 Resolve annotations on all reflected elements
Annotation in NestedEnumArgument test is made public, because we try to load
annotation argument values eagerly and fail, since you can't invoke methods
reflectively on an object of a non-effectively-public class
2015-03-11 16:42:19 +03:00
Alexander Udalov c90f11b7e6 Support Java symbols in runtime descriptor loading 2015-03-11 16:42:18 +03:00
Alexander Udalov 73e4287aee Initial support of annotation loading at runtime
In order to locate an annotated entity, we need to implement almost the whole
Java element model (which will be used anyway for Java descriptor loading)
2015-03-11 16:42:17 +03:00
Alexander Udalov 356f54b5df Initial support of descriptor loading at runtime 2015-03-11 16:42:15 +03:00
Dmitry Jemerov 07381b765f rename Numbers.kt to Primitives.kt as it now contains Char which is not a number 2015-03-11 12:40:39 +01:00
Dmitry Jemerov 89398796c6 generate also the Char class 2015-03-11 12:40:31 +01:00
Pavel V. Talanov 8fef31ee5b Replace 'class object' with 'default object' in builtins 2015-03-10 18:07:56 +03:00
Pavel V. Talanov 9ecf95532e Replace 'class object' with default object in project code 2015-03-10 18:07:46 +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 ed022f892b Drop JavaTypeParameter#getIndex 2015-03-07 02:32:14 +03:00
Alexander Udalov ca8831097f Resolve annotations on Java constructors
Also add tests on custom annotations on fields and methods
2015-03-07 02:32:14 +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
Alexander Udalov 9c5bcdc72a Prettify code in 'reflection.jvm'
Use stdlib instead of hand-written hacks, fix some warnings and unneeded !!
2015-03-07 02:31:00 +03:00
Alexander Udalov 4f649f5a33 Minor, drop KotlinBuiltIns.nonPhysicalClasses
See b9d47ffe7a
2015-03-07 02:31:00 +03:00
Alexander Udalov e136025ac5 Show "kotlin.Any" in decompiled text for local/anonymous types 2015-03-07 02:30:28 +03:00
Alexey Tsvetkov ded46843c2 JS: generate metadata for public inline functions 2015-03-06 21:36:18 +03:00
Dmitry Jemerov 1c426fada2 generate the code of Numbers.kt 2015-03-06 18:02:06 +01: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
Pavel V. Talanov ed4c265564 Drop ClassKind.CLASS_OBJECT
Default and non-default objects now have ClassKind.OBJECT
2015-03-05 13:06:33 +03:00
Pavel V. Talanov f72f548a93 Add ClassDescriptor#isDefaultObject()
with dummy implementations for now
2015-03-05 13:06:12 +03:00
Pavel V. Talanov 5e249e71f6 Do not exclude default object names when rendering descriptors in short names mode 2015-03-05 13:06:04 +03:00
Pavel V. Talanov 350864b22f Drop some of explicit ClassKind.CLASS_OBJECT and OBJECT usages 2015-03-05 13:05:56 +03:00
Pavel V. Talanov fa590a5b83 Refactor: Extract isObject with a new semantic 2015-03-05 13:05:48 +03:00
Pavel V. Talanov fc6f4208ec Rename: isObject -> isNonDefaultObject 2015-03-05 13:05:45 +03:00
Nikolay Krasko 1f79e0905f Intrinsic default objects implementation 2015-03-05 01:30:37 +03:00
Pavel V. Talanov f507af15c0 Rename in descriptors.proto: class_object_name -> default_object_name 2015-03-03 20:57:13 +03:00
Pavel V. Talanov 48fbce9582 Refactor: process mentions of class object
Rename usages that refer to "default object" concept now
Test data file names are left as is
2015-03-03 20:57:08 +03:00
Dmitry Jemerov 2cc291efdb Standard library documentation continued. 2015-03-03 11:20:30 +01:00
Pavel V. Talanov cbf9208c1d Minor: change rendering of class objects in source code renderers
Fixes one particular case in completion
2015-03-03 13:04:32 +03:00
Pavel V. Talanov 989f07962b Write to trace in case class qualifier is a short reference to default object
This allows to fix some cases when there is a difference between explicit and short reference to default object
Fix shorten reference, optimize imports and import insert helper for default objects
ShortenReferences always transforms default object references to shorter form for now
Fix DescriptorUtils#getFqName() for default objects (affects test data mostly)
Fix DescriptorUtils#getImportableDescriptor()
2015-03-03 13:04:30 +03:00
Pavel V. Talanov 7f672f8078 Minor: remove redundant class objects from project code 2015-03-03 13:04:30 +03:00
Dmitry Jemerov 595eacb099 remove incorrect JVM-specific note 2015-03-02 13:25:31 +01:00
Dmitry Jemerov 78cb983bd0 clarify docs 2015-03-02 13:02:00 +01:00
Dmitry Jemerov 417711f9e6 document InlineStrategy and InlineOptions 2015-03-02 12:52:52 +01:00
Dmitry Jemerov cec1b94664 provide documentation for generated built-in classes 2015-02-27 14:19:39 +01:00
Alexander Udalov b99b1883bc Drop unused parameter in JavaToKotlinClassMap and subclasses 2015-02-25 20:13:46 +03:00
Alexander Udalov fca7a8c4a2 Drop PrimitiveTypesUtil, store desc in JvmPrimitiveType 2015-02-25 20:13:46 +03:00