Commit Graph

1246 Commits

Author SHA1 Message Date
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
Michael Nedzelsky fac2e38054 Do not serizalize null as compile time constant 2015-02-20 02:33:30 +03:00
Michael Nedzelsky ead3a1dc65 fix getting compile time initializer before computing deferred type 2015-02-20 02:33:27 +03:00
Svetlana Isakova 204e9a0c34 KT-6751 References to type arguments of a type argument not resolved when wrong number of them
#KT-6751 Fixed
2015-02-19 14:43:18 +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 0d05fca838 Support serialization/deserialization of local classes
Most of these changes are aimed to support and correctly transform ClassId for
local classes, no actual bytes are written or read at the moment (see next
commits). See the comment on ClassId for clarification.

A hack in DescriptorSerializer which erased anonymous types to Any (which had
been breaking the consistency between descriptors resolved from sources and
from serialized information) is now gone
2015-02-16 20:19:54 +03:00
Alexander Udalov add9bb34cb Refactor ReadKotlinClassHeaderAnnotationVisitor
Extract a hierarchy of four nested classes instead of anonymous
2015-02-16 20:19:53 +03:00
Alexander Udalov 5d8ae3ed6a Minor, refactor some constants in JvmAnnotationNames
Declare KotlinClass similarly to KotlinSyntheticClass, this will be used later
2015-02-16 20:19:52 +03:00
Alexander Udalov fdfe3fd73b Minor, serialize/deserialize local visibility
Also support non-subsequent enum values in Flags
2015-02-16 20:19:51 +03:00
Alexander Udalov cd9898fc43 Minor, rename and invert meaning of ClassId.isTopLevelClass
Also use a simpler constructor and simplify ClassDeserializer.ClassKey
2015-02-16 20:19:50 +03:00
Alexander Udalov e812c4e67f Introduce KotlinSyntheticClass.Kind.LOCAL_TRAIT_IMPL 2015-02-16 20:19:50 +03:00
Alexander Udalov ce26ce0458 Drop "extra visibility" from binary format
Descriptors of Kotlin symbols should always have a visibility known to Kotlin
2015-02-16 20:19:49 +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 1e50078f6f Delete dependency of 'serialization' on trove4j
Use HashMap of wrapped objects instead of THashMap with custom hashing strategy
2015-02-16 20:19:12 +03:00
Andrey Breslav 47f772e75a Assert no lookup in meaningless scope created by commonSupertype() 2015-02-16 18:50:10 +03:00
Andrey Breslav c61a29d4f5 KT-6774 Cannot find equals() when comparing with null
#KT-6774 Fixed
2015-02-16 18:50:09 +03:00
Pavel V. Talanov 32aff01969 Increase abi version 2015-02-16 15:38:48 +03:00
Pavel V. Talanov 766912c590 Generate additional deprecated "OBJECT$" field for class object
To avoid breaking some code for now
It should be removed later
2015-02-16 15:38:43 +03:00
Pavel V. Talanov f482768acf Introduce ClassDescriptor#getDefaultObjectDescriptor()
ClassDescriptor#getClassObjectDescriptor (with old semantics) is now a utility
Process usages and replace with calls to a new method where appropriate
2015-02-16 15:38:42 +03:00
Pavel V. Talanov 945072a129 Drop DeserializedResolverUtils and it's usages 2015-02-16 15:38:41 +03:00
Pavel V. Talanov 42d2b97c09 Remove all class object related constants and utils from JvmAbi 2015-02-16 15:38:30 +03:00
Pavel V. Talanov c29ba63a74 Minor: Simplify getClassObjectType() 2015-02-16 15:38:27 +03:00
Pavel V. Talanov 0343fd8fc7 Rework class objects
Class objects have name "Default" by default
Do not produce synthetic class objects
Class objects have new semantics:
    class "A" has class object "B" if literal "A" can be used as a value of type "B"
Class objects act like ordinary nested objects
    i.e. are accessible from class scope via getClassifier()
Jvm backend: class object fields and class have the name of class object ("Default")
	as opposed to special "OBJECT$" and "object"
Serialization: only the name of class object is needed to serialize data
2015-02-16 15:38:27 +03:00
Valentin Kipyatkov 2d6ed5dd42 One more usage switched to use of new import insertion method 2015-02-12 18:18:03 +03:00
Alexander Udalov 9f74d64d03 Avoid using FQNAME_TO_CLASS_DESCRIPTOR slice where module exists 2015-02-11 18:37:13 +03:00
Alexander Udalov 1e8d8d0a99 Cleanup FqNamesUtil.kt
Delete unused, move some utilities to fqNameUtil.kt in IDE, rewrite comments
2015-02-11 18:37:11 +03:00
Andrey Breslav 1d4109aec1 Retaining annotations on Java array types 2015-02-10 06:55:48 +01:00
Andrey Breslav 5db6bb04e3 Basic Java nullability warnings implemented
#KT-6723 In Progress
2015-02-10 06:55:47 +01:00
Andrey Breslav 0e972acf8c == turned into a safe-call 2015-02-10 06:55:46 +01:00
Dmitry Jemerov 7827bbf64b Standard library documentation updates. 2015-02-09 19:19:29 +01:00
Alexander Udalov 4128655893 Report incomplete hierarchy error
This is the case when you reference a Java class in Kotlin whose superclass is
not resolved. Previously this fact was swallowed by LazyJavaClassDescriptor
leading to mysterious compilation errors

 #KT-5129 Fixed
2015-02-09 21:14:02 +03:00
Alexander Udalov cafc1ea24d Fix resolution of inherited Kotlin properties in Java classes
#KT-6720 Fixed
2015-02-04 14:57:47 +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
Michael Nedzelsky df8fed096c add support for compile time constant serialization 2015-02-03 14:41:24 +03:00
Andrey Breslav 0f0f205248 Serializing information about star projections 2015-02-02 19:52:02 +03:00
Andrey Breslav fecf6f9fdf Star projection information preserved in substitutions
#KT-6700 Fixed
2015-02-02 19:52:01 +03:00
Andrey Breslav da639039bd KT-6698 Bad class file when using a star-projection on a Java's recursive generic parameter
#KT-6698 Fixed
2015-02-02 19:52:00 +03:00
Svetlana Isakova a2f03f2d52 Fix: constraint T? >: Int! should transform to T >: Int 2015-01-30 13:33:37 +03:00
Svetlana Isakova 279f09ee45 Removed method 'hasTypeConstructorMismatchAt' from status
Used ConstraintError's instead
2015-01-30 13:33:36 +03:00
Svetlana Isakova 6cac6350a6 Fixed rendering of error message for 'cannot capture type' error
Type variable should be chosen correctly
2015-01-30 13:33:35 +03:00
Svetlana Isakova 971ad53bcc Introduced ConstraintError for storing errors in the constraint system 2015-01-30 13:33:35 +03:00
Alexander Udalov 5903b8c4a7 Reorder and optimize dependencies between modules and libraries
- drop 'kotlin-runtime' and other dependencies which are exported by
  other modules ('util' and 'util.runtime' in case of 'kotlin-runtime')
- make all Kotlin modules from the compiler depend on 'util' for clarity
- put 'util' and 'util.runtime' to the bottom of the list everywhere: when
  kotlin-runtime gets reflection, classes from core/ should have higher
  priority than their previous versions from kotlin-runtime.jar
2015-01-28 19:58:35 +03:00
Valentin Kipyatkov 974982463c Visible classes take priority when resolving imports with * 2015-01-21 20:10:18 +03:00
Valentin Kipyatkov b9d47ffe7a Changed priority for default imports + default imports include all built-ins explicitly for java module
#KT-4374 Fixed
2015-01-21 20:10:18 +03:00
Svetlana Isakova 9dbcd8b55f Approximate captured types only when necessary 2015-01-21 15:37:33 +03:00