BinaryVersion: introduce isCompatibleWithCurrentCompilerVersion
This commit is contained in:
@@ -14,7 +14,7 @@ import java.io.InputStream
|
||||
* of the core protobuf messages (metadata.proto).
|
||||
*/
|
||||
class BuiltInsBinaryVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
|
||||
override fun isCompatible(): Boolean =
|
||||
override fun isCompatibleWithCurrentCompilerVersion(): Boolean =
|
||||
this.isCompatibleTo(INSTANCE)
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -13,7 +13,7 @@ fun InputStream.readBuiltinsPackageFragment(): Pair<ProtoBuf.PackageFragment?, B
|
||||
use { stream ->
|
||||
val version = BuiltInsBinaryVersion.readFrom(stream)
|
||||
val proto =
|
||||
if (version.isCompatible()) ProtoBuf.PackageFragment.parseFrom(
|
||||
if (version.isCompatibleWithCurrentCompilerVersion()) ProtoBuf.PackageFragment.parseFrom(
|
||||
stream,
|
||||
ExtensionRegistryLite.newInstance().apply(BuiltInsProtoBuf::registerAllExtensions)
|
||||
)
|
||||
|
||||
@@ -25,7 +25,10 @@ abstract class BinaryVersion(private vararg val numbers: Int) {
|
||||
numbers.asList().subList(3, numbers.size).toList()
|
||||
} else emptyList()
|
||||
|
||||
abstract fun isCompatible(): Boolean
|
||||
@Deprecated("Please use isCompatibleWithCurrentCompilerVersion()", ReplaceWith("isCompatibleWithCurrentCompilerVersion()"))
|
||||
fun isCompatible(): Boolean = isCompatibleWithCurrentCompilerVersion()
|
||||
|
||||
abstract fun isCompatibleWithCurrentCompilerVersion(): Boolean
|
||||
|
||||
fun toArray(): IntArray = numbers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user