Skip to content

Commit 1aeacd4

Browse files
zhangskzmkruskal-google
authored andcommitted
Breaking change: Lock down visibility for descriptor syntax APIs.
Users should migrate to corresponding feature accessors (e.g. FieldDescriptor.hasPresence, EnumDescriptor.isClosed) instead of deriving these based on syntax, which will break after under Editions (https://protobuf.dev/editions/overview/) PiperOrigin-RevId: 586518687
1 parent 80337cb commit 1aeacd4

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

java/core/src/main/java/com/google/protobuf/Descriptors.java

-8
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ public List<FileDescriptor> getPublicDependencies() {
140140
}
141141

142142
/** The syntax of the .proto file. */
143-
@Deprecated
144-
public
145143
enum Syntax {
146144
UNKNOWN("unknown"),
147145
PROTO2("proto2"),
@@ -156,8 +154,6 @@ enum Syntax {
156154
}
157155

158156
/** Get the syntax of the .proto file. */
159-
@Deprecated
160-
public
161157
Syntax getSyntax() {
162158
if (Syntax.PROTO3.name.equals(proto.getSyntax())) {
163159
return Syntax.PROTO3;
@@ -1273,8 +1269,6 @@ public OneofDescriptor getRealContainingOneof() {
12731269
* Returns true if this field was syntactically written with "optional" in the .proto file.
12741270
* Excludes singular proto3 fields that do not have a label.
12751271
*/
1276-
@Deprecated
1277-
public
12781272
boolean hasOptionalKeyword() {
12791273
return isProto3Optional
12801274
|| (file.getSyntax() == Syntax.PROTO2 && isOptional() && getContainingOneof() == null);
@@ -2843,8 +2837,6 @@ public OneofDescriptorProto toProto() {
28432837
return proto;
28442838
}
28452839

2846-
@Deprecated
2847-
public
28482840
boolean isSynthetic() {
28492841
return fields.length == 1 && fields[0].isProto3Optional;
28502842
}

ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import com.google.protobuf.DynamicMessage;
4343
import com.google.protobuf.InvalidProtocolBufferException;
4444
import com.google.protobuf.LegacyDescriptorsUtil.LegacyFileDescriptor;
45+
import com.google.protobuf.LegacyDescriptorsUtil.LegacyOneofDescriptor;
4546
import com.google.protobuf.Message;
4647
import com.google.protobuf.UnknownFieldSet;
4748
import com.google.protobuf.util.JsonFormat;
@@ -1340,7 +1341,7 @@ private IRubyObject setFieldInternal(
13401341
// Keep track of what Oneofs are set
13411342
if (value.isNil()) {
13421343
oneofCases.remove(oneofDescriptor);
1343-
if (!oneofDescriptor.isSynthetic()) {
1344+
if (!LegacyOneofDescriptor.isSynthetic(oneofDescriptor)) {
13441345
addValue = false;
13451346
}
13461347
} else {

0 commit comments

Comments
 (0)