The error seems to suggest you are using a different version for protoc and
protobuf Java runtime. Could you check whether they are of the same version?

On Thu, Apr 16, 2015 at 3:29 AM, Tristan Soriano <[email protected]>
wrote:

>
> Hi,
> I am new to protobufers and I have some issues with the generated java
> code.
> I am successfully generating a java class from the following .proto file :
>
>
> ////////////////////////////////////////////////////////////////////////////////////////////////////////
> option java_package = "org.myname.hbase.Coprocessor.autogenerated";
> option java_outer_classname = "Sum";
> option java_generic_services = true;
> option java_generate_equals_and_hash = true;
> option optimize_for = SPEED;
> message SumRequest {
>     required string family = 1;
>     required string column = 2;
> }
>
> message SumResponse {
>   required int64 sum = 1 [default = 0];
> }
>
> service SumService {
>   rpc getSum(SumRequest)
>     returns (SumResponse);
> }
>
>
> //////////////////////////////////////////////////////////////////////////////////////////////////////
>
> However the generated code has error in SumResquest and SumResponse
> generated class :
> The auto generated method : HashCode( ) use an int "memoizedHashCode" as
> if it was an instance attribute but it is never declared.
> In SumRequest :
>
>     @java.lang.Override
>     public int hashCode() {
>       if (memoizedHashCode != 0) {
>         return memoizedHashCode;
>       }
>       int hash = 41;
>       hash = (19 * hash) + getDescriptorForType().hashCode();
>       if (hasFamily()) {
>         hash = (37 * hash) + FAMILY_FIELD_NUMBER;
>         hash = (53 * hash) + getFamily().hashCode();
>       }
>       if (hasColumn()) {
>         hash = (37 * hash) + COLUMN_FIELD_NUMBER;
>         hash = (53 * hash) + getColumn().hashCode();
>       }
>       hash = (29 * hash) + getUnknownFields().hashCode();
>       memoizedHashCode = hash;
>       return hash;
>     }
>
>
> //////////////////////////////////////////////////////////////////////////////////////////////////////
> In SumResponse I have an extra error : The method hashLong(long) is
> undefined for the type Internal
>
>     @java.lang.Override
>     public int hashCode() {
>       if (memoizedHashCode != 0) {
>         return memoizedHashCode;
>       }
>       int hash = 41;
>       hash = (19 * hash) + getDescriptorForType().hashCode();
>       if (hasSum()) {
>         hash = (37 * hash) + SUM_FIELD_NUMBER;
>         hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
>             getSum());
>       }
>       hash = (29 * hash) + getUnknownFields().hashCode();
>       memoizedHashCode = hash;
>       return hash;
>     }
>
>
> As we are not supposed to edit the code. Do you have any idea what the
> solution could be ?
> Should I add the missing attribute on my own, at what level and visibility
> ? How to solve my second issue ?
> Is there any risk to add directly "getSum( ) ?
>
> Thx
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to