Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4376591

Browse files
Restore the 3-argument internalBuildGeneratedFileFrom.
This is to restore gencode compatibility down to 3.0.0 on the 4.x line.PiperOrigin-RevId: 816326810
1 parent813a7ef commit4376591

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,45 @@ private static FileDescriptor[] findDescriptors(
495495
returndescriptors.toArray(newFileDescriptor[0]);
496496
}
497497

498+
/**
499+
* This method is for backward compatibility with generated code which passed an
500+
* InternalDescriptorAssigner.
501+
*
502+
* @deprecated Any gencode which is using this method is far out of support and should be
503+
* regenerated with a newer version of the protobuf compiler.
504+
*/
505+
@Deprecated
506+
publicstaticvoidinternalBuildGeneratedFileFrom(
507+
finalString[]descriptorDataParts,
508+
finalFileDescriptor[]dependencies,
509+
finalInternalDescriptorAssignerdescriptorAssigner) {
510+
finalbyte[]descriptorBytes =latin1Cat(descriptorDataParts);
511+
512+
FileDescriptorProtoproto;
513+
try {
514+
proto =FileDescriptorProto.parseFrom(descriptorBytes);
515+
}catch (InvalidProtocolBufferExceptione) {
516+
thrownewIllegalArgumentException(
517+
"Failed to parse protocol buffer descriptor for generated code.",e);
518+
}
519+
520+
finalFileDescriptorresult;
521+
try {
522+
// When building descriptors for generated code, we allow unknown
523+
// dependencies by default.
524+
result =buildFrom(proto,dependencies,true);
525+
}catch (DescriptorValidationExceptione) {
526+
thrownewIllegalArgumentException(
527+
"Invalid embedded descriptor for\"" +proto.getName() +"\".",e);
528+
}
529+
530+
finalExtensionRegistryregistry =descriptorAssigner.assignDescriptors(result);
531+
532+
if (registry !=null) {
533+
thrownewRuntimeException("assignDescriptors must return null");
534+
}
535+
}
536+
498537
/**
499538
* This method is to be called by generated code only. It is equivalent to {@code buildFrom}
500539
* except that the {@code FileDescriptorProto} is encoded in protocol buffer wire format.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp