Remove dependency of ClassMapperLite on JavaToKotlinClassMap

There are two reasons for this. First, this class will be used in the
metadata reading library which should not have dependencies on lots of
compiler stuff JavaToKotlinClassMap depends on.

Second, it was easy to accidentally break the deserialization in old
compilers by adding another mapping to JavaToKotlinClassMap. This was
possible because ClassMapperLite is used to decide whether or not the
JVM signature is "trivial" and should be written to the metadata (at
JvmSerializerExtension.SignatureSerializer.requiresSignature). If the
signature is trivial but mentions a type added in JavaToKotlinClassMap
in the new compiler, the old compiler will not be able to load the
signature correctly. See the comment on ClassMapperLite for more
information
This commit is contained in:
Alexander Udalov
2018-03-01 17:14:31 +01:00
parent 070effc69d
commit a5a69c5099
4 changed files with 65 additions and 28 deletions
@@ -265,7 +265,7 @@ public class JvmSerializerExtension extends SerializerExtension {
ClassifierDescriptor classifier = type.getConstructor().getDeclarationDescriptor();
if (!(classifier instanceof ClassDescriptor)) return null;
ClassId classId = DescriptorUtilsKt.getClassId((ClassDescriptor) classifier);
return classId == null ? null : ClassMapperLite.mapClass(classId);
return classId == null ? null : ClassMapperLite.mapClass(classId.asString());
}
@NotNull