This is a real issue. The easiest solution is not to name the field "class". A more complicated solution would be to modify the Java code generator so that it detects when a field is named "class" and somehow renames it (e.g. adds an underscore to the end). There are a very large number of ways to make the protocol compiler generate invalid code, and it doesn't seem worth the effort to fix them all. However, if you want this particular case fixed, I'm happy to accept a patch.
On Tue, Aug 18, 2009 at 6:50 AM, anonymous <[email protected]> wrote: > > While compiling the code generated from the following .proto file: > > message Entity { > message Row { > optional uint32 SerialNumber = 1; > optional uint32 Class = 4; > optional string Name = 2; > } > repeated Row rows = 1; > } > > I am getting the following error: > > getClass() in Example.Entity.Row cannot override getClass() in > java.lang.Object; overridden method is final > public int getClass() { return class_; } > > My understanding is that the generated getter for the Class field is > colliding with java.lang.Object.getClass() method. > > - is this a real issue ? > - is there any support in protobuf 2.2.0 to work around this issue ? I > did some homework and was not able to > find one. > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---
