Commit Graph

1010 Commits

Author SHA1 Message Date
Alexander Udalov 2d7a5ebf36 Simplify injectors for frontend.java
- delete InjectorForJavaSemanticServices, replace its usages with
  InjectorForJavaDescriptorResolver
- delete unneeded fields and parameters of InjectorForJavaDescriptorResolver
2013-08-26 15:59:57 +04:00
Alexander Udalov 763572663e Delete almost all code related to signature writing
Delete org.jetbrains.jet.rt.signature and jet.typeinfo packages from runtime,
refactor BothSignatureWriter so that it now writes only java generic signature
and saves parameter types and kinds
2013-08-26 15:59:54 +04:00
Alexander Udalov 5d647cac94 Delete ScopeUtils, move its only method 2013-08-26 15:59:52 +04:00
Alexander Udalov 78bd6faffc Minor, refactor JetFilesProvider 2013-08-26 15:59:51 +04:00
Alexander Udalov 155f3b3b96 Simplify TypeVariableResolver 2013-08-26 15:59:50 +04:00
Alexander Udalov cbdc157743 Delete PsiAnnotationWrapper
Merge its logic into KotlinSignatureAnnotation, move the latter to
resolve/java/kotlinSignature, delete resolve/java/kt package
2013-08-26 15:59:49 +04:00
Alexander Udalov bd54e070bb Get rid of dependency on PsiClass from deserialized resolver 2013-08-26 15:59:48 +04:00
Alexander Udalov 8746ee2895 Report ABI errors without PsiClass 2013-08-26 15:59:46 +04:00
Alexander Udalov 19299daacd Deserialize annotations on class object properties
Class object properties' backing fields are generated into static fields of the
containing class, not into fields of class object. For fields we now store the
flag which, if set, tells that this field should be looked for in the
containing class
2013-08-26 15:59:45 +04:00
Alexander Udalov 32c5624531 Convert between byte[] and String[] efficiently 2013-08-26 15:59:44 +04:00
Pavel V. Talanov 5ea38437c2 KotlinClassFileHeader determines what kind of annotation it contains
Add some stronger assertions about class file format
2013-08-26 15:59:42 +04:00
Pavel V. Talanov a131592c70 Refactor: Extract utilities related to reading KotlinClass and KotlinPackage annotations to a separate class KotlinClassFileHeader 2013-08-26 15:59:40 +04:00
Pavel V. Talanov f77dd0bad6 Remove JetTypeJetSignatureReader 2013-08-26 15:59:37 +04:00
Pavel V. Talanov a9b57a5535 Rearrange JvmStdlibNames, delete old annotations
Delete unused constants
Move constants related to abi to JvmAbi class
Constants related to annotation names are now in JvmAnnotationNames
Remove old annotation classes
Deprecate JetClass and JetPackageClass name constants
2013-08-26 15:59:36 +04:00
Pavel V. Talanov 01735a0412 Do not write old annotations (JetClass and others) 2013-08-26 15:59:33 +04:00
Pavel V. Talanov 4fe78e4e7b Move utilities using annotations to determine whether PsiClass is kotlin class or package class to DescriptorResolverUtils
Fix some of the usages
PackageClassUtils uses more precise method name
2013-08-26 15:59:32 +04:00
Pavel V. Talanov 7c49374dab Minor: remove unused field 2013-08-26 15:59:31 +04:00
Pavel V. Talanov 9be16bf94c Remove logic in JavaPropertyResolver related to kotlin properties
Make logic in MembersCache clearer
Remove useless helper classes
2013-08-26 15:59:29 +04:00
Pavel V. Talanov f5c4075837 Remove PsiClassWrapper class 2013-08-26 15:59:28 +04:00
Pavel V. Talanov 6c02f6aba8 Remove PsiParameterWrapper class 2013-08-26 15:59:27 +04:00
Pavel V. Talanov 9a76cd8472 Remove unused classes and methods in org.jetbrains.lang.resolve.java.kt package 2013-08-26 15:59:26 +04:00
Pavel V. Talanov 33d40f8a50 Use new annotations throughout JetFromJavaDescriptorHelper
Remove rest of JetClass annotation uses
2013-08-26 15:58:07 +04:00
Pavel V. Talanov ba8732d10f Remove JvmParameterMeaning abstraction
Some code enhancements included
2013-08-23 17:39:27 +04:00
Pavel V. Talanov 1843b7bbbe Don't use DeclarationOrigin 2013-08-23 17:39:27 +04:00
Pavel V. Talanov 69295290eb Remove big chunk of code related to using old annotations 2013-08-23 17:39:27 +04:00
Alexander Udalov 3123e57aa2 Calculate annotations once for each VirtualFile 2013-08-23 17:39:26 +04:00
Alexander Udalov eff99e563b Write ProtoBuf.Package to .kotlin_package
Instead of a delimited list of callables. Also some minor refactorings
2013-08-23 17:39:26 +04:00
Alexander Udalov b602db03f2 DescriptorFinder now can find class names in a package
This helps to get rid of "repeated class_name" field in Package protobuf
message. DescriptorFinder in resolve.java uses PSI to find all classes in a
package, and the finder for built-ins just reads .kotlin_class_names file
2013-08-23 17:39:24 +04:00
Alexander Udalov cfe9d78015 Deserialize annotations from package$src files if needed
For top-level members, we now write a FQ name of the package$src class which
has the member's annotations, and read the correct file in deserialization
2013-08-23 17:39:23 +04:00
Pavel V. Talanov 977cd7608a Split KotlinInfo annotation into two: KotlinClass and KotlinPackage
Two annotations are needed to properly distinguish package classes
2013-08-23 17:39:23 +04:00
Pavel V. Talanov 8a508fe938 Refactor: use constants instead of string literals 2013-08-23 17:39:22 +04:00
Alexander Udalov 6035d89c33 Extract field signature out of Java property signature 2013-08-23 17:39:22 +04:00
Alexander Udalov 87d4e35388 Deserialize annotations on class properties w/o fields
Annotations on properties without backing fields are stored on a special
synthesized method inside the class
2013-08-23 17:39:21 +04:00
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