activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Barnett (JIRA)" <j...@apache.org>
Subject [jira] Created: (AMQ-2707) activemq-protobuf: AltJavaGenerator generates syntactically incorrect Java for nested Messages
Date Fri, 23 Apr 2010 03:13:23 GMT
activemq-protobuf: AltJavaGenerator generates syntactically incorrect Java for nested Messages
----------------------------------------------------------------------------------------------

                 Key: AMQ-2707
                 URL: https://issues.apache.org/activemq/browse/AMQ-2707
             Project: ActiveMQ
          Issue Type: Bug
            Reporter: Richard Barnett


I built activemq-protobuf from http://svn.apache.org/repos/asf/activemq/activemq-protobuf/trunk/
(r817001).
I changed the configuration of the activemq-protobuf plugin in the activemq-protobuf-test
pom.xml to use type {{alt}}.
The plugin generates invalid Java for .proto files defining nested messages.

An example:

{code:title=Simple.proto}
package foo;

message Outer {
  message Inner {
    required string x = 1;
  }
  required Inner inner = 1;
}
{code}

generates code including a method {{Simple.Outer.OuterBean.readExternal}}:

{code:title=Simple.java}
public void readExternal(java.io.DataInput in) throws java.io.IOException {
  assert frozen==null : org.apache.activemq.protobuf.MessageBufferSupport.FORZEN_ERROR_MESSAGE;
  bean = this;
  frozen = null;
  if( in.readBoolean() ) {
    Outer.Inner.Outer.InnerBean o = new Outer.Inner.Outer.InnerBean();
    o.readExternal(in);
    f_inner = o;
  } else {
    f_inner = null;
  }
}
{code}

which fails to compile; it should refer to {{Outer.Inner.InnerBean}} rather than {{Outer.Inner.Outer.InnerBean}}.

I'm attaching a zip containing a patch which I've tested with 4 levels of nesting, & some
test .proto files.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message