Modifying the Protocol Buffers compiler to support ScalaDoc

I’ve been building a server for a chess game in Scala, and chose protobuf as the serialization format.  When I hooked up ScalaDoc, I hit all sorts of errors, such as:

Contracts.java:2125: error: not found: type BuilderParent
      private Builder(BuilderParent parent) {
                      ^

The limitation is in resolving class references.  While this is most likely a problem with ScalaDoc, it was easier to fix in the protobuf compiler.  My solution was to simply supply the fully qualified name for classes like BuilderParent in the Java portion of protoc. I’ve created a patch to protoc (based on 2.4.1) that represents these changes:

protobuf.patch
protobuf-unified.patch

I’ll also supply the protoc Windows binary:

protoc.exe

Using this to generate Java protobuf code will allow you to create ScalaDocs off of Scala code that consumes your contracts.

This entry was posted in Java, Protocol Buffers, Scala. Bookmark the permalink.
  • Delicious
  • Facebook
  • Reddit
  • StumbleUpon
  • Twitter
  • RSS Feed
  • Google
  • Digg

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>