Hello, I'm looking to implement a plugin that receives a 
CodeGeneratorRequest in Java to generate code in a custom language, and I'm 
using the Cpp java implementation for reference. Java APIs from 
protobuf-java actually provide various descriptor classes like 
*EnumDescriptor* etc but it's missing Descriptor::ExtensionRange so I'm not 
sure how am I supposed to translate it, for example in a visitor:


// --- Descriptor ---
default void visit(Descriptor descriptor, DescriptorProto proto) {
onVisit(descriptor, proto);

for (int i = 0; i < descriptor.getEnumTypes().size(); i++)
visit(descriptor.getEnumTypes().get(i), proto != null ? proto.getEnumType(i) 
: null);

for (int i = 0; i < descriptor.getOneofs().size(); i++)
visit(descriptor.getOneofs().get(i), proto != null ? proto.getOneofDecl(i) : 
null);

for (int i = 0; i < descriptor.getFields().size(); i++)
visit(descriptor.getFields().get(i), proto != null ? proto.getField(i) : 
null);

for (int i = 0; i < descriptor.getNestedTypes().size(); i++)
visit(descriptor.getNestedTypes().get(i), proto != null ? proto.
getNestedType(i) : null);

for (int i = 0; i < descriptor.getExtensions().size(); i++)
visit(descriptor.getExtensions().get(i), proto != null ? proto.getExtension(
i) : null);

// for (int i = 0; i < descriptor.getExtensionRanges().size(); i++)
// visit(descriptor.getExtensionRanges().get(i), proto != null ? 
proto.getExtensionRange(i) : null);
}

// --- ExtensionRange ---
// default void visit(Descriptor.ExtensionRange descriptor, 
DescriptorProto.ExtensionRange proto) {
// onVisit(descriptor, proto);
// }

As you can see, the last part is commented out (but it's taken almost 
directly from Cpp), because there is no *Descriptor.ExtensionRange* in 
published Java bindings... There's a *DescriptorProto.ExtensionRange* but 
that's not the actual class. What should I do about it?


-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/protobuf/14f82f1f-c327-4dc3-b1ba-924899240e80n%40googlegroups.com.

Reply via email to