Support version kind for RequireKotlin
#KT-20584 Fixed
This commit is contained in:
@@ -424,6 +424,12 @@ message VersionRequirement {
|
||||
HIDDEN = 2;
|
||||
}
|
||||
|
||||
enum VersionKind {
|
||||
LANGUAGE_VERSION = 0;
|
||||
COMPILER_VERSION = 1;
|
||||
API_VERSION = 2;
|
||||
}
|
||||
|
||||
// Kotlin version, since which this declaration is accessible, in the following format (encoded version is "major.minor.patch"):
|
||||
// (patch << 7) + (minor << 3) + major
|
||||
// Compilers with version less than this value should report a diagnostic if this declaration is selected as the resolution result
|
||||
@@ -441,6 +447,10 @@ message VersionRequirement {
|
||||
|
||||
// Diagnostic message
|
||||
optional int32 message = 5 [(string_id_in_table) = true];
|
||||
|
||||
// Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
// (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
optional VersionKind version_kind = 6 [default = LANGUAGE_VERSION];
|
||||
}
|
||||
|
||||
message VersionRequirementTable {
|
||||
|
||||
@@ -19913,6 +19913,25 @@ public final class ProtoBuf {
|
||||
* </pre>
|
||||
*/
|
||||
int getMessage();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
boolean hasVersionKind();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind getVersionKind();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.VersionRequirement}
|
||||
@@ -19996,6 +20015,18 @@ public final class ProtoBuf {
|
||||
message_ = input.readInt32();
|
||||
break;
|
||||
}
|
||||
case 48: {
|
||||
int rawValue = input.readEnum();
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind value = org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind.valueOf(rawValue);
|
||||
if (value == null) {
|
||||
unknownFieldsCodedOutput.writeRawVarint32(tag);
|
||||
unknownFieldsCodedOutput.writeRawVarint32(rawValue);
|
||||
} else {
|
||||
bitField0_ |= 0x00000020;
|
||||
versionKind_ = value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -20094,6 +20125,71 @@ public final class ProtoBuf {
|
||||
// @@protoc_insertion_point(enum_scope:org.jetbrains.kotlin.serialization.VersionRequirement.Level)
|
||||
}
|
||||
|
||||
/**
|
||||
* Protobuf enum {@code org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind}
|
||||
*/
|
||||
public enum VersionKind
|
||||
implements org.jetbrains.kotlin.protobuf.Internal.EnumLite {
|
||||
/**
|
||||
* <code>LANGUAGE_VERSION = 0;</code>
|
||||
*/
|
||||
LANGUAGE_VERSION(0, 0),
|
||||
/**
|
||||
* <code>COMPILER_VERSION = 1;</code>
|
||||
*/
|
||||
COMPILER_VERSION(1, 1),
|
||||
/**
|
||||
* <code>API_VERSION = 2;</code>
|
||||
*/
|
||||
API_VERSION(2, 2),
|
||||
;
|
||||
|
||||
/**
|
||||
* <code>LANGUAGE_VERSION = 0;</code>
|
||||
*/
|
||||
public static final int LANGUAGE_VERSION_VALUE = 0;
|
||||
/**
|
||||
* <code>COMPILER_VERSION = 1;</code>
|
||||
*/
|
||||
public static final int COMPILER_VERSION_VALUE = 1;
|
||||
/**
|
||||
* <code>API_VERSION = 2;</code>
|
||||
*/
|
||||
public static final int API_VERSION_VALUE = 2;
|
||||
|
||||
|
||||
public final int getNumber() { return value; }
|
||||
|
||||
public static VersionKind valueOf(int value) {
|
||||
switch (value) {
|
||||
case 0: return LANGUAGE_VERSION;
|
||||
case 1: return COMPILER_VERSION;
|
||||
case 2: return API_VERSION;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<VersionKind>
|
||||
internalGetValueMap() {
|
||||
return internalValueMap;
|
||||
}
|
||||
private static org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<VersionKind>
|
||||
internalValueMap =
|
||||
new org.jetbrains.kotlin.protobuf.Internal.EnumLiteMap<VersionKind>() {
|
||||
public VersionKind findValueByNumber(int number) {
|
||||
return VersionKind.valueOf(number);
|
||||
}
|
||||
};
|
||||
|
||||
private final int value;
|
||||
|
||||
private VersionKind(int index, int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(enum_scope:org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind)
|
||||
}
|
||||
|
||||
private int bitField0_;
|
||||
public static final int VERSION_FIELD_NUMBER = 1;
|
||||
private int version_;
|
||||
@@ -20216,12 +20312,38 @@ public final class ProtoBuf {
|
||||
return message_;
|
||||
}
|
||||
|
||||
public static final int VERSION_KIND_FIELD_NUMBER = 6;
|
||||
private org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind versionKind_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasVersionKind() {
|
||||
return ((bitField0_ & 0x00000020) == 0x00000020);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind getVersionKind() {
|
||||
return versionKind_;
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
version_ = 0;
|
||||
versionFull_ = 0;
|
||||
level_ = org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.Level.ERROR;
|
||||
errorCode_ = 0;
|
||||
message_ = 0;
|
||||
versionKind_ = org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION;
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
@@ -20251,6 +20373,9 @@ public final class ProtoBuf {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeInt32(5, message_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
output.writeEnum(6, versionKind_.getNumber());
|
||||
}
|
||||
output.writeRawBytes(unknownFields);
|
||||
}
|
||||
|
||||
@@ -20280,6 +20405,10 @@ public final class ProtoBuf {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeInt32Size(5, message_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeEnumSize(6, versionKind_.getNumber());
|
||||
}
|
||||
size += unknownFields.size();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -20384,6 +20513,8 @@ public final class ProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000008);
|
||||
message_ = 0;
|
||||
bitField0_ = (bitField0_ & ~0x00000010);
|
||||
versionKind_ = org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION;
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -20427,6 +20558,10 @@ public final class ProtoBuf {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
result.message_ = message_;
|
||||
if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
to_bitField0_ |= 0x00000020;
|
||||
}
|
||||
result.versionKind_ = versionKind_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
return result;
|
||||
}
|
||||
@@ -20448,6 +20583,9 @@ public final class ProtoBuf {
|
||||
if (other.hasMessage()) {
|
||||
setMessage(other.getMessage());
|
||||
}
|
||||
if (other.hasVersionKind()) {
|
||||
setVersionKind(other.getVersionKind());
|
||||
}
|
||||
setUnknownFields(
|
||||
getUnknownFields().concat(other.unknownFields));
|
||||
return this;
|
||||
@@ -20731,6 +20869,61 @@ public final class ProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind versionKind_ = org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
public boolean hasVersionKind() {
|
||||
return ((bitField0_ & 0x00000020) == 0x00000020);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind getVersionKind() {
|
||||
return versionKind_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setVersionKind(org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00000020;
|
||||
versionKind_ = value;
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.VersionRequirement.VersionKind version_kind = 6 [default = LANGUAGE_VERSION];</code>
|
||||
*
|
||||
* <pre>
|
||||
* Which version is this requirement for. For example, if version_kind = API_VERSION, this declaration requires the API version
|
||||
* (the "-api-version" argument value when compiling the call site) to be of at least the specified value
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearVersionKind() {
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
versionKind_ = org.jetbrains.kotlin.serialization.ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.VersionRequirement)
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -33,6 +33,7 @@ class VersionRequirementTable private constructor(private val infos: List<ProtoB
|
||||
|
||||
class VersionRequirement(
|
||||
val version: Version,
|
||||
val kind: ProtoBuf.VersionRequirement.VersionKind,
|
||||
val level: DeprecationLevel,
|
||||
val errorCode: Int?,
|
||||
val message: String?
|
||||
@@ -117,7 +118,7 @@ class VersionRequirement(
|
||||
|
||||
val message = if (info.hasMessage()) nameResolver.getString(info.message) else null
|
||||
|
||||
return VersionRequirement(version, level, errorCode, message)
|
||||
return VersionRequirement(version, info.versionKind, level, errorCode, message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user