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)
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
LoadCompiledKotlin and DescriptorSerialization tests should cover this.
KotlinClassAnnotationTest should only test that the correct annotation is
written
Serialize/deserialize package members via PackageData and
DescriptorSerializer.packageProto(), delete useless code
(JavaDescriptorFinder), extract some methods, etc.
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
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)
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
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
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
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.)
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
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)
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