incubator-cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Dusbabek <gdusba...@gmail.com>
Subject Re: build fails with "ant clean gen-thrift-java build"
Date Thu, 03 Dec 2009 18:36:00 GMT
2009/12/3 Ted Zlatanov <tzz@lifelogs.com>:
> On Thu, 3 Dec 2009 06:42:27 -0600 Gary Dusbabek <gdusbabek@gmail.com> wrote:
>
> GD> This seems to be a Thrift regression.  It is failing to generate any
> GD> but the no-arg constructors.  I saw this about a week ago but never
> GD> got around to filing a Thrift ticket against it.
>
> GD> Your best bet, other than rolling back to an older version of thrift,
> GD> is to add the constructors yourself from the old code.
>
> I could also file a Thrift bug.  Or are you implying you'll do it?

If it is a bug.  I never made time to do the research, but here is
what seems to be happening...

Optional members are not included in the constructor, required members
are.  I'm not sure if they ever were, and the constructors were just
manually added after generation or not.

E.g.,

struct ColumnParent1 {
    3: required string column_family,
    4: optional binary super_column,
}

generates:

 public ColumnParent1(String column_family)
  {
    this();
    this.column_family = column_family;
  }

whereas:

struct ColumnParent3 {
    3: required string column_family,
    4: required binary super_column,
}

generates:

  public ColumnParent3(String column_family, byte[] super_column)
  {
    this();
    this.column_family = column_family;
    this.super_column = super_column;
  }


Changing the optional fields to required solves the problem and
creates the necessary constructors, or the required constructors can
be added.

Unfortunately, I'm a thrift noob too.  Old-timers, what is the correct behavior?

Gary.

Mime
View raw message