Increase abi version

This commit is contained in:
Pavel V. Talanov
2015-01-20 20:44:06 +03:00
parent 1e772e3d1a
commit 32aff01969
3 changed files with 3 additions and 33 deletions
@@ -25,8 +25,7 @@ public final class JvmAbi {
* This constant is used to identify binary format (class file) versions
* If you change class file metadata format and/or naming conventions, please increase this number
*/
//TODO: remove clsStubBuilding#sortCallableStubs and this comment when abi version is increased to 20
public static final int VERSION = 19;
public static final int VERSION = 20;
public static final String TRAIT_IMPL_CLASS_NAME = "$TImpl";
public static final String TRAIT_IMPL_SUFFIX = "$" + TRAIT_IMPL_CLASS_NAME;
@@ -197,7 +197,7 @@ private class ClassClsStubBuilder(
private fun createCallableMemberStubs(classBody: KotlinPlaceHolderStubImpl<JetClassBody>) {
val container = ProtoContainer(classProto, null)
for (callableProto in sortCallableStubs(classProto.getMemberList())) {
for (callableProto in classProto.getMemberList()) {
createCallableStub(classBody, callableProto, c, container)
}
}
@@ -58,7 +58,7 @@ fun createPackageFacadeFileStub(
): KotlinFileStubImpl {
val fileStub = createFileStub(packageFqName)
val container = ProtoContainer(null, packageFqName)
for (callableProto in sortCallableStubs(packageProto.getMemberList())) {
for (callableProto in packageProto.getMemberList()) {
createCallableStub(fileStub, callableProto, c, container)
}
return fileStub
@@ -201,32 +201,3 @@ val ProtoBuf.Callable.annotatedCallableKind: AnnotatedCallableKind
fun Name.ref() = StringRef.fromString(this.asString())
fun FqName.ref() = StringRef.fromString(this.asString())
//NOTE: sorting should be removed when stub version is increased next time
// this workaround is relevant for abi version 19
// this is needed to avoid building stubs in wrong order for compilers built before 77dd027d690c0fe48abccdea04bfeab871c7c6de was introduced
fun sortCallableStubs(unordered: List<ProtoBuf.Callable>): List<ProtoBuf.Callable> {
val extensionProperties = arrayListOf<ProtoBuf.Callable>()
val nonExtensionProperties = arrayListOf<ProtoBuf.Callable>()
val extensionFunctions = arrayListOf<ProtoBuf.Callable>()
val nonExtensionFunctions = arrayListOf<ProtoBuf.Callable>()
for (callable in unordered) {
val isExtension = callable.hasReceiverType()
when (Flags.CALLABLE_KIND[callable.getFlags()]) {
CallableKind.FUN -> {
if (isExtension) extensionFunctions.add(callable) else nonExtensionFunctions.add(callable)
}
CallableKind.VAL, CallableKind.VAR -> {
if (isExtension) extensionProperties.add(callable) else nonExtensionProperties.add(callable)
}
}
}
val result = ArrayList<ProtoBuf.Callable>(
extensionProperties.size() + nonExtensionProperties.size() + extensionFunctions.size() + nonExtensionFunctions.size()
)
result.addAll(nonExtensionProperties)
result.addAll(extensionProperties)
result.addAll(nonExtensionFunctions)
result.addAll(extensionFunctions)
return result
}