protoc generated JAVA classes have always errors in GeneratedMessageLite and GeneratedMessageV3

Skip to first unread message

Markus Keggel

Oct 4, 2022, 5:40:21 PM10/4/22
to Protocol Buffers
Dear List,

I desperately try to generate JAVA classes for Protocol buffers. I tried protobuf-21.7, protobuf-21.6 and the latest protobuf-main but there are always two classes that are faulty:

Line 1307:       if (instance.extensions != FieldSet.emptySet()) {

Incompatible operand types FieldSet<GeneratedMessageLite.ExtensionDescriptor> and FieldSet<FieldSet.FieldDescriptorLite<FieldSet.FieldDescriptorLite<T>>>    

and class

Line 1679: ? (FieldSet<FieldDescriptor>) FieldSet.emptySet()

Cannot cast from FieldSet<FieldSet.FieldDescriptorLite<FieldSet.FieldDescriptorLite<T>>> to FieldSet<Descriptors.FieldDescriptor>

Is there anyone who can solve this? I am unable to fix this. 

Thank you very much for your help,


Derek Perez

Oct 4, 2022, 5:45:39 PM10/4/22
to Protocol Buffers
Do you have the ability to setup a simple reproducing github project so we can try and replicate the issue here?

Markus Keggel

Oct 5, 2022, 7:58:06 AM10/5/22
to Derek Perez, Protocol Buffers
I added a Repo here:

Thank you for looking into it. 


You received this message because you are subscribed to a topic in the Google Groups "Protocol Buffers" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit

Derek Perez

Oct 5, 2022, 1:41:40 PM10/5/22
to Markus Keggel, Protocol Buffers
OK I think a few things seem wrong here:

1. I'm not sure why you have the protobuf runtime source code in your project, I'd suggest not doing that and referencing it as a jar through maven.

2. The jar you referenced has a pom that is doing that and I suspect you're confusing the classloader because that is using version 3.16.1

3. I'd look into generating your proto files JIT using a maven plugin like so:

Hope that helps!

- D
Reply all
Reply to author
0 new messages