Commit Graph

11545 Commits

Author SHA1 Message Date
Pavel V. Talanov e83c785a50 Add serialization modules as dependencies for plugin 2013-08-26 15:59:39 +04:00
Alexander Udalov 9cb19d17b0 Don't test line numbers on *Package classes
Package classes in line number tests only contain "1" as the first line number
of a single function, so there's no point in testing it. The test was failing
due to the latest changes in the order of generation of classfiles (first $src,
then facade)
2013-08-26 15:59:38 +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 5f108905d1 Remove testing Kotlin signature from WriteSignatureTest 2013-08-26 15:59:34 +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
Pavel V. Talanov 60619a3507 KotlinAbiVersionIndex checks for KotlinClass and KotlinPackage annotations 2013-08-23 17:39:26 +04:00
Alexander Udalov 3123e57aa2 Calculate annotations once for each VirtualFile 2013-08-23 17:39:26 +04:00
Alexander Udalov f3f0260e69 Don't test DescriptorFinder logic in KotlinClass test
LoadCompiledKotlin and DescriptorSerialization tests should cover this.
KotlinClassAnnotationTest should only test that the correct annotation is
written
2013-08-23 17:39:26 +04:00
Alexander Udalov 49604f6298 Minor, move anonymous class to private inner 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 be2636de0f Refactor AbstractDescriptorSerializationTest
Serialize/deserialize package members via PackageData and
DescriptorSerializer.packageProto(), delete useless code
(JavaDescriptorFinder), extract some methods, etc.
2013-08-23 17:39:25 +04:00
Alexander Udalov 9ae9870d44 Don't test annotations in DescriptorSerializationTest 2013-08-23 17:39:25 +04:00
Alexander Udalov 196b829002 Serialize packages via descriptors in codegen
Disable KotlinPackage annotation for scripts, otherwise script analyzer tries
to add descriptors to a locked scope
2013-08-23 17:39:25 +04:00
Alexander Udalov d059a15bff Minor, make descriptor available to NamespaceCodegen 2013-08-23 17:39:25 +04:00
Alexander Udalov 8cbdb2924a Minor, make callback method empty, not abstract 2013-08-23 17:39:24 +04:00
Alexander Udalov 132f77d3c4 Minor, delete SerializerProvider 2013-08-23 17:39:24 +04:00
Alexander Udalov 2e3005e431 Minor, deserialized package scope is now not abstract 2013-08-23 17:39:24 +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 047ed18901 Change .kotlin_class_names format a little
Before writing a list of indexes of built-in classes' names, write the length
of such a list. It helps to read this list normally (not until an exception
happens)
2013-08-23 17:39:23 +04:00
Alexander Udalov d49a2ed613 Move Intrinsic annotation to javaClass property from its getter
This is needed because the property, not its getter, is used as a key to the
intrinsics map when codegen decides how to generate a method call. Earlier it
worked because annotations on getters of properties loaded from bytecode were
mistakenly added to annotations on properties themselves
2013-08-23 17:39:23 +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
Alexander Udalov e63a087ee5 Minor refactoring in codegen
Replace String by JvmClassName where possible in OwnerKind, ClassFileFactory,
NamespaceCodegen, add NotNull annotations, some minor renames, etc.
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 8dd27aa298 Java serialization maps descriptors correctly
Instead of determining JVM method names, fields, types heuristically (mapType),
do it correctly: in the place where a member is generated, its descriptor and
signature are stored into MemberMap, which is queried later when we serialize
its container
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 cf7c27ba79 Minor, Nullable/NotNull annotations 2013-08-23 17:39:21 +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 cc4fd008ad Minor, rename method
'resolveAnnotations' gives a false impression that this method will resolve
annotations with their arguments, which it does not
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 93d200be82 Minor, move byte arrays logic to ClassData/PackageData 2013-08-23 17:39:19 +04:00