Move BinaryVersion to metadata, JVM versions to metadata.jvm

To be used in kotlinx-metadata
This commit is contained in:
Alexander Udalov
2018-05-16 12:12:37 +02:00
parent e5a5d834ab
commit 1b15619457
39 changed files with 103 additions and 142 deletions
@@ -0,0 +1,24 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.metadata.jvm.deserialization
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
/**
* The version of conventions used in bytecode of generated .class files, such as default method naming & signatures,
* internal member name mangling specifics, property getter/setter names, etc.
*/
class JvmBytecodeBinaryVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
override fun isCompatible() = this.isCompatibleTo(INSTANCE)
companion object {
@JvmField
val INSTANCE = JvmBytecodeBinaryVersion(1, 0, 2)
@JvmField
val INVALID_VERSION = JvmBytecodeBinaryVersion()
}
}
@@ -0,0 +1,26 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.metadata.jvm.deserialization
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
/**
* The version of the metadata serialized by the compiler and deserialized by the compiler and reflection.
* This version includes the version of the core protobuf messages (metadata.proto) as well as JVM extensions (jvm_metadata.proto).
*/
class JvmMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
// NOTE: 1.1 is incompatible with 1.0 and hence with any other version except 1.1.*
override fun isCompatible() =
this.major == 1 && this.minor == 1
companion object {
@JvmField
val INSTANCE = JvmMetadataVersion(1, 1, 10)
@JvmField
val INVALID_VERSION = JvmMetadataVersion()
}
}