localshred/protobuf — pull request #70 by localshred (2013-03-19 21:54:50+00:00)
Title: multiple extension fields with the same name

When compiling this (and manually modifying the generate code as described in issue #69) the identical naming of the extensions fields turn out to be a problem. The return value of payload will always be cast to an object of PayloadB, even if it was serialized as PayloadA.

package ExtensionBug;

message Header {
extensions 100 to max;
enum Type {
PayloadTypeA = 1;
PayloadTypeB = 2;
}
required Type type = 1;
}

message PayloadA {
extend Header {
optional PayloadA payload = 100;
}
}

message PayloadB {
extend Header {
optional PayloadB payload = 101;
}
}