Do not call findKotlinClass when loading class annotations
The main change is in AbstractBinaryClassAnnotationAndConstantLoader, where we no longer perform unnecessary IO operations for classes which are already loaded to memory
This commit is contained in:
-7
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.serialization.deserialization;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
@@ -31,8 +30,6 @@ public interface ErrorReporter {
|
||||
|
||||
void reportCannotInferVisibility(@NotNull CallableMemberDescriptor descriptor);
|
||||
|
||||
void reportLoadingError(@NotNull String message, @Nullable Exception exception);
|
||||
|
||||
ErrorReporter DO_NOTHING = new ErrorReporter() {
|
||||
@Override
|
||||
public void reportIncompatibleMetadataVersion(
|
||||
@@ -47,9 +44,5 @@ public interface ErrorReporter {
|
||||
@Override
|
||||
public void reportCannotInferVisibility(@NotNull CallableMemberDescriptor descriptor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportLoadingError(@NotNull String message, @Nullable Exception exception) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+6
-4
@@ -25,14 +25,16 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.BinarySour
|
||||
|
||||
sealed class ProtoContainer(
|
||||
val nameResolver: NameResolver,
|
||||
val typeTable: TypeTable
|
||||
val typeTable: TypeTable,
|
||||
val source: BinarySource?
|
||||
) {
|
||||
class Class(
|
||||
val classProto: ProtoBuf.Class,
|
||||
nameResolver: NameResolver,
|
||||
typeTable: TypeTable,
|
||||
source: BinarySource?,
|
||||
val outerClassKind: ClassKind?
|
||||
) : ProtoContainer(nameResolver, typeTable) {
|
||||
) : ProtoContainer(nameResolver, typeTable, source) {
|
||||
val classId: ClassId = nameResolver.getClassId(classProto.fqName)
|
||||
|
||||
val kind: ProtoBuf.Class.Kind = Flags.CLASS_KIND.get(classProto.flags) ?: ProtoBuf.Class.Kind.CLASS
|
||||
@@ -45,8 +47,8 @@ sealed class ProtoContainer(
|
||||
val fqName: FqName,
|
||||
nameResolver: NameResolver,
|
||||
typeTable: TypeTable,
|
||||
val source: BinarySource?
|
||||
) : ProtoContainer(nameResolver, typeTable) {
|
||||
source: BinarySource?
|
||||
) : ProtoContainer(nameResolver, typeTable, source) {
|
||||
override fun debugFqName(): FqName = fqName
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -73,8 +73,9 @@ class DeserializedClassDescriptor(
|
||||
private val constructors = c.storageManager.createLazyValue { computeConstructors() }
|
||||
private val companionObjectDescriptor = c.storageManager.createNullableLazyValue { computeCompanionObjectDescriptor() }
|
||||
|
||||
internal val thisAsProtoContainer =
|
||||
ProtoContainer.Class(classProto, c.nameResolver, c.typeTable, (containingDeclaration as? ClassDescriptor)?.kind)
|
||||
internal val thisAsProtoContainer = ProtoContainer.Class(
|
||||
classProto, c.nameResolver, c.typeTable, sourceElement as? BinarySource, (containingDeclaration as? ClassDescriptor)?.kind
|
||||
)
|
||||
|
||||
private val annotations =
|
||||
if (!Flags.HAS_ANNOTATIONS.get(classProto.flags)) {
|
||||
|
||||
Reference in New Issue
Block a user