Status: New
Labels: Type-Defect Priority-Medium

New issue 594 by Java generated message builder implementations do not implement equals()

The Java generated message (proto) classes implement equals() and hashCode() as one would expect (if the java_generate_equals_and_hash option is true). But the Builder class implementations do not provide equals() or hashCode() methods. They rely on the default java.lang.Object versions of those methods, which are inconsistent with the proto versions.

This is really counter-intuitive, and should either be fixed or at least documented somewhere.

What steps will reproduce the problem?
Person.Builder b1 = Person.newBuilder().setName("Commander Jeffrey Sinclair"); Person.Builder b2 = Person.newBuilder().setName("Commander Jeffrey Sinclair");

if (b1.equals(b2) == {
  System.out.println(" Builder and Message equals() are the same. ");
} else {
  System.out.println(" Not the same. ");

What is the expected output? What do you see instead?
  Builder and Message equals() are the same.

  Not the same.

What version of the product are you using? On what operating system?
Not sure. 2.4 or 2.5, I think.
Java 7.
On Linux.

Please provide any additional information below.

You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:

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 post to this group, send email to
Visit this group at
For more options, visit

Reply via email to