Minor, serialize/deserialize local visibility
Also support non-subsequent enum values in Flags
This commit is contained in:
@@ -136,6 +136,10 @@ public final class DebugProtoBuf {
|
|||||||
* <code>PRIVATE_TO_THIS = 4;</code>
|
* <code>PRIVATE_TO_THIS = 4;</code>
|
||||||
*/
|
*/
|
||||||
PRIVATE_TO_THIS(4, 4),
|
PRIVATE_TO_THIS(4, 4),
|
||||||
|
/**
|
||||||
|
* <code>LOCAL = 5;</code>
|
||||||
|
*/
|
||||||
|
LOCAL(5, 5),
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,6 +166,10 @@ public final class DebugProtoBuf {
|
|||||||
* <code>PRIVATE_TO_THIS = 4;</code>
|
* <code>PRIVATE_TO_THIS = 4;</code>
|
||||||
*/
|
*/
|
||||||
public static final int PRIVATE_TO_THIS_VALUE = 4;
|
public static final int PRIVATE_TO_THIS_VALUE = 4;
|
||||||
|
/**
|
||||||
|
* <code>LOCAL = 5;</code>
|
||||||
|
*/
|
||||||
|
public static final int LOCAL_VALUE = 5;
|
||||||
|
|
||||||
|
|
||||||
public final int getNumber() { return value; }
|
public final int getNumber() { return value; }
|
||||||
@@ -173,6 +181,7 @@ public final class DebugProtoBuf {
|
|||||||
case 2: return PROTECTED;
|
case 2: return PROTECTED;
|
||||||
case 3: return PUBLIC;
|
case 3: return PUBLIC;
|
||||||
case 4: return PRIVATE_TO_THIS;
|
case 4: return PRIVATE_TO_THIS;
|
||||||
|
case 5: return LOCAL;
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16612,10 +16621,10 @@ public final class DebugProtoBuf {
|
|||||||
"E\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003\":\n\014" +
|
"E\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003\":\n\014" +
|
||||||
"CallableKind\022\007\n\003FUN\020\000\022\007\n\003VAL\020\001\022\007\n\003VAR\020\002\022" +
|
"CallableKind\022\007\n\003FUN\020\000\022\007\n\003VAL\020\001\022\007\n\003VAR\020\002\022" +
|
||||||
"\017\n\013CONSTRUCTOR\020\003*\005\010d\020\310\001*-\n\010Modality\022\t\n\005F" +
|
"\017\n\013CONSTRUCTOR\020\003*\005\010d\020\310\001*-\n\010Modality\022\t\n\005F" +
|
||||||
"INAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002*W\n\nVisibi" +
|
"INAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002*b\n\nVisibi" +
|
||||||
"lity\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTE" +
|
"lity\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTE" +
|
||||||
"CTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_TO_THIS\020\004B",
|
"CTED\020\002\022\n\n\006PUBLIC\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022",
|
||||||
"\022B\rDebugProtoBuf\210\001\000"
|
"\t\n\005LOCAL\020\005B\022B\rDebugProtoBuf\210\001\000"
|
||||||
};
|
};
|
||||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||||
|
|||||||
@@ -293,4 +293,5 @@ enum Visibility {
|
|||||||
PROTECTED = 0x02;
|
PROTECTED = 0x02;
|
||||||
PUBLIC = 0x03;
|
PUBLIC = 0x03;
|
||||||
PRIVATE_TO_THIS = 0x04;
|
PRIVATE_TO_THIS = 0x04;
|
||||||
|
LOCAL = 0x05;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,6 +154,9 @@ public class Flags {
|
|||||||
else if (visibility == Visibilities.PROTECTED) {
|
else if (visibility == Visibilities.PROTECTED) {
|
||||||
return ProtoBuf.Visibility.PROTECTED;
|
return ProtoBuf.Visibility.PROTECTED;
|
||||||
}
|
}
|
||||||
|
else if (visibility == Visibilities.LOCAL) {
|
||||||
|
return ProtoBuf.Visibility.LOCAL;
|
||||||
|
}
|
||||||
throw new IllegalArgumentException("Unknown visibility: " + visibility);
|
throw new IllegalArgumentException("Unknown visibility: " + visibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +229,12 @@ public class Flags {
|
|||||||
int maskUnshifted = (1 << bitWidth) - 1;
|
int maskUnshifted = (1 << bitWidth) - 1;
|
||||||
int mask = maskUnshifted << offset;
|
int mask = maskUnshifted << offset;
|
||||||
int value = (flags & mask) >> offset;
|
int value = (flags & mask) >> offset;
|
||||||
return values[value];
|
for (E e : values) {
|
||||||
|
if (getIntValue(e) == value) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalStateException("Flag not found: " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int toFlags(E value) {
|
public int toFlags(E value) {
|
||||||
|
|||||||
@@ -110,6 +110,10 @@ public final class ProtoBuf {
|
|||||||
* <code>PRIVATE_TO_THIS = 4;</code>
|
* <code>PRIVATE_TO_THIS = 4;</code>
|
||||||
*/
|
*/
|
||||||
PRIVATE_TO_THIS(4, 4),
|
PRIVATE_TO_THIS(4, 4),
|
||||||
|
/**
|
||||||
|
* <code>LOCAL = 5;</code>
|
||||||
|
*/
|
||||||
|
LOCAL(5, 5),
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,6 +140,10 @@ public final class ProtoBuf {
|
|||||||
* <code>PRIVATE_TO_THIS = 4;</code>
|
* <code>PRIVATE_TO_THIS = 4;</code>
|
||||||
*/
|
*/
|
||||||
public static final int PRIVATE_TO_THIS_VALUE = 4;
|
public static final int PRIVATE_TO_THIS_VALUE = 4;
|
||||||
|
/**
|
||||||
|
* <code>LOCAL = 5;</code>
|
||||||
|
*/
|
||||||
|
public static final int LOCAL_VALUE = 5;
|
||||||
|
|
||||||
|
|
||||||
public final int getNumber() { return value; }
|
public final int getNumber() { return value; }
|
||||||
@@ -147,6 +155,7 @@ public final class ProtoBuf {
|
|||||||
case 2: return PROTECTED;
|
case 2: return PROTECTED;
|
||||||
case 3: return PUBLIC;
|
case 3: return PUBLIC;
|
||||||
case 4: return PRIVATE_TO_THIS;
|
case 4: return PRIVATE_TO_THIS;
|
||||||
|
case 5: return LOCAL;
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -43,6 +43,7 @@ fun visibility(visibility: ProtoBuf.Visibility) = when (visibility) {
|
|||||||
ProtoBuf.Visibility.PRIVATE_TO_THIS -> Visibilities.PRIVATE_TO_THIS
|
ProtoBuf.Visibility.PRIVATE_TO_THIS -> Visibilities.PRIVATE_TO_THIS
|
||||||
ProtoBuf.Visibility.PROTECTED -> Visibilities.PROTECTED
|
ProtoBuf.Visibility.PROTECTED -> Visibilities.PROTECTED
|
||||||
ProtoBuf.Visibility.PUBLIC -> Visibilities.PUBLIC
|
ProtoBuf.Visibility.PUBLIC -> Visibilities.PUBLIC
|
||||||
|
ProtoBuf.Visibility.LOCAL -> Visibilities.LOCAL
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun classKind(kind: ProtoBuf.Class.Kind): ClassKind = when (kind) {
|
public fun classKind(kind: ProtoBuf.Class.Kind): ClassKind = when (kind) {
|
||||||
|
|||||||
Reference in New Issue
Block a user