Commit Graph

2877 Commits

Author SHA1 Message Date
Alexander Udalov c853c9be03 Create empty method for annotated properties w/o fields
There was no place in bytecode where annotations on properties without backing
fields could be stored to. Now they're written on a synthetic empty void method
with a special name ("propertyName$annotations").

(Annotations on properties cannot simply be written on getters in bytecode,
since a getter can have annotations of its own.)
2013-08-23 17:39:21 +04:00
Alexander Udalov 23378f0054 Deserialize annotations on property accessors 2013-08-23 17:39:21 +04:00
Alexander Udalov 453b0e8f10 Write java signature of serialized descriptors efficiently
Instead of storing a string with the signature, write the name, return type and
parameter types separately, reusing the name table. Refactor the name table to
allow it to store not only names of Kotlin entities, but also arbitrary names
and fq-names
2013-08-23 17:39:21 +04:00
Alexander Udalov eee9bb5a12 Refactor AbstractDescriptorSerializationTest
Use existing utility functions, replace ClassMetadata -> ClassData, add
annotations, etc.
2013-08-23 17:39:20 +04:00
Alexander Udalov 6ae81c3ade Store ABI version along with serialized descriptors
KotlinInfo annotation now has a version() field, which should be equal to the
compiler's JvmAbi.VERSION in order for this class to properly load and be used.

Create ErrorReporter class, which has a trace to which it can report errors
(now only related to ABI version). This is done because a dependency of
DeserializedDescriptorResolver from BindingTrace would be confusing.
Implementation of ErrorReporter will probably need to change when we untie
deserialization from java-resolve.

Check if PsiClass is actually a compiled class before trying to load serialized
data from it: otherwise it can be a Java source, as was in wrongAbiVersion()
test, and ASM will fail when trying to read that file. Rewrite the test so that
it now has a compiled Kotlin classes to check against (also include sources to
recompile this binary data later, although it won't probably be needed)
2013-08-23 17:39:20 +04:00
Alexander Udalov c14e324e85 Don't load Java's "FooPackage" class as a Kotlin package
Before creating a Kotlin package scope for a classfile, first check if it
contains KotlinInfo annotation
2013-08-23 17:39:20 +04:00
Alexander Udalov b44bc620e0 Implement getNamespace() for deserialized scope
DescriptorFinder now can find packages, pull the method up from
AbstractDescriptorFinder class
2013-08-23 17:39:19 +04:00
Alexander Udalov d90b764534 Fix getting built-in classes in frontend.java
getKotlinBuiltinClassDescriptor() worked only for classes in jet.* package and
was failing for classes like jet.Map.Entry, jet.MutableMap.MutableEntry
2013-08-23 17:39:19 +04:00
Alexander Udalov d0b84416b5 KotlinInfo data parameter is now String[]
This is done because byte arrays in annotation arguments cannot be longer than
65535 bytes, and serialized data's length for kotlin.KotlinPackage class from
stdlib is already close to this number
2013-08-23 17:39:19 +04:00
Alexander Udalov e63cef0848 Deserialize annotations on package members 2013-08-23 17:39:19 +04:00
Alexander Udalov 67ca7b78c4 Deserialize annotations on class members
Make 'Callable' message of descriptors.proto extensible, extend it in
java_descriptors.proto with a JVM signature of the member. This is needed in
order for annotation deserializer to find out which member in the compiled
bytecode corresponds to which descriptor in the hierarchy.

Create a new module 'serialization.java' containing everything related to
Java-specific serialization of descriptors.

Add an extension point to DescriptorSerializer, allowing to perform
platform-specific serialization on a callable
2013-08-23 17:39:18 +04:00
Alexander Udalov 4aeeafdff0 Deserialize annotations on classes
First version, not all kinds of value arguments of annotations are supported
2013-08-23 17:39:18 +04:00
Pavel V. Talanov 9a33567287 Read KotlinInfo annotations for packages
JavaNamespaceDescriptor creates DeserializedPackageMemberScope in case there is *Package class present for a particular package (other cases work as before)
2013-08-23 17:39:17 +04:00
Pavel V. Talanov 71060e0086 Use JetScope as the base interface in JavaNamespaceResolver 2013-08-23 17:39:17 +04:00
Alexander Udalov 011f733aad Serialize properties for objects
A new special CallableKind for properties created for objects --
OBJECT_PROPERTY.
Also fix PropertyPsiData.isFinal() in case of properties backed by fields
2013-08-23 17:39:17 +04:00
Pavel V. Talanov a57f74c278 Introduce VariableDescriptorForObject interface
Add implementations
Use this interface instead of CLASS_OBJECT_DECLARATION key in BindingContext
2013-08-23 17:39:16 +04:00
Pavel V. Talanov c08f067df2 Straightforward logic for deserialization descriptors in DeserializedDescriptorResolver 2013-08-23 17:39:15 +04:00
Pavel V. Talanov c3b1716e29 Rename ClassResolver -> DescriptorFinder
Avoid clash with JavaDescriptorResolver naming conventions
2013-08-23 17:39:15 +04:00
Pavel V. Talanov c3a44e37ba Remove various getClassId methods 2013-08-23 17:39:14 +04:00
Alexander Udalov f9ad6827d4 Simplify class object naming madness
- get rid of DescriptorNamer, always use descriptor.getName() instead
- delete AbstractClassResolver.getClassObjectName(), always use
  "<class-object-for-...>", except for the case of built-ins serialization
  (class object names should be replaced by "object" when writing files with
  serialized data for built-ins)
- delete NestedClassResolver.resolveClassObject(), always use the other method
  of this class instead
2013-08-23 17:39:14 +04:00
Pavel V. Talanov 04e9e953c3 Initial version of deserialization of compiled kotlin classes
Annotations are not supported
2013-08-23 17:39:12 +04:00
Alexander Udalov 83501c3722 KotlinInfo now has only one parameter data
Name table is now also stored in data, before the serialized class.
ClassData is now public, since it's used in plenty of places as a holder of
deserialized protobuf classes.
2013-08-23 17:39:12 +04:00
Alexander Udalov cc02ba7ab4 Don't load KotlinInfo annotation in resolve.java 2013-08-23 17:39:11 +04:00
Alexander Udalov defbf705fc Revert "Don't memoize exceptions in built-ins resolve session"
This reverts commit 450d6cad3b. It's no longer
needed since there's no resolve session in built-ins anymore
2013-08-23 17:39:03 +04:00
Nikolay Krasko 450d6cad3b Don't memoize exceptions in built-ins resolve session 2013-08-22 21:16:57 +04:00
Nikolay Krasko 73308378e5 Add ability to test jet file is in scope 2013-08-14 15:31:16 +04:00
Nikolay Krasko 70ae9e589c Generate only final fields for injectors - make the access thread-safe 2013-08-08 00:37:42 +04:00
Natalia.Ukhorskaya acf8c88cfc Java property as annotation parameter 2013-08-02 18:59:29 +04:00
Natalia.Ukhorskaya e792238cbe Boolean as annotation parameter (java) 2013-08-02 18:59:27 +04:00
Evgeny Gerashchenko 2cfe11cb6b Moved method. 2013-07-23 21:43:05 +04:00
Evgeny Gerashchenko 0126ee4e2a Regenerated Java to Kotlin method map (after fixing bug in overridance). 2013-07-23 21:43:04 +04:00
Evgeny Gerashchenko 5c8f87658a Made SAM adapters final. 2013-07-12 21:09:22 +04:00
Evgeny Gerashchenko 822c42603f Created extension point for overridability checks. 2013-07-12 21:09:22 +04:00
Evgeny Gerashchenko fc99ad35b3 Supported complex cases of SAM adapters inheritance/overriding. 2013-07-12 21:09:22 +04:00
Andrey Breslav 8d65613eed Create <out Any?> projections for raw Java types, not <*>
KT-3760 Internal compiler error with Java interoperability and ElasticSearch 0.90.2 (IllegalStateException, Type parameter descriptor in not initialized: T declared in ...)
 #KT-3760 Fixed

EA-44150 Type parameter descriptor in not initialized. Fixed
2013-07-10 08:28:47 +04:00
Andrey Breslav e566c3a738 Static import 2013-07-10 08:28:47 +04:00
Natalia.Ukhorskaya a5662fe906 Resolve annotations arguments in body resolver 2013-07-04 14:38:07 +04:00
Evgeny Gerashchenko 21b964cb7a Removed TODO. 2013-07-02 14:11:12 +04:00
Evgeny Gerashchenko 525af972d3 Replaced ref object usage with custom class. 2013-06-25 20:17:47 +04:00
Evgeny Gerashchenko b77fbf37b6 Using more specific class. 2013-06-25 20:17:47 +04:00
Evgeny Gerashchenko 104f15adc4 Moved Java-related keys to JavaBindingContext. 2013-06-25 20:17:47 +04:00
Evgeny Gerashchenko eef380a5c3 Extracted SAM constructor and adapter recording methods. 2013-06-25 20:17:46 +04:00
Evgeny Gerashchenko 939bab67f0 Removed useless parameter. 2013-06-25 20:17:46 +04:00
Evgeny Gerashchenko caf25ad4eb More direct resolving function group from Java. 2013-06-25 20:17:46 +04:00
Evgeny Gerashchenko 8e49eb135a Correctly processing inherited methods when checking for SAM interface. 2013-06-25 20:17:43 +04:00
Evgeny Gerashchenko eb7dc87225 Ignore SAM adapters when finding abstract members. 2013-06-25 20:17:42 +04:00
Evgeny Gerashchenko 5e2c3fcb50 Loading SAM adapters for constructors. 2013-06-25 20:16:20 +04:00
Mikhael Bogdanov aec6deae9f Rename fields on name clashing
#KT-3663 Fixed
 #KT-3664 Fixed
2013-06-17 15:20:42 +04:00
Mikhael Bogdanov 47fe81471a Synthetic accessors for class object private members
#KT-3338 Fixed
2013-06-17 15:20:34 +04:00
Andrey Breslav 3e8031acbd Properly load objects nested into class objects from Java 2013-06-10 15:33:10 +04:00