Commit Graph

20847 Commits

Author SHA1 Message Date
Denis Zharkov 7d963e8e07 Differ this/non-this instances for vars initialization in class
When deal with constructed object (not this) treat it like it's fully initialized.

Otherwise (this or access with no receiver) access instruction
should be handled as it was before.

 #KT-6788 Fixed
 #KT-4126 Fixed
2015-03-11 17:45:25 +03:00
Denis Zharkov 1004e016fd Minor, drop unused method 2015-03-11 17:45:25 +03:00
Denis Zharkov f673f4ff47 Prohibit super delegation call if there is primary constructor 2015-03-11 17:45:25 +03:00
Denis Zharkov 835a0df13a Prohibit secondary constructors in traits 2015-03-11 17:45:25 +03:00
Denis Zharkov 978279bff3 Minor, drop unused method 2015-03-11 17:45:25 +03:00
Denis Zharkov 4a628a3d8f Prohibit supertype initialization without primary constructor 2015-03-11 17:45:25 +03:00
Denis Zharkov 28fbdb7c53 Prohibit constructors declarations for object 2015-03-11 17:45:24 +03:00
Denis Zharkov 3fef4ad742 Minor, drop unneeded accept 2015-03-11 17:45:24 +03:00
Denis Zharkov 525ddf9eb0 Prevent circular secondary constructors delegation 2015-03-11 17:45:24 +03:00
Denis Zharkov 5388bd7cdc Record resolved delegated constructor in trace 2015-03-11 17:45:24 +03:00
Denis Zharkov 7f20c4a237 Control flow changes for secondary constructors 2015-03-11 17:45:24 +03:00
Denis Zharkov 61ae694be4 Allow return statements in secondary constructors 2015-03-11 17:45:24 +03:00
Denis Zharkov 80e13d3f70 Allow class initializer without primary constructor 2015-03-11 17:45:23 +03:00
Denis Zharkov 87193aec2f Minor, drop unused variable 2015-03-11 17:45:23 +03:00
Denis Zharkov 3509cafcea Allow no super class initialization within header
if there is no primary constructor
2015-03-11 17:45:23 +03:00
Denis Zharkov 1555eec954 Secondary constructors delegation calls and body resolve 2015-03-11 17:45:23 +03:00
Denis Zharkov b2cecf1dd0 Secondary constructors resolve 2015-03-11 17:45:23 +03:00
Denis Zharkov 8305d73682 Drop unused interface method
There was the only usage and it's redundant.
JetClass' implementation name is refined.
2015-03-11 17:45:22 +03:00
Denis Zharkov 3ba94d7352 Parsing: secondary constructors 2015-03-11 17:45:22 +03:00
Denis Zharkov cb881d2628 Drop some ClassDescriptor.getConstructors() usages
supposing that there is only primary constructor
2015-03-11 17:45:22 +03:00
Denis Zharkov bdd2756bd1 Rename ThisReference -> ConstructorDelegationReference 2015-03-11 17:45:22 +03:00
Denis Zharkov a55e8911ea Drop parsing of enum initializers using `this'
#KT-6626 Fixed
2015-03-11 17:45:22 +03:00
Andrey Breslav 0dc1448d69 Secondary constructors specs 2015-03-11 17:45:21 +03:00
Dmitry Jemerov d3b8464722 fix test: regenerate Primitives.kt 2015-03-11 15:18:38 +01:00
Alexander Udalov dc4dfbeec1 Fix generic class literals, substitute type parameters with stars 2015-03-11 16:42:47 +03:00
Alexander Udalov 6468515d99 Report error when LHS of class literal is not a class 2015-03-11 16:42:45 +03:00
Alexander Udalov b93b9bd565 Support KClass.simpleName and built-in class literals 2015-03-11 16:42:43 +03:00
Alexander Udalov 6e45c6f17c Support class literals (A::class) 2015-03-11 16:42:41 +03:00
Alexander Udalov 2b089e0f39 Configure kotlin-reflect.jar in IDE as part of KotlinJavaRuntime library 2015-03-11 16:42:39 +03:00
Alexander Udalov b3cdd818f0 Support member extension properties, implement KClass.getExtensionProperties()
#KT-6570 Fixed
2015-03-11 16:42:38 +03:00
Alexander Udalov da209e673c Implement KClass.getProperties()
#KT-6570 In Progress
2015-03-11 16:42:37 +03:00
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 2c8754a6af Build lite runtime of protobuf-java
Saves ~400kb (3.25mb -> 2.85mb) of runtime+reflect size
2015-03-11 16:42:27 +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
Yan Zhulanow be954f2c27 Fix WrongIdFormat exception on Android XML widgets with non-@+id/ format 2015-03-11 15:33:45 +03:00